Examples of OMGraphic


Examples of com.bbn.openmap.omGraphics.OMGraphic

     */
    protected String readGraphics(LinkOMGraphicList graphics, Projection proj,
                                  OMGridGenerator generator)
            throws IOException, EOFException {

        OMGraphic graphic;
        long startTime = System.currentTimeMillis();
        String header = null;
        int graphicType;

        // This is important, it's checked by the LinkLayer to see if
        // it needs to generate the LinkOMGraphicList to see if the
        // contents need to be generated.
        graphics.setNeedToRegenerate(proj == null);

        // doing nothing with the version number.
        float ver = link.dis.readFloat();

        if (ver != version) {
            if (ver == .1) {// Big difference....
                throw new IOException("LinkGraphicList: Versions do not match! DANGER!");
            } else {
                Debug.message("link", "LinkGraphicList: Versions do not match.");
            }
        }

        if (properties != null) {
            properties.clear();
        }

        properties = LinkProperties.read(link.dis, properties);

        Debug.message("link", "LinkGraphicList: reading graphics:");

        LinkProperties propertiesBuffer = new LinkProperties(properties);

        while (true) {
            graphic = null;
            // Just consume the header, don't create a useless
            // string object.
            header = link.readDelimiter(false);

            if (header == Link.END_TOTAL || header == Link.END_SECTION) {

                long endTime = System.currentTimeMillis();
                Debug.message("link", "LinkGraphicList: received "
                        + graphics.size() + " graphics in "
                        + (float) (endTime - startTime) / 1000.0f + " seconds");

                return header;
            }

            graphicType = link.dis.readByte();

            switch (graphicType) {
            case GRAPHICTYPE_LINE:
                graphic = LinkLine.read(link.dis, propertiesBuffer);
                break;
            case GRAPHICTYPE_POLY:
                graphic = LinkPoly.read(link.dis, propertiesBuffer);
                break;
            case GRAPHICTYPE_RECTANGLE:
                graphic = LinkRectangle.read(link.dis, propertiesBuffer);
                break;
            case GRAPHICTYPE_POINT:
                graphic = LinkPoint.read(link.dis, propertiesBuffer);
                break;
            case GRAPHICTYPE_CIRCLE:
                graphic = LinkCircle.read(link.dis, propertiesBuffer);
                break;
            case GRAPHICTYPE_ELLIPSE:
                graphic = LinkEllipse.read(link.dis, propertiesBuffer);
                break;
            case GRAPHICTYPE_RASTER:
                graphic = LinkRaster.read(link.dis, propertiesBuffer);
                break;
            case GRAPHICTYPE_BITMAP:
                graphic = LinkBitmap.read(link.dis, propertiesBuffer);
                break;
            case GRAPHICTYPE_TEXT:
                graphic = LinkText.read(link.dis, propertiesBuffer);
                break;
            case GRAPHICTYPE_GRID:
                graphic = LinkGrid.read(link.dis, propertiesBuffer);
                break;
            default:
                throw new IOException("LinkGraphicList: received unknown graphic type.");
            }

            if (graphic != null) {
                if (graphic instanceof OMGrid) {
                    ((OMGrid) graphic).setGenerator(generator);
                }
                if (proj != null) {
                    graphic.generate(proj);
                }
                graphics.add(graphic);
            }
        }
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

            } else {
                if (item != null) { // is this check necessary? I
                    // doubt it.
                    DrawingToolRequestor requestor = item.getRequestor();
                    OMGraphic omg = item.getOMGraphic();
                    if (requestor != null) {
                        requestor.drawingComplete(omg,
                                new OMAction(OMGraphicConstants.DELETE_GRAPHIC_MASK));
                    } else {
                        // if there isn't a requestor specified, tell
View Full Code Here

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 = omgraphics.selectClosest(e.getX(),
                e.getY(),
                2.0f);

        if (newSelectedGraphic != selectedGraphic) {
            if (selectedGraphic != null)
                selectedGraphic.setFillPaint(oldFillColor);

            selectedGraphic = newSelectedGraphic;
            if (newSelectedGraphic != null) {
                oldFillColor = newSelectedGraphic.getFillColor();
                newSelectedGraphic.setFillPaint(Color.white);
                fireRequestInfoLine(newSelectedGraphic.getAppObject()
                        .toString());
            }
            repaint();
        }

View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

        int[][] indexData = new int[2][list.size()];
        int pos = 50;

        for (int i = 0; i < list.size(); i++) {
            int contentLength = 0;
            OMGraphic graphic = (OMGraphic) list.getOMGraphicAt(i);

            contentLength += 2; // Shape Type
            contentLength += 16; // Box
            contentLength += 2; // NumParts
            contentLength += 2; // NumPoints
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

        _leos.writeDouble(0.0); // Byte 92

        // Iterate through the list
        for (int i = 0; i < list.size(); i++) {

            OMGraphic graphic = list.getOMGraphicAt(i);

            // Record header
            _leos.writeInt(i + 1); // Record numbers start with 1
            _leos.writeInt(indexData[1][i]);
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

     * @return true if the listener was able to process the event.
     */
    public boolean mouseReleased(MouseEvent e) {
        OMGraphicList omgraphics = getList();
        if (omgraphics != null && drillData != null) {
            OMGraphic obj = omgraphics.findClosest(e.getX(), e.getY(), 4);
            if (obj != null) {
                int id = ((Integer) obj.getAppObject()).intValue();
                fireRequestInfoLine(drillData[id]);
                showingInfoLine = true;
                return true;
            }
        }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

            retList.add(labels);
        }

        while (entryIt.hasNext() && omgIt.hasNext()) {
            Entry entry = (Entry) entryIt.next();
            OMGraphic omg = (OMGraphic) omgIt.next();
            if (entry.intersects(xmin, ymin, xmax, ymax)) {
                // We want to set attributes before the evaluate method is
                // called, since there might be special attributes set on the
                // omg based on dbf contents.
                drawingAttributes.setTo(omg);
                omg = spatialIndex.evaluate(omg, labels, proj);

                // omg can be null from the evaluate method, if the omg doesn't
                // pass proj and rule tests.
                if (omg != null) {
                    omg.generate(proj);
                    retList.add(omg);
                }
            }
        }
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

        if (list != null) {
            if (logger.isLoggable(Level.INFO))
                logger.info("size is " + list.size());

            for (int i = 0; i < list.size(); i++) {
                OMGraphic graphic = list.getOMGraphicAt(i);
                if (seen.contains(graphic))
                    continue; // let's not re-add it

                seen.add(graphic);
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

                    GraphicUpdate gu = (GraphicUpdate) it.next();
                    if (gu != null) {
                        String id = gu.id;
                        System.out.println("TestLinkServer: graphic id = " + id);

                        OMGraphic graphic = gu.graphic;
                        int index = clientCreatedGraphics.getOMGraphicIndexWithId(id);
                        if (index != Link.UNKNOWN) {
                            System.out.println("TestLinkServer: modifying graphic");
                            clientCreatedGraphics.setOMGraphicAt(gu.graphic,
                                    index);
                        } else {
                            System.out.println("TestLinkServer: new graphic");
                            // Set the ID for it, so it can be
                            // referred to later.
                            LinkProperties props = (LinkProperties) graphic.getAppObject();

                            props.setProperty(LPC_GRAPHICID, "graphic"
                                    + (newGraphicCounter++));
                            System.out.println("TestLinkServer: new graphic given id "
                                    + props);
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphic

            retList.add(labels);
        }
       
        while (entryIt.hasNext() && omgIt.hasNext()) {
            Entry entry = (Entry) entryIt.next();
            OMGraphic omg = (OMGraphic) omgIt.next();
            if (entry.intersects(xmin, ymin, xmax, ymax)) {
                // We want to set attributes before the evaluate method is
                // called, since there might be special attributes set on the
                // omg based on dbf contents.
                drawingAttributes.setTo(omg);
                omg = spatialIndex.evaluate(omg, labels, proj);

                // omg can be null from the evaluate method, if the omg doesn't
                // pass proj and rule tests.
                if (omg != null) {
                    omg.generate(proj);
                    retList.add(omg);
                }
            }
        }
    }
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.