net.divbyzero.gpx
Class Track

java.lang.Object
  extended by net.divbyzero.gpx.Track
All Implemented Interfaces:
Measurable

public class Track
extends Object
implements Measurable

A GPS track

A track consists of an arbitrary number of segments. Tracks have a length, can be queried for elevations and for the points in time when they were entered and left during a recording.

Since:
0.1
Author:
Martin Jansen

Constructor Summary
Track()
           
 
Method Summary
 void addSegment(TrackSegment segment)
          Adds a new segment to the track.
 double cumulativeAscent()
          Calculates the total ascent in the track.
 double cumulativeDescent()
          Calculates the total descent in the track.
 Date endTime()
          Returns the point in time when the track was left
 ArrayList<TrackSegment> getSegments()
          Returns the segments of which the track consists.
 double length()
          Calculates the length of the track
 Date startingTime()
          Returns the point in time when the track was entered
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Track

public Track()
Method Detail

addSegment

public void addSegment(TrackSegment segment)
Adds a new segment to the track.

This method is used for extending a track by another segment. The segment is added at the tracks's end.

Parameters:
segment - the segment to be added to the track

getSegments

public ArrayList<TrackSegment> getSegments()
Returns the segments of which the track consists.

This method returns a list of the segments that make up the track. They are returned in the order that they were added, i.e. the segment at which the track start is at position 0 while the segment where the track ends is at the last position of the list.

Returns:
a list of the track's segments

length

public double length()
Calculates the length of the track

Specified by:
length in interface Measurable
Returns:
the tracks's length in meters

cumulativeAscent

public double cumulativeAscent()
Calculates the total ascent in the track.

The total ascent of the track is calculated by comparing each of the track's segments with their predecessors. If the elevation of a segments is higher than the elevation of the predecessor, the total ascent is increased accordingly.

Specified by:
cumulativeAscent in interface Measurable
Returns:
the tracks's total ascent in meters
See Also:
cumulativeDescent()

cumulativeDescent

public double cumulativeDescent()
Calculates the total descent in the track.

The total descent of the track is calculated by comparing each of the track's segments with their predecessors. If the elevation of a segment is lower than the elevation of the predecessor, the total descent is increased accordingly.

Specified by:
cumulativeDescent in interface Measurable
Returns:
the tracks's total descent in meters
See Also:
cumulativeAscent()

startingTime

public Date startingTime()
Returns the point in time when the track was entered

Usually this is the time stamp of the segment that was added first to the track.

Specified by:
startingTime in interface Measurable
Returns:
the point in time when the track was entered
See Also:
endTime()

endTime

public Date endTime()
Returns the point in time when the track was left

Usually this is the time stamp of the segment that was added last to the track.

Specified by:
endTime in interface Measurable
Returns:
the point in time when the track was left
See Also:
startingTime()


Processing library MapThing by Jon Reades. (C) 2013