Package adams.data.gps
Class GPSDecimalSeconds
- java.lang.Object
-
- adams.data.gps.AbstractGPS
-
- adams.data.gps.GPSDecimalSeconds
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<AbstractGPS>
public class GPSDecimalSeconds extends AbstractGPS
GPS coordinates with degrees and minutes as integers and seconds 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 String
FORMAT
the regular expression.static String
FORMAT_SWAPPED
the regular expression (swapped).-
Fields inherited from class adams.data.gps.AbstractGPS
m_Latitude, m_Longitude, NUM_DECIMALS
-
-
Constructor Summary
Constructors Constructor Description GPSDecimalSeconds()
Default constructor.GPSDecimalSeconds(double lat, double lon)
Initialize GPS with latitude and longitude (in decimal notation).GPSDecimalSeconds(AbstractGPS gps)
Initialize GPS with latitude and longitude from the specified object.GPSDecimalSeconds(Coordinate lat, Coordinate lon)
Initialize GPS with latitude and longitude.GPSDecimalSeconds(String s)
Initialize GPS with latitude and longitude in string representation.GPSDecimalSeconds(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 GPSDecimalSeconds
clone()
Creates a copy of itself.protected Coordinate[]
parse(String s, boolean swapped)
Parses the string.String
toString()
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
-
GPSDecimalSeconds
public GPSDecimalSeconds()
Default constructor.
-
GPSDecimalSeconds
public GPSDecimalSeconds(String s)
Initialize GPS with latitude and longitude in string representation.- Parameters:
s
- the string representation to parse
-
GPSDecimalSeconds
public GPSDecimalSeconds(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'
-
GPSDecimalSeconds
public GPSDecimalSeconds(AbstractGPS gps)
Initialize GPS with latitude and longitude from the specified object.- Parameters:
gps
- the GPS object to use the lat/lon from
-
GPSDecimalSeconds
public GPSDecimalSeconds(double lat, double lon)
Initialize GPS with latitude and longitude (in decimal notation).- Parameters:
lat
- latitudelon
- longitude
-
GPSDecimalSeconds
public GPSDecimalSeconds(Coordinate lat, Coordinate lon)
Initialize GPS with latitude and longitude.- Parameters:
lat
- latitudelon
- longitude
-
-
Method Detail
-
clone
protected GPSDecimalSeconds clone()
Creates a copy of itself.- Specified by:
clone
in classAbstractGPS
- Returns:
- the copy
-
parse
protected Coordinate[] parse(String s, boolean swapped)
Parses the string.- Specified by:
parse
in 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:
toString
in classAbstractGPS
- Returns:
- the string representation
-
-