public class Marker extends Object implements TemplateEngineDataProvider
containsPoint
if you like to respond to user clicksModifier and Type | Class and Description |
---|---|
static class |
Marker.TemplateEntryProperty |
Modifier and Type | Field and Description |
---|---|
private String |
cachedText |
private CachedLatLon |
coor |
private TemplateEngineDataProvider |
dataProvider |
private boolean |
erroneous |
static String |
LABEL_PATTERN_AUTO |
static String |
LABEL_PATTERN_DESC |
static String |
LABEL_PATTERN_NAME |
static String |
MARKER_FORMATTED_OFFSET |
static String |
MARKER_OFFSET |
static 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).
|
double |
offset
Time offset in seconds from the gpx point from which it was derived, may be adjusted later to sync with other data, so not final
|
MarkerLayer |
parentLayer |
private BufferedImage |
redSymbol |
protected ImageIcon |
symbol |
private String |
text |
private int |
textVersion |
double |
time
Absolute time of marker in seconds since epoch
|
private DateFormat |
timeFormatter |
Modifier | Constructor and Description |
---|---|
|
Marker(LatLon ll,
String text,
String iconName,
MarkerLayer parentLayer,
double time,
double offset) |
|
Marker(LatLon ll,
TemplateEngineDataProvider dataProvider,
String iconName,
MarkerLayer parentLayer,
double time,
double offset) |
private |
Marker(LatLon ll,
TemplateEngineDataProvider dataProvider,
String text,
String iconName,
MarkerLayer parentLayer,
double time,
double offset) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent ev)
Called when the mouse is clicked in the marker's hotspot.
|
boolean |
containsPoint(Point p)
Checks whether the marker display area contains the given point.
|
WayPoint |
convertToWayPoint()
Convert Marker to WayPoint so it can be exported to a GPX file.
|
static Marker |
createMarker(WayPoint wpt,
File relativePath,
MarkerLayer parentLayer,
double time,
double offset)
Returns an object of class Marker or one of its subclasses
created from the parameters given.
|
boolean |
evaluateCondition(SearchCompiler.Match condition) |
private String |
formatOffset() |
LatLon |
getCoor()
Returns the marker's coordinates.
|
EastNorth |
getEastNorth()
Returns the marker's projected coordinates.
|
Collection<String> |
getTemplateKeys() |
Object |
getTemplateValue(String name,
boolean special) |
String |
getText()
Returns the Text which should be displayed, depending on chosen preference
|
protected Marker.TemplateEntryProperty |
getTextTemplate() |
boolean |
isErroneous()
Determines if this marker is erroneous.
|
void |
paint(Graphics g,
MapView mv,
boolean mousePressed,
boolean showTextOrIcon)
Paints the marker.
|
protected void |
paintIcon(MapView mv,
Graphics g,
int x,
int y) |
void |
setCoor(LatLon coor)
Sets the marker's coordinates.
|
void |
setEastNorth(EastNorth eastNorth)
Sets the marker's projected coordinates.
|
void |
setErroneous(boolean erroneous)
Sets this marker erroneous or not.
|
public static final List<MarkerProducers> markerProducers
public static final String MARKER_OFFSET
public static final String MARKER_FORMATTED_OFFSET
public static final String LABEL_PATTERN_AUTO
public static final String LABEL_PATTERN_NAME
public static final String LABEL_PATTERN_DESC
private final DateFormat timeFormatter
private final TemplateEngineDataProvider dataProvider
private BufferedImage redSymbol
public final MarkerLayer parentLayer
public double time
public double offset
private String cachedText
private int textVersion
private CachedLatLon coor
private boolean erroneous
public Marker(LatLon ll, TemplateEngineDataProvider dataProvider, String iconName, MarkerLayer parentLayer, double time, double offset)
public Marker(LatLon ll, String text, String iconName, MarkerLayer parentLayer, double time, double offset)
private Marker(LatLon ll, TemplateEngineDataProvider dataProvider, String text, String iconName, MarkerLayer parentLayer, double time, double offset)
public static Marker createMarker(WayPoint wpt, File relativePath, MarkerLayer parentLayer, double time, double offset)
wpt
- waypoint data for markerrelativePath
- An path to use for constructing relative URLs or
null
for no relative URLsparentLayer
- the MarkerLayer
that will contain the created Marker
time
- time of the marker in seconds since epochoffset
- double in seconds as the time offset of this marker from
the GPX file from which it was derived (if any).public WayPoint convertToWayPoint()
public final void setCoor(LatLon coor)
coor
- The marker's coordinates (lat/lon)public final LatLon getCoor()
public final void setEastNorth(EastNorth eastNorth)
eastNorth
- The marker's projected coordinates (easting/northing)public final EastNorth getEastNorth()
public boolean containsPoint(Point p)
p
- The point to checktrue
if the marker "hotspot" contains the point.public void actionPerformed(ActionEvent ev)
ev
- A dummy ActionEventpublic void paint(Graphics g, MapView mv, boolean mousePressed, boolean showTextOrIcon)
g
- graphics contextmv
- map viewmousePressed
- true if the left mouse button is pressedshowTextOrIcon
- true if text and icon shall be drawnprotected Marker.TemplateEntryProperty getTextTemplate()
public String getText()
public Collection<String> getTemplateKeys()
getTemplateKeys
in interface TemplateEngineDataProvider
private String formatOffset()
public Object getTemplateValue(String name, boolean special)
getTemplateValue
in interface TemplateEngineDataProvider
public boolean evaluateCondition(SearchCompiler.Match condition)
evaluateCondition
in interface TemplateEngineDataProvider
public final boolean isErroneous()
true
if this markers has any kind of error, false
otherwisepublic final void setErroneous(boolean erroneous)
erroneous
- true
if this markers has any kind of error, false
otherwise