Ignore:
Timestamp:
2019-09-19T16:30:27+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #18050 - DownloadAlong: download as new layer

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

Legend:

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

    r15350 r15363  
    123123     * @param gpxDownload Set to true if GPX data should be downloaded
    124124     * @param title the title string for the confirmation dialog
    125      */
    126     protected static void confirmAndDownloadAreas(Area a, double maxArea, boolean osmDownload, boolean gpxDownload, String title) {
     125     * @param newLayer Set to true if all areas should be put into a single new layer
     126     */
     127    protected static void confirmAndDownloadAreas(Area a, double maxArea, boolean osmDownload, boolean gpxDownload, String title,
     128            boolean newLayer) {
    127129        List<Rectangle2D> toDownload = new ArrayList<>();
    128130        addToDownload(a, a.getBounds(), toDownload, maxArea);
     
    140142        final PleaseWaitProgressMonitor monitor = new PleaseWaitProgressMonitor(tr("Download data"));
    141143        final Future<?> future = new DownloadTaskList(Config.getPref().getBoolean("download.along.zoom-after-download"))
    142                 .download(false, toDownload, osmDownload, gpxDownload, monitor);
     144                .download(newLayer, toDownload, osmDownload, gpxDownload, monitor);
    143145        waitFuture(future, monitor);
    144146    }
     
    179181     * @param panel the panel that was displayed to the user and now contains his selections
    180182     * @param confirmTitle the title to display in the confirmation panel
     183     * @param newLayer Set to true if all areas should be put into a single new layer
    181184     * @return the task or null if canceled by user
    182185     */
    183     protected PleaseWaitRunnable createCalcTask(Path2D alongPath, DownloadAlongPanel panel, String confirmTitle) {
     186    protected PleaseWaitRunnable createCalcTask(Path2D alongPath, DownloadAlongPanel panel, String confirmTitle, boolean newLayer) {
    184187        /*
    185188         * Find the average latitude for the data we're contemplating, so we can know how many
     
    221224
    222225            private final Path2D downloadPath = new Path2D.Double();
     226            private final boolean newLayer;
    223227            private boolean cancel;
    224228            private int ticks;
    225229            private final Rectangle2D r = new Rectangle2D.Double();
    226230
    227             CalculateDownloadArea() {
     231            CalculateDownloadArea(boolean newLayer) {
    228232                super(tr("Calculating Download Area"), displayProgress ? null : NullProgressMonitor.INSTANCE, false);
     233                this.newLayer = newLayer;
    229234            }
    230235
     
    245250                }
    246251                confirmAndDownloadAreas(new Area(downloadPath), maxArea, panel.isDownloadOsmData(), panel.isDownloadGpxData(),
    247                         confirmTitle);
     252                        confirmTitle, newLayer);
    248253            }
    249254
     
    291296        }
    292297
    293         return new CalculateDownloadArea();
     298        return new CalculateDownloadArea(newLayer);
    294299    }
    295300
  • trunk/src/org/openstreetmap/josm/actions/DownloadAlongWayAction.java

    r15028 r15363  
    5454                PREF_DOWNLOAD_ALONG_WAY_DISTANCE, PREF_DOWNLOAD_ALONG_WAY_AREA, null);
    5555
    56         if (0 != panel.showInDownloadDialog(tr("Download from OSM along selected ways"), HelpUtil.ht("/Tools/DownloadAlong"))) {
     56        int ret = panel.showInDownloadDialog(tr("Download from OSM along selected ways"), HelpUtil.ht("/Tools/DownloadAlong"));
     57        if (0 != ret && 1 != ret) {
    5758            return null;
    5859        }
     
    7172            }
    7273        }
    73         return createCalcTask(alongPath, panel, tr("Download from OSM along selected ways"));
    74 
     74        return createCalcTask(alongPath, panel, tr("Download from OSM along selected ways"), 1 == ret);
    7575    }
    7676
Note: See TracChangeset for help on using the changeset viewer.