public class WayPoint extends WithAttributes implements java.lang.Comparable<WayPoint>, TemplateEngineDataProvider, ILatLon
Modifier and Type | Class and Description |
---|---|
private static class |
WayPoint.LegacyMap
Interim to detect legacy code that is not using
WayPoint.setTime(x)
functions, but attr.put(PT_TIME, (String) x) logic. |
GpxConstants.ColorFormat
Modifier and Type | Field and Description |
---|---|
java.awt.Color |
customColoring
The color to draw the segment before this point in
|
int |
dir
The direction of the line before this point.
|
boolean |
drawLine
true indicates that the line before this point should be drawn |
private double |
east |
private java.lang.Object |
eastNorthCacheKey |
private double |
lat |
private double |
lon |
private double |
north |
attr
EXTENSION_ABBREVIATIONS, FIX_VALUES, GARMIN_COLORS, GPX_CMT, GPX_DESC, GPX_NAME, GPX_PREFIX, GPX_SRC, META_AUTHOR_EMAIL, META_AUTHOR_LINK, META_AUTHOR_NAME, META_BOUNDS, META_COPYRIGHT_AUTHOR, META_COPYRIGHT_LICENSE, META_COPYRIGHT_YEAR, META_DESC, META_KEYWORDS, META_LINKS, META_NAME, META_PREFIX, META_TIME, PT_AGEOFDGPSDATA, PT_DGPSID, PT_ELE, PT_FIX, PT_GEOIDHEIGHT, PT_HDOP, PT_MAGVAR, PT_PDOP, PT_SAT, PT_SYM, PT_TIME, PT_TYPE, PT_VDOP, RTE_TRK_KEYS, RTKLIB_AGE, RTKLIB_Q, RTKLIB_RATIO, RTKLIB_SDE, RTKLIB_SDEU, RTKLIB_SDN, RTKLIB_SDNE, RTKLIB_SDU, RTKLIB_SDUN, WPT_KEYS, XML_URI_EXTENSIONS_DRAWING, XML_URI_EXTENSIONS_GARMIN, XML_URI_EXTENSIONS_JOSM, XML_URI_XSD, XML_XSD_EXTENSIONS_DRAWING, XML_XSD_EXTENSIONS_GARMIN, XML_XSD_EXTENSIONS_JOSM
Constructor and Description |
---|
WayPoint(LatLon ll)
Constructs a new
WayPoint from lat/lon coordinates. |
WayPoint(WayPoint p)
Constructs a new
WayPoint from an existing one. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(WayPoint w) |
boolean |
equals(java.lang.Object obj) |
boolean |
evaluateCondition(SearchCompiler.Match condition)
Check if a condition holds for the object represented by this
TemplateEngineDataProvider . |
LatLon |
getCoor()
Returns the waypoint coordinates.
|
java.util.Date |
getDate()
Returns the waypoint time Date object.
|
private java.util.Date |
getDateImpl()
Returns the waypoint time Date object.
|
EastNorth |
getEastNorth(Projecting projecting)
Replies the projected east/north coordinates.
|
java.util.List<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.
|
double |
getTime()
Returns the waypoint time in seconds since the epoch.
|
long |
getTimeInMillis()
Returns the waypoint time in milliseconds since the epoch.
|
boolean |
hasDate()
Returns true if this waypoint has a time.
|
int |
hashCode() |
void |
invalidateEastNorthCache()
Invalidate the internal cache of east/north coordinates.
|
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 |
setTime(java.util.Date time)
Sets the
GpxConstants.PT_TIME attribute to the specified time. |
void |
setTime(long ts)
Sets the
GpxConstants.PT_TIME attribute to the specified time. |
void |
setTimeInMillis(long ts)
Sets the
GpxConstants.PT_TIME attribute to the specified time. |
java.lang.String |
toString() |
get, getAttributes, getCollection, getExtensions, getString, put
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isLatLonKnown
getExtensionAbbreviations, getGarminColors
public java.awt.Color customColoring
drawLine
public boolean drawLine
true
indicates that the line before this point should be drawnpublic int dir
private final double lat
private final double lon
private double east
private double north
private java.lang.Object eastNorthCacheKey
public WayPoint(WayPoint p)
WayPoint
from an existing one.
Except for PT_TIME attribute, all attribute objects are shallow copied.
This means modification of attr objects will affect original and new WayPoint
.p
- existing waypointpublic void invalidateEastNorthCache()
public final LatLon getCoor()
public double lon()
ILatLon
lon
in interface ILatLon
ILatLon.isLatLonKnown()
returns falsepublic double lat()
ILatLon
lat
in interface ILatLon
ILatLon.isLatLonKnown()
returns falsepublic final EastNorth getEastNorth(Projecting projecting)
ILatLon
The result of the last conversion may be cached. Null is returned in case this object is invalid.
getEastNorth
in interface ILatLon
projecting
- The projection to use.public java.lang.String toString()
toString
in class java.lang.Object
public void setTime(java.util.Date time)
GpxConstants.PT_TIME
attribute to the specified time.time
- the time to setpublic void setTime(long ts)
GpxConstants.PT_TIME
attribute to the specified time.ts
- seconds from the epochpublic void setTimeInMillis(long ts)
GpxConstants.PT_TIME
attribute to the specified time.ts
- milliseconds from the epochpublic int compareTo(WayPoint w)
compareTo
in interface java.lang.Comparable<WayPoint>
public double getTime()
public long getTimeInMillis()
public boolean hasDate()
public java.util.Date getDate()
private java.util.Date getDateImpl()
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 java.util.List<java.lang.String> getTemplateKeys()
TemplateEngineDataProvider
getTemplateKeys
in interface TemplateEngineDataProvider
public int hashCode()
hashCode
in class WithAttributes
public boolean equals(java.lang.Object obj)
equals
in class WithAttributes