Class Latitude
java.lang.Object
rgu.transport.geospatial.Latitude
- All Implemented Interfaces:
Comparable<Latitude>
Represents a Latitude from -90 degrees (inclusive) to +90 degrees (inclusive) to 7 decimal
places.
- Author:
- Lee A. Christie
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintCompares two latitudes numerically.Returns the latitude as a decimal to 7 decimal places.doubleReturns the latitude as a double.booleanReturns true if the other object is the same latitude value.inthashCode()Returns a hash code for this latitude.static Latitudeof(BigDecimal decimal) Returns a latitude of the specified decimal value.static LatitudeofRounded(double value) Rounds the specified double to a latitude.static LatitudeparseLatitude(String string) Parses the specified string to a latitude.static LatitudeparseLatitudeTruncate(String string) Parses the specified string to a latitude.static LatitudeReads a latitude from the specified input stream.toString()Returns a String object representing this latitude's value.voidwrite(ObjectOutputStream out) Writes this latitude to the specified output stream.
-
Field Details
-
EQUATOR
The value 0.
-
-
Method Details
-
parseLatitude
-
of
Returns a latitude of the specified decimal value.- Parameters:
decimal- the latitude as a decimal- Returns:
- a Latitude
-
ofRounded
Rounds the specified double to a latitude.- Parameters:
value- the latitude as a double, finite- Returns:
- a Latitude
-
parseLatitudeTruncate
-
decimalValue
Returns the latitude as a decimal to 7 decimal places. For example parseLatitude("57.1497").doubleValue() returns 57.1497000- Returns:
- the latitude as a decimal
-
doubleValue
public double doubleValue()Returns the latitude as a double. For example parseLatitude("57.1497").doubleValue() returns 57.1497- Returns:
- the latitude as a double
-
hashCode
-
equals
-
toString
-
compareTo
Compares two latitudes numerically.- Specified by:
compareToin interfaceComparable<Latitude>- Returns:
- 0 if this latitude is the same as the other latitude, less than 0 if less, or greater than 0 if greater than the other latitude.
-
write
Writes this latitude to the specified output stream.- Parameters:
out- the output stream, not null- Throws:
IOException- if an exception occurred writing
-
read
Reads a latitude from the specified input stream.- Parameters:
in- the input stream, not null- Returns:
- the latitude
- Throws:
IOException- if an exception occurred reading
-