Package com.bbn.openmap.omGraphics

Examples of com.bbn.openmap.omGraphics.OMGraphicList


    /**
     * Called when the layer is no longer part of the map.
     */
    public void removed(java.awt.Container cont) {
        OMGraphicList rasters = getList();
        if (rasters != null) {
            rasters.clear();
        }
    }
View Full Code Here


        Projection projection = getProjection();

        if (projection == null) {
            Debug.output("DTED Layer needs to be added to the MapBean before it can draw images!");
            return new OMGraphicList();
        }

        // Check to make sure the projection is EqualArc
        if (!(projection instanceof EqualArc)) {
            if (!firstProjectionWarningSent) {
                fireRequestInfoLine("  DTED requires an Equal Arc projection (CADRG/LLXY) to view images.");
                Debug.output("DTEDFrameCacheLayer: DTED requires an Equal Arc projection (CADRG/LLXY) to view images.");
                firstProjectionWarningSent = true;
            }
            return new OMGraphicList();
        }

        Debug.message("basic", getName()
                + "|DTEDFrameCacheLayer.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("dted")) {
            Debug.output(getName() + "|DTEDFrameCacheLayer.prepare(): "
                    + "calling getRectangle " + " with projection: "
                    + projection + " ul = " + projection.getUpperLeft()
                    + " lr = " + projection.getLowerRight());
        }

        OMGraphicList omGraphicList;

        if (projection.getScale() < maxScale) {
            omGraphicList = cache.getRectangle((EqualArc) projection);
        } else {
            fireRequestInfoLine("  The scale is too small for DTED viewing.");
            Debug.error("DTEDFrameCacheLayer: scale (1:" + projection.getScale()
                    + ") is smaller than minimum (1:" + maxScale + ") allowed.");
            omGraphicList = new OMGraphicList();
        }
        /////////////////////
        // safe quit
        int size = 0;
        if (omGraphicList != null) {
            size = omGraphicList.size();
            Debug.message("basic", getName()
                    + "|DTEDFrameCacheLayer.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",
                    getName()
                            + "|DTEDFrameCacheLayer.prepare(): finished with null graphics list");
View Full Code Here

     * The method is synchronized in case renderDataForProjection() gets called
     * while in the middle of this method. For a different projection, that
     * would be bad.
     */
    public synchronized OMGraphicList prepare() {
        OMGraphicList currentList = getList();
        Projection proj = getProjection();

        // if the layer hasn't been added to the MapBean
        // the projection could be null.
        if (currentList != null && proj != null) {
            currentList.generate(proj);
        }

        return currentList;
    }
View Full Code Here

    public void select(OMGraphicList list) {
        if (list != null) {
            Iterator it = list.iterator();
            while (it.hasNext()) {
                if (selectedList == null) {
                    selectedList = new OMGraphicList();
                }

                OMGraphic omg = (OMGraphic) it.next();
                if (omg instanceof OMGraphicList
                        && !((OMGraphicList) omg).isVague()) {
View Full Code Here

    /**
     * Remove OMGraphics from the layer.
     */
    public OMGraphicList cut(OMGraphicList omgl) {
        OMGraphicList list = getList();
        if (list != null && omgl != null) {
            Iterator it = omgl.iterator();
            while (it.hasNext()) {
                list.remove((OMGraphic) it.next());
            }
        }
        return omgl;
    }
View Full Code Here

    /**
     * Add OMGraphics to the Layer.
     */
    public void paste(OMGraphicList omgl) {
        OMGraphicList list = getList();
        if (list != null && omgl != null) {
            Iterator it = omgl.iterator();
            while (it.hasNext()) {
                list.add((OMGraphic) it.next());
            }
        }
    }
View Full Code Here

    public OMGraphicList checkProjAndGetTiledImages(Projection proj)
            throws IOException {

        if (!isOnMap(proj) || !validScale(proj)) {
            // off the map
            return new OMGraphicList();
        }

        return getTiledImages(proj);
    }
View Full Code Here

        if (Debug.debugging("asrp")) {
            Debug.output("ASRPDirectory: fielding request for " + rect);
        }

        OMGraphicList list = new OMGraphicList();

        int startX = (int) rect.getX();
        int startY = (int) rect.getY();
        int endX = startX + (int) rect.getWidth();
        int endY = startY + (int) rect.getHeight();

        for (int x = startX; x < endX; x++) {
            for (int y = startY; y < endY; y++) {
                OMGraphic omg = (OMGraphic) get(new String(x + "," + y).intern());
                if (omg != null) {
                    omg.generate(proj);
                    list.add(omg);
                }
            }
        }

        return list;
View Full Code Here

            String msg;

            try {

                long start = System.currentTimeMillis();
                OMGraphicList list = getRenderPolicy().prepare();
                long stop = System.currentTimeMillis();
                if (Debug.debugging("layer")) {
                    Debug.output(getName()
                            + "|LayerWorker.construct(): fetched "
                            + (list == null ? "null list "
                                    : (list.size() + " graphics ")) + "in "
                            + (double) ((stop - start) / 1000d) + " seconds");
                }
                return list;

            } catch (OutOfMemoryError e) {
View Full Code Here

    }

    public synchronized OMGraphicList prepare() {
        int w, h, left_x = 0, right_x = 0, lower_y = 0, upper_y = 0;
        Projection projection = getProjection();
        OMGraphicList graphics = new OMGraphicList();

        w = projection.getWidth();
        h = projection.getHeight();
        if (locationXoffset < 0) {
            left_x = w + locationXoffset - width;
            right_x = w + locationXoffset;
        } else if (locationXoffset >= 0) {
            left_x = locationXoffset;
            right_x = locationXoffset + width;
        }
        if (locationYoffset < 0) {
            upper_y = h + locationYoffset - height;
            lower_y = h + locationYoffset;
        } else if (locationYoffset >= 0) {
            upper_y = locationYoffset;
            lower_y = locationYoffset + height;
        }

        graphics.clear();

        OMLine line = new OMLine(left_x, lower_y, right_x, lower_y);
        line.setLinePaint(lineColor);
        graphics.add(line);

        line = new OMLine(left_x, lower_y, left_x, upper_y);
        line.setLinePaint(lineColor);
        graphics.add(line);

        line = new OMLine(right_x, lower_y, right_x, upper_y);
        line.setLinePaint(lineColor);
        graphics.add(line);

        LatLonPoint loc1 = projection.inverse(left_x, lower_y);
        LatLonPoint loc2 = projection.inverse(right_x, lower_y);

        float dist = GreatCircle.spherical_distance(loc1.radlat_,
                loc1.radlon_,
                loc2.radlat_,
                loc2.radlon_);
        dist = uom.fromRadians(dist);

        if (dist > 1)
            dist = (int) dist;
        String outtext = dist + " " + uomAbbr;

        OMText text = new OMText((left_x + right_x) / 2, lower_y - 3, ""
                + outtext, OMText.JUSTIFY_CENTER);
        text.setLinePaint(textColor);
        graphics.add(text);
        graphics.generate(projection);

        return graphics;
    }
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.