Examples of OMText


Examples of com.bbn.openmap.omGraphics.OMText

        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) {
                if (boxy) {
                    point = projection.forward(south, lon);
                    point.y = projection.getHeight();
                    llpoint = projection.inverse(point);
                } else {
                    llpoint = new LatLonPoint(south, lon);
                    while (projection.forward(llpoint).y > projection.getHeight()) {
                        llpoint.setLatitude(llpoint.getLatitude() + stepSize);
                    }
                }

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

            }
        }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMText

        int east = (int) Math.ceil(right);
        if (east > 180)
            east = 180;

        int stepSize = 10;
        OMText currentText;

        // For calculating text locations
        java.awt.Point point;
        LatLonPoint llpoint;
        Projection projection = getProjection();

        if (doLats) {

            // generate other parallels of latitude be creating series
            // of labels
            for (int i = south; i < north; i += stepSize) {
                float lat = (float) i;

                if ((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(), (int) 2, (int) -2, // Move
                            // them
                            // up a
                            // little
                            Integer.toString((int) lat), font, OMText.JUSTIFY_LEFT);
                    currentText.setLinePaint(textColor);
                    labels.addOMGraphic(currentText);
                }
            }
        }

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

            if ((lon % 2) == 0) {
                if (boxy) {
                    point = projection.forward(south, lon);
                    point.y = projection.getHeight();
                    llpoint = projection.inverse(point);
                } else {
                    llpoint = new LatLonPoint(south, lon);
                    while (projection.forward(llpoint).y > projection.getHeight()) {
                        llpoint.setLatitude(llpoint.getLatitude() + stepSize);
                    }
                }

                currentText = new OMText(llpoint.getLatitude(), llpoint.getLongitude(),
                // Move them up a little
                        (int) 2, (int) -5, Integer.toString((int) lon), font, OMText.JUSTIFY_CENTER);
                currentText.setLinePaint(textColor);
                labels.addOMGraphic(currentText);

            }
        }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMText

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

        OMText text = null;
        float lat = 0;
        float lon = 0;
        int x = 0;
        int y = 0;
        int just = 0;
        String string, font;

        int renderType = dis.readByte();

        switch (renderType) {
        case RENDERTYPE_OFFSET:
            lat = dis.readFloat();
            lon = dis.readFloat();
        case RENDERTYPE_XY:
            x = dis.readInt();
            y = dis.readInt();
            break;
        case RENDERTYPE_LATLON:
        default:
            lat = dis.readFloat();
            lon = dis.readFloat();
        }

        just = dis.readByte();

        LinkProperties properties = (LinkProperties) LinkProperties.read(dis,
                propertiesBuffer).clone();

        string = properties.getProperty(LPC_LINKTEXTSTRING);
        font = properties.getProperty(LPC_LINKTEXTFONT);

        if (string == null)
            string = "";
        if (font == null)
            font = DEFAULT_FONT;

        switch (renderType) {
        case RENDERTYPE_OFFSET:
            text = new OMText(lat, lon, x, y, string, OMText.rebuildFont(font), just);
            break;
        case RENDERTYPE_XY:
            text = new OMText(x, y, string, OMText.rebuildFont(font), just);
            break;
        case RENDERTYPE_LATLON:
        default:
            text = new OMText(lat, lon, string, OMText.rebuildFont(font), just);
        }

        if (text != null) {
            properties.setProperties(text);
            text.setBaseline(PropUtils.intFromProperties(properties,
                    LPC_LINKTEXTBASELINE,
                    BASELINE_BOTTOM));
            text.setRotationAngle((double) ProjMath.degToRad(PropUtils.floatFromProperties(properties,
                    LPC_LINKROTATION,
                    0.0f)));
        }

        return text;
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMText

    protected void addLabel(LatLonPoint llp, UTMPoint utm, QuadTree labelTree) {
        float latitude = llp.getLatitude();
        float longitude = llp.getLongitude();
        labelTree.put(latitude,
                longitude,
                new OMText(latitude, longitude, 2, -2, utm.zone_number + ""
                        + utm.zone_letter, OMText.JUSTIFY_LEFT));
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMText

                    // Lame attempt of testing whether the label is
                    // on-screen
                    if ((x > -buffer || x < p.getWidth() + buffer)
                            && (y > -buffer || y < p.getHeight() + buffer)) {

                        OMText label = new OMText(llp.getLatitude(), llp.getLongitude(), 4, -4, labelString, OMText.JUSTIFY_LEFT);
                        label.setLinePaint(distanceGridPaint);
                        textList.add(label);
                    }
                }
                list.add(textList);
            }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMText

        // arc1.setLinePaint(Color.blue);
        // arc1.setFillPaint(Color.yellow);
        // arc1.setArcType(java.awt.geom.Arc2D.PIE);
        // omList.add(arc1);

        OMText text = new OMText(30f, 80f, "Testing FontSizer", OMText.JUSTIFY_CENTER);
        text.setFontSizer(new FontSizer(30000000f, 1, 5, 40));
        omList.add(text);

        if (srl != null) {
            ImageIcon ii = srl.getIcon("SFPPV-----*****",
                    new Dimension(100, 100));
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMText

        // If the caller has supplied a substitute graphic for
        // the location spot, it's up to them to horizontally
        // offset the label appropriately. They should do that
        // here, or in an extended class.
        label = new OMText(lat, lon, 0, 0, name, OMText.JUSTIFY_LEFT);
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMText

        // If the caller has supplied a substitute graphic for
        // the location spot, it's up to them to horizontally
        // offset the label appropriately. They should do that
        // here, or in an extended class.
        label = new OMText(x, y, name, OMText.JUSTIFY_LEFT);
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMText

        // If the caller has supplied a substitute graphic for
        // the location spot, it's up to them to horizontally
        // offset the label appropriately. They should do that
        // here, or in an extended class.
        label = new OMText(lat, lon, xOffset, yOffset, name, OMText.JUSTIFY_LEFT);
    }
View Full Code Here

Examples of com.bbn.openmap.omGraphics.OMText

        if (dist > 1)
            dist = (int) dist;
        String outtext = dist + " " + uomAbbr;

        OMText text = new OMText((left_x + right_x) / 2, lower_y - 3, ""
                + outtext, OMText.JUSTIFY_CENTER);
        text.setLinePaint(textColor);
        graphics.add(text);
        graphics.generate(projection);

        return graphics;
    }
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.