Class Position


  • public class Position
    extends Location
    Geographic position with a latitude and longitude in degrees and altitude in meters.
    • Field Detail

      • altitude

        public double altitude
        The position's altitude in meters.
    • 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 degrees
        longitude - the longitude in degrees
        altitude - 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 degrees
        longitudeDegrees - the longitude in degrees
        altitude - 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 radians
        longitudeRadians - the longitude in radians
        altitude - the altitude in meters
        Returns:
        the new position
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class Location
      • toString

        @NonNull
        public java.lang.String toString()
        Overrides:
        toString in class Location
      • 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 degrees
        longitude - the new longitude in degrees
        altitude - 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 position
        pathType - WorldWind.PathType indicating type of path to assume
        amount - the fraction of the path at which to compute a position
        result - 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