Class DownloadOsmChangeTask
- java.lang.Object
-
- org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask<DataSet>
-
- org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask
-
- org.openstreetmap.josm.actions.downloadtasks.DownloadOsmChangeTask
-
- All Implemented Interfaces:
DownloadTask
public class DownloadOsmChangeTask extends DownloadOsmTask
Task allowing to download OsmChange data (http://wiki.openstreetmap.org/wiki/OsmChange).- Since:
- 4530
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DownloadOsmChangeTask.DownloadTask
OsmChange download task.private static class
DownloadOsmChangeTask.HistoryLoaderAndListener
Loads history and updates incomplete primitives.-
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask
DownloadOsmTask.AbstractInternalTask
-
-
Field Summary
-
Fields inherited from class org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask
currentBounds, downloadTask, newLayerName, OVERPASS_INTERPRETER_DATA, warnAboutEmptyArea
-
Fields inherited from class org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask
downloadedData, zoomAfterDownload
-
-
Constructor Summary
Constructors Constructor Description DownloadOsmChangeTask()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.Future<?>
download(DownloadParams settings, Bounds downloadArea, ProgressMonitor progressMonitor)
Asynchronously launches the download task for a given bounding box.java.lang.String[]
getPatterns()
Returns regular expressions that match the URLsjava.lang.String
getTitle()
Returns human-readable description of the taskprivate static java.util.Map<OsmPrimitive,java.time.Instant>
getToLoad(DataSet ds)
Get the primitives to load more informationjava.util.concurrent.Future<?>
loadUrl(DownloadParams settings, java.lang.String url, ProgressMonitor progressMonitor)
Loads a given URL from the OSM Server-
Methods inherited from class org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask
cancel, download, download, extractOsmFilename, getConfirmationMessage, getDownloadProjectionBounds, getOsmServerReader, isSafeForRemotecontrolRequests, modifyUrlBeforeLoad, rememberDownloadedBounds, searchPotentiallyDeletedPrimitives
-
Methods inherited from class org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask
acceptsUrl, acceptsUrl, getDownloadedData, getErrorObjects, isCanceled, isFailed, patterns, rememberDownloadedData, rememberErrorMessage, rememberException, setCanceled, setFailed, setZoomAfterDownload, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.actions.downloadtasks.DownloadTask
acceptsDocumentationSummary, getErrorMessages
-
-
-
-
Constructor Detail
-
DownloadOsmChangeTask
public DownloadOsmChangeTask()
-
-
Method Detail
-
getPatterns
public java.lang.String[] getPatterns()
Description copied from interface:DownloadTask
Returns regular expressions that match the URLs- Specified by:
getPatterns
in interfaceDownloadTask
- Overrides:
getPatterns
in classDownloadOsmTask
- Returns:
- The array of accepted URL patterns
-
getTitle
public java.lang.String getTitle()
Description copied from interface:DownloadTask
Returns human-readable description of the task- Specified by:
getTitle
in interfaceDownloadTask
- Overrides:
getTitle
in classDownloadOsmTask
- Returns:
- The task description
-
download
public java.util.concurrent.Future<?> download(DownloadParams settings, Bounds downloadArea, ProgressMonitor progressMonitor)
Description copied from interface:DownloadTask
Asynchronously launches the download task for a given bounding box.Set
progressMonitor
to null, if the task should create, open, and close a progress monitor. Set progressMonitor toNullProgressMonitor.INSTANCE
if progress information is to be discarded.You can wait for the asynchronous download task to finish by synchronizing on the returned
Future
, but make sure not to freeze up JOSM. Example:Future<?> future = task.download(...); // DON'T run this on the Swing EDT or JOSM will freeze future.get(); // waits for the dowload task to complete
The following example uses a pattern which is better suited if a task is launched from the Swing EDT:final Future<?> future = task.download(...); Runnable runAfterTask = new Runnable() { public void run() { // this is not strictly necessary because of the type of executor service // Main.worker is initialized with, but it doesn't harm either // future.get(); // wait for the download task to complete doSomethingAfterTheTaskCompleted(); } } MainApplication.worker.submit(runAfterTask);
- Specified by:
download
in interfaceDownloadTask
- Overrides:
download
in classDownloadOsmTask
- Parameters:
settings
- download settingsdownloadArea
- the area to downloadprogressMonitor
- the progressMonitor- Returns:
- the future representing the asynchronous task
-
loadUrl
public java.util.concurrent.Future<?> loadUrl(DownloadParams settings, java.lang.String url, ProgressMonitor progressMonitor)
Description copied from class:DownloadOsmTask
Loads a given URL from the OSM Server- Specified by:
loadUrl
in interfaceDownloadTask
- Overrides:
loadUrl
in classDownloadOsmTask
- Parameters:
settings
- download settingsurl
- The URL as StringprogressMonitor
- the progressMonitor- Returns:
- the future representing the asynchronous task
- See Also:
DownloadTask.download(DownloadParams, Bounds, ProgressMonitor)
-
getToLoad
private static java.util.Map<OsmPrimitive,java.time.Instant> getToLoad(DataSet ds)
Get the primitives to load more information- Parameters:
ds
- The dataset to look for incomplete primitives from- Returns:
- The objects that still need to be loaded
-
-