us.zuercher.gpx2map.coord
Class LatLon

java.lang.Object
  extended by us.zuercher.gpx2map.coord.LatLon

public final class LatLon
extends Object

LatLon represents a location as decimal degrees of latitude and longitude.

Author:
Stephan Zuercher

Field Summary
private  double latitude
          Degrees latitude.
private  double longitude
          Degrees longitude.
 
Constructor Summary
LatLon(double latitude, double longitude)
          Construct a new LatLon.
 
Method Summary
 boolean eastOf(LatLon other)
          Test whether this LatLon represents a location east of another LatLon.
 boolean equals(LatLon other)
          Test whether this coordinate is equal to another.
 boolean equals(Object other)
          Test whether this coordinate is equal to another.
 double getLatitude()
          Retrieve the degrees of latitude for this coordinate.
 double getLongitude()
          Retrieve the degrees of longitude for this coordinate.
 int hashCode()
          Compute a reasonable hash code for this coordinate.
 boolean northOf(LatLon other)
          Test whether this LatLon represents a location north of another LatLon.
 String toString()
          Generate a string describing this coordinate.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

latitude

private final double latitude
Degrees latitude.


longitude

private final double longitude
Degrees longitude.

Constructor Detail

LatLon

public LatLon(double latitude,
              double longitude)
Construct a new LatLon. Longitudes outside the range of -180.0 to 180.0 are corrected automatically.

Parameters:
latitude - degrees latitude
longitude - degrees longitude
Method Detail

getLatitude

public double getLatitude()
Retrieve the degrees of latitude for this coordinate.

Returns:
degrees of latitude for this coordinate.

getLongitude

public double getLongitude()
Retrieve the degrees of longitude for this coordinate.

Returns:
degrees of longitude for this coordinate.

toString

public String toString()
Generate a string describing this coordinate.

Overrides:
toString in class Object
Returns:
a string describing this coordinate.

hashCode

public int hashCode()
Compute a reasonable hash code for this coordinate.

Overrides:
hashCode in class Object
Returns:
a reasonable hash code for this coordinate.

equals

public boolean equals(LatLon other)
Test whether this coordinate is equal to another.

Parameters:
other - coordinate to compare to
Returns:
true if they are equal, false otherwise

equals

public boolean equals(Object other)
Test whether this coordinate is equal to another.

Overrides:
equals in class Object
Parameters:
other - coordinate to compare to
Returns:
true if they are equal, false otherwise
Throws:
ClassCastException - if other is not a LatLon

northOf

public boolean northOf(LatLon other)
Test whether this LatLon represents a location north of another LatLon.

Parameters:
other - coordinate to compare to
Returns:
true if this is north of other

eastOf

public boolean eastOf(LatLon other)
Test whether this LatLon represents a location east of another LatLon.

Parameters:
other - coordinate to compare to
Returns:
true if this is east of other