Class DownloadTaskList
- java.lang.Object
-
- org.openstreetmap.josm.actions.downloadtasks.DownloadTaskList
-
public class DownloadTaskList extends Object
This class encapsulates the downloading of several bounding boxes that would otherwise be too large to download in one go. Error messages will be collected for all downloads and displayed as a list in the end.- Since:
- 6053
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
DownloadTaskList.PostDownloadProcessor
-
Field Summary
Fields Modifier and Type Field Description private ProgressMonitor
progressMonitor
private List<Future<?>>
taskFutures
private List<DownloadTask>
tasks
private boolean
zoomAfterDownload
-
Constructor Summary
Constructors Constructor Description DownloadTaskList()
Constructs a newDownloadTaskList
.DownloadTaskList(boolean zoomAfterDownload)
Constructs a newDownloadTaskList
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addDownloadTask(ProgressMonitor progressMonitor, DownloadTask dt, Rectangle2D td, int i, int n)
Future<?>
download(boolean newLayer, Collection<Area> areas, boolean osmData, boolean gpxData, ProgressMonitor progressMonitor)
Downloads a list of areas from the OSM ServerFuture<?>
download(boolean newLayer, List<Rectangle2D> rects, boolean osmData, boolean gpxData, ProgressMonitor progressMonitor)
Downloads a list of areas from the OSM Serverprotected Set<OsmPrimitive>
getCompletePrimitives(DataSet ds)
Replies the set of ids of all complete, non-new primitives (i.e.Set<OsmPrimitive>
getDownloadedPrimitives()
Replies the set of primitive ids which have been downloaded by this task listprotected void
handlePotentiallyDeletedPrimitives(Set<OsmPrimitive> potentiallyDeleted)
Processes a set of primitives (given by a set of their ids) which might be deleted on the server.protected void
updatePotentiallyDeletedPrimitives(Set<OsmPrimitive> potentiallyDeleted)
Updates the local state of a set of primitives (given by a set of primitive ids) with the state currently held on the server.
-
-
-
Field Detail
-
tasks
private final List<DownloadTask> tasks
-
taskFutures
private final List<Future<?>> taskFutures
-
zoomAfterDownload
private final boolean zoomAfterDownload
-
progressMonitor
private ProgressMonitor progressMonitor
-
-
Constructor Detail
-
DownloadTaskList
public DownloadTaskList()
Constructs a newDownloadTaskList
. Zooms to each download area.
-
DownloadTaskList
public DownloadTaskList(boolean zoomAfterDownload)
Constructs a newDownloadTaskList
.- Parameters:
zoomAfterDownload
- whether to zoom to each download area- Since:
- 15205
-
-
Method Detail
-
addDownloadTask
private void addDownloadTask(ProgressMonitor progressMonitor, DownloadTask dt, Rectangle2D td, int i, int n)
-
download
public Future<?> download(boolean newLayer, List<Rectangle2D> rects, boolean osmData, boolean gpxData, ProgressMonitor progressMonitor)
Downloads a list of areas from the OSM Server- Parameters:
newLayer
- Set to true if all areas should be put into a single new layerrects
- The List of Rectangle2D to downloadosmData
- Set to true if OSM data should be downloadedgpxData
- Set to true if GPX data should be downloadedprogressMonitor
- The progress monitor- Returns:
- The Future representing the asynchronous download task
-
download
public Future<?> download(boolean newLayer, Collection<Area> areas, boolean osmData, boolean gpxData, ProgressMonitor progressMonitor)
Downloads a list of areas from the OSM Server- Parameters:
newLayer
- Set to true if all areas should be put into a single new layerareas
- The Collection of Areas to downloadosmData
- Set to true if OSM data should be downloadedgpxData
- Set to true if GPX data should be downloadedprogressMonitor
- The progress monitor- Returns:
- The Future representing the asynchronous download task
-
getCompletePrimitives
protected Set<OsmPrimitive> getCompletePrimitives(DataSet ds)
Replies the set of ids of all complete, non-new primitives (i.e. those with !primitive.incomplete)- Parameters:
ds
- data set- Returns:
- the set of ids of all complete, non-new primitives
-
updatePotentiallyDeletedPrimitives
protected void updatePotentiallyDeletedPrimitives(Set<OsmPrimitive> potentiallyDeleted)
Updates the local state of a set of primitives (given by a set of primitive ids) with the state currently held on the server.- Parameters:
potentiallyDeleted
- a set of ids to check update from the server
-
handlePotentiallyDeletedPrimitives
protected void handlePotentiallyDeletedPrimitives(Set<OsmPrimitive> potentiallyDeleted)
Processes a set of primitives (given by a set of their ids) which might be deleted on the server. First prompts the user whether he wants to check the current state on the server. If yes, retrieves the current state on the server and checks whether the primitives are indeed deleted on the server.- Parameters:
potentiallyDeleted
- a set of primitives (given by their ids)
-
getDownloadedPrimitives
public Set<OsmPrimitive> getDownloadedPrimitives()
Replies the set of primitive ids which have been downloaded by this task list- Returns:
- the set of primitive ids which have been downloaded by this task list
-
-