Package org.openstreetmap.josm.gui.io
Class AbstractPrimitiveTask
- java.lang.Object
-
- org.openstreetmap.josm.gui.PleaseWaitRunnable
-
- org.openstreetmap.josm.gui.io.AbstractPrimitiveTask
-
- All Implemented Interfaces:
java.lang.Runnable
,ProgressMonitor.CancelListener
- Direct Known Subclasses:
DownloadPrimitivesTask
,UpdatePrimitivesTask
public abstract class AbstractPrimitiveTask extends PleaseWaitRunnable
Abstract superclass of download/update primitives tasks.- Since:
- 10129
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
canceled
protected DataSet
ds
protected boolean
fullRelation
protected java.lang.Exception
lastException
protected OsmDataLayer
layer
private java.util.Set<PrimitiveId>
missingPrimitives
protected MultiFetchServerObjectReader
multiObjectReader
protected OsmServerObjectReader
objectReader
private boolean
zoom
-
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPrimitiveTask(java.lang.String title, OsmDataLayer layer)
protected
AbstractPrimitiveTask(java.lang.String title, ProgressMonitor progressMonitor, OsmDataLayer layer)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
cancel()
User pressed cancel button.protected void
finish()
Finish up the data work.java.util.Set<PrimitiveId>
getMissingPrimitives()
Replies the set of ids of all primitives for which a fetch request to the server was submitted but which are not available from the server (the server replied a return code of 404)protected abstract void
initMultiFetchReader(MultiFetchServerObjectReader reader)
protected void
loadIncompleteNodes()
protected void
realRun()
Called in the worker thread to do the actual work.AbstractPrimitiveTask
setDownloadRelations(boolean fullRelation)
Sets whether all members of the relation should be downloaded completely.AbstractPrimitiveTask
setZoom(boolean zoom)
Sets whether the map view should zoom to impacted primitives at the end.-
Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
-
-
-
-
Field Detail
-
canceled
protected boolean canceled
-
lastException
protected java.lang.Exception lastException
-
missingPrimitives
private java.util.Set<PrimitiveId> missingPrimitives
-
layer
protected final OsmDataLayer layer
-
multiObjectReader
protected MultiFetchServerObjectReader multiObjectReader
-
objectReader
protected OsmServerObjectReader objectReader
-
zoom
private boolean zoom
-
fullRelation
protected boolean fullRelation
-
-
Constructor Detail
-
AbstractPrimitiveTask
protected AbstractPrimitiveTask(java.lang.String title, OsmDataLayer layer)
-
AbstractPrimitiveTask
protected AbstractPrimitiveTask(java.lang.String title, ProgressMonitor progressMonitor, OsmDataLayer layer)
-
-
Method Detail
-
initMultiFetchReader
protected abstract void initMultiFetchReader(MultiFetchServerObjectReader reader)
-
setZoom
public final AbstractPrimitiveTask setZoom(boolean zoom)
Sets whether the map view should zoom to impacted primitives at the end.- Parameters:
zoom
-true
if the map view should zoom to impacted primitives at the end- Returns:
this
-
setDownloadRelations
public final AbstractPrimitiveTask setDownloadRelations(boolean fullRelation)
Sets whether all members of the relation should be downloaded completely.- Parameters:
fullRelation
-true
if a full download is required, i.e., a download including the immediate children of a relation.- Returns:
this
since 15811 (changed parameter list)
-
getMissingPrimitives
public java.util.Set<PrimitiveId> getMissingPrimitives()
Replies the set of ids of all primitives for which a fetch request to the server was submitted but which are not available from the server (the server replied a return code of 404)- Returns:
- the set of ids of missing primitives
-
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
-
loadIncompleteNodes
protected void loadIncompleteNodes() throws OsmTransferException
- Throws:
OsmTransferException
-
cancel
protected void cancel()
Description copied from class:PleaseWaitRunnable
User pressed cancel button.- Specified by:
cancel
in classPleaseWaitRunnable
-
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
-
-