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:
java.lang.Runnable
,ProgressMonitor.CancelListener
public class DownloadPrimitivesWithReferrersTask extends PleaseWaitRunnable
Task for downloading a set of primitives with all referrers.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
canceled
Flag indicated that user ask for cancel this taskprivate PleaseWaitRunnable
currentTask
Reference to the task currently runningprivate boolean
downloadReferrers
If true, download also referrersprivate boolean
full
If true, download members for relationprivate java.util.List<PrimitiveId>
ids
List of primitives id to downloadprivate java.util.Set<PrimitiveId>
missingPrimitives
set of missing ids, with overpass API these are also deleted objectsprivate boolean
newLayer
If true download into a new layerprivate OsmDataLayer
tmpLayer
Temporary layer where downloaded primitives are put-
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor
-
-
Constructor Summary
Constructors Constructor Description DownloadPrimitivesWithReferrersTask(boolean newLayer, java.util.List<PrimitiveId> ids, boolean downloadReferrers, boolean full, java.lang.String newLayerName, ProgressMonitor monitor)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
cancel()
Cancel recursively the task.protected void
finish()
Finish up the data work.java.util.List<PrimitiveId>
getDownloadedId()
Return ids of really downloaded primitives.protected void
realRun()
Called in the worker thread to do the actual work.static ExtendedDialog
reportProblemDialog(java.util.Set<PrimitiveId> errs, java.lang.String title, java.lang.String text, java.lang.String listLabel, int msgType)
Dialog for report a problem during download.private void
useOSMApi()
private void
useOverpassApi()
-
Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
-
-
-
-
Field Detail
-
newLayer
private final boolean newLayer
If true download into a new layer
-
ids
private final java.util.List<PrimitiveId> ids
List of primitives id to download
-
full
private final boolean full
If true, download members for relation
-
downloadReferrers
private final boolean downloadReferrers
If true, download also referrers
-
tmpLayer
private final OsmDataLayer tmpLayer
Temporary layer where downloaded primitives are put
-
canceled
private boolean canceled
Flag indicated that user ask for cancel this task
-
currentTask
private PleaseWaitRunnable currentTask
Reference to the task currently running
-
missingPrimitives
private java.util.Set<PrimitiveId> missingPrimitives
set of missing ids, with overpass API these are also deleted objects
-
-
Constructor Detail
-
DownloadPrimitivesWithReferrersTask
public DownloadPrimitivesWithReferrersTask(boolean newLayer, java.util.List<PrimitiveId> ids, boolean downloadReferrers, boolean full, java.lang.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 Detail
-
cancel
protected void cancel()
Cancel recursively the task. Do not call directly- Specified by:
cancel
in classPleaseWaitRunnable
- See Also:
PleaseWaitRunnable.operationCanceled()
-
realRun
protected void realRun() throws org.xml.sax.SAXException, java.io.IOException, OsmTransferException
Description copied from class:PleaseWaitRunnable
Called 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:
realRun
in classPleaseWaitRunnable
- Throws:
org.xml.sax.SAXException
- if a SAX error occursjava.io.IOException
- if an I/O error occursOsmTransferException
- if a communication error with the OSM server occurs
-
useOverpassApi
private void useOverpassApi()
-
useOSMApi
private void useOSMApi()
-
finish
protected void finish()
Description copied from class:PleaseWaitRunnable
Finish 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:
finish
in classPleaseWaitRunnable
-
getDownloadedId
public java.util.List<PrimitiveId> getDownloadedId()
Return ids of really downloaded primitives.- Returns:
- List of primitives id or null if no primitives were downloaded
-
reportProblemDialog
public static ExtendedDialog reportProblemDialog(java.util.Set<PrimitiveId> errs, java.lang.String title, java.lang.String text, java.lang.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
-
-