public abstract static class DownloadOsmTask.AbstractInternalTask extends PleaseWaitRunnable
Modifier and Type | Field and Description |
---|---|
protected DataSet |
dataSet |
protected DownloadParams |
settings |
protected boolean |
zoomAfterDownload |
progressMonitor
Constructor and Description |
---|
AbstractInternalTask(DownloadParams settings,
java.lang.String title,
boolean ignoreException,
boolean zoomAfterDownload)
Constructs a new
AbstractInternalTask . |
AbstractInternalTask(DownloadParams settings,
java.lang.String title,
ProgressMonitor progressMonitor,
boolean ignoreException,
boolean zoomAfterDownload)
Constructs a new
AbstractInternalTask . |
Modifier and Type | Method and Description |
---|---|
protected OsmDataLayer |
addNewLayerIfRequired(java.lang.String newLayerName) |
protected java.util.Optional<ProjectionBounds> |
computeBbox(Bounds bounds) |
protected OsmDataLayer |
createNewLayer(DataSet ds,
java.util.Optional<java.lang.String> layerName)
Can be overridden (e.g.
|
protected OsmDataLayer |
createNewLayer(java.util.Optional<java.lang.String> layerName)
Convenience method for
createNewLayer(DataSet, Optional) , uses the dataset
from field dataSet and applies the settings from field settings . |
protected java.lang.String |
generateLayerName()
Creates a name for a new layer by utilizing the settings (
DownloadParams.getLayerName() ) or
OsmDataLayer.createNewName() if the former option is null . |
protected OsmDataLayer |
getEditLayer() |
protected OsmDataLayer |
getFirstModifiableDataLayer()
Returns the first modifiable data layer
|
private static java.util.stream.Stream<OsmDataLayer> |
getModifiableDataLayers() |
protected long |
getNumModifiableDataLayers()
Returns the number of modifiable data layers
|
protected void |
loadData(java.lang.String newLayerName,
Bounds bounds) |
private 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
|
afterFinish, cancel, canRunInBackground, finish, getProgressMonitor, operationCanceled, realRun, run
protected final DownloadParams settings
protected final boolean zoomAfterDownload
public AbstractInternalTask(DownloadParams settings, java.lang.String title, boolean ignoreException, boolean zoomAfterDownload)
AbstractInternalTask
.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 downloadpublic AbstractInternalTask(DownloadParams settings, java.lang.String title, ProgressMonitor progressMonitor, boolean ignoreException, boolean zoomAfterDownload)
AbstractInternalTask
.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 downloadprotected OsmDataLayer getEditLayer()
private static java.util.stream.Stream<OsmDataLayer> getModifiableDataLayers()
protected long getNumModifiableDataLayers()
protected OsmDataLayer getFirstModifiableDataLayer()
protected java.lang.String generateLayerName()
DownloadParams.getLayerName()
) or
OsmDataLayer.createNewName()
if the former option is null
.protected OsmDataLayer createNewLayer(DataSet ds, java.util.Optional<java.lang.String> layerName)
OsmDataLayer
is needed.
If you want to change how the name is determined, consider overriding
generateLayerName()
instead.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-presentOsmDataLayer
constructed with the given argumentsprotected final OsmDataLayer createNewLayer(java.util.Optional<java.lang.String> layerName)
createNewLayer(DataSet, Optional)
, uses the dataset
from field dataSet
and applies the settings from field settings
.layerName
- an optional layer name, must be non-blank if the [Optional] is presentprotected java.util.Optional<ProjectionBounds> computeBbox(Bounds bounds)
protected OsmDataLayer addNewLayerIfRequired(java.lang.String newLayerName)
private java.util.Collection<OsmPrimitive> searchPrimitivesToUpdate(Bounds bounds, DataSet ds)
bounds
- download boundsds
- existing data set