Package gov.nasa.worldwind.geom
Class Position
- java.lang.Object
-
- gov.nasa.worldwind.geom.Location
-
- gov.nasa.worldwind.geom.Position
-
public class Position extends Location
Geographic position with a latitude and longitude in degrees and altitude in meters.
-
-
Constructor Summary
Constructors Constructor Description Position()Constructs a position with latitude, longitude and altitude all 0.Position(double latitude, double longitude, double altitude)Constructs a position with a specified latitude and longitude in degrees and altitude in meters.Position(Position position)Constructs a position with the latitude, longitude and altitude of a specified position.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static PositionfromDegrees(double latitudeDegrees, double longitudeDegrees, double altitude)Constructs a position with a specified latitude and longitude in degrees and altitude in meters.static PositionfromRadians(double latitudeRadians, double longitudeRadians, double altitude)Constructs a position with a specified latitude and longitude in radians and altitude in meters.inthashCode()PositioninterpolateAlongPath(Position endPosition, int pathType, double amount, Position result)Compute a position along a path between two positions.Positionset(double latitude, double longitude, double altitude)Sets this position to a specified latitude and longitude in degrees and altitude in meters.Positionset(Position position)Sets this position to the latitude, longitude and altitude of a specified position.java.lang.StringtoString()-
Methods inherited from class gov.nasa.worldwind.geom.Location
clampLatitude, clampLongitude, fromDegrees, fromRadians, fromTimeZone, greatCircleAzimuth, greatCircleDistance, greatCircleLocation, interpolateAlongPath, linearAzimuth, linearDistance, linearLocation, locationsCrossAntimeridian, normalizeLatitude, normalizeLongitude, rhumbAzimuth, rhumbDistance, rhumbLocation, set, set
-
-
-
-
Constructor Detail
-
Position
public Position()
Constructs a position with latitude, longitude and altitude all 0.
-
Position
public Position(double latitude, double longitude, double altitude)Constructs a position with a specified latitude and longitude in degrees and altitude in meters.- Parameters:
latitude- the latitude in degreeslongitude- the longitude in degreesaltitude- the altitude in meters
-
Position
public Position(Position position)
Constructs a position with the latitude, longitude and altitude of a specified position.- Parameters:
position- the position specifying the coordinates- Throws:
java.lang.IllegalArgumentException- If the position is null
-
-
Method Detail
-
fromDegrees
public static Position fromDegrees(double latitudeDegrees, double longitudeDegrees, double altitude)
Constructs a position with a specified latitude and longitude in degrees and altitude in meters.- Parameters:
latitudeDegrees- the latitude in degreeslongitudeDegrees- the longitude in degreesaltitude- the altitude in meters- Returns:
- the new position
-
fromRadians
public static Position fromRadians(double latitudeRadians, double longitudeRadians, double altitude)
Constructs a position with a specified latitude and longitude in radians and altitude in meters.- Parameters:
latitudeRadians- the latitude in radianslongitudeRadians- the longitude in radiansaltitude- the altitude in meters- Returns:
- the new position
-
set
public Position set(double latitude, double longitude, double altitude)
Sets this position to a specified latitude and longitude in degrees and altitude in meters.- Parameters:
latitude- the new latitude in degreeslongitude- the new longitude in degreesaltitude- the new altitude in meters- Returns:
- this position with its latitude, longitude and altitude set to the specified values
-
set
public Position set(Position position)
Sets this position to the latitude, longitude and altitude of a specified position.- Parameters:
position- the position specifying the new coordinates- Returns:
- this position with its latitude, longitude and altitude set to that of the specified position
- Throws:
java.lang.IllegalArgumentException- If the position is null
-
interpolateAlongPath
public Position interpolateAlongPath(Position endPosition, int pathType, double amount, Position result)
Compute a position along a path between two positions. The amount indicates the fraction of the path at which to compute a position. This value is typically between 0 and 1, where 0 indicates the begin position (this position) and 1 indicates the end position.- Parameters:
endPosition- the path's end positionpathType-WorldWind.PathTypeindicating type of path to assumeamount- the fraction of the path at which to compute a positionresult- a pre-allocated Position in which to return the computed result- Returns:
- the result argument set to the computed position
- Throws:
java.lang.IllegalArgumentException- If either of the end position or the result argument is null
-
-