- Timestamp:
- 2017-09-05T17:58:01+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r12718 r12735 34 34 import org.openstreetmap.josm.data.UndoRedoHandler; 35 35 import org.openstreetmap.josm.data.cache.JCSCacheManager; 36 import org.openstreetmap.josm.data.coor.CoordinateFormat; 36 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 37 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 38 import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat; 37 39 import org.openstreetmap.josm.data.osm.DataSet; 38 40 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 724 726 public static void preConstructorInit() { 725 727 // init default coordinate format 726 try { 727 CoordinateFormat.setCoordinateFormat(CoordinateFormat.valueOf(Main.pref.get("coordinates"))); 728 } catch (IllegalArgumentException iae) { 729 Logging.trace(iae); 730 CoordinateFormat.setCoordinateFormat(CoordinateFormat.DECIMAL_DEGREES); 731 } 728 ICoordinateFormat fmt = CoordinateFormatManager.getCoordinateFormat(Main.pref.get("coordinates")); 729 if (fmt == null) { 730 fmt = DecimalDegreesCoordinateFormat.INSTANCE; 731 } 732 CoordinateFormatManager.setCoordinateFormat(fmt); 732 733 } 733 734 -
trunk/src/org/openstreetmap/josm/data/coor/CoordinateFormat.java
r11489 r12735 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 7 import org.openstreetmap.josm.data.coor.conversion.DMSCoordinateFormat; 8 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 9 import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat; 10 import org.openstreetmap.josm.data.coor.conversion.NauticalCoordinateFormat; 11 import org.openstreetmap.josm.data.coor.conversion.ProjectedCoordinateFormat; 12 6 13 /** 7 14 * An enumeration of coordinate formats 8 15 * @since 1990 16 * @deprecated use {@link CoordinateFormatManager} 9 17 */ 18 @Deprecated 10 19 public enum CoordinateFormat { 11 20 … … 13 22 * the decimal format 999.999 14 23 */ 15 DECIMAL_DEGREES(tr("Decimal Degrees") ),24 DECIMAL_DEGREES(tr("Decimal Degrees"), DecimalDegreesCoordinateFormat.INSTANCE), 16 25 17 26 /** 18 27 * the degrees/minutes/seconds format 9 deg 99 min 99 sec 19 28 */ 20 DEGREES_MINUTES_SECONDS(tr("deg\u00B0 min'' sec\"") ),29 DEGREES_MINUTES_SECONDS(tr("deg\u00B0 min'' sec\""), DMSCoordinateFormat.INSTANCE), 21 30 22 31 /** 23 32 * the nautical format 24 33 */ 25 NAUTICAL(tr("deg\u00B0 min'' (Nautical)") ),34 NAUTICAL(tr("deg\u00B0 min'' (Nautical)"), NauticalCoordinateFormat.INSTANCE), 26 35 27 36 /** 28 37 * coordinates East/North 29 38 */ 30 EAST_NORTH(tr("Projected Coordinates") );39 EAST_NORTH(tr("Projected Coordinates"), ProjectedCoordinateFormat.INSTANCE); 31 40 32 41 private final String displayName; 42 private final ICoordinateFormat migration; 33 43 34 CoordinateFormat(String displayName ) {44 CoordinateFormat(String displayName, ICoordinateFormat migration) { 35 45 this.displayName = displayName; 46 this.migration = migration; 36 47 } 37 48 … … 43 54 public String getDisplayName() { 44 55 return displayName; 56 } 57 58 /** 59 * Returns the corresponding {@link ICoordinateFormat} instance for 60 * migration. 61 * @return the corresponding {@link ICoordinateFormat} instance for 62 * migration 63 */ 64 public ICoordinateFormat getICoordinateFormat() { 65 return migration; 45 66 } 46 67 -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r12725 r12735 25 25 import org.openstreetmap.josm.Main; 26 26 import org.openstreetmap.josm.data.Bounds; 27 import org.openstreetmap.josm.data.coor.conversion.DMSCoordinateFormat; 28 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 29 import org.openstreetmap.josm.data.coor.conversion.NauticalCoordinateFormat; 27 30 import org.openstreetmap.josm.tools.Logging; 28 31 import org.openstreetmap.josm.tools.Utils; … … 69 72 public static final LatLon SOUTH_POLE = new LatLon(-90, 0); 70 73 71 private static DecimalFormat cDmsMinuteFormatter = new DecimalFormat("00");72 private static DecimalFormat cDmsSecondFormatter = new DecimalFormat(73 Main.pref == null ? "00.0" : Main.pref.get("latlon.dms.decimal-format", "00.0"));74 private static DecimalFormat cDmMinuteFormatter = new DecimalFormat(75 Main.pref == null ? "00.000" : Main.pref.get("latlon.dm.decimal-format", "00.000"));76 74 /** 77 75 * The normal number format for server precision coordinates … … 90 88 cDdHighPecisionFormatter.applyPattern("###0.0##########"); 91 89 } 92 93 private static final String cDms60 = cDmsSecondFormatter.format(60.0);94 private static final String cDms00 = cDmsSecondFormatter.format(0.0);95 private static final String cDm60 = cDmMinuteFormatter.format(60.0);96 private static final String cDm00 = cDmMinuteFormatter.format(0.0);97 90 98 91 /** Character denoting South, as string */ … … 217 210 * @return The coordinate in degrees/minutes/seconds format 218 211 * @since 12561 219 */ 212 * @deprecated use {@link DMSCoordinateFormat#degreesMinutesSeconds(double)} 213 */ 214 @Deprecated 220 215 public static String degreesMinutesSeconds(double pCoordinate) { 221 222 double tAbsCoord = Math.abs(pCoordinate); 223 int tDegree = (int) tAbsCoord; 224 double tTmpMinutes = (tAbsCoord - tDegree) * 60; 225 int tMinutes = (int) tTmpMinutes; 226 double tSeconds = (tTmpMinutes - tMinutes) * 60; 227 228 String sDegrees = Integer.toString(tDegree); 229 String sMinutes = cDmsMinuteFormatter.format(tMinutes); 230 String sSeconds = cDmsSecondFormatter.format(tSeconds); 231 232 if (cDms60.equals(sSeconds)) { 233 sSeconds = cDms00; 234 sMinutes = cDmsMinuteFormatter.format(tMinutes+1L); 235 } 236 if ("60".equals(sMinutes)) { 237 sMinutes = "00"; 238 sDegrees = Integer.toString(tDegree+1); 239 } 240 241 return sDegrees + '\u00B0' + sMinutes + '\'' + sSeconds + '\"'; 216 return DMSCoordinateFormat.degreesMinutesSeconds(pCoordinate); 242 217 } 243 218 … … 247 222 * @return The coordinate in degrees/minutes format 248 223 * @since 12537 249 */ 224 * @deprecated use {@link NauticalCoordinateFormat#degreesMinutes(double)} 225 */ 226 @Deprecated 250 227 public static String degreesMinutes(double pCoordinate) { 251 252 double tAbsCoord = Math.abs(pCoordinate); 253 int tDegree = (int) tAbsCoord; 254 double tMinutes = (tAbsCoord - tDegree) * 60; 255 256 String sDegrees = Integer.toString(tDegree); 257 String sMinutes = cDmMinuteFormatter.format(tMinutes); 258 259 if (sMinutes.equals(cDm60)) { 260 sMinutes = cDm00; 261 sDegrees = Integer.toString(tDegree+1); 262 } 263 264 return sDegrees + '\u00B0' + sMinutes + '\''; 228 return NauticalCoordinateFormat.degreesMinutes(pCoordinate); 265 229 } 266 230 … … 302 266 * @param d the coordinate format to use 303 267 * @return the formatted latitude 304 */ 268 * @deprecated use {@link org.openstreetmap.josm.data.coor.format.ICoordinateFormat#latToString(ILatLon) 269 */ 270 @Deprecated 305 271 public String latToString(CoordinateFormat d) { 306 switch(d) { 307 case DECIMAL_DEGREES: return cDdFormatter.format(y); 308 case DEGREES_MINUTES_SECONDS: return degreesMinutesSeconds(y) + ((y < 0) ? SOUTH : NORTH); 309 case NAUTICAL: return degreesMinutes(y) + ((y < 0) ? SOUTH : NORTH); 310 case EAST_NORTH: return cDdFormatter.format(this.getEastNorth(Main.getProjection()).north()); 311 default: return "ERR"; 312 } 272 return d.getICoordinateFormat().latToString(this); 313 273 } 314 274 … … 322 282 * @param d the coordinate format to use 323 283 * @return the formatted longitude 324 */ 284 * @deprecated use {@link org.openstreetmap.josm.data.coor.format.ICoordinateFormat#lonToString(ILatLon) 285 */ 286 @Deprecated 325 287 public String lonToString(CoordinateFormat d) { 326 switch(d) { 327 case DECIMAL_DEGREES: return cDdFormatter.format(x); 328 case DEGREES_MINUTES_SECONDS: return degreesMinutesSeconds(x) + ((x < 0) ? WEST : EAST); 329 case NAUTICAL: return degreesMinutes(x) + ((x < 0) ? WEST : EAST); 330 case EAST_NORTH: return cDdFormatter.format(this.getEastNorth(Main.getProjection()).east()); 331 default: return "ERR"; 332 } 288 return d.getICoordinateFormat().lonToString(this); 333 289 } 334 290 … … 469 425 public String toStringCSV(String separator) { 470 426 return Utils.join(separator, Arrays.asList( 471 latToString(CoordinateFormat.DECIMAL_DEGREES),472 lonToString(CoordinateFormat.DECIMAL_DEGREES)427 DecimalDegreesCoordinateFormat.INSTANCE.latToString(this), 428 DecimalDegreesCoordinateFormat.INSTANCE.lonToString(this) 473 429 )); 474 430 } -
trunk/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java
r12663 r12735 22 22 23 23 import org.openstreetmap.josm.Main; 24 import org.openstreetmap.josm.data.coor.CoordinateFormat;25 24 import org.openstreetmap.josm.data.coor.LatLon; 25 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 26 26 import org.openstreetmap.josm.data.osm.history.HistoryNameFormatter; 27 27 import org.openstreetmap.josm.data.osm.history.HistoryNode; … … 187 187 } 188 188 if (node.getCoor() != null) { 189 name.append(" \u200E(").append( node.getCoor().latToString(CoordinateFormat.getDefaultFormat())).append(", ")190 .append( node.getCoor().lonToString(CoordinateFormat.getDefaultFormat())).append(')');189 name.append(" \u200E(").append(CoordinateFormatManager.getDefaultFormat().latToString(node)).append(", ") 190 .append(CoordinateFormatManager.getDefaultFormat().lonToString(node)).append(')'); 191 191 } 192 192 } … … 541 541 if (coord != null) { 542 542 sb.append(" (") 543 .append( coord.latToString(CoordinateFormat.getDefaultFormat()))543 .append(CoordinateFormatManager.getDefaultFormat().latToString(coord)) 544 544 .append(", ") 545 .append( coord.lonToString(CoordinateFormat.getDefaultFormat()))545 .append(CoordinateFormatManager.getDefaultFormat().lonToString(coord)) 546 546 .append(')'); 547 547 } -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r12675 r12735 60 60 import org.openstreetmap.josm.data.SystemOfMeasurement; 61 61 import org.openstreetmap.josm.data.SystemOfMeasurement.SoMChangeListener; 62 import org.openstreetmap.josm.data.coor.CoordinateFormat;63 62 import org.openstreetmap.josm.data.coor.LatLon; 63 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 64 import org.openstreetmap.josm.data.coor.conversion.DMSCoordinateFormat; 65 import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat; 66 import org.openstreetmap.josm.data.coor.conversion.ProjectedCoordinateFormat; 64 67 import org.openstreetmap.josm.data.osm.DataSet; 65 68 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; … … 210 213 } 211 214 212 /** The {@link CoordinateFormat} set in the previous update */213 private transient CoordinateFormat previousCoordinateFormat;215 /** The {@link ICoordinateFormat} set in the previous update */ 216 private transient ICoordinateFormat previousCoordinateFormat; 214 217 private final ImageLabel latText = new ImageLabel("lat", 215 null, LatLon.SOUTH_POLE.latToString(CoordinateFormat.DEGREES_MINUTES_SECONDS).length(), PROP_BACKGROUND_COLOR.get());218 null, DMSCoordinateFormat.INSTANCE.latToString(LatLon.SOUTH_POLE).length(), PROP_BACKGROUND_COLOR.get()); 216 219 private final ImageLabel lonText = new ImageLabel("lon", 217 null, new LatLon(0, 180).lonToString(CoordinateFormat.DEGREES_MINUTES_SECONDS).length(), PROP_BACKGROUND_COLOR.get());220 null, DMSCoordinateFormat.INSTANCE.lonToString(new LatLon(0, 180)).length(), PROP_BACKGROUND_COLOR.get()); 218 221 private final ImageLabel headingText = new ImageLabel("heading", 219 222 tr("The (compass) heading of the line segment being drawn."), … … 763 766 /** Icons for selecting {@link SystemOfMeasurement} */ 764 767 private final Collection<JCheckBoxMenuItem> somItems = new ArrayList<>(); 765 /** Icons for selecting {@link CoordinateFormat} */768 /** Icons for selecting {@link ICoordinateFormat} */ 766 769 private final Collection<JCheckBoxMenuItem> coordinateFormatItems = new ArrayList<>(); 767 770 … … 787 790 add(item); 788 791 } 789 for (final CoordinateFormat format : CoordinateFormat.values()) {792 for (final ICoordinateFormat format : CoordinateFormatManager.getCoordinateFormats()) { 790 793 JCheckBoxMenuItem item = new JCheckBoxMenuItem(new AbstractAction(format.getDisplayName()) { 791 794 @Override 792 795 public void actionPerformed(ActionEvent e) { 793 CoordinateFormat .setCoordinateFormat(format);796 CoordinateFormatManager.setCoordinateFormat(format); 794 797 } 795 798 }); … … 811 814 item.setVisible(distText.equals(invoker)); 812 815 } 813 final String currentCorrdinateFormat = CoordinateFormat .getDefaultFormat().getDisplayName();816 final String currentCorrdinateFormat = CoordinateFormatManager.getDefaultFormat().getDisplayName(); 814 817 for (JMenuItem item : coordinateFormatItems) { 815 818 item.setSelected(currentCorrdinateFormat.equals(item.getText())); … … 873 876 // Do not update the view if ctrl is pressed. 874 877 if ((e.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) == 0) { 875 CoordinateFormat mCord = CoordinateFormat.getDefaultFormat();878 ICoordinateFormat mCord = CoordinateFormatManager.getDefaultFormat(); 876 879 LatLon p = mv.getLatLon(e.getX(), e.getY()); 877 latText.setText( p.latToString(mCord));878 lonText.setText( p.lonToString(mCord));880 latText.setText(mCord.latToString(p)); 881 lonText.setText(mCord.lonToString(p)); 879 882 if (Objects.equals(previousCoordinateFormat, mCord)) { 880 883 // do nothing 881 } else if ( CoordinateFormat.EAST_NORTH.equals(mCord)) {884 } else if (ProjectedCoordinateFormat.INSTANCE.equals(mCord)) { 882 885 latText.setIcon("northing"); 883 886 lonText.setIcon("easting"); -
trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
r12678 r12735 24 24 25 25 import org.openstreetmap.josm.Main; 26 import org.openstreetmap.josm.data.coor.CoordinateFormat;27 26 import org.openstreetmap.josm.data.coor.EastNorth; 28 27 import org.openstreetmap.josm.data.coor.LatLon; 28 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 29 29 import org.openstreetmap.josm.gui.ExtendedDialog; 30 30 import org.openstreetmap.josm.gui.util.WindowGeometry; … … 191 191 public void setCoordinates(LatLon ll) { 192 192 LatLon llc = Optional.ofNullable(ll).orElse(LatLon.ZERO); 193 tfLatLon.setText( llc.latToString(CoordinateFormat.getDefaultFormat()) + ' ' +194 llc.lonToString(CoordinateFormat.getDefaultFormat()));193 tfLatLon.setText(CoordinateFormatManager.getDefaultFormat().latToString(llc) + ' ' + 194 CoordinateFormatManager.getDefaultFormat().lonToString(llc)); 195 195 EastNorth en = Main.getProjection().latlon2eastNorth(llc); 196 196 tfEastNorth.setText(Double.toString(en.east()) + ' ' + Double.toString(en.north())); -
trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
r11620 r12735 25 25 26 26 import org.openstreetmap.josm.data.Bounds; 27 import org.openstreetmap.josm.data.coor.CoordinateFormat;28 27 import org.openstreetmap.josm.data.coor.LatLon; 28 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 29 29 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 30 30 import org.openstreetmap.josm.gui.widgets.JosmTextField; … … 163 163 private void updateBboxFields(Bounds area) { 164 164 if (area == null) return; 165 latlon[0].setText( area.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES));166 latlon[1].setText( area.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES));167 latlon[2].setText( area.getMax().latToString(CoordinateFormat.DECIMAL_DEGREES));168 latlon[3].setText( area.getMax().lonToString(CoordinateFormat.DECIMAL_DEGREES));165 latlon[0].setText(DecimalDegreesCoordinateFormat.INSTANCE.latToString(area.getMin())); 166 latlon[1].setText(DecimalDegreesCoordinateFormat.INSTANCE.lonToString(area.getMin())); 167 latlon[2].setText(DecimalDegreesCoordinateFormat.INSTANCE.latToString(area.getMax())); 168 latlon[3].setText(DecimalDegreesCoordinateFormat.INSTANCE.lonToString(area.getMax())); 169 169 for (JosmTextField tf: latlon) { 170 170 resetErrorMessage(tf); -
trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java
r11878 r12735 20 20 import org.openstreetmap.gui.jmapviewer.MapMarkerDot; 21 21 import org.openstreetmap.gui.jmapviewer.tilesources.OsmTileSource; 22 import org.openstreetmap.josm.data.coor.CoordinateFormat;23 22 import org.openstreetmap.josm.data.coor.LatLon; 23 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 24 24 import org.openstreetmap.josm.data.osm.history.HistoryNode; 25 25 import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive; … … 308 308 309 309 // display the coordinates 310 lblLat.setText(coord != null ? coord.latToString(CoordinateFormat.DECIMAL_DEGREES) : tr("(none)"));311 lblLon.setText(coord != null ? coord.lonToString(CoordinateFormat.DECIMAL_DEGREES) : tr("(none)"));310 lblLat.setText(coord != null ? DecimalDegreesCoordinateFormat.INSTANCE.latToString(coord) : tr("(none)")); 311 lblLon.setText(coord != null ? DecimalDegreesCoordinateFormat.INSTANCE.lonToString(coord) : tr("(none)")); 312 312 313 313 // update background color to reflect differences in the coordinates -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r12674 r12735 26 26 import org.openstreetmap.josm.data.Bounds; 27 27 import org.openstreetmap.josm.data.SystemOfMeasurement; 28 import org.openstreetmap.josm.data.coor.CoordinateFormat; 28 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 29 import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat; 29 30 import org.openstreetmap.josm.data.preferences.CollectionProperty; 30 31 import org.openstreetmap.josm.data.preferences.StringProperty; … … 288 289 * Combobox with all projections available 289 290 */ 290 private final JosmComboBox<ProjectionChoice> projectionCombo = new JosmComboBox<>( 291 projectionChoices.toArray(new ProjectionChoice[projectionChoices.size()])); 291 private final JosmComboBox<ProjectionChoice> projectionCombo; 292 292 293 293 /** 294 294 * Combobox with all coordinate display possibilities 295 295 */ 296 private final JosmComboBox< CoordinateFormat> coordinatesCombo = new JosmComboBox<>(CoordinateFormat.values());296 private final JosmComboBox<ICoordinateFormat> coordinatesCombo; 297 297 298 298 private final JosmComboBox<String> unitsCombo = new JosmComboBox<>(unitsValuesTr); … … 326 326 private static final GBC projSubPrefPanelGBC = GBC.std().fill(GBC.BOTH).weight(1.0, 1.0); 327 327 328 public ProjectionPreference() { 329 this.projectionCombo = new JosmComboBox<>( 330 projectionChoices.toArray(new ProjectionChoice[projectionChoices.size()])); 331 this.coordinatesCombo = new JosmComboBox<>( 332 CoordinateFormatManager.getCoordinateFormats().toArray(new ICoordinateFormat[0])); 333 } 334 328 335 @Override 329 336 public void addGui(PreferenceTabbedPane gui) { … … 331 338 332 339 for (int i = 0; i < coordinatesCombo.getItemCount(); ++i) { 333 if (coordinatesCombo.getItemAt(i). name().equals(PROP_COORDINATES.get())) {340 if (coordinatesCombo.getItemAt(i).getId().equals(PROP_COORDINATES.get())) { 334 341 coordinatesCombo.setSelectedIndex(i); 335 342 break; … … 399 406 projectionName.setText(proj.toString()); 400 407 Bounds b = proj.getWorldBoundsLatLon(); 401 CoordinateFormat cf = CoordinateFormat.getDefaultFormat();402 bounds.setText( b.getMin().lonToString(cf) + ", " + b.getMin().latToString(cf) + " : " +403 b.getMax().lonToString(cf) + ", " + b.getMax().latToString(cf));408 ICoordinateFormat cf = CoordinateFormatManager.getDefaultFormat(); 409 bounds.setText(cf.lonToString(b.getMin()) + ", " + cf.latToString(b.getMin()) + " : " + 410 cf.lonToString(b.getMax()) + ", " + cf.latToString(b.getMax())); 404 411 boolean showCode = true; 405 412 boolean showName = false; … … 425 432 setProjection(id, prefs, false); 426 433 427 if (PROP_COORDINATES.put((( CoordinateFormat) coordinatesCombo.getSelectedItem()).name())) {428 CoordinateFormat .setCoordinateFormat((CoordinateFormat) coordinatesCombo.getSelectedItem());434 if (PROP_COORDINATES.put(((ICoordinateFormat) coordinatesCombo.getSelectedItem()).getId())) { 435 CoordinateFormatManager.setCoordinateFormat((ICoordinateFormat) coordinatesCombo.getSelectedItem()); 429 436 } 430 437 -
trunk/src/org/openstreetmap/josm/gui/widgets/BoundingBoxSelectionPanel.java
r12304 r12735 17 17 18 18 import org.openstreetmap.josm.data.Bounds; 19 import org.openstreetmap.josm.data.coor.CoordinateFormat;20 19 import org.openstreetmap.josm.data.coor.LatLon; 20 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 21 21 import org.openstreetmap.josm.tools.GBC; 22 22 import org.openstreetmap.josm.tools.OsmUrlToBounds; … … 125 125 private void updateBboxFields(Bounds area) { 126 126 if (area == null) return; 127 tfLatLon[0].setText( area.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES));128 tfLatLon[1].setText( area.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES));129 tfLatLon[2].setText( area.getMax().latToString(CoordinateFormat.DECIMAL_DEGREES));130 tfLatLon[3].setText( area.getMax().lonToString(CoordinateFormat.DECIMAL_DEGREES));127 tfLatLon[0].setText(DecimalDegreesCoordinateFormat.INSTANCE.latToString(area.getMin())); 128 tfLatLon[1].setText(DecimalDegreesCoordinateFormat.INSTANCE.lonToString(area.getMin())); 129 tfLatLon[2].setText(DecimalDegreesCoordinateFormat.INSTANCE.latToString(area.getMax())); 130 tfLatLon[3].setText(DecimalDegreesCoordinateFormat.INSTANCE.lonToString(area.getMax())); 131 131 } 132 132 -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r12692 r12735 13 13 14 14 import org.openstreetmap.josm.data.DataSource; 15 import org.openstreetmap.josm.data.coor.CoordinateFormat;16 15 import org.openstreetmap.josm.data.coor.LatLon; 16 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 17 17 import org.openstreetmap.josm.data.osm.AbstractPrimitive; 18 18 import org.openstreetmap.josm.data.osm.Changeset; … … 194 194 for (DataSource s : ds.getDataSources()) { 195 195 out.println(" <bounds minlat='" 196 + s.bounds.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES)196 + DecimalDegreesCoordinateFormat.INSTANCE.latToString(s.bounds.getMin()) 197 197 +"' minlon='" 198 + s.bounds.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES)198 + DecimalDegreesCoordinateFormat.INSTANCE.lonToString(s.bounds.getMin()) 199 199 +"' maxlat='" 200 + s.bounds.getMax().latToString(CoordinateFormat.DECIMAL_DEGREES)200 + DecimalDegreesCoordinateFormat.INSTANCE.latToString(s.bounds.getMax()) 201 201 +"' maxlon='" 202 + s.bounds.getMax().lonToString(CoordinateFormat.DECIMAL_DEGREES)202 + DecimalDegreesCoordinateFormat.INSTANCE.lonToString(s.bounds.getMax()) 203 203 +"' origin='"+XmlWriter.encode(s.origin)+"' />"); 204 204 } … … 273 273 out.print(" open='"+ (cs.isOpen() ? "true" : "false") +'\''); 274 274 if (cs.getMin() != null) { 275 out.print(" min_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');276 out.print(" min_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');275 out.print(" min_lon='"+ DecimalDegreesCoordinateFormat.INSTANCE.lonToString(cs.getMin()) +'\''); 276 out.print(" min_lat='"+ DecimalDegreesCoordinateFormat.INSTANCE.latToString(cs.getMin()) +'\''); 277 277 } 278 278 if (cs.getMax() != null) { 279 out.print(" max_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');280 out.print(" max_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');279 out.print(" max_lon='"+ DecimalDegreesCoordinateFormat.INSTANCE.lonToString(cs.getMin()) +'\''); 280 out.print(" max_lat='"+ DecimalDegreesCoordinateFormat.INSTANCE.latToString(cs.getMin()) +'\''); 281 281 } 282 282 out.println(">");
Note:
See TracChangeset
for help on using the changeset viewer.