Class DownloadOsmTask.AbstractInternalTask
java.lang.Object
org.openstreetmap.josm.gui.PleaseWaitRunnable
org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask.AbstractInternalTask
- All Implemented Interfaces:
Runnable,ProgressMonitor.CancelListener
- Direct Known Subclasses:
DownloadOsmTask.DownloadTask,LoadDataHandler.LoadDataTask
- Enclosing class:
- DownloadOsmTask
Superclass of internal download task.
- Since:
- 7636
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DataSetprotected final DownloadParamsprotected final booleanFields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractInternalTask(DownloadParams settings, String title, boolean ignoreException, boolean zoomAfterDownload) Constructs a newAbstractInternalTask.protectedAbstractInternalTask(DownloadParams settings, String title, ProgressMonitor progressMonitor, boolean ignoreException, boolean zoomAfterDownload) Constructs a newAbstractInternalTask. -
Method Summary
Modifier and TypeMethodDescriptionprotected OsmDataLayeraddNewLayerIfRequired(String newLayerName) protected Optional<ProjectionBounds>computeBbox(Bounds bounds) protected final OsmDataLayercreateNewLayer(Optional<String> layerName) Convenience method forcreateNewLayer(DataSet, Optional), uses the dataset from fielddataSetand applies the settings from fieldsettings.protected OsmDataLayercreateNewLayer(DataSet ds, Optional<String> layerName) Can be overridden (e.g.protected StringCreates a name for a new layer by utilizing the settings (DownloadParams.getLayerName()) orOsmDataLayer.createNewName()if the former option isnull.protected OsmDataLayerprotected OsmDataLayerReturns the first modifiable data layerprivate static Stream<OsmDataLayer>protected longReturns the number of modifiable data layersprotected voidprotected Collection<OsmPrimitive>searchPrimitivesToUpdate(Bounds bounds, DataSet ds) Look for primitives deleted on server (thus absent from downloaded data) but still present in existing data layerMethods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, cancel, canRunInBackground, finish, getProgressMonitor, operationCanceled, realRun, run
-
Field Details
-
settings
-
zoomAfterDownload
-
dataSet
-
-
Constructor Details
-
AbstractInternalTask
protected AbstractInternalTask(DownloadParams settings, 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, 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 Details
-
getEditLayer
-
getModifiableDataLayers
-
getNumModifiableDataLayers
Returns the number of modifiable data layers- Returns:
- number of modifiable data layers
- Since:
- 13434
-
getFirstModifiableDataLayer
Returns the first modifiable data layer- Returns:
- the first modifiable data layer
- Since:
- 13434
-
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
Can be overridden (e.g. by plugins) if a subclass ofOsmDataLayeris 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
OsmDataLayerconstructed with the given arguments - Since:
- 14347
-
createNewLayer
Convenience method forcreateNewLayer(DataSet, Optional), uses the dataset from fielddataSetand 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
-
addNewLayerIfRequired
-
loadData
-
searchPrimitivesToUpdate
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
-