public class NoteLayer extends AbstractModifiableLayer implements java.awt.event.MouseListener
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction
MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener
Modifier and Type | Field and Description |
---|---|
private NoteData |
noteData |
FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP
Constructor and Description |
---|
NoteLayer()
Convenience constructor that creates a layer with an empty note list
|
NoteLayer(java.util.Collection<Note> notes,
java.lang.String name)
Create a new note layer with a set of notes
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
createAndOpenSaveFileChooser()
Creates a new "Save" dialog for this layer and makes it visible.
When the user has chosen a file, checks the file extension, and confirms overwrite if needed. |
AbstractIOTask |
createUploadTask(ProgressMonitor monitor)
Creates a new
AbstractIOTask for uploading data. |
javax.swing.Icon |
getIcon()
Return a representative small image for this layer.
|
java.lang.Object |
getInfoComponent() |
javax.swing.Action[] |
getMenuEntries()
Returns list of actions.
|
NoteData |
getNoteData()
Returns the note data store being used by this layer
|
java.lang.String |
getToolTipText() |
void |
hookUpMapView()
Initialization code, that depends on Main.map.mapView.
|
boolean |
isMergable(Layer other) |
boolean |
isModified()
Determines if data managed by this layer has been modified.
|
boolean |
isSavable()
Replies the savable state of this layer (i.e if it can be saved through a "File->Save" dialog).
|
boolean |
isUploadable()
Determines if the layer is able to upload data and implements the
UploadToServer interface. |
void |
mergeFrom(Layer from)
Merges the given layer into this layer.
|
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
paint(java.awt.Graphics2D g,
MapView mv,
Bounds box)
Paint the dataset using the engine set.
|
boolean |
requiresSaveToFile()
Determines if the data managed by this layer needs to be saved to
a file.
|
boolean |
requiresUploadToServer()
Determines if the data managed by this layer needs to be uploaded to
the server because it contains modified data.
|
void |
visitBoundingBox(BoundingXYVisitor v) |
getUploadDialog, isUploadDiscouraged, onPostSaveToFile, onPostUploadToServer
addPropertyChangeListener, checkSaveConditions, destroy, estimateMemoryUsage, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getColor, getDefaultLayerPosition, getName, getOpacity, isBackgroundLayer, isChanged, isInfoResizable, isProjectionSupported, isRenamed, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible
addInvalidationListener, invalidate, removeInvalidationListener
public NoteLayer(java.util.Collection<Note> notes, java.lang.String name)
notes
- A list of notes to show in this layername
- The name of the layer. Typically "Notes"public NoteLayer()
public void hookUpMapView()
Layer
estimateMemoryUsage
method and give a hint.
This allows for preemptive warning message for user, instead of failing later on
Remember to call super.hookUpMapView()
when overriding this methodhookUpMapView
in class Layer
public NoteData getNoteData()
public boolean isModified()
AbstractModifiableLayer
isModified
in class AbstractModifiableLayer
public boolean isUploadable()
AbstractModifiableLayer
UploadToServer
interface.isUploadable
in interface UploadToServer
isUploadable
in class AbstractModifiableLayer
public boolean requiresUploadToServer()
AbstractModifiableLayer
requiresUploadToServer
in interface UploadToServer
requiresUploadToServer
in class AbstractModifiableLayer
public boolean isSavable()
Layer
isSavable
in interface SaveToFile
isSavable
in class Layer
public boolean requiresSaveToFile()
AbstractModifiableLayer
requiresSaveToFile
in interface SaveToFile
requiresSaveToFile
in class AbstractModifiableLayer
public void paint(java.awt.Graphics2D g, MapView mv, Bounds box)
MapViewPaintable
paint
in interface MapViewPaintable
g
- Graphicsmv
- The object that can translate GeoPoints to screen coordinates.box
- Bounding boxpublic javax.swing.Icon getIcon()
Layer
public java.lang.String getToolTipText()
getToolTipText
in class Layer
public void mergeFrom(Layer from)
Layer
public boolean isMergable(Layer other)
isMergable
in class Layer
other
- The other layer that is tested to be mergable with this.public void visitBoundingBox(BoundingXYVisitor v)
visitBoundingBox
in class Layer
public java.lang.Object getInfoComponent()
getInfoComponent
in class Layer
public javax.swing.Action[] getMenuEntries()
Layer
Layer.SeparatorLayerAction.INSTANCE
instead of new JSeparatorgetMenuEntries
in class Layer
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public java.io.File createAndOpenSaveFileChooser()
Layer
createAndOpenSaveFileChooser
in class Layer
File
SaveActionBase.createAndOpenSaveFileChooser(java.lang.String, org.openstreetmap.josm.actions.ExtensionFileFilter)
public AbstractIOTask createUploadTask(ProgressMonitor monitor)
AbstractModifiableLayer
AbstractIOTask
for uploading data.createUploadTask
in interface UploadToServer
createUploadTask
in class AbstractModifiableLayer
monitor
- The progress monitorAbstractIOTask
for uploading data, or null
if not applicablepublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener