Package com.bbn.openmap.proj

Examples of com.bbn.openmap.proj.Length


        float hRes = grid.getHorizontalResolution();

        float vResRad = Length.DECIMAL_DEGREE.toRadians(vRes);
        float hResRad = Length.DECIMAL_DEGREE.toRadians(hRes);

        Length units = grid.getUnits();
        double vDist = Math.pow(2.0 * (double) units.fromRadians(vResRad), 2);
        double hDist = Math.pow(2.0 * (double) units.fromRadians(hResRad), 2);

        return modifier * Math.sqrt(vDist + hDist);
    }
View Full Code Here


    protected Length displayUnits = Length.METER;
    protected int bandHeight = ElevationBandGenerator.DEFAULT_BANDHEIGHT;

    public void setDisplayUnits(Length units) {
        Length oldValue = displayUnits;
        displayUnits = units;
        if (oldValue != displayUnits) {
            firePropertyChange(DISPLAY_UNITS_PROPERTY, oldValue, displayUnits);
        }
    }
View Full Code Here

            start = dis.readFloat();
            extent = dis.readFloat();
            int units = dis.readByte();
            int nverts = dis.readInt();

            Length unit = Length.DECIMAL_DEGREE;

            switch (units) {
            case 0:
                unit = Length.KM;
                break;
View Full Code Here

    private JComboBox makeUnitsCombo() {
        Length[] available = Length.getAvailable();
        String[] unitStrings = new String[available.length + 1];

        String current = null;
        Length l = ((OMRangeRings) circle).getIntervalUnits();
        if (l != null) {
            current = l.toString();
        }

        int currentIndex = unitStrings.length - 1;

        for (int i = 0; i < available.length; i++) {
            unitStrings[i] = available[i].toString();
            if (current != null && unitStrings[i].equals(current)) {
                currentIndex = i;
            }
        }
        unitStrings[unitStrings.length - 1] = i18n.get(this,
                "unitStrings.concentric",
                "concentric");

        JComboBox combo = new JComboBox(unitStrings);
        combo.setBorder(new EmptyBorder(0, 1, 0, 1));
        combo.setSelectedIndex(currentIndex);
        combo.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JComboBox jcb = (JComboBox) e.getSource();
                OMRangeRings rr = (OMRangeRings) circle;
                Length newLength = Length.get((String) jcb.getSelectedItem());
                Length oldLength = rr.getIntervalUnits();

                /*
                 * If newLength is not null and oldLength is not null, just
                 * translate the distance that is current specified. If
                 * newLength is null, then find out how many rings are on the
                 * range ring and set the interval to that. If oldLength is
                 * null, find out the radius and divide it by the number of
                 * rings - 1.
                 */

                int value = interpretValue(intervalField.getText());
                if (value <= 0) {
                    value = 4;
                }

                if (newLength != null && oldLength != null) {
                    value = (int) newLength.fromRadians(oldLength.toRadians(value));
                } else {
                    int numSubCircles;
                    if (rr.subCircles == null || rr.subCircles.length == 0) {
                        numSubCircles = 1;
                    } else {
View Full Code Here

    protected void setRadius(float radius) {
        if (circle != null) {
            if (snapToInterval) {
                OMRangeRings rr = (OMRangeRings) circle;
                Length units = rr.getIntervalUnits();
                if (units != null) {
                    float rds = units.fromRadians(Length.DECIMAL_DEGREE.toRadians(radius));
                    radius = Math.round(rds / rr.getInterval())
                            * rr.getInterval();
                    radius = Length.DECIMAL_DEGREE.fromRadians(units.toRadians(radius));
                }
            }
            circle.setRadius(radius);
        }
    }
View Full Code Here

        prefix = PropUtils.getScopedPropertyPrefix(prefix);

        String name = setList.getProperty(prefix + UnitProperty);
        if (name != null) {
            Length length = Length.get(name);
            if (length != null) {
                setUnit(length);
            } else if (name.equals(AllUnitsPropertyValue)) {
                setUnit(null);
            }
View Full Code Here

            lon = dis.readFloat();
            radius = dis.readFloat();
            int units = dis.readByte();
            int nverts = dis.readInt();

            Length unit = Length.DECIMAL_DEGREE;

            switch (units) {
            case 0:
                unit = Length.KM;
                break;
View Full Code Here

            double majorAxisSpan = dis.readFloat();
            double minorAxisSpan = dis.readFloat();
            int units = dis.readByte();
            double rotationAngle = dis.readFloat();

            Length unit = Length.DECIMAL_DEGREE;
            switch (units) {
            case 0:
                unit = Length.KM;
                break;
            case 1:
View Full Code Here

TOP

Related Classes of com.bbn.openmap.proj.Length

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.