public class OsmDataLayer extends Layer implements DataSetListenerAdapter.Listener, SelectionChangedListener
| Modifier and Type | Class and Description |
|---|---|
static interface |
OsmDataLayer.CommandQueueListener |
private class |
OsmDataLayer.ConsistencyTestAction |
class |
OsmDataLayer.ConvertToGpxLayerAction |
static class |
OsmDataLayer.DataCountVisitor |
static interface |
OsmDataLayer.LayerStateChangeListener
Listener called when a state of this layer has changed.
|
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction| Modifier and Type | Field and Description |
|---|---|
private ConflictCollection |
conflicts
the collection of conflicts detected in this layer
|
DataSet |
data
The data behind this layer.
|
private static int |
dataLayerCounter
the global counter for created data layers
|
private static TexturePaint |
hatched
a paint texture for non-downloaded area
|
private int |
highlightUpdateCount |
private boolean |
isChanged |
private CopyOnWriteArrayList<OsmDataLayer.LayerStateChangeListener> |
layerStateChangeListeners |
static String |
REQUIRES_SAVE_TO_DISK_PROP |
static String |
REQUIRES_UPLOAD_TO_SERVER_PROP |
private boolean |
requiresSaveToFile |
private boolean |
requiresUploadToServer |
List<TestError> |
validationErrors
List of validation errors in this layer.
|
ICON_SIZE, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP| Constructor and Description |
|---|
OsmDataLayer(DataSet data,
String name,
File associatedFile)
Construct a OsmDataLayer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLayerStateChangeListener(OsmDataLayer.LayerStateChangeListener listener)
Adds a layer state change listener
|
boolean |
checkSaveConditions()
Checks whether it is ok to launch a save (whether we have data, there is no conflict etc.)
|
void |
cleanupAfterUpload(Collection<IPrimitive> processed)
Clean out the data behind the layer.
|
boolean |
containsPoint(LatLon coor) |
File |
createAndOpenSaveFileChooser()
Creates a new "Save" dialog for this layer and makes it visible.
|
static void |
createHatchTexture()
Initialize the hatch pattern used to paint the non-downloaded area
|
static String |
createNewName()
Replies a new unique name for a data layer
|
void |
destroy()
Called, when the layer is removed from the mapview and is going to be
destroyed.
|
static Color |
getBackgroundColor() |
protected Icon |
getBaseIcon() |
ConflictCollection |
getConflicts()
replies the set of conflicts currently managed in this layer
|
Icon |
getIcon()
TODO: @return Return a dynamic drawn icon of the map data.
|
Object |
getInfoComponent() |
Action[] |
getMenuEntries()
Returns list of actions.
|
static Color |
getOutsideColor() |
String |
getToolTipText() |
boolean |
isChanged()
Check changed status of layer
|
private boolean |
isDataSetEmpty()
Check the data set if it would be empty on save.
|
boolean |
isMergable(Layer other) |
boolean |
isSavable()
Replies the savable state of this layer (i.e if it can be saved through a "File->Save" dialog).
|
boolean |
isUploadDiscouraged() |
void |
mergeFrom(DataSet from)
merges the primitives in dataset
from into the dataset of
this layer |
void |
mergeFrom(DataSet from,
ProgressMonitor progressMonitor)
merges the primitives in dataset
from into the dataset of
this layer |
void |
mergeFrom(Layer from)
Merges the given layer into this layer.
|
void |
onPostDownloadFromServer() |
void |
onPostLoadFromFile()
Initializes the layer after a successful load of data from a file
|
void |
onPostSaveToFile()
Initializes the layer after a successful save of OSM data to a file
|
void |
onPostUploadToServer()
Initializes the layer after a successful upload to the server
|
void |
paint(Graphics2D g,
MapView mv,
Bounds box)
Draw all primitives in this layer but do not draw modified ones (they
are drawn by the edit layer).
|
void |
processDatasetEvent(AbstractDatasetChangedEvent event) |
void |
projectionChanged(Projection oldValue,
Projection newValue) |
void |
removeLayerPropertyChangeListener(OsmDataLayer.LayerStateChangeListener listener)
Removes a layer property change listener
|
boolean |
requiresSaveToFile()
Replies true if the data managed by this layer needs to be saved to
a file.
|
boolean |
requiresUploadToServer()
Replies true if the data managed by this layer needs to be uploaded to
the server because it contains at least one modified primitive.
|
void |
selectionChanged(Collection<? extends OsmPrimitive> newSelection)
Informs the listener that the selection in the dataset has changed.
|
protected void |
setRequiresSaveToFile(boolean newValue) |
protected void |
setRequiresUploadToServer(boolean newValue) |
void |
setUploadDiscouraged(boolean uploadDiscouraged) |
GpxData |
toGpxData() |
static GpxData |
toGpxData(DataSet data,
File file) |
void |
visitBoundingBox(BoundingXYVisitor v) |
addPropertyChangeListener, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getColor, getName, getOpacity, hookUpMapView, isBackgroundLayer, isProjectionSupported, isVisible, nameSupportedProjections, removePropertyChangeListener, setAssociatedFile, setBackgroundLayer, setName, setOpacity, setVisible, toggleVisiblepublic static final String REQUIRES_SAVE_TO_DISK_PROP
public static final String REQUIRES_UPLOAD_TO_SERVER_PROP
private boolean requiresSaveToFile
private boolean requiresUploadToServer
private boolean isChanged
private int highlightUpdateCount
public final List<TestError> validationErrors
private static int dataLayerCounter
private final CopyOnWriteArrayList<OsmDataLayer.LayerStateChangeListener> layerStateChangeListeners
private ConflictCollection conflicts
private static TexturePaint hatched
public OsmDataLayer(DataSet data, String name, File associatedFile)
protected void setRequiresSaveToFile(boolean newValue)
protected void setRequiresUploadToServer(boolean newValue)
public static String createNewName()
public void addLayerStateChangeListener(OsmDataLayer.LayerStateChangeListener listener)
listener - the listener. Ignored if null or already registered.public void removeLayerPropertyChangeListener(OsmDataLayer.LayerStateChangeListener listener)
listener - the listener. Ignored if null or already registered.public static Color getBackgroundColor()
public static Color getOutsideColor()
public static void createHatchTexture()
protected Icon getBaseIcon()
public Icon getIcon()
public void paint(Graphics2D g, MapView mv, Bounds box)
paint in interface MapViewPaintablepaint in class Layermv - The object that can translate GeoPoints to screen coordinates.public String getToolTipText()
getToolTipText in class Layerpublic void mergeFrom(Layer from)
Layerpublic void mergeFrom(DataSet from)
from into the dataset of
this layerfrom - the source data setpublic void mergeFrom(DataSet from, ProgressMonitor progressMonitor)
from into the dataset of
this layerfrom - the source data setprogressMonitor - the progress monitor, can be nullpublic boolean isMergable(Layer other)
isMergable in class Layerother - The other layer that is tested to be mergable with this.public void visitBoundingBox(BoundingXYVisitor v)
visitBoundingBox in class Layerpublic void cleanupAfterUpload(Collection<IPrimitive> processed)
processed - A list of all objects that were actually uploaded.
May be null, which means nothing has been uploadedpublic Object getInfoComponent()
getInfoComponent in class Layerpublic Action[] getMenuEntries()
LayergetMenuEntries in class Layerpublic boolean containsPoint(LatLon coor)
public ConflictCollection getConflicts()
public boolean requiresUploadToServer()
public boolean requiresSaveToFile()
public void onPostLoadFromFile()
LayeronPostLoadFromFile in class Layerpublic void onPostDownloadFromServer()
public boolean isChanged()
Layerpublic void onPostSaveToFile()
public void onPostUploadToServer()
public void destroy()
Layerdestroy in interface Destroyabledestroy in class Layerpublic void processDatasetEvent(AbstractDatasetChangedEvent event)
processDatasetEvent in interface DataSetListenerAdapter.Listenerpublic void selectionChanged(Collection<? extends OsmPrimitive> newSelection)
SelectionChangedListenerselectionChanged in interface SelectionChangedListenernewSelection - The new selection.public void projectionChanged(Projection oldValue, Projection newValue)
projectionChanged in interface ProjectionChangeListenerprojectionChanged in class Layerpublic final boolean isUploadDiscouraged()
public final void setUploadDiscouraged(boolean uploadDiscouraged)
public boolean isSavable()
Layerpublic boolean checkSaveConditions()
LayercheckSaveConditions in class Layertrue, if it is safe to save.private boolean isDataSetEmpty()
true, if a save result in an empty data set.public File createAndOpenSaveFileChooser()
LayercreateAndOpenSaveFileChooser in class LayerFileSaveActionBase.createAndOpenSaveFileChooser(java.lang.String, org.openstreetmap.josm.actions.ExtensionFileFilter)