Changeset 8855 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
- Timestamp:
- 2015-10-10T21:01:42+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
r8846 r8855 9 9 import java.awt.event.FocusEvent; 10 10 import java.awt.event.FocusListener; 11 import java.text.NumberFormat;12 import java.text.ParsePosition;13 11 import java.util.ArrayList; 14 12 import java.util.Arrays; … … 235 233 } 236 234 237 protected Double parseDoubleFromUserInput(String input) {238 if (input == null) return null;239 // remove white space and an optional degree symbol240 //241 input = input.trim();242 input = input.replaceAll(DEG, "");243 244 // try to parse using the current locale245 //246 NumberFormat f = NumberFormat.getNumberInstance();247 Number n = null;248 ParsePosition pp = new ParsePosition(0);249 n = f.parse(input, pp);250 if (pp.getErrorIndex() >= 0 || pp.getIndex() < input.length()) {251 // fall back - try to parse with the english locale252 //253 pp = new ParsePosition(0);254 f = NumberFormat.getNumberInstance(Locale.ENGLISH);255 n = f.parse(input, pp);256 if (pp.getErrorIndex() >= 0 || pp.getIndex() < input.length())257 return null;258 }259 return n == null ? null : n.doubleValue();260 }261 262 235 protected void parseLatLonUserInput() { 263 236 LatLon latLon;
Note:
See TracChangeset
for help on using the changeset viewer.
