Class DownloadOsmTask.AbstractInternalTask
- java.lang.Object
-
- org.openstreetmap.josm.gui.PleaseWaitRunnable
-
- org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask.AbstractInternalTask
-
- All Implemented Interfaces:
java.lang.Runnable
,ProgressMonitor.CancelListener
- Direct Known Subclasses:
DownloadOsmTask.DownloadTask
,LoadDataHandler.LoadDataTask
- Enclosing class:
- DownloadOsmTask
public abstract static class DownloadOsmTask.AbstractInternalTask extends PleaseWaitRunnable
Superclass of internal download task.- Since:
- 7636
-
-
Field Summary
Fields Modifier and Type Field Description protected DataSet
dataSet
protected DownloadParams
settings
protected boolean
zoomAfterDownload
-
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractInternalTask(DownloadParams settings, java.lang.String title, boolean ignoreException, boolean zoomAfterDownload)
Constructs a newAbstractInternalTask
.protected
AbstractInternalTask(DownloadParams settings, java.lang.String title, ProgressMonitor progressMonitor, boolean ignoreException, boolean zoomAfterDownload)
Constructs a newAbstractInternalTask
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected OsmDataLayer
addNewLayerIfRequired(java.lang.String newLayerName)
protected java.util.Optional<ProjectionBounds>
computeBbox(Bounds bounds)
protected OsmDataLayer
createNewLayer(java.util.Optional<java.lang.String> layerName)
Convenience method forcreateNewLayer(DataSet, Optional)
, uses the dataset from fielddataSet
and applies the settings from fieldsettings
.protected OsmDataLayer
createNewLayer(DataSet ds, java.util.Optional<java.lang.String> layerName)
Can be overridden (e.g.protected java.lang.String
generateLayerName()
Creates a name for a new layer by utilizing the settings (DownloadParams.getLayerName()
) orOsmDataLayer.createNewName()
if the former option isnull
.protected OsmDataLayer
getEditLayer()
protected OsmDataLayer
getFirstModifiableDataLayer()
Returns the first modifiable data layerprivate static java.util.stream.Stream<OsmDataLayer>
getModifiableDataLayers()
protected long
getNumModifiableDataLayers()
Returns the number of modifiable data layersprotected void
loadData(java.lang.String newLayerName, Bounds bounds)
protected java.util.Collection<OsmPrimitive>
searchPrimitivesToUpdate(Bounds bounds, DataSet ds)
Look for primitives deleted on server (thus absent from downloaded data) but still present in existing data layer-
Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, cancel, canRunInBackground, finish, getProgressMonitor, operationCanceled, realRun, run
-
-
-
-
Field Detail
-
settings
protected final DownloadParams settings
-
zoomAfterDownload
protected final boolean zoomAfterDownload
-
-
Constructor Detail
-
AbstractInternalTask
protected AbstractInternalTask(DownloadParams settings, java.lang.String title, boolean ignoreException, boolean zoomAfterDownload)
Constructs a newAbstractInternalTask
.- Parameters:
settings
- download settingstitle
- message for the userignoreException
- If true, exception will be propagated to calling code. If false then exception will be thrown directly in EDT. When this runnable is executed using executor framework then use false unless you read result of task (because exception will get lost if you don't)zoomAfterDownload
- If true, the map view will zoom to download area after download
-
AbstractInternalTask
protected AbstractInternalTask(DownloadParams settings, java.lang.String title, ProgressMonitor progressMonitor, boolean ignoreException, boolean zoomAfterDownload)
Constructs a newAbstractInternalTask
.- Parameters:
settings
- download settingstitle
- message for the userprogressMonitor
- progress monitorignoreException
- If true, exception will be propagated to calling code. If false then exception will be thrown directly in EDT. When this runnable is executed using executor framework then use false unless you read result of task (because exception will get lost if you don't)zoomAfterDownload
- If true, the map view will zoom to download area after download
-
-
Method Detail
-
getEditLayer
protected OsmDataLayer getEditLayer()
-
getModifiableDataLayers
private static java.util.stream.Stream<OsmDataLayer> getModifiableDataLayers()
-
getNumModifiableDataLayers
protected long getNumModifiableDataLayers()
Returns the number of modifiable data layers- Returns:
- number of modifiable data layers
- Since:
- 13434
-
getFirstModifiableDataLayer
protected OsmDataLayer getFirstModifiableDataLayer()
Returns the first modifiable data layer- Returns:
- the first modifiable data layer
- Since:
- 13434
-
generateLayerName
protected java.lang.String generateLayerName()
Creates a name for a new layer by utilizing the settings (DownloadParams.getLayerName()
) orOsmDataLayer.createNewName()
if the former option isnull
.- Returns:
- a name for a new layer
- Since:
- 14347
-
createNewLayer
protected OsmDataLayer createNewLayer(DataSet ds, java.util.Optional<java.lang.String> layerName)
Can be overridden (e.g. by plugins) if a subclass ofOsmDataLayer
is needed. If you want to change how the name is determined, consider overridinggenerateLayerName()
instead.- Parameters:
ds
- the dataset on which the layer is based, must be non-nulllayerName
- the name of the new layer, must be either non-blank or non-present- Returns:
- a new instance of
OsmDataLayer
constructed with the given arguments - Since:
- 14347
-
createNewLayer
protected final OsmDataLayer createNewLayer(java.util.Optional<java.lang.String> layerName)
Convenience method forcreateNewLayer(DataSet, Optional)
, uses the dataset from fielddataSet
and applies the settings from fieldsettings
.- Parameters:
layerName
- an optional layer name, must be non-blank if the [Optional] is present- Returns:
- a newly constructed layer
- Since:
- 14347
-
computeBbox
protected java.util.Optional<ProjectionBounds> computeBbox(Bounds bounds)
-
addNewLayerIfRequired
protected OsmDataLayer addNewLayerIfRequired(java.lang.String newLayerName)
-
searchPrimitivesToUpdate
protected java.util.Collection<OsmPrimitive> searchPrimitivesToUpdate(Bounds bounds, DataSet ds)
Look for primitives deleted on server (thus absent from downloaded data) but still present in existing data layer- Parameters:
bounds
- download boundsds
- existing data set- Returns:
- the primitives to update
-
-