public class Location
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
double |
latitude
The location's latitude in degrees.
|
double |
longitude
The location's longitude in degrees.
|
| Constructor and Description |
|---|
Location()
Constructs a location with latitude and longitude both 0.
|
Location(double latitude,
double longitude)
Constructs a location with a specified latitude and longitude in degrees.
|
Location(Location location)
Constructs a location with the latitude and longitude of a specified location.
|
| Modifier and Type | Method and Description |
|---|---|
static double |
clampLatitude(double degrees)
Restricts an angle to the range [-90, +90] degrees, clamping angles outside the range.
|
static double |
clampLongitude(double degrees)
Restricts an angle to the range [-180, +180] degrees, clamping angles outside the range.
|
boolean |
equals(java.lang.Object o) |
static Location |
fromDegrees(double latitudeDegrees,
double longitudeDegrees)
Constructs a location with a specified latitude and longitude in degrees.
|
static Location |
fromRadians(double latitudeRadians,
double longitudeRadians)
Constructs a location with a specified latitude and longitude in radians.
|
static Location |
fromTimeZone(java.util.TimeZone timeZone)
Constructs an approximate location for a specified time zone.
|
double |
greatCircleAzimuth(Location location)
Computes the azimuth angle (clockwise from North) for the great circle path between this location and a specified
location.
|
double |
greatCircleDistance(Location location)
Computes the angular distance of the great circle path between this location and a specified location.
|
Location |
greatCircleLocation(double azimuthDegrees,
double distanceRadians,
Location result)
Computes the location on the great circle path starting at this location and traversing with the specified
azimuth and angular distance.
|
int |
hashCode() |
Location |
interpolateAlongPath(Location endLocation,
int pathType,
double amount,
Location result)
Compute a location along a path between two locations.
|
double |
linearAzimuth(Location location)
Computes the azimuth angle (clockwise from North) for the linear path between this location and a specified
location.
|
double |
linearDistance(Location location)
Computes the angular distance of the linear path between this location and a specified location.
|
Location |
linearLocation(double azimuthDegrees,
double distanceRadians,
Location result)
Computes the location on the linear path starting at this location and traversing with the specified azimuth and
angular distance.
|
static boolean |
locationsCrossAntimeridian(java.util.List<? extends Location> locations)
Determines whether a list of locations crosses the antimeridian.
|
static double |
normalizeLatitude(double degrees)
Restricts an angle to the range [-90, +90] degrees, wrapping angles outside the range.
|
static double |
normalizeLongitude(double degrees)
Restricts an angle to the range [-180, +180] degrees, wrapping angles outside the range.
|
double |
rhumbAzimuth(Location location)
Computes the azimuth angle (clockwise from North) for the rhumb path (line of constant azimuth) between this
location and a specified location.
|
double |
rhumbDistance(Location location)
Computes the angular distance of the rhumb path (line of constant azimuth) between this location and a specified
location.
|
Location |
rhumbLocation(double azimuthDegrees,
double distanceRadians,
Location result)
Computes the location on a rhumb path (line of constant azimuth) starting at this location and traversing with
the specified azimuth and angular distance.
|
Location |
set(double latitude,
double longitude)
Sets this location to a specified latitude and longitude in degrees.
|
Location |
set(Location location)
Sets this location to the latitude and longitude of a specified location.
|
java.lang.String |
toString() |
public double latitude
public double longitude
public Location()
public Location(double latitude,
double longitude)
latitude - the latitude in degreeslongitude - the longitude in degreespublic Location(Location location)
location - the location specifying the coordinatesjava.lang.IllegalArgumentException - If the location is nullpublic static Location fromDegrees(double latitudeDegrees, double longitudeDegrees)
latitudeDegrees - the latitude in degreeslongitudeDegrees - the longitude in degreespublic static Location fromRadians(double latitudeRadians, double longitudeRadians)
latitudeRadians - the latitude in radianslongitudeRadians - the longitude in radianspublic static Location fromTimeZone(java.util.TimeZone timeZone)
timeZone - the time zone in questionpublic static double normalizeLatitude(double degrees)
degrees - the angle to wrap in degreespublic static double normalizeLongitude(double degrees)
degrees - the angle to wrap in degreespublic static double clampLatitude(double degrees)
degrees - the angle to clamp in degreespublic static double clampLongitude(double degrees)
degrees - the angle to clamp in degreespublic static boolean locationsCrossAntimeridian(java.util.List<? extends Location> locations)
locations - the locations to testjava.lang.IllegalArgumentException - If the locations list is nullpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic Location set(double latitude, double longitude)
latitude - the new latitude in degreeslongitude - the new longitude in degreespublic Location set(Location location)
location - the location specifying the new coordinatesjava.lang.IllegalArgumentException - If the location is nullpublic Location interpolateAlongPath(Location endLocation, int pathType, double amount, Location result)
endLocation - the path's end locationpathType - WorldWind.PathType indicating type of path to assumeamount - the fraction of the path at which to compute a locationresult - a pre-allocated Location in which to return the computed locationjava.lang.IllegalArgumentException - If either of the end location or the result argument is nullpublic double greatCircleAzimuth(Location location)
location - the great circle path's ending locationjava.lang.IllegalArgumentException - If the location is nullpublic double greatCircleDistance(Location location)
location - the great circle path's ending locationjava.lang.IllegalArgumentException - If the location is nullpublic Location greatCircleLocation(double azimuthDegrees, double distanceRadians, Location result)
azimuthDegrees - the starting azimuth in degreesdistanceRadians - the angular distance along the path in radiansresult - a pre-allocated Location in which to return the computed locationjava.lang.IllegalArgumentException - If either the location or the result is nullpublic double rhumbAzimuth(Location location)
location - the rhumb path's ending locationjava.lang.IllegalArgumentException - If the location is nullpublic double rhumbDistance(Location location)
location - the great circle path's ending locationjava.lang.IllegalArgumentException - If the location is nullpublic Location rhumbLocation(double azimuthDegrees, double distanceRadians, Location result)
azimuthDegrees - the starting azimuth in degreesdistanceRadians - the angular distance along the path in radiansresult - a pre-allocated Location in which to return the computed locationjava.lang.IllegalArgumentException - If either the location or the result is nullpublic double linearAzimuth(Location location)
location - the linear path's ending locationjava.lang.IllegalArgumentException - If the location is nullpublic double linearDistance(Location location)
location - the great circle path's ending locationjava.lang.IllegalArgumentException - If the location is nullpublic Location linearLocation(double azimuthDegrees, double distanceRadians, Location result)
azimuthDegrees - the starting azimuth in degreesdistanceRadians - the angular distance along the path in radiansresult - a pre-allocated Location in which to return the computed locationjava.lang.IllegalArgumentException - If either the location or the result is null