Examples of OMGraphicList


Examples of com.bbn.openmap.omGraphics.OMGraphicList

            plotY += dy;
            prevX = x;
            prevY = y;

            graph.resize(plotX, plotY, plotWidth, plotHeight);
            OMGraphicList plotGraphics = graph.getPlotGraphics();
            //regenerate the plot graphics
            plotGraphics.generate(getProjection(), true);
            repaint();
        }
        return false;
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphicList

            }

            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());
                    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphicList

                                                   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...");
        for (int i = 0; i < size; i++) {
            obj = list.getOMGraphicAt(i);
            if ((obj instanceof OMPoly) && !((OMPoly) obj).isPolygon()) {
                plineGraphics.addOMGraphic(obj);
            } else {
                newGraphics.addOMGraphic(obj);
            }
        }

        // iterate through the polylines and join lines with common
        // endpoints
        size = plineGraphics.size();
        OMPoly poly1, poly2;
        float[] rads1, rads2, radians;
        System.out.println("maybe joining " + size + " polylines...");
        // nasty!: > O(n^2)
        for (int i = 0; i < size; i++) {
            if (i % 500 == 0) {
                System.out.println("checking pline i=" + i);
            }
            for (int j = 0; j < size; j++) {
                if (i == j) {
                    continue;
                }
                obj = plineGraphics.getOMGraphicAt(i);
                if (obj instanceof SinkGraphic) {
                    continue;
                }
                poly1 = (OMPoly) obj;
                rads1 = poly1.getLatLonArray();
                len1 = rads1.length;
                lat1 = ProjMath.radToDeg(rads1[len1 - 2]);
                lon1 = ProjMath.radToDeg(rads1[len1 - 1]);

                obj = plineGraphics.getOMGraphicAt(j);
                if (obj instanceof SinkGraphic) {
                    continue;
                }
                poly2 = (OMPoly) obj;
                rads2 = poly2.getLatLonArray();
                len2 = rads2.length;
                lat2 = ProjMath.radToDeg(rads2[0]);
                lon2 = ProjMath.radToDeg(rads2[1]);

                if (MoreMath.approximately_equal(lat1, lat2, zero_eps)
                        && MoreMath.approximately_equal(lon1, lon2, zero_eps)) {
                    // System.out.println("joining...");
                    radians = new float[len1 + len2 - 2];
                    System.arraycopy(rads1, 0, radians, 0, len1);
                    System.arraycopy(rads2, 0, radians, len1 - 2, len2);
                    poly1.setLocation(radians, OMGraphic.RADIANS);
                    plineGraphics.setOMGraphicAt(SinkGraphic.getSharedInstance(),
                            j);
                    j = -1;// redo search
                }
            }
        }

        // add the joined lines back to the data set
        size = plineGraphics.size();
        for (int i = 0; i < size; i++) {
            obj = plineGraphics.getOMGraphicAt(i);
            if (obj instanceof OMPoly) {
                newGraphics.addOMGraphic(obj);
            }
        }
        return newGraphics;
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphicList

     * rendered.
     */
    public void paint(Graphics g) {
        super.paint(g);
        if (drawIntersections || drawResults) {
            OMGraphicList graphics;
            graphics = new OMGraphicList(toDraw);
            graphics.generate(getProjection(), true);//all new
            // graphics
            logger.info("rendering toDraw " + toDraw.size() + " items");
            graphics.render(g);
        }
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphicList

     *
     * @return List of OMGraphic items that will be used to create
     *         roads
     */
    public List getGraphicList() {
        OMGraphicList omgl = getList();

        if (omgl != null) {
            return omgl.getTargets();
        }
        return new ArrayList();
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphicList

        Projection p = getProjection();

        if (p == null) {
            Debug.error("VPFLayer.getRectangle() called without a projection set in the layer. Make sure a projection is set in the layer before calling getRectangle.");
            return new OMGraphicList();
        }

        LatLonPoint upperleft = p.getUpperLeft();
        LatLonPoint lowerright = p.getLowerRight();
        if (Debug.debugging("vpfdetail")) {
            Debug.output("VPFLayer.getRectangle: " + coverageType /*
                                                                   * + " " +
                                                                   * dynamicArgs
                                                                   */);
        }

        warehouse.clear();

        //      int edgecount[] = new int[] { 0 , 0 };
        //      int textcount[] = new int[] { 0 , 0 };
        //      int areacount[] = new int[] { 0 , 0 };

        // Check both dynamic args and palette values when
        // deciding what to draw.
        if (Debug.debugging("vpf")) {
            Debug.output("VPFLayer.getRectangle(): "
                    + "calling draw with boundaries: " + upperleft + " "
                    + lowerright);
        }
        long start = System.currentTimeMillis();

        StringTokenizer t = new StringTokenizer(coverageType);
        while (t.hasMoreTokens()) {
            String currentCoverage = t.nextToken();
            if (searchByFeatures) {
                lst.drawFeatures((int) p.getScale(),
                        p.getWidth(),
                        p.getHeight(),
                        currentCoverage,
                        (VPFFeatureWarehouse) warehouse,
                        upperleft,
                        lowerright);
            } else {
                lst.drawTile((int) p.getScale(),
                        p.getWidth(),
                        p.getHeight(),
                        currentCoverage,
                        warehouse,
                        upperleft,
                        lowerright);
            }
        }
        long stop = System.currentTimeMillis();

        //      if (Debug.debugging("vpfdetail")) {
        //          Debug.output("Returned " + edgecount[0] +
        //                       " polys with " + edgecount[1] + " points\n" +
        //                       "Returned " + textcount[0] +
        //                       " texts with " + textcount[1] + " points\n" +
        //                       "Returned " + areacount[0] +
        //                       " areas with " + areacount[1] + " points");
        //      }

        if (Debug.debugging("vpf")) {
            Debug.output("VPFLayer.getRectangle(): read time: "
                    + ((stop - start) / 1000d) + " seconds");
        }

        OMGraphicList omglist = warehouse.getGraphics();

        // Don't forget to project.
        start = System.currentTimeMillis();
        omglist.project(p);
        stop = System.currentTimeMillis();

        if (Debug.debugging("vpf")) {
            Debug.output("VPFLayer.getRectangle(): proj time: "
                    + ((stop - start) / 1000d) + " seconds");
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphicList

     *
     * @param graphic An OMGraphic to add the graphics list
     * @param record A record to add to the DbfTableModel
     */
    public void addRecord(OMGraphic graphic, ArrayList record) {
        OMGraphicList list = getEsriGraphicList();

        // Associate the record directly in the OMGraphic
        graphic.putAttribute(SHAPE_DBF_INFO_ATTRIBUTE, record);

        // If list == null, model will be too.
        if (list != null) {
            // Might as well set the index
            graphic.putAttribute(SHAPE_INDEX_ATTRIBUTE,
                    new Integer(list.size() + 1));
            list.add(graphic);
            _model.addRecord(record);
        } else {
            Debug.error("EsriPlugIn.addRecord(): invalid data files!");
        }
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphicList

        EsriPlugIn epi = new EsriPlugIn();
        Properties props = new Properties();
        props.put(PARAM_SHP, argv[0]);
        epi.setProperties(props);

        OMGraphicList list = epi.getEsriGraphicList();

        if (list != null) {
            Debug.output(list.getDescription());
        }

        String dbfFileName = argv[0].substring(0, argv[0].lastIndexOf('.') + 1)
                + "dbf";

        try {
            DbfTableModel dbf = epi.getDbfTableModel(PropUtils.getResourceOrFileOrURL(epi,
                    dbfFileName));
            list.putAttribute(DBF_ATTRIBUTE, dbf);
            Debug.output("Set list in table");
            dbf.showGUI(dbfFileName, 0);

        } catch (Exception e) {
            Debug.error("Can't read .dbf file for .shp file: " + dbfFileName
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphicList

     * @param p projection of the screen, holding scale, center coords, height,
     *        width. May be null if the parent component hasn't been given a
     *        projection.
     */
    public OMGraphicList getRectangle(Projection p) {
        OMGraphicList list = getEsriGraphicList();
        proj = p;

        if (list != null) {
            list.generate(p);

            // Setting the list up so that if anything is "selected",
            // it will also be drawn on top of all the other
            // OMGraphics. This maintains order while also making any
            // line edge changes more prominent.
            OMGraphicList parent = new OMGraphicList();
            parent.add(selectedGraphics);
            parent.add(list);
            list = parent;
        }

        return list;
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMGraphicList

     *        coords, height, width.
     * @return an OMGraphicList containing an OMRaster with the image
     *         to be displayed.
     */
    public OMGraphicList getRectangle(Projection p) {
        OMGraphicList list = new OMGraphicList();

        // The first time through with a good bi, the it will be
        // created later. This routine will only be executed if the
        // image icon is no good.
        if (bi == null && it == null) {
            return list;
        }

        OMRaster ras = null;

        if (it == null) {
            it = new ImageTranslator(bi);
            bi = null; // don't hold onto it.
        }

        ras = it.getImage(p);

        if (ras != null) {
            list.add(ras);
        }

        list.generate(p);
        return list;
    }
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.