Ignore:
Timestamp:
2019-09-09T19:54:43+02:00 (5 years ago)
Author:
stoecker
Message:

fix #18116 - don't 'download along' already downloaded areas

File:
1 edited

Legend:

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

    r15205 r15340  
    2121
    2222import org.openstreetmap.josm.actions.downloadtasks.DownloadTaskList;
     23import org.openstreetmap.josm.data.Bounds;
    2324import org.openstreetmap.josm.data.coor.LatLon;
     25import org.openstreetmap.josm.data.osm.DataSet;
    2426import org.openstreetmap.josm.gui.MainApplication;
    2527import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     
    8789            addToDownload(tmp, r2, results, maxArea);
    8890        } else {
     91            DataSet ds = MainApplication.getLayerManager().getEditDataSet();
     92            if (ds != null) {
     93                Collection<Bounds> existing = ds.getDataSourceBounds();
     94                if (existing != null) {
     95                    double p = LatLon.MAX_SERVER_PRECISION;
     96                    LatLon min = new LatLon(bounds.getY()+p, bounds.getX()+p);
     97                    LatLon max = new LatLon(bounds.getY()+bounds.getHeight()-p, bounds.getX()+bounds.getWidth()-p);
     98                    if(existing.stream().anyMatch(current -> (current.contains(min) && current.contains(max)))) {
     99                        return; /* skip this one, already downloaded */
     100                    }
     101                }
     102            }
    89103            results.add(bounds);
    90104        }
     
    102116     * that goes like this: +----+ | /| | / | | / | |/ | +----+ then we would first look at
    103117     * downloading the whole rectangle (assume it's too big), after that we split it in half
    104      * (upper and lower half), but we donot request the full upper and lower rectangle, only
     118     * (upper and lower half), but we do not request the full upper and lower rectangle, only
    105119     * the part of the upper/lower rectangle that actually has something in it.
    106120     *
Note: See TracChangeset for help on using the changeset viewer.