Examples of OMPoly


Examples of com.bbn.openmap.omGraphics.OMPoly

        int stepSize;
        // Choose how far apart the lines will be.
        stepSize = ((showWhichLines == SHOW_ONES) ? 1 : 5);
        float[] llp;
        OMPoly currentLine;
        OMText currentText;

        // For calculating text locations
        java.awt.Point point;
        LatLonPoint llpoint;

        Projection projection = getProjection();

        // generate other parallels of latitude be creating series
        // of polylines
        for (int i = south; i < north; i += stepSize) {
            float lat = (float) i;
            // generate parallel of latitude North/South of the
            // equator
            if (west < 0 && east > 0) {
                llp = new float[6];
                llp[2] = lat;
                llp[3] = 0f;
                llp[4] = lat;
                llp[5] = east;
            } else {
                llp = new float[4];
                llp[2] = lat;
                llp[3] = east;
            }
            llp[0] = lat;
            llp[1] = west;

            // Do not duplicate the 10 degree line.
            if ((lat % 10) != 0) {
                currentLine = new OMPoly(llp, OMGraphic.DECIMAL_DEGREES, boxy ? OMGraphic.LINETYPE_STRAIGHT
                        : OMGraphic.LINETYPE_RHUMB);
                if ((lat % 5) == 0) {
                    currentLine.setLinePaint(fiveDegreeColor);
                } else {
                    currentLine.setLinePaint(oneDegreeColor);
                }
                lines.addOMGraphic(currentLine);
            }

            if (showRuler && (lat % 2) == 0) {
                if (boxy) {
                    point = projection.forward(lat, west);
                    point.x = 0;
                    llpoint = projection.inverse(point);
                } else {
                    llpoint = new LatLonPoint(lat, west);
                    while (projection.forward(llpoint).x < 0) {
                        llpoint.setLongitude(llpoint.getLongitude() + stepSize);
                    }
                }

                currentText = new OMText(llpoint.getLatitude(), llpoint.getLongitude(),
                // Move them up a little
                        (int) 2, (int) -2, Integer.toString((int) lat), font, OMText.JUSTIFY_LEFT);
                currentText.setLinePaint(textColor);
                lines.addOMGraphic(currentText);
            }
        }

        // generate lines of longitude
        for (int i = west; i < east; i += stepSize) {
            float lon = (float) i;

            if (north < 0 && south > 0) {
                llp = new float[6];
                llp[2] = 0f;
                llp[3] = lon;
                llp[4] = south;
                llp[5] = lon;
            } else {
                llp = new float[4];
                llp[2] = south;
                llp[3] = lon;
            }
            llp[0] = north;
            llp[1] = lon;

            if ((lon % 10) != 0) {
                currentLine = new OMPoly(llp, OMGraphic.DECIMAL_DEGREES, boxy ? OMGraphic.LINETYPE_STRAIGHT
                        : OMGraphic.LINETYPE_GREATCIRCLE);
                if ((lon % 5) == 0) {
                    currentLine.setLinePaint(fiveDegreeColor);
                } else {
                    currentLine.setLinePaint(oneDegreeColor);
                }
                lines.addOMGraphic(currentLine);
            }

            if (showRuler && (lon % 2) == 0) {
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMPoly

    /** Create the ten degree lines. */
    protected OMGraphicList constructTenDegreeLines() {

        OMGraphicList lines = new OMGraphicList(3);
        OMPoly currentLine;

        // generate other parallels of latitude by creating series
        // of polylines
        for (int i = 1; i <= 8; i++) {
            for (int j = -1; j < 2; j += 2) {
                float lat = (float) (10 * i * j);
                // generate parallel of latitude North/South of the
                // equator
                float[] llp = { lat, -180f, lat, -90f, lat, 0f, lat, 90f, lat,
                        180f };
                currentLine = new OMPoly(llp, OMGraphic.DECIMAL_DEGREES, boxy ? OMGraphic.LINETYPE_STRAIGHT
                        : OMGraphic.LINETYPE_RHUMB);
                currentLine.setLinePaint(tenDegreeColor);
                lines.addOMGraphic(currentLine);
            }
        }

        // generate lines of longitude
        for (int i = 1; i < 18; i++) {
            for (int j = -1; j < 2; j += 2) {
                float lon = (float) (10 * i * j);
                //not quite 90.0 for beautification reasons.
                float[] llp = { 80f, lon, 0f, lon, -80f, lon };
                if (MoreMath.approximately_equal(Math.abs(lon), 90f, 0.001f)) {
                    llp[0] = 90f;
                    llp[4] = -90f;
                }
                currentLine = new OMPoly(llp, OMGraphic.DECIMAL_DEGREES, boxy ? OMGraphic.LINETYPE_STRAIGHT
                        : OMGraphic.LINETYPE_GREATCIRCLE);
                currentLine.setLinePaint(tenDegreeColor);
                lines.addOMGraphic(currentLine);
            }
        }

        if (Debug.debugging("graticule")) {
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMPoly

    /** Constructs the Dateline and Prime Meridian lines. */
    protected OMGraphicList constructMarkerLines() {

        OMGraphicList lines = new OMGraphicList(3);
        OMPoly currentLine;

        // generate Prime Meridian and Dateline
        for (int j = 0; j < 360; j += 180) {
            float lon = (float) j;
            float[] llp = { 90f, lon, 0f, lon, -90f, lon };
            currentLine = new OMPoly(llp, OMGraphic.DECIMAL_DEGREES, boxy ? OMGraphic.LINETYPE_STRAIGHT
                    : OMGraphic.LINETYPE_GREATCIRCLE);
            currentLine.setLinePaint(dateLineColor);
            lines.addOMGraphic(currentLine);
        }

        // equator
        float[] llp = { 0f, -180f, 0f, -90f, 0f, 0f, 0f, 90f, 0f, 180f };
        // polyline
        currentLine = new OMPoly(llp, OMGraphic.DECIMAL_DEGREES, boxy ? OMGraphic.LINETYPE_STRAIGHT
                : OMGraphic.LINETYPE_GREATCIRCLE);
        currentLine.setLinePaint(equatorColor);
        lines.addOMGraphic(currentLine);

        if (Debug.debugging("graticule")) {
            Debug.output("GraticuleLayer.constructMarkerLines(): "
                    + "constructed " + lines.size() + " graticule lines");
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMPoly

     */
    public static OMPoly read(DataInputStream dis,
                              LinkProperties propertiesBuffer)
            throws IOException {

        OMPoly poly = null;
        int numPoints;
        int[] xpoints, ypoints;

        int renderType = dis.readByte();

        switch (renderType) {
        case RENDERTYPE_LATLON:
            int lineType = dis.readByte();
            numPoints = dis.readInt();

            float[] llpoints = new float[numPoints];
            for (int i = 0; i < numPoints; i++) {
                llpoints[i] = dis.readFloat();
            }
            int units = dis.readByte();
            int nsegs = dis.readInt();

            if (Debug.debugging("linkdetail")) {
                System.out.println("  Lat/Lon LinkPoly:");
                System.out.println("  linetype = " + lineType);
                System.out.println("  number of points = " + numPoints / 2);
                // for (int i = 0; i < numPoints; i+=2) {
                // System.out.println(" Lat = " + llpoints[i] +
                // ", Lon = " + llpoints[i+1]);
                // }
                System.out.println("  units = " + units);
                System.out.println("  nsegs = " + nsegs);
            }

            poly = new OMPoly(llpoints, units, lineType, nsegs);
            break;
        case RENDERTYPE_XY:
            numPoints = dis.readInt();
            xpoints = new int[numPoints / 2];
            ypoints = new int[numPoints / 2];

            for (int i = 0; i < numPoints / 2; i += 1) {
                xpoints[i] = dis.readInt();
                ypoints[i] = dis.readInt();
            }

            if (Debug.debugging("linkdetail")) {
                System.out.println("  X/Y LinkPoly:");
                System.out.println("  number of points = " + numPoints / 2);
                // for (i = 0; i < numPoints; i++) {
                // System.out.println(" X = " + xpoints[i] +
                // ", Y = " + ypoints[i]);
                // }
            }

            poly = new OMPoly(xpoints, ypoints);
            break;
        case RENDERTYPE_OFFSET:
            float lat_1 = dis.readFloat();
            float lon_1 = dis.readFloat();
            numPoints = dis.readInt();

            xpoints = new int[numPoints / 2];
            ypoints = new int[numPoints / 2];

            for (int i = 0; i < numPoints / 2; i += 1) {
                xpoints[i] = dis.readInt();
                ypoints[i] = dis.readInt();
            }
            int cMode = dis.readByte();

            if (Debug.debugging("linkdetail")) {
                System.out.println("  Offset LinkPoly:");
                System.out.println("  lat = " + lat_1);
                System.out.println("  lon = " + lon_1);
                System.out.println("  number of points = " + numPoints / 2);
                // for (i = 0; i < numPoints; i+=2) {
                // System.out.println(" Lat = " + llpoints[i] +
                // ", Lon = " + llpoints[i+1]);
                // }
                System.out.println("  cMode = " + cMode);
            }

            poly = new OMPoly(lat_1, lon_1, xpoints, ypoints, cMode);
            break;
        default:
        }

        if (poly != null) {
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMPoly

        omList.add(ell);

        float[] llp2 = new float[] { 0.41789755f, -1.435303f, 0.41813868f,
                -1.3967744f };

        OMPoly p2 = new OMPoly(llp2, OMGraphic.RADIANS, OMGraphic.LINETYPE_RHUMB);
        p2.setLinePaint(Color.yellow);
        omList.add(p2);

        // OMArc arc = new OMArc(40f, 65f, 750f, Length.MILE, 20f,
        // 95f);
        OMArc arc = new OMArc((float) 40.0, (float) 65.0, (float) 750.0, Length.MILE, (float) 20.0, (float) 95.0);
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMPoly

                    EditableOMPoly eomp = new EditableOMPoly(fga);
                    eomp.setEnclosed(true);
                    eomp.setShowGUI(false);

                    dt.setBehaviorMask(OMDrawingTool.QUICK_CHANGE_BEHAVIOR_MASK);
                    OMPoly poly = (OMPoly) getDrawingTool().edit(eomp, layer);

                    if (poly != null) {
                        poly.setIsPolygon(true);
                        poly.setAppObject(internalKey);
                    } else {
                        Debug.error("DemoLayer: Drawing tool can't create OMPoly");
                    }
                } else {
                    Debug.output("DemoLayer can't find a drawing tool");
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMPoly

        overviewScale = proj.getScale();

        boolean cylindrical = sourceMapProjection instanceof Cylindrical;

        if (poly == null) {
            poly = new OMPoly();
            areaAttributes.setTo(poly);
            poly.setLineType(cylindrical ? OMGraphic.LINETYPE_STRAIGHT
                    : OMGraphic.LINETYPE_GREATCIRCLE);
        }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMPoly

     * Create graphics.
     */
    protected void createGraphics(OMGraphicList list) {
        // NOTE: all this is very non-optimized...

        OMPoly poly;

        // H
        poly = new OMPoly(new float[] { 10f, -150f, 35f, -150f, 35f, -145f,
                25f, -145f, 25f, -135f, 35f, -135f, 35f, -130f, 10f, -130f,
                10f, -135f, 20f, -135f, 20f, -145f, 10f, -145f, 10f, -150f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(Color.green);
        list.add(poly);

        // E
        poly = new OMPoly(new float[] { 10f, -120f, 35f, -120f, 35f, -100f,
                30f, -100f, 30f, -115f, 25f, -115f, 25f, -105f, 20f, -105f,
                20f, -115f, 15f, -115f, 15f, -100f, 10f, -100f, 10f, -120f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(Color.green);
        list.add(poly);

        // L
        poly = new OMPoly(new float[] { 10f, -90f, 35f, -90f, 35f, -85f, 15f,
                -85f, 15f, -75f, 10f, -75f, 10f, -90f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(Color.green);
        list.add(poly);

        // L
        poly = new OMPoly(new float[] { 10f, -70f, 35f, -70f, 35f, -65f, 15f,
                -65f, 15f, -55f, 10f, -55f, 10f, -70f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(Color.green);
        list.add(poly);

        // O
        poly = new OMPoly(new float[] { 10f, -50f, 35f, -50f, 35f, -30f, 10f,
                -30f, 10f, -50f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(OMGraphic.clear);
        list.add(poly);
        poly = new OMPoly(new float[] { 15f, -45f, 30f, -45f, 30f, -35f, 15f,
                -35f, 15f, -45f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(OMGraphic.clear);
        list.add(poly);
        poly = new OMPoly(new float[] { 10f, -50f, 35f, -50f, 35f, -30f, 10f,
                -30f, 10f, -45f, 15f, -45f, 15f, -35f, 30f, -35f, 30f, -45f,
                10f, -45f, 10f, -50f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(OMGraphic.clear);
        poly.setFillPaint(Color.green);
        list.add(poly);

        // W
        poly = new OMPoly(new float[] { -35f, -5f, -10f, -5f, -10f, 0f, -25f,
                0f, -25f, 5f, -20f, 5f, -20f, 10f, -25f, 10f, -25f, 15f, -10f,
                15f, -10f, 20f, -35f, 20f, -35f, 10f, -30f, 10f, -30f, 5f,
                -35f, 5f, -35f, -5f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(Color.green);
        list.add(poly);

        // O
        poly = new OMPoly(new float[] { -35f, 30f, -10f, 30f, -10f, 50f, -35f,
                50f, -35f, 30f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(OMGraphic.clear);
        list.add(poly);
        poly = new OMPoly(new float[] { -30f, 35f, -15f, 35f, -15f, 45f, -30f,
                45f, -30f, 35f, }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(OMGraphic.clear);
        list.add(poly);
        poly = new OMPoly(new float[] { -35f, 30f, -10f, 30f, -10f, 50f, -35f,
                50f, -35f, 35f, -30f, 35f, -30f, 45f, -15f, 45f, -15f, 35f,
                -35f, 35f, -35f, 30f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(OMGraphic.clear);
        poly.setFillPaint(Color.green);
        list.add(poly);

        // R
        poly = new OMPoly(new float[] { -35f, 60f, -10f, 60f, -10f, 75f, -20f,
                75f, -25f, 70f, -30f, 80f, -35f, 80f, -35f, 75f, -30f, 70f,
                -30f, 65f, -35f, 65f, -35f, 60f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(OMGraphic.clear);
        list.add(poly);
        poly = new OMPoly(new float[] { -20f, 65f, -15f, 65f, -15f, 70f, -20f,
                70f, -20f, 65f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(OMGraphic.clear);
        list.add(poly);
        poly = new OMPoly(new float[] { -35f, 60f, -10f, 60f, -10f, 75f, -20f,
                75f, -25f, 70f, -30f, 80f, -35f, 80f, -35f, 75f, -30f, 70f,
                -30f, 65f, -20f, 65f, -20f, 70f, -15f, 70f, -15f, 65f, -35f,
                65f, -35f, 60f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(OMGraphic.clear);
        poly.setFillPaint(Color.green);
        list.add(poly);

        // L
        poly = new OMPoly(new float[] { -35f, 90f, -10f, 90f, -10f, 95f, -30f,
                95f, -30f, 105f, -35f, 105f, -35f, 90f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(Color.green);
        list.add(poly);

        // D
        poly = new OMPoly(new float[] { -35f, 110f, -10f, 110f, -10f, 125f,
                -15f, 130f, -30f, 130f, -35f, 125f, -35f, 110f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(OMGraphic.clear);
        list.add(poly);
        poly = new OMPoly(new float[] { -30f, 115f, -15f, 115f, -15f, 120f,
                -20f, 125f, -25f, 125f, -30f, 120f, -30f, 115f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(Color.black);
        poly.setFillPaint(OMGraphic.clear);
        list.add(poly);
        poly = new OMPoly(new float[] { -35f, 110f, -10f, 110f, -10f, 125f,
                -15f, 130f, -30f, 130f, -35f, 125f, -35f, 115f, -30f, 115f,
                -30f, 120f, -25f, 125f, -20f, 125f, -15f, 120f, -15f, 115f,
                -35f, 115f, -35f, 110f }, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB, 32);
        poly.setLinePaint(OMGraphic.clear);
        poly.setFillPaint(Color.green);
        list.add(poly);
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMPoly

        switch (poly.rt) {
        case OMGraphic.RENDERTYPE_LATLON:
            int len = poly.llpts.length;
            float[] llpts = new float[len];
            System.arraycopy(poly.llpts, 0, llpts, 0, len);
            ompoly = new OMPoly(llpts, OMPoly.DECIMAL_DEGREES, poly.type, poly.nsegs);
            break;
        case OMGraphic.RENDERTYPE_XY:
            ompoly = new OMPoly(poly.xypts);
            break;
        case OMGraphic.RENDERTYPE_OFFSET:
            ompoly = new OMPoly(poly.lat, poly.lon, poly.xypts, poly.cMode);
            break;
        default:
            System.err.println("ARRRR!");
            break;
        }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMPoly

        // get the northwest corner again to close the polygon
        rectPoints[8] = (omRect.getNorthLat());
        rectPoints[9] = (omRect.getWestLon());

        // using the OMRect data create an OMPoly
        OMPoly poly = new OMPoly(rectPoints, OMGraphic.DECIMAL_DEGREES, omRect.getLineType());
        poly.setAttributes(omRect.getAttributes());
        DrawingAttributes da = new DrawingAttributes();
        da.setFrom(omRect);
        da.setTo(poly);
        return poly;
    }
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.