Changeset 15733 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-01-19T21:21:52+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
r14866 r15733 15 15 import java.awt.event.KeyEvent; 16 16 import java.awt.event.MouseEvent; 17 import java.util.Formatter;18 17 import java.util.Locale; 19 18 … … 316 315 private void updateOffsetIntl() { 317 316 if (layer != null) { 318 // Support projections with very small numbers (e.g. 4326) 319 int precision = ProjectionRegistry.getProjection().getDefaultZoomInPPD() >= 1.0 ? 2 : 7; 320 // US locale to force decimal separator to be '.' 321 try (Formatter us = new Formatter(Locale.US)) { 322 EastNorth displacement = layer.getDisplaySettings().getDisplacement(); 323 tOffset.setText(us.format(new StringBuilder() 324 .append("%1.").append(precision).append("f; %1.").append(precision).append('f').toString(), 325 displacement.east(), displacement.north()).toString()); 326 } 317 // ROOT locale to force decimal separator to be '.' 318 tOffset.setText(layer.getDisplaySettings().getDisplacementString(Locale.ROOT)); 327 319 } 328 320 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r15651 r15733 21 21 import java.util.Arrays; 22 22 import java.util.List; 23 import java.util.Locale; 23 24 import java.util.concurrent.CopyOnWriteArrayList; 24 25 … … 73 74 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 74 75 import org.openstreetmap.josm.gui.layer.NativeScaleLayer; 76 import org.openstreetmap.josm.gui.layer.imagery.TileSourceDisplaySettings; 75 77 import org.openstreetmap.josm.gui.layer.imagery.TileSourceDisplaySettings.DisplaySettingsChangeEvent; 76 78 import org.openstreetmap.josm.gui.layer.imagery.TileSourceDisplaySettings.DisplaySettingsChangeListener; … … 651 653 Layer layer = (Layer) value; 652 654 if (layer instanceof AbstractTileSourceLayer<?>) { 653 if (EastNorth.ZERO.equals(((AbstractTileSourceLayer<?>) layer).getDisplaySettings().getDisplacement())) { 655 final TileSourceDisplaySettings displaySettings = ((AbstractTileSourceLayer<?>) layer).getDisplaySettings(); 656 if (EastNorth.ZERO.equals(displaySettings.getDisplacement())) { 654 657 cb.setSelected(false); 655 658 cb.setEnabled(false); // TODO: allow reselecting checkbox and thereby setting the old offset again … … 658 661 cb.setSelected(true); 659 662 cb.setEnabled(true); 660 cb.setToolTipText(tr("layer has a user-defined offset (click to remove offset)")); 663 cb.setToolTipText(tr("layer has an offset of {0} (click to remove offset)", 664 displaySettings.getDisplacementString(Locale.getDefault()))); 661 665 } 662 666 -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/TileSourceDisplaySettings.java
r14532 r15733 3 3 4 4 import java.util.HashMap; 5 import java.util.Locale; 5 6 import java.util.Map; 6 7 import java.util.concurrent.CopyOnWriteArrayList; … … 197 198 198 199 /** 200 * Gets the displacement of the image formatted as a string 201 * @param locale the locale used to format the decimals 202 * @return the displacement string 203 * @see #getDisplacement() 204 * @since 15733 205 */ 206 public String getDisplacementString(final Locale locale) { 207 // Support projections with very small numbers (e.g. 4326) 208 int precision = ProjectionRegistry.getProjection().getDefaultZoomInPPD() >= 1.0 ? 2 : 7; 209 return String.format(locale, "%1." + precision + "f; %1." + precision + "f", getDx(), getDy()); 210 } 211 212 /** 199 213 * Sets an offset bookmark to use. Loads the displacement from the bookmark. 200 214 *
Note:
See TracChangeset
for help on using the changeset viewer.