Ignore:
Timestamp:
2019-10-12T23:34:58+02:00 (5 years ago)
Author:
donvip
Message:

Fix #josm18221 - handle “zoom to download”

Location:
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/download
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/download/CadastreDownloadSource.java

    r34355 r35188  
    2424    public void doDownload(CadastreDownloadData data, DownloadSettings settings) {
    2525        if (settings.getDownloadBounds().isPresent()) {
    26             new CadastreDownloadTask(data).download(
     26            new CadastreDownloadTask(data, settings.zoomToData()).download(
    2727                    new DownloadParams().withUploadPolicy(UploadPolicy.BLOCKED).withNewLayer(settings.asNewLayer()),
    2828                    settings.getDownloadBounds().get(), null);
  • applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/download/CadastreDownloadTask.java

    r34801 r35188  
    4343     */
    4444    public CadastreDownloadTask() {
    45         this(new CadastreDownloadData(true, true, true, true, true, true, true, true, true));
     45        this(new CadastreDownloadData(true, true, true, true, true, true, true, true, true), true);
    4646    }
    4747
     
    4949     * Constructs a new {@code CadastreDownloadTask} with parameterizable behaviour.
    5050     * @param data defines which data has to be downloaded
     51     * @param zoomToData if true, the map view will zoom to download area after download
    5152     */
    52     public CadastreDownloadTask(CadastreDownloadData data) {
     53    public CadastreDownloadTask(CadastreDownloadData data, boolean zoomToData) {
    5354        this.data = Objects.requireNonNull(data);
     55        setZoomAfterDownload(zoomToData);
    5456    }
    5557
     
    6062            for (String id : CadastreAPI.getSheets(downloadArea)) {
    6163                String url = String.join("/", CADASTRE_URL, id.substring(0, 2), id.substring(0, 5), "edigeo-"+id+".tar.bz2");
    62                 tasks.add(MainApplication.worker.submit(new InternalDownloadTask(settings, url, progressMonitor)));
     64                tasks.add(MainApplication.worker.submit(new InternalDownloadTask(settings, url, progressMonitor, zoomAfterDownload)));
    6365            }
    6466        } catch (IOException e) {
     
    8082    @Override
    8183    public Future<?> loadUrl(DownloadParams settings, String url, ProgressMonitor progressMonitor) {
    82         downloadTask = new InternalDownloadTask(settings, url, progressMonitor);
     84        downloadTask = new InternalDownloadTask(settings, url, progressMonitor, zoomAfterDownload);
    8385        currentBounds = null;
    8486        return MainApplication.worker.submit(downloadTask);
     
    106108        private final String url;
    107109
    108         InternalDownloadTask(DownloadParams settings, String url, ProgressMonitor progressMonitor) {
    109             super(settings, new CadastreServerReader(url, data), progressMonitor);
     110        InternalDownloadTask(DownloadParams settings, String url, ProgressMonitor progressMonitor, boolean zoom) {
     111            super(settings, new CadastreServerReader(url, data), progressMonitor, zoom);
    110112            this.url = url;
    111113        }
Note: See TracChangeset for help on using the changeset viewer.