source: josm/trunk/src/org/openstreetmap/josm/gui/download/DownloadSettings.java@ 17318

Last change on this file since 17318 was 16893, checked in by simon04, 4 years ago

fix #3450 - SlippyMapBBoxChooser: confirm download bounds outside current map view

File size: 2.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.download;
3
4import java.util.Optional;
5
6import org.openstreetmap.josm.data.Bounds;
7
8/**
9 * The global settings of {@link DownloadDialog}.
10 * <p>
11 * This class is immutable
12 * @since 12652
13 */
14public final class DownloadSettings {
15
16 private final Bounds downloadBounds;
17 private final Bounds slippyMapBounds;
18 private final boolean downloadAsNewLayer;
19 private final boolean zoomToDownloadedData;
20
21 /**
22 * Initializes a new instance of {@code DownloadSettings}.
23 * @param bbox The bounding box
24 * @param slippyMapBounds The bounds of the {@link SlippyMapChooser}/{@link org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser}
25 * @param downloadAsNewLayer The flag defining if a new layer must be created for the downloaded data.
26 * @param zoomToDownloadedData The flag defining if the map view, see {@link SlippyMapChooser},
27 */
28 public DownloadSettings(Bounds bbox, Bounds slippyMapBounds, boolean downloadAsNewLayer, boolean zoomToDownloadedData) {
29 this.downloadBounds = bbox;
30 this.slippyMapBounds = slippyMapBounds;
31 this.downloadAsNewLayer = downloadAsNewLayer;
32 this.zoomToDownloadedData = zoomToDownloadedData;
33 }
34
35 /**
36 * Gets the flag defining if a new layer must be created for the downloaded data.
37 * @return {@code true} if a new layer must be created, {@code false} otherwise.
38 */
39 public boolean asNewLayer() {
40 return this.downloadAsNewLayer;
41 }
42
43 /**
44 * Gets the flag defining if the map view must zoom to the downloaded data.
45 * @return {@code true} if the view must zoom, {@code false} otherwise.
46 */
47 public boolean zoomToData() {
48 return this.zoomToDownloadedData;
49 }
50
51 /**
52 * Gets the download bounds that are requested
53 * @return The bounds or an empty {@link Optional} if no bounds are selected
54 */
55 public Optional<Bounds> getDownloadBounds() {
56 return Optional.ofNullable(downloadBounds);
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 }
66}
Note: See TracBrowser for help on using the repository browser.