public class GlobalCoordinates extends Object implements Comparable<GlobalCoordinates>, Serializable
Encapsulation of latitude and longitude coordinates on a globe. Negative latitude is southern hemisphere. Negative longitude is western hemisphere.
Any angle may be specified for longtiude and latitude, but all angles will be canonicalized such that:
-90 <= latitude <= +90 - 180 < longitude <= +180
| Constructor and Description |
|---|
GlobalCoordinates(double latitude,
double longitude)
Construct a new GlobalCoordinates.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(GlobalCoordinates other)
Compare these coordinates to another set of coordiates.
|
boolean |
equals(Object obj)
Compare these coordinates to another object for equality.
|
double |
getLatitude()
Get latitude.
|
double |
getLongitude()
Get longitude.
|
int |
hashCode()
Get a hash code for these coordinates.
|
void |
setLatitude(double latitude)
Set latitude.
|
void |
setLongitude(double longitude)
Set longitude.
|
String |
toString()
Get coordinates as a string.
|
public GlobalCoordinates(double latitude,
double longitude)
latitude - latitude in degreeslongitude - longitude in degreespublic double getLatitude()
public void setLatitude(double latitude)
latitude - in degreespublic double getLongitude()
public void setLongitude(double longitude)
longitude - in degreespublic int compareTo(GlobalCoordinates other)
compareTo in interface Comparable<GlobalCoordinates>other - instance to compare topublic int hashCode()
public boolean equals(Object obj)
Copyright © 2016. All rights reserved.