net.divbyzero.gpx
Class Waypoint

java.lang.Object
  extended by net.divbyzero.gpx.Waypoint

public class Waypoint
extends Object

Way point for the GPS tracks.

Way points represent the smallest unit of which GPS track are composed. They are made up of a coordinate, a time stamp, an optional name and an elevation.

Since:
0.1
Author:
Martin Jansen

Constructor Summary
Waypoint()
           
 
Method Summary
 double calculateDistanceTo(Waypoint otherPoint)
          Calculates the distance between this way point and another one
 Coordinate getCoordinate()
          Returns the coordinate of the way point
 double getElevation()
          Returns the elevation of the way point
 String getName()
          Returns the name of the way point.
 Date getTime()
          Returns the time stamp of the way point.
 void setCoordinate(Coordinate coordinate)
          Sets the coordinate of the way point.
 void setElevation(double elevation)
          Sets the elevation of the way point in meters
 void setName(String name)
          Sets the name of the way point.
 void setTime(Date time)
          Sets the time stamp of the way point.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Waypoint

public Waypoint()
Method Detail

setTime

public void setTime(Date time)
Sets the time stamp of the way point.

The time stamp denotes the point in time when a way point was recorded. The library does not assume anything regarding the use of time zones. Instead time stamps are accepted "as is".

Parameters:
time - the time stamp of the way point

getTime

public Date getTime()
Returns the time stamp of the way point.

Returns:
the time stamp of the way point

setCoordinate

public void setCoordinate(Coordinate coordinate)
Sets the coordinate of the way point.

Parameters:
coordinate - the coordinate of the way point

getCoordinate

public Coordinate getCoordinate()
Returns the coordinate of the way point

Returns:
the coordinate of the way point

setName

public void setName(String name)
Sets the name of the way point.

Optionally a way point can be label with a name in order to describe it further.

Parameters:
name - the name of the waypoint

getName

public String getName()
Returns the name of the way point.

Returns:
the name of the way point

setElevation

public void setElevation(double elevation)
Sets the elevation of the way point in meters

Internally the library expects the elevation to be in meters instead of feet or anything else. No conversion is applied to ensure this though.

Parameters:
elevation - the way point's elevation in meters

getElevation

public double getElevation()
Returns the elevation of the way point

Returns:
the way point's elevation in meters

calculateDistanceTo

public double calculateDistanceTo(Waypoint otherPoint)
Calculates the distance between this way point and another one

In order to calculate the distance, the Spherical Law of Cosines is used. An equatorial radius of 6,378.137 kilometers is assumed.

Parameters:
otherPoint - The other way point
Returns:
the distance in meters
See Also:
Wikipedia on the Spherical Law Of Cosines, Implementation notes


Processing library MapThing by Jon Reades. (C) 2013