Class LatLongPosition

  • All Implemented Interfaces:
    it.unibo.alchemist.model.GeoPosition , it.unibo.alchemist.model.Position , it.unibo.alchemist.model.Position2D , java.io.Serializable

    
    public final class LatLongPosition
     implements GeoPosition
                        

    Unmodifiable state version of LatLng, also implementing the GeoPosition interface.

    • Constructor Detail

      • LatLongPosition

        LatLongPosition(double lat, double lon)
        Parameters:
        lat - latitude
        lon - longitude
      • LatLongPosition

        LatLongPosition(double lat, double lon, LatLongPosition.DistanceFormula distanceFormula)
        Parameters:
        lat - latitude
        lon - longitude
        distanceFormula - the formula to use to compute distances
      • LatLongPosition

        LatLongPosition(double lat, double lon, int distanceFormula)
        Parameters:
        lat - latitude
        lon - longitude
        distanceFormula - the index of the formula to use to compute distances
      • LatLongPosition

        LatLongPosition(Number lat, Number lon)
        Parameters:
        lat - latitude
        lon - longitude
    • Method Detail

      • distance

         static double distance(LatLng point1, LatLng point2, LatLongPosition.DistanceFormula df)

        Distance between two points.

        Parameters:
        point1 - the first point.
        point2 - the second point.
        df - the formula to use to compute distances
        Returns:

        the distance in the chosen unit of measure.

      • distance

         static double distance(LatLng point1, LatLng point2, LengthUnit unit, LatLongPosition.DistanceFormula df)

        Distance between two points with arbitrary LengthUnit.

        Parameters:
        point1 - the first point.
        point2 - the second point.
        unit - the unit of measure in which to receive the result.
        df - the formula to use to compute distances
        Returns:

        the distance in the chosen unit of measure.

      • getLatitude

         double getLatitude()
        Returns:

        the latitude

      • getX

         double getX()
      • getY

         double getY()
      • distanceInRadians

         static double distanceInRadians(LatLng point1, LatLng point2, LatLongPosition.DistanceFormula precision)

        This "distance" function is mostly for internal use. Most users will simply rely upon distance

        Yields the internal angle for an arc between two points on the surface of a sphere in radians. This angle is in the plane of the great circle connecting the two points measured from an axis through one of the points and the center of the Earth. Multiply this value by the sphere's radius to get the length of the arc.

        Parameters:
        point1 - the first point
        point2 - the second point
        precision - the formula to use
        Returns:

        the internal angle for the arc connecting the two points in radians.