Examples of OMGraphic


Examples of com.bbn.openmap.omGraphics.OMGraphic

     * @param e the move event
     * @return true if event was consumed (handled), false otherwise
     * @see #getMouseModeServiceList
     */
    public boolean mouseMoved(MouseEvent e) {
        OMGraphic newSelectedGraphic;

        if (show_plot_ && graph != null) {

            newSelectedGraphic = graph.selectPoint(e.getX(), e.getY(), 4.0f);

            if (newSelectedGraphic != null) {
                String infostring = (String) (newSelectedGraphic.getAppObject());
                if (infostring != null) {
                    fireRequestInfoLine(infostring);
                }
            } else {
                fireRequestInfoLine("");
            }

        } else {
            newSelectedGraphic = getList().selectClosest(e.getX(),
                    e.getY(),
                    4.0f);

            if (newSelectedGraphic != null
                    && (selectedGraphic == null || newSelectedGraphic != selectedGraphic)) {

                Debug.message("basic", "Making selection...");

                selectedGraphic = newSelectedGraphic;
                //selectedGraphic.setLineColor(Color.yellow);
                selectedGraphic.regenerate(getProjection());

                // display site info on map
                GLOBESite site = (GLOBESite) (newSelectedGraphic.getAppObject());
                if (site != null) {
                    fireRequestInfoLine(site.getInfo());
                }

                repaint();
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

    public void writeShapeFile(String shapeFileName, OMGraphicList graphics) {
        try {
            ShapeFile s = new ShapeFile(shapeFileName);
            int nGraphics = graphics.size();
            if (nGraphics > 0) {
                OMGraphic omg = graphics.getOMGraphicAt(0);
                if ((omg instanceof OMPoly)
                        && (omg.getRenderType() == OMGraphic.RENDERTYPE_LATLON)) {
                    int shapeType = ((OMPoly) omg).isPolygon() ? ShapeUtils.SHAPE_TYPE_POLYGON
                            : ShapeUtils.SHAPE_TYPE_ARC;
                    System.out.println("shapeType=" + shapeType);
                    s.setShapeType(shapeType);
                }
            }

            System.out.println(nGraphics + " candidates.");

            if (doThinning) {
                OMGraphicList saveGraphics = new OMGraphicList();
                for (int i = 0; i < nGraphics; i++) {
                    OMGraphic omg = graphics.getOMGraphicAt(i);
                    if ((omg instanceof OMPoly)
                            && (omg.getRenderType() == OMGraphic.RENDERTYPE_LATLON)) {
                        OMPoly poly = (OMPoly) omg;

                        if (maybeThrowAwayPoly(poly)) {
                            continue;
                        }

                        saveGraphics.addOMGraphic(poly);
                    } else {
                        System.out.println("Skipping candidate: "
                                + omg.getClass().toString() + ", "
                                + omg.getRenderType());
                    }
                }
               
                graphics = saveGraphics;
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

    protected static OMGraphicList joinCommonLines(OMGraphicList list,
                                                   float zero_eps) {
        int size = list.size();
        int len1, len2;
        float lat1, lon1, lat2, lon2;
        OMGraphic obj;
        OMGraphicList newGraphics = new OMGraphicList();
        OMGraphicList plineGraphics = new OMGraphicList();

        // check for non-connected polylines
        System.out.println("finding polylines...");
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

     * @return OMGraphic being modified.
     */
    public OMGraphic edit(OMGraphic g, DrawingToolRequestor requestor,
                          MouseEvent e) {

        OMGraphic ret = null;

        if (getCurrentEditable() == null) {
            EditableOMGraphic eomg = getEditableGraphic(g);
            if (eomg != null) {
                ret = edit(eomg, requestor, e);
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

     * @return OMGraphic being modified contained within the EditableOMGraphic.
     */
    public OMGraphic edit(EditableOMGraphic eomg,
                          DrawingToolRequestor requestor, MouseEvent e) {

        OMGraphic ret = null;
        if (eomg != null) {
            eomg.setActionMask(OMGraphic.UPDATE_GRAPHIC_MASK);

            ret = edit(eomg, requestor);

View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

        if (DEBUG) {
            Debug.output("OMDrawingTool.select()");
        }

        OMGraphic ret = null;
        boolean currentlyEditing = (getCurrentEditable() != null);
        if (currentlyEditing) {
            boolean repaintCanvas = true;
            if (!(currentEditable instanceof EditableOMGraphicList)) {
                if (DEBUG) {
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

                ((MapBean) canvas).removeProjectionListener(this);
                ((MapBean) canvas).removePaintListener(this);
            }
        }

        OMGraphic g = null;

        if (currentEditable != null) {
            if (!(currentEditable.getStateMachine().getState() instanceof com.bbn.openmap.omGraphics.editable.GraphicUndefinedState)) {
                g = currentEditable.getGraphic();
            }
            currentEditable.removeEOMGListener(this);
        }

        // ////////////////////////////////
        // Clean up, then notify listener

        setCurrentEditable(null);
        // hide the gui while currentEditable is null, so it resets to
        // the default.
        hidePalette();
        unsetMask(DEACTIVATE_ASAP_BEHAVIOR_MASK);
        popup = null;
        activated = false;

        // End cleanup
        // ////////////////////////////////

        if (g != null && requestor != null) {
            g.setVisible(true);
            OMAction action = new OMAction();
            action.setMask(actionToDoWithOMGraphic);
            generateOMGraphic(g);
            notifyListener(g, action);
        }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

        return false;
    }

    public JPopupMenu createPopupMenu() {

        OMGraphic g = getCurrentEditable().getGraphic();
        JPopupMenu pum = new JPopupMenu();

        if ((g.getAttribute(OMGraphicConstants.CHANGE_APPEARANCE)) == null
                || ((Boolean) g.getAttribute(OMGraphicConstants.CHANGE_APPEARANCE)).booleanValue()) {

            JMenuItem gui = new JMenuItem(i18n.get(OMDrawingTool.class,
                    "popupMenuChangeAppearance",
                    "Change Appearance"));
            gui.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    EditableOMGraphic eomg = getCurrentEditable();
                    if (eomg != null) {
                        boolean previous = eomg.getShowGUI();
                        eomg.setShowGUI(true);
                        setVisible(true);
                        if (!getUseAsTool()) {
                            showInWindow();
                        }
                        eomg.setShowGUI(previous);
                        eomg.getStateMachine().setSelected();
                    }
                }
            });
            if (isMask(SHOW_GUI_BEHAVIOR_MASK | GUI_VIA_POPUP_BEHAVIOR_MASK)
                    && !getUseAsTool()) {
                pum.add(gui);
            } else {
                Debug.output("Not adding Change Appearance to popup: guiViaPopup("
                        + isMask(SHOW_GUI_BEHAVIOR_MASK)
                        + ") isTool("
                        + getUseAsTool() + ")");
            }
        }

        if ((g.getAttribute(OMGraphicConstants.REMOVABLE)) == null
                || ((Boolean) g.getAttribute(OMGraphicConstants.REMOVABLE)).booleanValue()) {

            JMenuItem delete = new JMenuItem(i18n.get(OMDrawingTool.class,
                    "popupMenuDelete",
                    "Delete"));
            delete.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    OMAction action = new OMAction();
                    action.setMask(OMGraphic.DELETE_GRAPHIC_MASK);
                    EditableOMGraphic eomg = getCurrentEditable();
                    if (eomg != null) {
                        OMGraphic g = eomg.getGraphic();
                        if (g != null) {
                            notifyListener(g, action);
                        }
                    }
                    setCurrentEditable(null);
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

                if (lsm2.isSelectionEmpty()) {
                    //no rows are selected
                } else {
                    int index = lsm2.getMinSelectionIndex();
                    EsriGraphicList list = layer.getEsriGraphicList();
                    OMGraphic graphic = list.getOMGraphicAt(index);
                    graphic.select();
                    list.generate(_mapBean.getProjection());
                    layer.repaint();
                }
            }
        });
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

    /**
     * Extendable method to create specific subclasses of OMPolys.
     */
    public OMGraphic createGraphic(int renderType, int lineType) {
        OMGraphic g = null;
        switch (renderType) {
        case (OMGraphic.RENDERTYPE_LATLON):
            g = new OMSpline(new float[0], OMGraphic.RADIANS, lineType);
            break;
        case (OMGraphic.RENDERTYPE_OFFSET):
View Full Code Here
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.