tag of the GPX file.
HowTo implement a new Marker
- Subclass Marker or ButtonMarker and override
containsPoint
if you like to respond to user clicks
- Override paint, if you want a custom marker look (not "a label and a symbol")
- Implement MarkerCreator to return a new instance of your marker class
- In you plugin constructor, add an instance of your MarkerCreator
implementation either on top or bottom of Marker.markerProducers.
Add at top, if your marker should overwrite an current marker or at bottom
if you only add a new marker style.
Constructor Summary |
Marker(LatLon ll,
java.lang.String text,
java.lang.String iconName,
MarkerLayer parentLayer,
double time,
double offset)
|
Marker(LatLon ll,
TemplateEngineDataProvider dataProvider,
java.lang.String iconName,
MarkerLayer parentLayer,
double time,
double offset)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
markerProducers
public static final java.util.List<MarkerProducers> markerProducers
- Plugins can add their Marker creation stuff at the bottom or top of this list
(depending on whether they want to override default behaviour or just add new
stuff).
MARKER_OFFSET
public static final java.lang.String MARKER_OFFSET
- See Also:
- Constant Field Values
MARKER_FORMATTED_OFFSET
public static final java.lang.String MARKER_FORMATTED_OFFSET
- See Also:
- Constant Field Values
LABEL_PATTERN_AUTO
public static final java.lang.String LABEL_PATTERN_AUTO
- See Also:
- Constant Field Values
LABEL_PATTERN_NAME
public static final java.lang.String LABEL_PATTERN_NAME
- See Also:
- Constant Field Values
LABEL_PATTERN_DESC
public static final java.lang.String LABEL_PATTERN_DESC
- See Also:
- Constant Field Values
dataProvider
private final TemplateEngineDataProvider dataProvider
text
private final java.lang.String text
symbol
public final javax.swing.Icon symbol
parentLayer
public final MarkerLayer parentLayer
time
public double time
offset
public double offset
cachedText
private java.lang.String cachedText
textVersion
private int textVersion
coor
private CachedLatLon coor
Marker
public Marker(LatLon ll,
TemplateEngineDataProvider dataProvider,
java.lang.String iconName,
MarkerLayer parentLayer,
double time,
double offset)
Marker
public Marker(LatLon ll,
java.lang.String text,
java.lang.String iconName,
MarkerLayer parentLayer,
double time,
double offset)
createMarker
public static Marker createMarker(WayPoint wpt,
java.io.File relativePath,
MarkerLayer parentLayer,
double time,
double offset)
- Returns an object of class Marker or one of its subclasses
created from the parameters given.
- Parameters:
wpt
- waypoint data for markerrelativePath
- An path to use for constructing relative URLs or
null
for no relative URLsoffset
- double in seconds as the time offset of this marker from
the GPX file from which it was derived (if any).
- Returns:
- a new Marker object
setCoor
public final void setCoor(LatLon coor)
getCoor
public final LatLon getCoor()
setEastNorth
public final void setEastNorth(EastNorth eastNorth)
getEastNorth
public final EastNorth getEastNorth()
containsPoint
public boolean containsPoint(java.awt.Point p)
- Checks whether the marker display area contains the given point.
Markers not interested in mouse clicks may always return false.
- Parameters:
p
- The point to check
- Returns:
true
if the marker "hotspot" contains the point.
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent ev)
- Called when the mouse is clicked in the marker's hotspot. Never
called for markers which always return false from containsPoint.
- Parameters:
ev
- A dummy ActionEvent
paint
public void paint(java.awt.Graphics g,
MapView mv,
boolean mousePressed,
boolean showTextOrIcon)
- Paints the marker.
- Parameters:
g
- graphics contextmv
- map viewmousePressed
- true if the left mouse button is pressed
getTextTemplate
protected Marker.TemplateEntryProperty getTextTemplate()
getText
public java.lang.String getText()
- Returns the Text which should be displayed, depending on chosen preference
- Returns:
- Text of the label
getTemplateKeys
public java.util.Collection<java.lang.String> getTemplateKeys()
- Specified by:
getTemplateKeys
in interface TemplateEngineDataProvider
formatOffset
private java.lang.String formatOffset()
getTemplateValue
public java.lang.Object getTemplateValue(java.lang.String name,
boolean special)
- Specified by:
getTemplateValue
in interface TemplateEngineDataProvider
evaluateCondition
public boolean evaluateCondition(SearchCompiler.Match condition)
- Specified by:
evaluateCondition
in interface TemplateEngineDataProvider
JOSM