java.lang.Object
io.jenetics.jpx.Track
- All Implemented Interfaces:
Serializable,Iterable<TrackSegment>
Represents a GPX track - an ordered list of points describing a path.
Creating a Track object with one track-segment and 3 track-points:
final Track track = Track.builder()
.name("Track 1")
.description("Mountain bike tour.")
.addSegment(segment -> segment
.addPoint(p -> p.lat(48.2081743).lon(16.3738189).ele(160))
.addPoint(p -> p.lat(48.2081743).lon(16.3738189).ele(161))
.addPoint(p -> p.lat(48.2081743).lon(16.3738189).ele(162))))
.addSegment(segment -> segment
.addPoint(p -> p.lat(46.2081743).lon(16.3738189).ele(160))
.addPoint(p -> p.lat(47.2081743).lon(16.3738189).ele(161))
.addPoint(p -> p.lat(49.2081743).lon(16.3738189).ele(162))))
.build();- Since:
- 1.0
- Version:
- 1.5
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder class for creating immutableTrackobjects. -
Method Summary
Modifier and TypeMethodDescriptionstatic Track.Builderbuilder()booleanReturn the GPS comment of the track.Return the text description of the track.Return the (cloned) extensions document.getLinks()Return the links to external information about the track.getName()Return the track name.Return the GPS track number.Return the sequence of route points.Return the source of data.getType()Return the type (classification) of the track.inthashCode()booleanisEmpty()Returntrueif all track properties arenullor empty.iterator()booleannonEmpty()Returntrueif not all track properties arenullor empty.static Trackof(String name, String comment, String description, String source, List<Link> links, UInt number, String type, List<TrackSegment> segments) Create a newTrackwith the given parameters.static Trackof(String name, String comment, String description, String source, List<Link> links, UInt number, String type, Document extensions, List<TrackSegment> segments) Create a newTrackwith the given parameters.segments()Return a stream ofTrackSegmentobjects this track contains.Convert the immutable track object into a mutable builder initialized with the current track values.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getName
Return the track name.- Returns:
- the track name
-
getComment
Return the GPS comment of the track.- Returns:
- the GPS comment of the track
-
getDescription
Return the text description of the track.- Returns:
- the text description of the track
-
getSource
Return the source of data. Included to give user some idea of reliability and accuracy of data.- Returns:
- the source of data
-
getLinks
Return the links to external information about the track.- Returns:
- the links to external information about the track
-
getNumber
Return the GPS track number.- Returns:
- the GPS track number
-
getType
Return the type (classification) of the track.- Returns:
- the type (classification) of the track
-
getExtensions
Return the (cloned) extensions document. The root element of the returned document has the nameextensions.<extensions> ... </extensions>- Returns:
- the extensions document
- Throws:
DOMException- if the document could not be cloned, because of an erroneous XML configuration- Since:
- 1.5
-
getSegments
Return the sequence of route points.- Returns:
- the sequence of route points
-
segments
Return a stream ofTrackSegmentobjects this track contains.- Returns:
- a stream of
TrackSegmentobjects this track contains
-
iterator
- Specified by:
iteratorin interfaceIterable<TrackSegment>
-
toBuilder
Convert the immutable track object into a mutable builder initialized with the current track values.- Returns:
- a new track builder initialized with the values of
thistrack - Since:
- 1.1
-
isEmpty
Returntrueif all track properties arenullor empty.- Returns:
trueif all track properties arenullor empty
-
nonEmpty
Returntrueif not all track properties arenullor empty.- Returns:
trueif not all track properties arenullor empty- Since:
- 1.1
-
hashCode
-
equals
-
toString
-
builder
-
of
public static Track of(String name, String comment, String description, String source, List<Link> links, UInt number, String type, Document extensions, List<TrackSegment> segments) Create a newTrackwith the given parameters.- Parameters:
name- the GPS name of the trackcomment- the GPS comment for the trackdescription- user description of the tracksource- the source of data. Included to give user some idea of reliability and accuracy of data.links- the links to external information about tracknumber- the GPS track numbertype- the type (classification) of trackextensions- the extensions documentsegments- the track-segments holds a list of track-points which are logically connected in order. To represent a single GPS track where GPS reception was lost, or the GPS receiver was turned off, start a new track-segment for each continuous span of track data.- Returns:
- a new
Trackwith the given parameters - Throws:
NullPointerException- if thelinksor thesegmentssequence isnull- Since:
- 1.5
-
of
public static Track of(String name, String comment, String description, String source, List<Link> links, UInt number, String type, List<TrackSegment> segments) Create a newTrackwith the given parameters.- Parameters:
name- the GPS name of the trackcomment- the GPS comment for the trackdescription- user description of the tracksource- the source of data. Included to give user some idea of reliability and accuracy of data.links- the links to external information about tracknumber- the GPS track numbertype- the type (classification) of tracksegments- the track-segments holds a list of track-points which are logically connected in order. To represent a single GPS track where GPS reception was lost, or the GPS receiver was turned off, start a new track-segment for each continuous span of track data.- Returns:
- a new
Trackwith the given parameters - Throws:
NullPointerException- if thelinksor thesegmentssequence isnull
-