public class GpxTrack extends WithAttributes implements IGpxTrack
Modifier and Type | Class and Description |
---|---|
(package private) static class |
GpxTrack.GpxTrackChangeEvent
Deprecated.
use
IGpxTrack.GpxTrackChangeEvent instead |
(package private) static interface |
GpxTrack.GpxTrackChangeListener
Deprecated.
use
IGpxTrack.GpxTrackChangeListener instead |
GpxConstants.ColorFormat
Modifier and Type | Field and Description |
---|---|
private Bounds |
bounds |
private static java.util.HashMap<java.awt.Color,java.lang.String> |
closestGarminColorCache |
private java.awt.Color |
colorCache |
private GpxConstants.ColorFormat |
colorFormat |
private double |
length |
private ListenerList<IGpxTrack.GpxTrackChangeListener> |
listeners |
private java.util.List<IGpxTrackSegment> |
segments |
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 |
---|
GpxTrack(java.util.Collection<java.util.Collection<WayPoint>> trackSegs,
java.util.Map<java.lang.String,java.lang.Object> attributes)
Constructs a new
GpxTrack . |
GpxTrack(java.util.List<IGpxTrackSegment> trackSegs,
java.util.Map<java.lang.String,java.lang.Object> attributes)
Constructs a new
GpxTrack from GpxTrackSegment objects. |
Modifier and Type | Method and Description |
---|---|
void |
addListener(IGpxTrack.GpxTrackChangeListener l)
Add a listener that listens to changes in the GPX track.
|
private Bounds |
calculateBounds() |
private double |
calculateLength() |
private double |
colorDist(java.awt.Color c1,
java.awt.Color c2) |
void |
convertColor(GpxConstants.ColorFormat cFormat)
Converts the color to the given format, if present.
|
boolean |
equals(java.lang.Object obj) |
private void |
fireInvalidate() |
Bounds |
getBounds()
Returns the track bounds.
|
java.awt.Color |
getColor()
Gets the color of this track.
|
private java.awt.Color |
getColorFromExtension() |
java.util.Collection<IGpxTrackSegment> |
getSegments()
Returns the track segments.
|
int |
hashCode() |
void |
invalidate()
Resets the color cache
|
double |
length()
Returns the track length.
|
void |
put(java.lang.String key,
java.lang.Object value)
Put a key / value pair as a new attribute.
|
void |
removeListener(IGpxTrack.GpxTrackChangeListener l)
Remove a listener that listens to changes in the GPX track.
|
void |
setColor(java.awt.Color color)
Sets the color of this track.
|
private void |
setColorExtension(java.awt.Color color) |
get, getAttributes, getCollection, getExtensions, getString
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
get, getAttributes, getCollection, getExtensions, getString
getExtensionAbbreviations, getGarminColors
private final java.util.List<IGpxTrackSegment> segments
private final double length
private java.awt.Color colorCache
private final ListenerList<IGpxTrack.GpxTrackChangeListener> listeners
private static final java.util.HashMap<java.awt.Color,java.lang.String> closestGarminColorCache
private GpxConstants.ColorFormat colorFormat
public GpxTrack(java.util.Collection<java.util.Collection<WayPoint>> trackSegs, java.util.Map<java.lang.String,java.lang.Object> attributes)
GpxTrack
.trackSegs
- track segmentsattributes
- track attributespublic GpxTrack(java.util.List<IGpxTrackSegment> trackSegs, java.util.Map<java.lang.String,java.lang.Object> attributes)
GpxTrack
from GpxTrackSegment
objects.trackSegs
- The segments to build the track from. Input is not deep-copied,
which means the caller may reuse the same segments to build
multiple GpxTrack instances from. This should not be
a problem, since this object cannot modify this.segments
.attributes
- Attributes for the GpxTrack, the input map is copied.private double calculateLength()
private Bounds calculateBounds()
public void setColor(java.awt.Color color)
IGpxTrack
private void setColorExtension(java.awt.Color color)
public java.awt.Color getColor()
IGpxTrack
private java.awt.Color getColorFromExtension()
public void convertColor(GpxConstants.ColorFormat cFormat)
cFormat
- can be a GpxConstants.ColorFormat
private double colorDist(java.awt.Color c1, java.awt.Color c2)
public void put(java.lang.String key, java.lang.Object value)
WithAttributes
put
in interface IWithAttributes
put
in class WithAttributes
key
- the keyvalue
- the valueprivate void fireInvalidate()
public Bounds getBounds()
IGpxTrack
public double length()
IGpxTrack
public java.util.Collection<IGpxTrackSegment> getSegments()
IGpxTrack
getSegments
in interface IGpxTrack
public int hashCode()
hashCode
in class WithAttributes
public boolean equals(java.lang.Object obj)
equals
in class WithAttributes
public void addListener(IGpxTrack.GpxTrackChangeListener l)
IGpxTrack
addListener
in interface IGpxTrack
l
- The listenerpublic void removeListener(IGpxTrack.GpxTrackChangeListener l)
IGpxTrack
removeListener
in interface IGpxTrack
l
- The listenerpublic void invalidate()