Ignore:
Timestamp:
2013-11-29T00:19:15+01:00 (11 years ago)
Author:
simon04
Message:

JOSM/measurement: show measured length in meters or better - fix #josm9331

Location:
applications/editors/josm/plugins/measurement
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/measurement/build.xml

    r29854 r30104  
    44    <property name="commit.message" value="recompile dure to core change"/>
    55    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    6     <property name="plugin.main.version" value="6162"/>
     6    <property name="plugin.main.version" value="6422"/>
    77   
    88    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java

    r29750 r30104  
    105105        valuePanel.add(new JLabel(tr("Path Length")));
    106106
    107         pathLengthLabel = new JLabel(NavigatableComponent.getDistText(0));
     107        pathLengthLabel = new JLabel(getDistText(0));
    108108        valuePanel.add(pathLengthLabel);
    109109
    110110        valuePanel.add(new JLabel(tr("Selection Length")));
    111111
    112         selectLengthLabel = new JLabel(NavigatableComponent.getDistText(0));
     112        selectLengthLabel = new JLabel(getDistText(0));
    113113        valuePanel.add(selectLengthLabel);
    114114
    115115        valuePanel.add(new JLabel(tr("Selection Area")));
    116116
    117         selectAreaLabel = new JLabel(NavigatableComponent.getAreaText(0));
     117        selectAreaLabel = new JLabel(getAreaText(0));
    118118        valuePanel.add(selectAreaLabel);
    119119
     
    135135    }
    136136
     137    protected String getDistText(double v) {
     138        return NavigatableComponent.getSystemOfMeasurement().getDistText(v, new DecimalFormat("#0.000"), 1e-3);
     139    }
     140
     141    protected String getAreaText(double v) {
     142        return NavigatableComponent.getSystemOfMeasurement().getAreaText(v, new DecimalFormat("#0.000"), 1e-3);
     143    }
     144
     145    protected String getAngleText(double v) {
     146        return new DecimalFormat("#0.0").format(v) + " \u00b0";
     147    }
     148
    137149    /**
    138150     * Cleans the active Measurement Layer
     
    142154    }
    143155
    144         @Override
    145         public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
     156    @Override
     157    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    146158        double length = 0.0;
    147159        double segAngle = 0.0;
     
    186198        }
    187199       
    188         final String lengthLabel = NavigatableComponent.getDistText(length);
    189         final String angleLabel = new DecimalFormat("#0.0").format(segAngle) + " \u00b0";
    190         final String areaLabel = NavigatableComponent.getAreaText(area);
     200        final String lengthLabel = getDistText(length);
     201        final String angleLabel = getAngleText(segAngle);
     202        final String areaLabel = getAreaText(area);
    191203       
    192204        GuiHelper.runInEDT(new Runnable() {
Note: See TracChangeset for help on using the changeset viewer.