Package org.openstreetmap.josm.gui.io
Class DownloadPrimitivesWithReferrersTask
java.lang.Object
org.openstreetmap.josm.gui.PleaseWaitRunnable
org.openstreetmap.josm.gui.io.DownloadPrimitivesWithReferrersTask
- All Implemented Interfaces:
Runnable,ProgressMonitor.CancelListener
Task for downloading a set of primitives with all referrers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFlag indicated that user ask for cancel this taskprivate PleaseWaitRunnableReference to the task currently runningprivate final booleanIf true, download also referrersprivate final booleanIf true, download members for relationprivate final List<PrimitiveId>List of primitives id to downloadprivate Set<PrimitiveId>set of missing ids, with overpass API these are also deleted objectsprivate final booleanIf true download into a new layerprivate final OsmDataLayerTemporary layer where downloaded primitives are putFields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor -
Constructor Summary
ConstructorsConstructorDescriptionDownloadPrimitivesWithReferrersTask(boolean newLayer, List<PrimitiveId> ids, boolean downloadReferrers, boolean full, String newLayerName, ProgressMonitor monitor) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcancel()Cancel recursively the task.protected voidfinish()Finish up the data work.Return ids of really downloaded primitives.protected voidrealRun()Called in the worker thread to do the actual work.static ExtendedDialogreportProblemDialog(Set<PrimitiveId> errs, String title, String text, String listLabel, int msgType) Dialog for report a problem during download.private voidprivate voidMethods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
-
Field Details
-
newLayer
If true download into a new layer -
ids
List of primitives id to download -
full
If true, download members for relation -
downloadReferrers
If true, download also referrers -
tmpLayer
Temporary layer where downloaded primitives are put -
canceled
Flag indicated that user ask for cancel this task -
currentTask
Reference to the task currently running -
missingPrimitives
set of missing ids, with overpass API these are also deleted objects
-
-
Constructor Details
-
DownloadPrimitivesWithReferrersTask
public DownloadPrimitivesWithReferrersTask(boolean newLayer, List<PrimitiveId> ids, boolean downloadReferrers, boolean full, String newLayerName, ProgressMonitor monitor) Constructor- Parameters:
newLayer- if the data should be downloaded into a new layerids- List of primitive id to downloaddownloadReferrers- if the referrers of the object should be downloaded as well, i.e., parent relations, and for nodes, additionally, parent waysfull- if the members of a relation should be downloaded as wellnewLayerName- the name to use for the new layer, can be null.monitor- ProgressMonitor to use, or null to create a new one
-
-
Method Details
-
cancel
Cancel recursively the task. Do not call directly- Specified by:
cancelin classPleaseWaitRunnable- See Also:
-
realRun
Description copied from class:PleaseWaitRunnableCalled in the worker thread to do the actual work. When any of the exception is thrown, a message box will be displayed and closeDialog is called. finish() is called in any case.- Specified by:
realRunin classPleaseWaitRunnable- Throws:
SAXException- if a SAX error occursIOException- if an I/O error occursOsmTransferException- if a communication error with the OSM server occurs
-
useOverpassApi
-
useOSMApi
-
finish
Description copied from class:PleaseWaitRunnableFinish up the data work. Is guaranteed to be called if realRun is called. Finish is called in the gui thread just after the dialog disappeared.- Specified by:
finishin classPleaseWaitRunnable
-
getDownloadedId
Return ids of really downloaded primitives.- Returns:
- List of primitives id or null if no primitives were downloaded
-
reportProblemDialog
public static ExtendedDialog reportProblemDialog(Set<PrimitiveId> errs, String title, String text, String listLabel, int msgType) Dialog for report a problem during download.- Parameters:
errs- Primitives involvedtitle- Title of dialogtext- Detail messagelistLabel- List of primitives descriptionmsgType- Type of message, seeJOptionPane- Returns:
- The Dialog object
-