Package adams.data.gps
Class GPSDecimalDegrees
- java.lang.Object
-
- adams.data.gps.AbstractGPS
-
- adams.data.gps.GPSDecimalDegrees
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<AbstractGPS>
public class GPSDecimalDegrees extends AbstractGPS
GPS coordinates in decimal notation.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringFORMATthe regular expression.static StringFORMAT_SWAPPEDthe regular expression (swapped).-
Fields inherited from class adams.data.gps.AbstractGPS
m_Latitude, m_Longitude, NUM_DECIMALS
-
-
Constructor Summary
Constructors Constructor Description GPSDecimalDegrees()Default constructor.GPSDecimalDegrees(double lat, double lon)Initialize GPS with latitude and longitude (in decimal notation).GPSDecimalDegrees(AbstractGPS gps)Initialize GPS with latitude and longitude from the specified object.GPSDecimalDegrees(Coordinate lat, Coordinate lon)Initialize GPS with latitude and longitude.GPSDecimalDegrees(String s)Initialize GPS with latitude and longitude in string representation.GPSDecimalDegrees(String s, boolean swapped)Initialize GPS with latitude and longitude in string representation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GPSDecimalDegreesclone()Creates a copy of itself.protected Coordinate[]parse(String s, boolean swapped)Parses the string.StringtoString()Turns the GPS object back into its string representation.-
Methods inherited from class adams.data.gps.AbstractGPS
compareTo, equals, fromString, fromString, getLatitude, getLongitude, isValid, isValid, parse, preprocess
-
-
-
-
Field Detail
-
FORMAT
public static final String FORMAT
the regular expression.- See Also:
- Constant Field Values
-
FORMAT_SWAPPED
public static final String FORMAT_SWAPPED
the regular expression (swapped).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GPSDecimalDegrees
public GPSDecimalDegrees()
Default constructor.
-
GPSDecimalDegrees
public GPSDecimalDegrees(String s)
Initialize GPS with latitude and longitude in string representation.- Parameters:
s- the string representation to parse
-
GPSDecimalDegrees
public GPSDecimalDegrees(String s, boolean swapped)
Initialize GPS with latitude and longitude in string representation.- Parameters:
s- the string representation to parseswapped- whether format is 'long lat' instead of 'lat long'
-
GPSDecimalDegrees
public GPSDecimalDegrees(AbstractGPS gps)
Initialize GPS with latitude and longitude from the specified object.- Parameters:
gps- the GPS object to use the lat/lon from
-
GPSDecimalDegrees
public GPSDecimalDegrees(double lat, double lon)Initialize GPS with latitude and longitude (in decimal notation).- Parameters:
lat- latitudelon- longitude
-
GPSDecimalDegrees
public GPSDecimalDegrees(Coordinate lat, Coordinate lon)
Initialize GPS with latitude and longitude.- Parameters:
lat- latitudelon- longitude
-
-
Method Detail
-
clone
protected GPSDecimalDegrees clone()
Creates a copy of itself.- Specified by:
clonein classAbstractGPS- Returns:
- the copy
-
parse
protected Coordinate[] parse(String s, boolean swapped)
Parses the string.- Specified by:
parsein classAbstractGPS- Parameters:
s- the string to parseswapped- "long lat" instead of "lat long"- Returns:
- the coordinates (lat/long), null if failed to parse
-
toString
public String toString()
Turns the GPS object back into its string representation.- Specified by:
toStringin classAbstractGPS- Returns:
- the string representation
-
-