Changeset 15205 in josm for trunk/src/org
- Timestamp:
- 2019-07-06T18:37:14+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/DownloadAlongAction.java
r14962 r15205 27 27 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 28 28 import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor; 29 import org.openstreetmap.josm.spi.preferences.Config; 29 30 import org.openstreetmap.josm.tools.GBC; 30 31 import org.openstreetmap.josm.tools.Logging; … … 128 129 } 129 130 final PleaseWaitProgressMonitor monitor = new PleaseWaitProgressMonitor(tr("Download data")); 130 final Future<?> future = new DownloadTaskList().download(false, toDownload, osmDownload, gpxDownload, monitor); 131 final Future<?> future = new DownloadTaskList(Config.getPref().getBoolean("download.along.zoom-after-download")) 132 .download(false, toDownload, osmDownload, gpxDownload, monitor); 131 133 waitFuture(future, monitor); 132 134 } -
trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java
r14397 r15205 18 18 import org.openstreetmap.josm.io.NetworkManager; 19 19 import org.openstreetmap.josm.io.OnlineResource; 20 import org.openstreetmap.josm.spi.preferences.Config; 20 21 import org.openstreetmap.josm.tools.Shortcut; 21 22 … … 91 92 // bounds defined? => use the bbox downloader 92 93 final PleaseWaitProgressMonitor monitor = new PleaseWaitProgressMonitor(tr("Download data")); 93 final Future<?> future = new DownloadTaskList().download(false /* no new layer */, areasToDownload, true, false, monitor); 94 final Future<?> future = new DownloadTaskList(Config.getPref().getBoolean("update.data.zoom-after-download")) 95 .download(false /* no new layer */, areasToDownload, true, false, monitor); 94 96 waitFuture(future, monitor); 95 97 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r15152 r15205 50 50 private final List<DownloadTask> tasks = new LinkedList<>(); 51 51 private final List<Future<?>> taskFutures = new LinkedList<>(); 52 private final boolean zoomAfterDownload; 52 53 private ProgressMonitor progressMonitor; 54 55 /** 56 * Constructs a new {@code DownloadTaskList}. Zooms to each download area. 57 */ 58 public DownloadTaskList() { 59 this(true); 60 } 61 62 /** 63 * Constructs a new {@code DownloadTaskList}. 64 * @param zoomAfterDownload whether to zoom to each download area 65 * @since 15205 66 */ 67 public DownloadTaskList(boolean zoomAfterDownload) { 68 this.zoomAfterDownload = zoomAfterDownload; 69 } 53 70 54 71 private void addDownloadTask(ProgressMonitor progressMonitor, DownloadTask dt, Rectangle2D td, int i, int n) { 55 72 ProgressMonitor childProgress = progressMonitor.createSubTaskMonitor(1, false); 56 73 childProgress.setCustomText(tr("Download {0} of {1} ({2} left)", i, n, n - i)); 74 dt.setZoomAfterDownload(zoomAfterDownload); 57 75 Future<?> future = dt.download(new DownloadParams(), new Bounds(td), childProgress); 58 76 taskFutures.add(future); … … 109 127 progressMonitor.beginTask(tr("Updating data")); 110 128 try { 111 List<Rectangle2D> rects = new ArrayList<>(areas.size()); 112 for (Area a : areas) { 113 rects.add(a.getBounds2D()); 114 } 115 129 List<Rectangle2D> rects = areas.stream().map(Area::getBounds2D).collect(Collectors.toList()); 116 130 return download(newLayer, rects, osmData, gpxData, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)); 117 131 } finally {
Note:
See TracChangeset
for help on using the changeset viewer.