Package com.bbn.openmap.geo

Examples of com.bbn.openmap.geo.Geo


        }
        if (rawllpts.length < 4) {
            return;
        }

        Geo lastGeo = new Geo(rawllpts[0], rawllpts[1], false);
        points.add(new OMPoint(ProjMath.radToDeg(rawllpts[0]), ProjMath.radToDeg(rawllpts[1]), 1));
        Geo curGeo = null;
        float cumulativeDist = 0f;
        for (int p = 2; p < rawllpts.length; p += 2) {
            if (curGeo == null) {
                curGeo = new Geo(rawllpts[p], rawllpts[p + 1], false);
            } else {
                curGeo.initializeRadians(rawllpts[p], rawllpts[p + 1]);
            }

            float dist = getDist(lastGeo, curGeo);
            cumulativeDist += dist;
View Full Code Here


     * Get an OMText label for a segments between the given lat/lon points whose
     * given distance and cumulative distance is specified.
     */
    public OMText createLabel(Geo g1, Geo g2, float dist, float cumulativeDist,
                              Length distanceUnits) {
        Geo mid;
        switch (getLineType()) {
        case LINETYPE_STRAIGHT:
            float lat = (float) (g1.getLatitude() + g2.getLatitude()) / 2f;
            float lon = (float) (g1.getLongitude() + g2.getLongitude()) / 2f;
            mid = new Geo(lat, lon);
            break;
        case LINETYPE_RHUMB:
            System.err.println("Rhumb distance calculation not implemented.");
        case LINETYPE_GREATCIRCLE:
        case LINETYPE_UNKNOWN:
        default:
            mid = g1.midPoint(g2);
        }

        // String text = ((int)dist) + " (" + ((int)cumulativeDist) +
        // ")";

        String text = (df.format(distanceUnits.fromRadians(dist))) + " ("
                + (df.format(distanceUnits.fromRadians(cumulativeDist))) + ") "
                + distanceUnits.getAbbr();
        OMText omtext = new OMText((float) mid.getLatitude(), (float) mid.getLongitude(), text, OMText.JUSTIFY_LEFT);
        // omtext.setLinePaint(new Color(200, 200, 255));
        return omtext;
    }
View Full Code Here

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

                int num = 0;

                while (crssngs != null && crssngs.hasNext()) {
                    BoundaryCrossing bc = (BoundaryCrossing) crssngs.next();
                    Geo geo = bc.getGeo();

                    OMPoint pgeo = new OMPoint((float) geo.getLatitude(), (float) geo.getLongitude());
                    pgeo.setFillPaint(Color.WHITE);
                    pgeo.putAttribute(OMGraphic.LABEL,
                            new OMTextLabeler(Integer.toString(num++)));
                    intersectionResultList.add(pgeo);
                }
View Full Code Here

            double y = r.getY();
            double h = r.getHeight();
            double w = r.getWidth();
            float[] rawll = ((OMPoly) omg).getLatLonArray();
            LatLonPoint llHolder = new LatLonPoint();
            Geo g = new Geo(0, 0);
            int[] pix = new int[(int) (h * w)];

            for (double j = 0; j < h; j++) {
                for (double i = 0; i < w; i++) {

                    boolean inShape = s.contains(i + x, j + y);
                    p.inverse((int) (i + x), (int) (j + y), llHolder);

                    g.initialize(llHolder.getLatitude(), llHolder.getLongitude());
                    boolean inGeo = Intersection.isPointInPolygon(g,
                            rawll,
                            false);

                    int val = 0;
View Full Code Here

        float[] segArray;

        public OMLineSegment(OMLine oml) {
            segArray = oml.getLL();
            geos = new Geo[2];
            geos[0] = new Geo(segArray[0], segArray[1]);
            geos[1] = new Geo(segArray[2], segArray[3]);
        }
View Full Code Here

TOP

Related Classes of com.bbn.openmap.geo.Geo

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.