uk.me.jstott.coordconv
Class LatitudeLongitude

java.lang.Object
  extended by uk.me.jstott.coordconv.LatitudeLongitude

public class LatitudeLongitude
extends java.lang.Object

An object to represent a latitude and longitude pair. Latitudes and longitudes are used to represent a point on a spherical surface, for example, a point on the surface of Earth. Latitudes and longitudes are measured in degrees, minutes and seconds. For more information on using this class, look at http://www.jstott.me.uk/jsuntimes/

Since:
0.1
Version:
0.3
Author:
Jonathan Stott

Field Summary
static int EAST
           
static int NORTH
           
static int SOUTH
           
static int WEST
           
 
Constructor Summary
LatitudeLongitude(double lat, double lng)
          Construct a latitude and longitude pair.
LatitudeLongitude(int degreesLat, int minutesLat, double secondsLat, int degreesLong, int minutesLong, double secondsLong)
          Construct a latitude and longitude pair.
LatitudeLongitude(int northSouth, int degreesLat, int minutesLat, double secondsLat, int eastWest, int degreesLong, int minutesLong, double secondsLong)
          Construct a latitude and longitude pair.
 
Method Summary
 double getLatitude()
          Get the latitude
 double getLongitude()
          Get the longitude
 void setLatitude(double latitude)
          Set the latitude
 void setLongitude(double longitude)
          Set the longitude
 java.lang.String toString()
          Get a string representation of the latitude and longitude in the form 52°39'27.2531"N 1°43'4.5177"E
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NORTH

public static final int NORTH
See Also:
Constant Field Values

SOUTH

public static final int SOUTH
See Also:
Constant Field Values

EAST

public static final int EAST
See Also:
Constant Field Values

WEST

public static final int WEST
See Also:
Constant Field Values
Constructor Detail

LatitudeLongitude

public LatitudeLongitude(double lat,
                         double lng)
Construct a latitude and longitude pair. Negative values of lat and lng are Southerly latitudes and easterly longitudes respectively.

Parameters:
lat - the latitude
lng - the longitude
Since:
0.1

LatitudeLongitude

public LatitudeLongitude(int northSouth,
                         int degreesLat,
                         int minutesLat,
                         double secondsLat,
                         int eastWest,
                         int degreesLong,
                         int minutesLong,
                         double secondsLong)
Construct a latitude and longitude pair.

Parameters:
northSouth - one of LatitudeLongitude.NORTH and LatitudeLongitude.SOUTH to represent whether the given latitude is north or south of the equator respectively
degreesLat - degrees of latitude
minutesLat - minutes of latitude
secondsLat - seconds of latitude
eastWest - one of LatitudeLongitude.East and LatitudeLongitude.WEST to represent whether the given longitude is east or west of the Greenwich Meridian respectively
degreesLong - degrees of longitude
minutesLong - minutes of longitude
secondsLong - seconds of longitude
Since:
0.3

LatitudeLongitude

public LatitudeLongitude(int degreesLat,
                         int minutesLat,
                         double secondsLat,
                         int degreesLong,
                         int minutesLong,
                         double secondsLong)
Construct a latitude and longitude pair. Negative values of degreesLat represent latitudes south of the equator. Negative values of degreesLong represent longitudes west of the Greenwich Meridian.

Parameters:
degreesLat - degrees of latitude
minutesLat - minutes of latitude
secondsLat - seconds of latitude
degreesLong - degrees of longitude
minutesLong - minutes of longitude
secondsLong - seconds of longitude
Since:
0.1
Method Detail

getLatitude

public double getLatitude()
Get the latitude

Returns:
the latitude
Since:
0.1

getLongitude

public double getLongitude()
Get the longitude

Returns:
the longitude
Since:
0.1

setLatitude

public void setLatitude(double latitude)
Set the latitude

Parameters:
latitude - the new value of the latitude
Since:
0.1

setLongitude

public void setLongitude(double longitude)
Set the longitude

Parameters:
longitude - the new value of the longitude
Since:
0.1

toString

public java.lang.String toString()
Get a string representation of the latitude and longitude in the form 52°39'27.2531"N 1°43'4.5177"E

Overrides:
toString in class java.lang.Object
Returns:
the latitude and longitude as a string.
Since:
0.1