- Timestamp:
- 2020-08-14T23:46:00+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r16623 r16893 359 359 // Do nothing 360 360 } 361 362 /** 363 * Returns the currently visible map area 364 * @return the currently visible map area 365 */ 366 public Bounds getVisibleMapArea() { 367 final ICoordinate topLeft = getPosition(0, 0); 368 final ICoordinate bottomRight = getPosition(getWidth(), getHeight()); 369 final Bounds bounds = new Bounds(topLeft.getLat(), topLeft.getLon(), false); 370 bounds.extend(bottomRight.getLat(), bottomRight.getLon()); 371 return bounds; 372 } 361 373 } -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r16684 r16893 44 44 import org.openstreetmap.josm.gui.MainApplication; 45 45 import org.openstreetmap.josm.gui.MapView; 46 import org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser; 46 47 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 47 48 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; … … 502 503 */ 503 504 public DownloadSettings getDownloadSettings(boolean newLayer) { 504 return new DownloadSettings(currentBounds, newLayer, isZoomToDownloadedDataRequired()); 505 final Component areaSelector = tpDownloadAreaSelectors.getSelectedComponent(); 506 final Bounds slippyMapBounds = areaSelector instanceof SlippyMapBBoxChooser 507 ? ((SlippyMapBBoxChooser) areaSelector).getVisibleMapArea() 508 : null; 509 return new DownloadSettings(currentBounds, slippyMapBounds, newLayer, isZoomToDownloadedDataRequired()); 505 510 } 506 511 -
trunk/src/org/openstreetmap/josm/gui/download/DownloadSettings.java
r12846 r16893 15 15 16 16 private final Bounds downloadBounds; 17 private final Bounds slippyMapBounds; 17 18 private final boolean downloadAsNewLayer; 18 19 private final boolean zoomToDownloadedData; … … 21 22 * Initializes a new instance of {@code DownloadSettings}. 22 23 * @param bbox The bounding box 24 * @param slippyMapBounds The bounds of the {@link SlippyMapChooser}/{@link org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser} 23 25 * @param downloadAsNewLayer The flag defining if a new layer must be created for the downloaded data. 24 26 * @param zoomToDownloadedData The flag defining if the map view, see {@link SlippyMapChooser}, 25 * must zoom to the downloaded data.26 27 */ 27 public DownloadSettings(Bounds bbox, boolean downloadAsNewLayer, boolean zoomToDownloadedData) {28 public DownloadSettings(Bounds bbox, Bounds slippyMapBounds, boolean downloadAsNewLayer, boolean zoomToDownloadedData) { 28 29 this.downloadBounds = bbox; 30 this.slippyMapBounds = slippyMapBounds; 29 31 this.downloadAsNewLayer = downloadAsNewLayer; 30 32 this.zoomToDownloadedData = zoomToDownloadedData; … … 54 56 return Optional.ofNullable(downloadBounds); 55 57 } 58 59 /** 60 * Gets the slippy map bounds 61 * @return the slippy map bounds or an empty {@link Optional} if no slippy map was used to select the download bounds 62 */ 63 public Optional<Bounds> getSlippyMapBounds() { 64 return Optional.ofNullable(slippyMapBounds); 65 } 56 66 } -
trunk/src/org/openstreetmap/josm/gui/download/OSMDownloadSource.java
r16553 r16893 273 273 } 274 274 275 final Boolean slippyMapShowsDownloadBounds = settings.getSlippyMapBounds() 276 .map(b -> b.intersects(settings.getDownloadBounds().get())) 277 .orElse(true); 278 if (!slippyMapShowsDownloadBounds) { 279 final int confirmation = JOptionPane.showConfirmDialog( 280 this.getParent(), 281 tr("The slippy map no longer shows the selected download bounds. Continue?"), 282 tr("Confirmation"), 283 JOptionPane.OK_CANCEL_OPTION, 284 JOptionPane.QUESTION_MESSAGE 285 ); 286 if (confirmation != JOptionPane.OK_OPTION) { 287 return false; 288 } 289 } 290 275 291 /* 276 292 * Checks if the user selected the type of data to download. At least one the following
Note:
See TracChangeset
for help on using the changeset viewer.