Package mccombe.mapping
Class LatLong
- java.lang.Object
-
- mccombe.mapping.LatLong
-
public class LatLong extends java.lang.ObjectA simple immutable wrapper class for Latitude and Longitude values
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublelat()Get the latitude componentstatic doublelatDMS(java.lang.String ns, int deg, int min, double sec)A static method to turn values of degrees, minutes and seconds into a latitude value.doublelon()Get the longitude componentstatic doublelonDMS(java.lang.String ew, int deg, int min, double sec)A static method to turn values of degrees, minutes and seconds into a longitude value.static java.lang.StringtoDMS(double v, java.lang.String signs)java.lang.StringtoString()Provide a String representing this latitude and longitude.
-
-
-
Method Detail
-
latDMS
public static double latDMS(java.lang.String ns, int deg, int min, double sec) throws LatLongFormatExceptionA static method to turn values of degrees, minutes and seconds into a latitude value.- Parameters:
ns- "N" or "S". Points south of the equator have negative values of latitude.deg- Degrees. Value must not exceed 90.min- Minutes - zero or positive, less than 60.sec- Seconds - zero or positive real value less than 60.0- Returns:
- value in the range -90.0 to +90.0
- Throws:
LatLongFormatException- if the degrees/minutes/seconds values do not correspond to legal latitudes between 0 and 90.0 or if ns is neither "N" nor "S"
-
lonDMS
public static double lonDMS(java.lang.String ew, int deg, int min, double sec) throws LatLongFormatExceptionA static method to turn values of degrees, minutes and seconds into a longitude value.- Parameters:
ew- "E" or "W". Points west of the reference meridian have negative values of longitude.deg- Degrees. Value must not exceed 180.min- Minutes - zero or positive, less than 60.sec- Seconds - zero or positive real value less than 60.0- Returns:
- value in the range -180.0 to +180.0
- Throws:
LatLongFormatException- if the degrees/minutes/seconds values do not correspond to legal longitudes between 0 and 180.0 or if ew is neither "E" nor "W"
-
lat
public double lat()
Get the latitude component- Returns:
- Latitude (degrees)
-
lon
public double lon()
Get the longitude component- Returns:
- Longitude (degrees)
-
toString
public java.lang.String toString()
Provide a String representing this latitude and longitude.- Overrides:
toStringin classjava.lang.Object- Returns:
- The String representation of the coordinates (in Lat/Lon format)
-
toDMS
public static java.lang.String toDMS(double v, java.lang.String signs)
-
-