Package com.drew.lang
Class GeoLocation
- java.lang.Object
-
- com.drew.lang.GeoLocation
-
public final class GeoLocation extends Object
Represents a latitude and longitude pair, giving a position on earth in spherical coordinates.Values of latitude and longitude are given in degrees.
This type is immutable.
-
-
Constructor Summary
Constructors Constructor Description GeoLocation(double latitude, double longitude)Instantiates a new instance ofGeoLocation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static double[]decimalToDegreesMinutesSeconds(double decimal)Converts a decimal degree angle into its corresponding DMS (degrees-minutes-seconds) component values, as a double array.static StringdecimalToDegreesMinutesSecondsString(double decimal)Converts a decimal degree angle into its corresponding DMS (degrees-minutes-seconds) representation as a string, of format:-1° 23' 4.56"static DoubledegreesMinutesSecondsToDecimal(Rational degs, Rational mins, Rational secs, boolean isNegative)Converts DMS (degrees-minutes-seconds) rational values, as given inGpsDirectory, into a single value in degrees, as a double.booleanequals(Object o)doublegetLatitude()doublegetLongitude()inthashCode()booleanisZero()StringtoDMSString()StringtoString()
-
-
-
Constructor Detail
-
GeoLocation
public GeoLocation(double latitude, double longitude)Instantiates a new instance ofGeoLocation.- Parameters:
latitude- the latitude, in degreeslongitude- the longitude, in degrees
-
-
Method Detail
-
getLatitude
public double getLatitude()
- Returns:
- the latitudinal angle of this location, in degrees.
-
getLongitude
public double getLongitude()
- Returns:
- the longitudinal angle of this location, in degrees.
-
isZero
public boolean isZero()
- Returns:
- true, if both latitude and longitude are equal to zero
-
decimalToDegreesMinutesSecondsString
public static String decimalToDegreesMinutesSecondsString(double decimal)
Converts a decimal degree angle into its corresponding DMS (degrees-minutes-seconds) representation as a string, of format:-1° 23' 4.56"
-
decimalToDegreesMinutesSeconds
public static double[] decimalToDegreesMinutesSeconds(double decimal)
Converts a decimal degree angle into its corresponding DMS (degrees-minutes-seconds) component values, as a double array.
-
degreesMinutesSecondsToDecimal
public static Double degreesMinutesSecondsToDecimal(Rational degs, Rational mins, Rational secs, boolean isNegative)
Converts DMS (degrees-minutes-seconds) rational values, as given inGpsDirectory, into a single value in degrees, as a double.
-
toString
public String toString()
-
toDMSString
public String toDMSString()
- Returns:
- a string representation of this location, of format:
-1° 23' 4.56", 54° 32' 1.92"
-
-