Ignore:
Timestamp:
2017-03-04T00:49:24+01:00 (3 years ago)
Author:
Don-vip
Message:

fix #13922 - Add (expert) option to not zoom to the new downloaded data

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DownloadAction.java

    r11621 r11658  
    4848            if (dialog.isDownloadOsmData()) {
    4949                DownloadOsmTask task = new DownloadOsmTask();
     50                task.setZoomAfterDownload(dialog.isZoomToDownloadedDataRequired());
    5051                Future<?> future = task.download(dialog.isNewLayerRequired(), area, null);
    5152                Main.worker.submit(new PostDownloadHandler(task, future));
     
    5354            if (dialog.isDownloadGpxData()) {
    5455                DownloadGpsTask task = new DownloadGpsTask();
     56                task.setZoomAfterDownload(dialog.isZoomToDownloadedDataRequired());
    5557                Future<?> future = task.download(dialog.isNewLayerRequired(), area, null);
    5658                Main.worker.submit(new PostDownloadHandler(task, future));
     
    5860            if (dialog.isDownloadNotes()) {
    5961                DownloadNotesTask task = new DownloadNotesTask();
     62                task.setZoomAfterDownload(dialog.isZoomToDownloadedDataRequired());
    6063                Future<?> future = task.download(false, area, null);
    6164                Main.worker.submit(new PostDownloadHandler(task, future));
  • trunk/src/org/openstreetmap/josm/actions/OverpassDownloadAction.java

    r10782 r11658  
    8181            Bounds area = dialog.getSelectedDownloadArea();
    8282            DownloadOsmTask task = new DownloadOsmTask();
     83            task.setZoomAfterDownload(dialog.isZoomToDownloadedDataRequired());
    8384            Future<?> future = task.download(
    8485                    new OverpassDownloadReader(area, OverpassServerPreference.getOverpassServer(), dialog.getOverpassQuery()),
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTask.java

    r10305 r11658  
    1717    private boolean failed;
    1818    protected T downloadedData;
     19    protected boolean zoomAfterDownload = true;
    1920
    2021    /**
     
    7576    public final T getDownloadedData() {
    7677        return downloadedData;
     78    }
     79
     80    /**
     81     * Sets whether the map view will zoom to download area after download
     82     * @param zoomAfterDownload if true, the map view will zoom to download area after download
     83     * @since 11658
     84     */
     85    public final void setZoomAfterDownload(boolean zoomAfterDownload) {
     86        this.zoomAfterDownload = zoomAfterDownload;
    7787    }
    7888
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java

    r11124 r11658  
    163163                mergeLayer.mergeFrom(layer);
    164164                mergeLayer.invalidate();
    165                 if (Main.map != null) {
     165                if (Main.map != null && zoomAfterDownload) {
    166166                    Main.map.mapView.scheduleZoomTo(new ViewportData(layer.getViewProjectionBounds()));
    167167                }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java

    r10463 r11658  
    1414import org.openstreetmap.josm.Main;
    1515import org.openstreetmap.josm.data.Bounds;
     16import org.openstreetmap.josm.data.ViewportData;
    1617import org.openstreetmap.josm.data.notes.Note;
    1718import org.openstreetmap.josm.data.osm.NoteData;
     
    117118            if (!noteLayers.isEmpty()) {
    118119                noteLayers.get(0).getNoteData().addNotes(notesData);
     120                if (Main.map != null && zoomAfterDownload) {
     121                    Main.map.mapView.scheduleZoomTo(new ViewportData(noteLayers.get(0).getViewProjectionBounds()));
     122                }
    119123            } else {
    120124                Main.getLayerManager().addLayer(new NoteLayer(notesData, tr("Notes")));
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java

    r11627 r11658  
    115115     */
    116116    public Future<?> download(OsmServerReader reader, boolean newLayer, Bounds downloadArea, ProgressMonitor progressMonitor) {
    117         return download(new DownloadTask(newLayer, reader, progressMonitor), downloadArea);
     117        return download(new DownloadTask(newLayer, reader, progressMonitor, zoomAfterDownload), downloadArea);
    118118    }
    119119
Note: See TracChangeset for help on using the changeset viewer.