org.openstreetmap.josm.gui.layer.markerlayer
Class MarkerLayer

java.lang.Object
  extended by org.openstreetmap.josm.gui.layer.Layer
      extended by org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer
All Implemented Interfaces:
ProjectionChangeListener, JumpToMarkerActions.JumpToMarkerLayer, MapViewPaintable, Destroyable

public class MarkerLayer
extends Layer
implements JumpToMarkerActions.JumpToMarkerLayer

A layer holding markers. 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
private  class MarkerLayer.MoveAudio
           
static class MarkerLayer.ShowHideMarkerText
           
private  class MarkerLayer.SynchronizeAudio
           
 
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.Layer
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction
 
Field Summary
private  Marker currentMarker
           
 java.util.List<Marker> data
          A list of markers.
 GpxLayer fromLayer
           
private  boolean mousePressed
           
 
Fields inherited from class org.openstreetmap.josm.gui.layer.Layer
ICON_SIZE, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP
 
Constructor Summary
MarkerLayer(GpxData indata, java.lang.String name, java.io.File associatedFile, GpxLayer fromLayer)
           
MarkerLayer(GpxData indata, java.lang.String name, java.io.File associatedFile, GpxLayer fromLayer, boolean addMouseHandlerInConstructor)
           
 
Method Summary
 AudioMarker addAudioMarker(double time, LatLon coor)
           
 void addMouseHandler()
           
private static Marker getAdjacentMarker(Marker startMarker, boolean next, Layer layer)
           
 java.awt.Color getColor(boolean ignoreCustom)
          Return a Color for this layer.
static java.awt.Color getGenericColor()
           
 javax.swing.Icon getIcon()
          Return a static icon.
 java.lang.Object getInfoComponent()
           
 javax.swing.Action[] getMenuEntries()
          Returns list of actions.
 java.lang.String getToolTipText()
           
 boolean isMergable(Layer other)
           
private  boolean isTextOrIconShown()
          Get state of text display.
 void jumpToNextMarker()
           
 void jumpToPreviousMarker()
           
 void mergeFrom(Layer from)
          Merges the given layer into this layer.
 void paint(java.awt.Graphics2D g, MapView mv, Bounds box)
          Paint the dataset using the engine set.
private static void playAdjacentMarker(Marker startMarker, boolean next)
           
static void playAudio()
           
static void playNextMarker()
           
static void playPreviousMarker()
           
 boolean synchronizeAudioMarkers(AudioMarker startMarker)
           
 void visitBoundingBox(BoundingXYVisitor v)
           
 
Methods inherited from class org.openstreetmap.josm.gui.layer.Layer
addPropertyChangeListener, checkSaveConditions, createAndOpenSaveFileChooser, destroy, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getName, getOpacity, hookUpMapView, isBackgroundLayer, isChanged, isProjectionSupported, isSavable, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, setAssociatedFile, setBackgroundLayer, setName, setOpacity, setVisible, toggleVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

public final java.util.List<Marker> data
A list of markers.


mousePressed

private boolean mousePressed

fromLayer

public GpxLayer fromLayer

currentMarker

private Marker currentMarker
Constructor Detail

MarkerLayer

public MarkerLayer(GpxData indata,
                   java.lang.String name,
                   java.io.File associatedFile,
                   GpxLayer fromLayer)

MarkerLayer

public MarkerLayer(GpxData indata,
                   java.lang.String name,
                   java.io.File associatedFile,
                   GpxLayer fromLayer,
                   boolean addMouseHandlerInConstructor)
Method Detail

addMouseHandler

public void addMouseHandler()

getIcon

public javax.swing.Icon getIcon()
Return a static icon.

Specified by:
getIcon in class Layer

getColor

public java.awt.Color getColor(boolean ignoreCustom)
Description copied from class: Layer
Return a Color for this layer. Return null when no color specified.

Overrides:
getColor in class Layer
Parameters:
ignoreCustom - Custom color should return null, as no default color is used. When this is true, then even for custom coloring the base color is returned - mainly for layer internal use.

getGenericColor

public static java.awt.Color getGenericColor()

paint

public void paint(java.awt.Graphics2D g,
                  MapView mv,
                  Bounds box)
Description copied from class: Layer
Paint the dataset using the engine set.

Specified by:
paint in interface MapViewPaintable
Specified by:
paint in class Layer
mv - The object that can translate GeoPoints to screen coordinates.

getToolTipText

public java.lang.String getToolTipText()
Specified by:
getToolTipText in class Layer
Returns:
A small tooltip hint about some statistics for this layer.

mergeFrom

public void mergeFrom(Layer from)
Description copied from class: Layer
Merges the given layer into this layer. Throws if the layer types are incompatible.

Specified by:
mergeFrom in class Layer
Parameters:
from - The layer that get merged into this one. After the merge, the other layer is not usable anymore and passing to one others mergeFrom should be one of the last things to do with a layer.

isMergable

public boolean isMergable(Layer other)
Specified by:
isMergable in class Layer
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

public void visitBoundingBox(BoundingXYVisitor v)
Specified by:
visitBoundingBox in class Layer

getInfoComponent

public java.lang.Object getInfoComponent()
Specified by:
getInfoComponent in class Layer

getMenuEntries

public javax.swing.Action[] getMenuEntries()
Description copied from class: Layer
Returns 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 SeparatorLayerAction.INSTANCE instead of new JSeparator

Specified by:
getMenuEntries in class Layer

synchronizeAudioMarkers

public boolean synchronizeAudioMarkers(AudioMarker startMarker)

addAudioMarker

public AudioMarker addAudioMarker(double time,
                                  LatLon coor)

jumpToNextMarker

public void jumpToNextMarker()
Specified by:
jumpToNextMarker in interface JumpToMarkerActions.JumpToMarkerLayer

jumpToPreviousMarker

public void jumpToPreviousMarker()
Specified by:
jumpToPreviousMarker in interface JumpToMarkerActions.JumpToMarkerLayer

playAudio

public static void playAudio()

playNextMarker

public static void playNextMarker()

playPreviousMarker

public static void playPreviousMarker()

getAdjacentMarker

private static Marker getAdjacentMarker(Marker startMarker,
                                        boolean next,
                                        Layer layer)

playAdjacentMarker

private static void playAdjacentMarker(Marker startMarker,
                                       boolean next)

isTextOrIconShown

private boolean isTextOrIconShown()
Get state of text display.

Returns:
true if text should be shown, false otherwise.


JOSM