public class DownloadOsmCompressedTask extends DownloadOsmTask
DownloadOsmTask.AbstractInternalTask, DownloadOsmTask.DownloadTask| Modifier and Type | Field and Description |
|---|---|
(package private) static java.lang.String |
PATTERN_COMPRESS |
currentBounds, downloadedData, downloadTask, newLayerName, PATTERN_EXTERNAL_OSM_FILE, PATTERN_OSM_API_URL, PATTERN_OVERPASS_API_URL, PATTERN_OVERPASS_API_XAPI_URL| Constructor and Description |
|---|
DownloadOsmCompressedTask() |
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.Future<?> |
download(boolean newLayer,
Bounds downloadArea,
ProgressMonitor progressMonitor)
Asynchronously launches the download task for a given bounding box.
|
java.lang.String[] |
getPatterns()
Returns regular expressions that match the URLs
|
java.lang.String |
getTitle()
Returns human-readable description of the task
|
java.util.concurrent.Future<?> |
loadUrl(boolean new_layer,
java.lang.String url,
ProgressMonitor progressMonitor)
Loads a given URL
|
cancel, download, download, extractOsmFilename, getConfirmationMessage, getDownloadedData, isSafeForRemotecontrolRequests, modifyUrlBeforeLoad, rememberDownloadedDataacceptsDocumentationSummary, acceptsUrl, acceptsUrl, getErrorObjects, isCanceled, isFailed, rememberErrorMessage, rememberException, setCanceled, setFailedstatic final java.lang.String PATTERN_COMPRESS
public DownloadOsmCompressedTask()
public java.lang.String[] getPatterns()
DownloadTaskgetPatterns in interface DownloadTaskgetPatterns in class DownloadOsmTaskpublic java.lang.String getTitle()
DownloadTaskgetTitle in interface DownloadTaskgetTitle in class DownloadOsmTaskpublic java.util.concurrent.Future<?> download(boolean newLayer, Bounds downloadArea, ProgressMonitor progressMonitor)
DownloadTaskprogressMonitor to null, if the task should create, open, and close a progress monitor.
Set progressMonitor to NullProgressMonitor.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();
}
}
Main.worker.submit(runAfterTask);
download in interface DownloadTaskdownload in class DownloadOsmTasknewLayer - true, if the data is to be downloaded into a new layer. If false, the task
selects one of the existing layers as download layer, preferably the active layer.downloadArea - the area to downloadprogressMonitor - the progressMonitorpublic java.util.concurrent.Future<?> loadUrl(boolean new_layer, java.lang.String url, ProgressMonitor progressMonitor)
loadUrl in interface DownloadTaskloadUrl in class DownloadOsmTasknew_layer - true if the data should be saved to a new layerurl - The URL as StringprogressMonitor - progress monitor for user interactionDownloadTask.download(boolean, Bounds, ProgressMonitor)