Examples of OMGraphicList


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
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.