Package com.bbn.openmap.omGraphics

Examples of com.bbn.openmap.omGraphics.OMGraphicList


        Projection projection = getProjection();

        if (projection == null) {
            System.err.println("Terrain Layer needs to be added to the MapBean before it can be used!");
            return new OMGraphicList();
        }

        Debug.message("basic", getName() + "|TerrainLayer.prepare(): doing it");

        // Setting the OMGraphicsList for this layer. Remember, the
View Full Code Here


     * map. If the buffered OMGraphicList hasn't been created yet, it gets
     * created here.
     */
    public synchronized OMGraphicList prepare() {

        OMGraphicList list = getList();

        if (list != null) {
            list.clear();
        } else {
            list = new OMGraphicList();
        }

        if (spatialIndex == null)
            return list;

View Full Code Here

                                            Projection proj) {
        // There should be the same number of objects in both iterators.
        Iterator entryIt = spatialIndex.entries.iterator();
        Iterator omgIt = bufferedList.iterator();
       
        OMGraphicList labels = null;
        if (spatialIndex.getDbf() != null) {
            labels = new OMGraphicList();
            retList.add(labels);
        }
       
        while (entryIt.hasNext() && omgIt.hasNext()) {
            Entry entry = (Entry) entryIt.next();
View Full Code Here

        /*
         * modifications in the next 4 lines marked with as: allow to
         * treat ESRIPolygonRecord with holes correctly (ESRIPolys
         * with counterclockwise order of vertices)
         */
        OMGraphicList sublist = null;

        if (nPolys > 1) {
            // Only want the OMAreaList if the shape type is for
            // polygons
            if (false && ispolyg) {
                // There's a problem here with OMPolys that wrap
                // around the earth, putting them in OMAreaLists makes
                // them draw lines through the map. Need to sort that
                // out before enabling this code by removing 'false'
                // in if statement.
                sublist = new OMAreaList();
                ((OMAreaList) sublist).setConnectParts(false);
            } else {
                sublist = new OMGraphicList();
            }

            if (drawingAttributes != null) {
                drawingAttributes.setTo(sublist);
            }

            sublist.setVague(true); // Treat list as one object.
            list.add(sublist);
            sublist.setAppObject(new Integer(getRecordNumber()));
        }

        for (int i = 0; i < nPolys; i++) {
            // these points are already in RADIAN lat,lon order!...
            pts = ((ESRIPoly.ESRIFloatPoly) polygons[i]).getRadians();
            p = new OMPoly(pts, OMGraphic.RADIANS, OMGraphic.LINETYPE_STRAIGHT);

            drawingAttributes.setTo(p);
            if (!ispolyg) {
                p.setIsPolygon(false);
            }

            if (sublist != null) {
                sublist.add(p);
            } else {
                // There should be only one.
                p.setAppObject(new Integer(getRecordNumber()));
                list.add(p);
            }
View Full Code Here

        // LinkOMGraphicList is made up of OMGraphics, which are
        // generated
        // (projected) when the graphics are added to the list. So,
        // after this call, the list is ready for painting.

        OMGraphicList omGraphics = getList();

        if (omGraphics == null || omGraphics.size() == 0) {

            ////////////// Call getRectangle for server....
            try {
                // We do want the link object here... If another
                // thread is
                // using the link, wait.
                ClientLink l = linkManager.getLink(true);

                if (l == null) {
                    System.err.println("BufferedLinkLayer: unable to get link in prepare().");
                    return new LinkOMGraphicList();
                }

                synchronized (l) {
                    omGraphics = getAllGraphics(l, projection);
                }

                linkManager.finLink();

            } catch (UnknownHostException uhe) {
                System.err.println("BufferedLinkLayer: unknown host!");
                omGraphics = new LinkOMGraphicList();
            } catch (java.io.IOException ioe) {
                System.err.println("BufferedLinkLayer: IOException contacting server for map request!");
                System.err.println(ioe);

                linkManager.resetLink();

                if (!quiet) {
                    fireRequestMessage("Communication error between "
                            + getName() + " layer\nand Link Server: Host: "
                            + host + ", Port: " + port);
                }

                System.err.println("BufferedLinkLayer: Communication error between "
                        + getName()
                        + " layer\nand Link Server: Host: "
                        + host
                        + ", Port: " + port);

                omGraphics = new LinkOMGraphicList();
            }
        } else {
            omGraphics.project(projection);
        }

        /////////////////////
        // safe quit
        int size = 0;
        if (omGraphics != null) {
            size = omGraphics.size();

            if (Debug.debugging("basic")) {
                System.out.println(getName()
                        + "|BufferedLinkLayer.prepare(): finished with " + size
                        + " graphics");
View Full Code Here

                    // breather
                    -1f * lon[1]);// -1 to make it 180, not -180
        } else
            caches[3] = null;

        OMGraphicList graphics = new OMGraphicList();

        if (Debug.debugging("dted"))
            Debug.output("--- DTEDCacheManager: getting images: ---");

        for (int nbox = 0; nbox < MAX_NUM_BOXES; nbox++) {
            if (caches[nbox] != null) {
                OMRaster image = caches[nbox].getNextImage();
                while (image != null) {
                    graphics.add(image);
                    image = caches[nbox].getNextImage();
                }
            }
        }
        return graphics;
View Full Code Here

            setPaths(paths);
            if (frameProvider == null) {
                // Doh! no paths were set!
                Debug.error(getName()
                        + "|RpfLayer.prepare(): null frame provider - either no RPF paths were set, or no frame provider was assigned.  The RpfLayer has no way to get RPF data.");
                return new OMGraphicList();
            }
        }

        if (this.cache == null) {
            Debug.message("rpf", getName() + "|RpfLayer: Creating cache!");
            this.cache = new RpfCacheManager(frameProvider, viewAttributes, subframeCacheSize, auxSubframeCacheSize);
        }

        Projection projection = getProjection();

        if (coverage != null && coverage.isInUse()) {
            coverage.prepare(frameProvider,
                    projection,
                    viewAttributes.chartSeries);
        }

        // Check to make sure the projection is CADRG
        if (!(projection instanceof EqualArc)
                && (viewAttributes.showMaps || viewAttributes.showInfo)) {
            fireRequestInfoLine("RpfLayer requires an Equal Arc projection (CADRG/LLXY) for images or attributes!");
            return null;
        }

        Debug.message("basic", getName() + "|RpfLayer.prepare(): doing it");

        // Setting the OMGraphicsList for this layer. Remember, the
        // OMGraphicList is made up of OMGraphics, which are generated
        // (projected) when the graphics are added to the list. So,
        // after this call, the list is ready for painting.

        // call getRectangle();
        if (Debug.debugging("rpf")) {
            Debug.output(getName() + "|RpfLayer.prepare(): "
                    + "calling getRectangle " + " with projection: "
                    + projection + " ul = " + projection.getUpperLeft()
                    + " lr = " + projection.getLowerRight());
        }

        if (frameProvider.needViewAttributeUpdates()) {
            frameProvider.setViewAttributes(viewAttributes);
        }

        Projection cadrgProj = projection;
        if (!(projection instanceof CADRG)) {
            cadrgProj = new CADRG(projection.getCenter(), projection.getScale(), projection.getWidth(), projection.getHeight());

            Point ulp = cadrgProj.forward(projection.getUpperLeft());
            Point lrp = cadrgProj.forward(projection.getLowerRight());

            int w = (int) Math.abs(lrp.getX() - ulp.getX());
            int h = (int) Math.abs(lrp.getY() - ulp.getY());

            // float cadrgScale =
            // ProjMath.getScale(projection.getUpperLeft(),
            // projection.getLowerRight(),
            // cadrgProj);

            cadrgProj = new CADRG(projection.getCenter(), projection.getScale(), w, h);
        }

        // Fetch the list with a CADRG projection, generate it with
        // the real projection.

        OMGraphicList omGraphicList;
        try {
            omGraphicList = this.cache.getRectangle(cadrgProj);
        } catch (java.lang.NullPointerException npe) {
            Debug.error(getName()
                    + "|RpfLayer.prepare(): Something really bad happened - \n "
                    + npe);
            npe.printStackTrace();
            omGraphicList = new OMGraphicList();
            this.cache = null;
        }

        // ///////////////////
        // safe quit
        int size = 0;
        if (omGraphicList != null) {
            size = omGraphicList.size();
            if (Debug.debugging("basic")) {
                Debug.output("RpfLayer.prepare(): finished with " + size
                        + " graphics");
            }

            // Don't forget to project them. Since they are only
            // being recalled if the projection hase changed, then we
            // need to force a reprojection of all of them because the
            // screen position has changed.
            omGraphicList.project(projection, true);

        } else {
            Debug.message("basic",
                    "RpfLayer.prepare(): finished with null graphics list");
        }
View Full Code Here

        }

    }

    public OMGraphicList prepare() {
        OMGraphicList list = getList();

        if (list == null) {
            list = new OMGraphicList();
            // If there isn't any data loaded, ask the user for a
            // file.
            if (fileDataList.size() == 0) {
                addShapeFileFromUser();
            }
        } else {
            list.clear();
        }

        // If we created any pixel intersection images before, time to
        // get rid of them.

        calculateIntersectionsWithDrawnList();

        list.add(intersectionResultList);
        list.add(drawnList);
        if (DEBUG)
            Debug.output("GeoIntersectLayer(" + getName()
                    + "): Adding lines to main list");
        list.add(fileDataList);
        if (DEBUG)
            Debug.output("GeoIntersectLayer(" + getName()
                    + "): Adding shapes to main list");

        list.generate(getProjection());
        if (DEBUG)
            Debug.output("GeoIntersectLayer(" + getName()
                    + "): Projected main list, returning");

        return list;
View Full Code Here

    protected void setShapeListVisibilityForCheckbox() {
        for (Iterator it = fileDataList.iterator(); it.hasNext();) {
            Object obj = it.next();
            if (obj instanceof OMGraphicList) {
                OMGraphicList omgl = (OMGraphicList) obj;
                obj = omgl.getAttribute(SHAPE_VISIBILITY_CONTROL_ATTRIBUTE);
                if (obj != null) {
                    omgl.setVisible(((JCheckBox) obj).isSelected());
                }
            }

        }
    }
View Full Code Here

     *
     * @return OMGraphicList new graphic list
     */
    protected OMGraphicList constructGraticuleLines() {

        OMGraphicList newgraphics = new OMGraphicList(20);
        // Lets figure out which lines should be painted...
        Projection projection = getProjection();

        if (projection == null) {
            return newgraphics;
        }
        tenDegreeLines = null;

        if (showOneAndFiveLines || showRuler || showBelowOneLines) {

            float left = projection.getUpperLeft().getLongitude();
            float right = projection.getLowerRight().getLongitude();
            float up = projection.getUpperLeft().getLatitude();
            float down = projection.getLowerRight().getLatitude();

            if (up > 80.0f)
                up = 80.0f;
            if (down > 80.0f)
                down = 80f; // unlikely
            if (up < -80.0f)
                up = -80.0f; // unlikely
            if (down < -80)
                down = -80.0f;

            int showWhichLines = evaluateSpacing(up, down, left, right);

            // Find out whether we need to do one or two queries,
            // depending on if we're straddling the dateline.
            if ((left > 0 && right < 0) || (left > right)
                    || (Math.abs(left - right) < 1)) {
                // Test to draw the ones and fives, which will also do
                // the labels.

                if (showWhichLines != SHOW_TENS) {
                    newgraphics.add(constructGraticuleLines(up,
                            down,
                            left,
                            180.0f,
                            showWhichLines));
                    newgraphics.add(constructGraticuleLines(up,
                            down,
                            -180.0f,
                            right,
                            showWhichLines));
                } else if (showRuler) { // Just do the labels for the
                    // tens lines
                    newgraphics.add(constructTensLabels(up,
                            down,
                            left,
                            180.0f,
                            true));
                    newgraphics.add(constructTensLabels(up,
                            down,
                            -180.0f,
                            right,
                            false));
                }
            } else {
                // Test to draw the ones and fives, which will also do
                // the labels.
                if (showWhichLines != SHOW_TENS) {
                    newgraphics = constructGraticuleLines(up,
                            down,
                            left,
                            right,
                            showWhichLines);
                } else if (showRuler) { // Just do the labels for the
                    // tens lines
                    newgraphics.add(constructTensLabels(up,
                            down,
                            left,
                            right,
                            true));
                }
            }
        }

        OMGraphicList list;
        if (tenDegreeLines == null) {
            list = constructTenDegreeLines();
            tenDegreeLines = list;
        } else {
            synchronized (tenDegreeLines) {
View Full Code Here

TOP

Related Classes of com.bbn.openmap.omGraphics.OMGraphicList

Copyright © 2018 www.massapicom. 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.