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

Last change on this file since 13498 was 12846, checked in by bastiK, 7 years ago

see #15229 - use Config.getPref() wherever possible

File size: 1.8 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 boolean downloadAsNewLayer;
18 private final boolean zoomToDownloadedData;
19
20 /**
21 * Initializes a new instance of {@code DownloadSettings}.
22 * @param bbox The bounding box
23 * @param downloadAsNewLayer The flag defining if a new layer must be created for the downloaded data.
24 * @param zoomToDownloadedData The flag defining if the map view, see {@link SlippyMapChooser},
25 * must zoom to the downloaded data.
26 */
27 public DownloadSettings(Bounds bbox, boolean downloadAsNewLayer, boolean zoomToDownloadedData) {
28 this.downloadBounds = bbox;
29 this.downloadAsNewLayer = downloadAsNewLayer;
30 this.zoomToDownloadedData = zoomToDownloadedData;
31 }
32
33 /**
34 * Gets the flag defining if a new layer must be created for the downloaded data.
35 * @return {@code true} if a new layer must be created, {@code false} otherwise.
36 */
37 public boolean asNewLayer() {
38 return this.downloadAsNewLayer;
39 }
40
41 /**
42 * Gets the flag defining if the map view must zoom to the downloaded data.
43 * @return {@code true} if the view must zoom, {@code false} otherwise.
44 */
45 public boolean zoomToData() {
46 return this.zoomToDownloadedData;
47 }
48
49 /**
50 * Gets the download bounds that are requested
51 * @return The bounds or an empty {@link Optional} if no bounds are selected
52 */
53 public Optional<Bounds> getDownloadBounds() {
54 return Optional.ofNullable(downloadBounds);
55 }
56}
Note: See TracBrowser for help on using the repository browser.