public class Marker extends java.lang.Object implements TemplateEngineDataProvider, ILatLon
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 java.lang.String |
cachedText |
private CachedLatLon |
coor |
private TemplateEngineDataProvider |
dataProvider |
private boolean |
erroneous |
static java.lang.String |
LABEL_PATTERN_AUTO |
static java.lang.String |
LABEL_PATTERN_DESC |
static java.lang.String |
LABEL_PATTERN_NAME |
static java.lang.String |
MARKER_FORMATTED_OFFSET |
static java.lang.String |
MARKER_OFFSET |
private static 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).
|
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 java.awt.image.BufferedImage |
redSymbol |
protected javax.swing.ImageIcon |
symbol |
private java.lang.String |
text |
private int |
textVersion |
double |
time
Absolute time of marker in seconds since epoch
|
private java.text.DateFormat |
timeFormatter |
Modifier | Constructor and Description |
---|---|
|
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) |
private |
Marker(LatLon ll,
TemplateEngineDataProvider dataProvider,
java.lang.String text,
java.lang.String iconName,
MarkerLayer parentLayer,
double time,
double offset) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ev)
Called when the mouse is clicked in the marker's hotspot.
|
static void |
appendMarkerProducer(MarkerProducers mp)
Add a new marker producers at the end of the JOSM list.
|
boolean |
containsPoint(java.awt.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 java.util.Collection<Marker> |
createMarkers(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.
|
boolean |
evaluateCondition(SearchCompiler.Match condition)
Check if a condition holds for the object represented by this
TemplateEngineDataProvider . |
private java.lang.String |
formatOffset() |
LatLon |
getCoor()
Returns the marker's coordinates.
|
java.util.Collection<java.lang.String> |
getTemplateKeys()
Get the collection of all keys that can be mapped to values.
|
java.lang.Object |
getTemplateValue(java.lang.String name,
boolean special)
Map a key to a value given the properties of the object.
|
java.lang.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.
|
double |
lat()
Returns the latitude, i.e., the north-south position in degrees.
|
double |
lon()
Returns the longitude, i.e., the east-west position in degrees.
|
void |
paint(java.awt.Graphics g,
MapView mv,
boolean mousePressed,
boolean showTextOrIcon)
Paints the marker.
|
protected void |
paintIcon(MapView mv,
java.awt.Graphics g,
int x,
int y) |
static void |
prependMarkerProducer(MarkerProducers mp)
Add a new marker producers at the beginning of the JOSM list.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEastNorth, isLatLonKnown
private static final java.util.List<MarkerProducers> markerProducers
public static final java.lang.String MARKER_OFFSET
public static final java.lang.String MARKER_FORMATTED_OFFSET
public static final java.lang.String LABEL_PATTERN_AUTO
public static final java.lang.String LABEL_PATTERN_NAME
public static final java.lang.String LABEL_PATTERN_DESC
private final java.text.DateFormat timeFormatter
private final TemplateEngineDataProvider dataProvider
private final java.lang.String text
protected final javax.swing.ImageIcon symbol
private java.awt.image.BufferedImage redSymbol
public final MarkerLayer parentLayer
public double time
public double offset
private java.lang.String cachedText
private int textVersion
private CachedLatLon coor
private boolean erroneous
public Marker(LatLon ll, TemplateEngineDataProvider dataProvider, java.lang.String iconName, MarkerLayer parentLayer, double time, double offset)
public Marker(LatLon ll, java.lang.String text, java.lang.String iconName, MarkerLayer parentLayer, double time, double offset)
private Marker(LatLon ll, TemplateEngineDataProvider dataProvider, java.lang.String text, java.lang.String iconName, MarkerLayer parentLayer, double time, double offset)
public static void appendMarkerProducer(MarkerProducers mp)
mp
- a new marker producerspublic static void prependMarkerProducer(MarkerProducers mp)
mp
- a new marker producerspublic static java.util.Collection<Marker> createMarkers(WayPoint wpt, java.io.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 double lon()
ILatLon
lon
in interface ILatLon
ILatLon.isLatLonKnown()
returns falsepublic double lat()
ILatLon
lat
in interface ILatLon
ILatLon.isLatLonKnown()
returns falsepublic boolean containsPoint(java.awt.Point p)
p
- The point to checktrue
if the marker "hotspot" contains the point.public void actionPerformed(java.awt.event.ActionEvent ev)
ev
- A dummy ActionEventpublic void paint(java.awt.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 java.lang.String getText()
public java.util.Collection<java.lang.String> getTemplateKeys()
TemplateEngineDataProvider
getTemplateKeys
in interface TemplateEngineDataProvider
private java.lang.String formatOffset()
public java.lang.Object getTemplateValue(java.lang.String name, boolean special)
TemplateEngineDataProvider
getTemplateValue
in interface TemplateEngineDataProvider
name
- the key to mapspecial
- if the key is a "special:*" keyword that is used
to get certain information or automated behaviorspecial
is truepublic boolean evaluateCondition(SearchCompiler.Match condition)
TemplateEngineDataProvider
TemplateEngineDataProvider
.evaluateCondition
in interface TemplateEngineDataProvider
condition
- the condition to check (which is a search expression)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