Class MarkerLayer
- All Implemented Interfaces:
ProjectionChangeListener,IGeoImageLayer,JumpToMarkerActions.JumpToMarkerLayer,MapViewPaintable,Destroyable
Markers are GPS points with a name and, optionally, a symbol code attached; marker layers can be created from waypoints when importing raw GPS data, but they may also come from other sources.
The symbol code is for future use.
The data is read only.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassthe data of a MarkerLayerprivate final classprivate classstatic final classToggle visibility of the marker text and iconsprivate classNested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.Layer
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerActionNested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
AbstractMapViewPaintable.CompatibilityModeLayerPainterNested classes/interfaces inherited from interface org.openstreetmap.josm.gui.layer.geoimage.IGeoImageLayer
IGeoImageLayer.ImageChangeListenerNested classes/interfaces inherited from interface org.openstreetmap.josm.gui.layer.MapViewPaintable
MapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Colorprivate Markerfinal MarkerLayer.MarkerDataA list of markers.static final NamedColorPropertyThe default color that is used for drawing markers.private final ListenerList<IGeoImageLayer.ImageChangeListener>private MapView(package private) final int(package private) final BasicStrokeprivate MarkerLayer.MarkerMouseAdapterprivate booleanprivate ColorFields inherited from class org.openstreetmap.josm.gui.layer.Layer
FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP -
Constructor Summary
ConstructorsConstructorDescriptionMarkerLayer(GpxData indata, String name, File associatedFile, GpxLayer fromLayer) Constructs a newMarkerLayer. -
Method Summary
Modifier and TypeMethodDescriptionaddAudioMarker(double time, LatLon coor) voidAdd a listener for when images changeThis method is called whenever this layer is added to a map view.private static booleancheckIfListContainsEntry(List<Marker> markerList, RemoteEntry imageEntry) Check if a list contains an entryvoidClear the selection of the layerbooleancontainsImage(IImageEntry<?> imageEntry) Check if the layer contains the specified imagevoiddestroy()Called, when the layer is removed from the mapview and is going to be destroyed.private static MarkergetAdjacentMarker(Marker startMarker, boolean next, Layer layer) getColor()Return the current color of the layergetIcon()Return a static icon.Gets the layer information to display to the user.Action[]Returns list of actions.List<? extends IImageEntry<?>>Get the current selectionReturns a small tooltip hint about some statistics for this layer.booleanhasColor()Determines whether the layer has / can handle colors.booleanisMergable(Layer other) Determines if the other layer can be merged into this layer.private booleanGet state of text display.voidJump (move the viewport) to the next marker.voidJump (move the viewport) to the previous marker.voidMerges the given layer into this layer.voidpaint(Graphics2D g, MapView mv, Bounds box) Paint the dataset using the engine set.private static voidplayAdjacentMarker(Marker startMarker, boolean next) static voidstatic voidstatic voidvoidRemove a listener for when images changevoidSets the color for this layer.(package private) voidsetCurrentMarker(Marker newMarker) Set the current markerprivate voidsetPrivateColors(Color color) booleansynchronizeAudioMarkers(AudioMarker startMarker) voidVisits the content bounds of this layer.Methods inherited from class org.openstreetmap.josm.gui.layer.Layer
addPropertyChangeListener, checkSaveConditions, createAndOpenSaveFileChooser, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getChangesetSourceTag, getDefaultLayerPosition, getLabel, getName, getOpacity, getViewProjectionBounds, hookUpMapView, isBackgroundLayer, isInfoResizable, isProjectionSupported, isRenamed, isSavable, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible, toStringMethods inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
addInvalidationListener, createMapViewPainter, invalidate, removeInvalidationListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.gui.layer.geoimage.IGeoImageLayer
getInvalidGeoImages
-
Field Details
-
data
A list of markers. -
mousePressed
-
fromLayer
-
currentMarker
-
syncAudioMarker
-
color
-
realcolor
-
markerSize
-
markerStroke
-
imageChangeListenerListenerList
-
mouseAdapter
-
mapView
-
DEFAULT_COLOR_PROPERTY
The default color that is used for drawing markers.
-
-
Constructor Details
-
MarkerLayer
Constructs a newMarkerLayer.- Parameters:
indata- The GPX data for this layername- The marker layer nameassociatedFile- The associated GPX filefromLayer- The associated GPX layer
-
-
Method Details
-
destroy
Description copied from class:LayerCalled, when the layer is removed from the mapview and is going to be destroyed.This is because the Layer constructor cannot add itself safely as a listener to the layerlist dialog, because there may be no such dialog yet (loaded via command line parameter).
- Specified by:
destroyin interfaceDestroyable- Overrides:
destroyin classLayer
-
attachToMapView
Description copied from class:AbstractMapViewPaintableThis method is called whenever this layer is added to a map view.You need to return a painter here. The
MapViewPaintable.LayerPainter.detachFromMapView(org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent)method is called when the layer is removed from that map view. You are free to reuse painters.You should always call the super method. See
AbstractMapViewPaintable.createMapViewPainter(org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent)if you want to influence painter creation.This replaces
Layer.hookUpMapView()in the long run.- Overrides:
attachToMapViewin classAbstractMapViewPaintable- Parameters:
event- the event.- Returns:
- A layer painter.
-
getIcon
Return a static icon. -
paint
Description copied from interface:MapViewPaintablePaint the dataset using the engine set.- Specified by:
paintin interfaceMapViewPaintable- Parameters:
g- Graphicsmv- The object that can translate GeoPoints to screen coordinates.box- Bounding box
-
getToolTipText
Description copied from class:LayerReturns a small tooltip hint about some statistics for this layer.- Specified by:
getToolTipTextin classLayer- Returns:
- A small tooltip hint about some statistics for this layer.
-
mergeFrom
Description copied from class:LayerMerges the given layer into this layer. Throws if the layer types are incompatible. -
isMergable
Description copied from class:LayerDetermines if the other layer can be merged into this layer.- Specified by:
isMergablein classLayer- Parameters:
other- The other layer that is tested to be mergable with this.- Returns:
- Whether the other layer can be merged into this layer.
-
visitBoundingBox
Description copied from class:LayerVisits the content bounds of this layer. The behavior of this method depends on the layer, but each implementation should attempt to cover the relevant content of the layer in this method.- Specified by:
visitBoundingBoxin classLayer- Parameters:
v- The visitor that gets notified about the contents of this layer.
-
getInfoComponent
Description copied from class:LayerGets the layer information to display to the user. This is used if the user requests information about this layer. It should display a description of the layer content.- Specified by:
getInfoComponentin classLayer- Returns:
- Either a String or a
Componentdescribing the layer.
-
getMenuEntries
Description copied from class:LayerReturns list of actions. Action can implement LayerAction interface when it needs to be represented by other menu component than JMenuItem or when it supports multiple layers. Actions that support multiple layers should also have correct equals implementation.Use
Layer.SeparatorLayerAction.INSTANCEinstead of new JSeparator- Specified by:
getMenuEntriesin classLayer- Returns:
- menu actions for this layer
-
synchronizeAudioMarkers
-
addAudioMarker
-
jumpToNextMarker
Description copied from interface:JumpToMarkerActions.JumpToMarkerLayerJump (move the viewport) to the next marker.- Specified by:
jumpToNextMarkerin interfaceJumpToMarkerActions.JumpToMarkerLayer
-
jumpToPreviousMarker
Description copied from interface:JumpToMarkerActions.JumpToMarkerLayerJump (move the viewport) to the previous marker.- Specified by:
jumpToPreviousMarkerin interfaceJumpToMarkerActions.JumpToMarkerLayer
-
setCurrentMarker
Set the current marker- Parameters:
newMarker- The marker to set
-
playAudio
-
playNextMarker
-
playPreviousMarker
-
getAdjacentMarker
-
playAdjacentMarker
-
isTextOrIconShown
Get state of text display.- Returns:
trueif text should be shown,falseotherwise.
-
hasColor
Description copied from class:LayerDetermines whether the layer has / can handle colors. -
getColor
Description copied from class:LayerReturn the current color of the layer -
setColor
Description copied from class:LayerSets the color for this layer. Nothing happens if not supported by the layer -
setPrivateColors
-
clearSelection
Description copied from interface:IGeoImageLayerClear the selection of the layer- Specified by:
clearSelectionin interfaceIGeoImageLayer
-
getSelection
Description copied from interface:IGeoImageLayerGet the current selection- Specified by:
getSelectionin interfaceIGeoImageLayer- Returns:
- The currently selected images
-
containsImage
Description copied from interface:IGeoImageLayerCheck if the layer contains the specified image- Specified by:
containsImagein interfaceIGeoImageLayer- Parameters:
imageEntry- The entry to look for- Returns:
trueif this layer contains the image
-
checkIfListContainsEntry
Check if a list contains an entry- Parameters:
markerList- The list to look throughimageEntry- The image entry to check- Returns:
trueif the entry is in the list
-
addImageChangeListener
Description copied from interface:IGeoImageLayerAdd a listener for when images change- Specified by:
addImageChangeListenerin interfaceIGeoImageLayer- Parameters:
listener- The listener to call
-
removeImageChangeListener
Description copied from interface:IGeoImageLayerRemove a listener for when images change- Specified by:
removeImageChangeListenerin interfaceIGeoImageLayer- Parameters:
listener- The listener to remove
-