Changeset 7135 in josm
- Timestamp:
- 2014-05-17T04:49:16+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r7005 r7135 27 27 import java.awt.event.MouseMotionListener; 28 28 import java.lang.reflect.InvocationTargetException; 29 import java.text.DecimalFormat; 29 30 import java.util.ArrayList; 30 31 import java.util.Collection; … … 85 86 */ 86 87 public class MapStatus extends JPanel implements Helpful, Destroyable, PreferenceChangedListener { 88 89 private static final DecimalFormat ONE_DECIMAL_PLACE = new DecimalFormat("0.0"); 87 90 88 91 /** … … 723 726 724 727 private final JSeparator separator = new JSeparator(); 725 728 726 729 private final JMenuItem doNotHide = new JCheckBoxMenuItem(new AbstractAction(tr("Do not hide status bar")) { 727 730 @Override … … 743 746 add(item); 744 747 } 745 748 746 749 add(separator); 747 750 add(doNotHide); 748 751 749 752 addPopupMenuListener(new PopupMenuListener() { 750 753 @Override … … 947 950 948 951 public void setAngle(double a) { 949 angleText.setText(a < 0 ? "--" : Math.round(a*10)/10.0+ " \u00B0");952 angleText.setText(a < 0 ? "--" : ONE_DECIMAL_PLACE.format(a) + " \u00B0"); 950 953 } 951 954 952 955 public void setHeading(double h) { 953 headingText.setText(h < 0 ? "--" : Math.round(h*10)/10.0+ " \u00B0");956 headingText.setText(h < 0 ? "--" : ONE_DECIMAL_PLACE.format(h) + " \u00B0"); 954 957 } 955 958 … … 960 963 public void setDist(double dist) { 961 964 distValue = dist; 962 distText.setText(dist < 0 ? "--" : NavigatableComponent.getDistText(dist ));965 distText.setText(dist < 0 ? "--" : NavigatableComponent.getDistText(dist, ONE_DECIMAL_PLACE, 0.01)); 963 966 } 964 967 -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r7082 r7135 10 10 import java.awt.geom.Point2D; 11 11 import java.nio.charset.StandardCharsets; 12 import java.text.NumberFormat; 12 13 import java.util.ArrayList; 13 14 import java.util.Collection; … … 195 196 196 197 /** 198 * Returns the text describing the given distance in the current system of measurement. 199 * @param dist The distance in metres 200 * @param format A {@link NumberFormat} to format the area value 201 * @param threshold Values lower than this {@code threshold} are displayed as {@code "< [threshold]"} 202 * @return the text describing the given distance in the current system of measurement. 203 * @since 7135 204 */ 205 public static String getDistText(final double dist, final NumberFormat format, final double threshold) { 206 return getSystemOfMeasurement().getDistText(dist, format, threshold); 207 } 208 209 /** 197 210 * Returns the text describing the given area in the current system of measurement. 198 211 * @param area The distance in square metres. … … 202 215 public static String getAreaText(double area) { 203 216 return getSystemOfMeasurement().getAreaText(area); 217 } 218 219 /** 220 * Returns the text describing the given area in the current system of measurement. 221 * @param area The area in square metres 222 * @param format A {@link NumberFormat} to format the area value 223 * @param threshold Values lower than this {@code threshold} are displayed as {@code "< [threshold]"} 224 * @return the text describing the given area in the current system of measurement. 225 * @since 7135 226 */ 227 public static String getAreaText(final double area, final NumberFormat format, final double threshold) { 228 return getSystemOfMeasurement().getAreaText(area, format, threshold); 204 229 } 205 230
Note: See TracChangeset
for help on using the changeset viewer.