Package com.bbn.openmap.omGraphics

Examples of com.bbn.openmap.omGraphics.OMGraphicList


    public GeoCrossDemoLayer() {
        super();
    }

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

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

        OMLine oldLine = null;
        Geo ogc = null;

        for (Iterator it = lines.iterator(); it.hasNext();) {

            OMLine line = (OMLine) it.next();
            float[] ll = line.getLL();
            Geo g1 = new Geo(ll[0], ll[1]);
            Geo g2 = new Geo(ll[2], ll[3]);

            Geo gc = g1.crossNormalize(g2);

            OMPoint p = new OMPoint((float) gc.getLatitude(), (float) gc.getLongitude(), 3);
            p.setLinePaint(line.getLinePaint());
            p.setFillPaint(line.getFillPaint());
            p.setStroke(line.getStroke());

            line.addArrowHead(true);

            list.add(line);
            list.add(p);

            if (oldLine != null) {

                float[] ll2 = oldLine.getLL();
                Geo g3 = new Geo(ll2[0], ll2[1]);
                Geo g4 = new Geo(ll2[2], ll2[3]);

                OMLine line2 = new OMLine((float) ogc.getLatitude(), (float) ogc.getLongitude(), (float) gc.getLatitude(), (float) gc.getLongitude(), OMGraphic.LINETYPE_GREATCIRCLE);
                line2.setLinePaint(line.getLinePaint());
                line2.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0f, new float[] {
                        10, 10 }, 0f));
                line2.addArrowHead(true);
                list.add(line2);

                Geo i = gc.crossNormalize(ogc);

                if (!(Intersection.isOnSegment(g1, g2, i) || Intersection.isOnSegment(g3,
                        g4,
                        i))) {
                    i = i.antipode();
                }

                p = new OMPoint((float) i.getLatitude(), (float) i.getLongitude(), 3);
                p.setOval(true);
                p.setLinePaint(line.getLinePaint());
                p.setFillPaint(Color.white);
                p.setStroke(line.getStroke());

                list.add(p);
            }

            oldLine = line;
            ogc = gc;
        }

        list.generate(getProjection());

        return list;

    }
View Full Code Here


        if (Debug.debugging("cachelayer")) {
            Debug.output("Reading cached graphics");
        }

        if (omgraphics == null) {
            omgraphics = new OMGraphicList();
        }

        if (cacheURL != null) {
            omgraphics.readGraphics(cacheURL);
        }
View Full Code Here

            contentLength += 16; // Box
            contentLength += 2; // NumParts
            contentLength += 2; // NumPoints

            if (graphic instanceof OMGraphicList) {
                OMGraphicList sublist = (OMGraphicList) graphic;
                contentLength += sublist.size() * 2; // offsets?

                for (int j = 0; j < sublist.size(); j++) {
                    OMPoly poly = (OMPoly) sublist.getOMGraphicAt(j);
                    data = poly.getLatLonArray();

                    // each value equals 4 words
                    contentLength += data.length * 4;
                }
View Full Code Here

     * Construct a default route layer. Initializes omgraphics to a
     * new OMGraphicList, and invokes createGraphics to create the
     * canned list of routes.
     */
    public RouteLayer() {
        omgraphics = new OMGraphicList();
        createGraphics(omgraphics);
    }
View Full Code Here

    /**
     * Create the graphics.
     */
    protected OMGraphicList generateGraphics() {
        OMGraphicList omgraphics = new OMGraphicList();
        OMPoint circ;
        OMText text;

        int circle_r = 2;
        int circle_h = 5;

        for (int i = 0, j = 0; i < llData.length; i += 2, j++) {

            // grouping
            OMGraphicList group = new OMGraphicList(2);

            // XY-Circle at LatLonPoint
            circ = new OMPoint(llData[i], llData[i + 1], circle_r);
            circ.setOval(true);
            circ.setFillPaint(lineColor);
            group.add(circ);

            // Info
            text = new OMText(llData[i], llData[i + 1], 0, circle_h + 10, infoData[j], java.awt.Font.decode("SansSerif"), OMText.JUSTIFY_CENTER);
            text.setLinePaint(lineColor);
            group.add(text);

            group.setAppObject(new Integer(j));//remember index
            omgraphics.add(group);
        }

        omgraphics.generate(getProjection(), false);
        return omgraphics;
View Full Code Here

     *
     * @param e MouseEvent
     * @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

    public OMGraphicList getGraphics(double xmin, double ymin, double xmax,
                                     double ymax, OMGraphicList list,
                                     Projection proj) throws IOException,
            FormatException {
        if (list == null) {
            list = new OMGraphicList();
        }

        if (!buffered) {

            // Clean up if buffering turned off.
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

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

        Set seen = new HashSet();

        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

     * 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
            if (logger.isLoggable(Level.INFO)) {
                logger.info("rendering toDraw " + toDraw.size() + " items");
            }
            graphics.render(g);
        }
    }
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.