Package com.bbn.openmap.layer.specialist

Source Code of com.bbn.openmap.layer.specialist.JCircle

// **********************************************************************
//
// <copyright>
//
//  BBN Technologies
//  10 Moulton Street
//  Cambridge, MA 02138
//  (617) 873-8000
//
//  Copyright (C) BBNT Solutions LLC. All rights reserved.
//
// </copyright>
// **********************************************************************
//
// $Source: /cvs/distapps/openmap/src/corba/com/bbn/openmap/layer/specialist/JCircle.java,v $
// $RCSfile: JCircle.java,v $
// $Revision: 1.2.2.1 $
// $Date: 2004/10/14 18:26:30 $
// $Author: dietrick $
//
// **********************************************************************

package com.bbn.openmap.layer.specialist;

// import netscape.application.*;
import com.bbn.openmap.CSpecialist.CirclePackage.ECircle;
import com.bbn.openmap.CSpecialist.LLPoint;
import com.bbn.openmap.CSpecialist.XYPoint;
import com.bbn.openmap.omGraphics.*;
import java.io.Serializable;

/** JCircle - circles */
public class JCircle extends OMCircle implements Serializable, JObjectHolder {

    protected transient com.bbn.openmap.CSpecialist.EComp object = null;

    /** Constructor. */
    public JCircle(ECircle ecircle) {
        super();
        JGraphic.fillOMGraphicParams(this, ecircle.egraphic);

        setX(ecircle.p1.x);
        setY(ecircle.p1.y);
        setLatLon(ecircle.ll1.lat, ecircle.ll1.lon);

        // HACK - Due to a problem in the projection libs, LatLon
        // ellipses aren't supported right now. So for now, we're
        // picking the major value and making a circle
        setRadius(ecircle.major);
        //      setMajor(ecircle.major);
        //      setMinor(ecircle.minor);

        setWidth(ecircle.width);
        setHeight(ecircle.height);
    }

    public void setObject(com.bbn.openmap.CSpecialist.EComp aObject) {
        object = aObject;
    }

    public com.bbn.openmap.CSpecialist.EComp getObject() {
        return object;
    }

    public void update(
                       com.bbn.openmap.CSpecialist.GraphicPackage.GF_update update) {
        JGraphic.update((JObjectHolder) this, update);
    }

    /**
     * update() - takes a CircPackage.CF_update and changes the fields
     * that need to be. Called as a result of a gesture.
     */
    public void update(
                       com.bbn.openmap.CSpecialist.CirclePackage.CF_update update) {

        needToRegenerate = true; // flag dirty
        // do the updates, but don't rerender just yet
        switch (update.discriminator().value()) {

        // set fixed point
        case com.bbn.openmap.CSpecialist.CirclePackage.settableFields._CF_ll1:
            LLPoint ll = update.ll1();
            setLatLon(ll.lat, ll.lon);
            break;

        case com.bbn.openmap.CSpecialist.CirclePackage.settableFields._CF_p1:
            XYPoint pt1 = update.p1();
            setX(pt1.x);
            setY(pt1.y);
            break;

        case com.bbn.openmap.CSpecialist.CirclePackage.settableFields._CF_major:
            // HACK - Projection lib doesn't handle LatLon Ellipses
            // -make it a circle
            setRadius(update.major());
            //            setMajor(update.major());
            break;

        case com.bbn.openmap.CSpecialist.CirclePackage.settableFields._CF_minor:
            // HACK - Projection lib doesn't handle LatLon Ellipses
            // -make it a circle
            setRadius(update.minor());
            //            setMinor(update.minor());
            break;

        case com.bbn.openmap.CSpecialist.CirclePackage.settableFields._CF_height:
            setHeight(update.height());
            break;

        case com.bbn.openmap.CSpecialist.CirclePackage.settableFields._CF_width:
            setWidth(update.width());
            break;

        default:
            System.err.println("JCircle.update: invalid circle update");
            break;
        }
    }
}
TOP

Related Classes of com.bbn.openmap.layer.specialist.JCircle

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.