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 GeoPositionUnmodifiable state version of LatLng, also implementing the GeoPosition interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumLatLongPosition.DistanceFormulaPossible methods to compute the distance between two latitude-longitude points.
-
Field Summary
Fields Modifier and Type Field Description public final static LatLongPosition.DistanceFormulaDEFAULT_DISTANCE_FORMULApublic final static doubleEARTH_MEAN_RADIUS_METERS
-
Constructor Summary
Constructors Constructor Description LatLongPosition(double lat, double lon)LatLongPosition(double lat, double lon, LatLongPosition.DistanceFormula distanceFormula)LatLongPosition(double lat, double lon, int distanceFormula)LatLongPosition(Number lat, Number lon)
-
Method Summary
Modifier and Type Method Description List<GeoPosition>boundingBox(double range)static doubledistance(LatLng point1, LatLng point2, LatLongPosition.DistanceFormula df)Distance between two points. static doubledistance(LatLng point1, LatLng point2, LengthUnit unit, LatLongPosition.DistanceFormula df)Distance between two points with arbitrary LengthUnit. doubledistanceTo(@Nonnull() GeoPosition other)booleanequals(Object obj)Array<double>getCoordinates()doublegetCoordinate(int dimension)intgetDimensions()doublegetLatitude()doublegetLongitude()doublegetX()doublegetY()inthashCode()GeoPositionminus(@Nonnull() GeoPosition other)GeoPositionminus(@Nonnull() Array<double> other)GeoPositionplus(@Nonnull() Array<double> other)GeoPositionplus(@Nonnull() GeoPosition other)StringtoString()static doubledistanceInRadians(LatLng point1, LatLng point2, LatLongPosition.DistanceFormula precision)This "distance" function is mostly for internal use. -
-
Constructor Detail
-
LatLongPosition
LatLongPosition(double lat, double lon)
- Parameters:
lat- latitudelon- longitude
-
LatLongPosition
LatLongPosition(double lat, double lon, LatLongPosition.DistanceFormula distanceFormula)
- Parameters:
lat- latitudelon- longitudedistanceFormula- the formula to use to compute distances
-
LatLongPosition
LatLongPosition(double lat, double lon, int distanceFormula)
- Parameters:
lat- latitudelon- longitudedistanceFormula- the index of the formula to use to compute distances
-
-
Method Detail
-
boundingBox
@Nonnull() List<GeoPosition> boundingBox(double range)
-
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.
-
distanceTo
double distanceTo(@Nonnull() GeoPosition other)
-
getCoordinates
@Nonnull() Array<double> getCoordinates()
-
getCoordinate
double getCoordinate(int dimension)
-
getDimensions
int getDimensions()
-
getLatitude
double getLatitude()
- Returns:
the latitude
-
getLongitude
double getLongitude()
- Returns:
the longitude
-
getX
double getX()
-
getY
double getY()
-
hashCode
int hashCode()
-
minus
GeoPosition minus(@Nonnull() GeoPosition other)
-
plus
GeoPosition plus(@Nonnull() GeoPosition other)
-
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 pointpoint2- the second pointprecision- the formula to use- Returns:
the internal angle for the arc connecting the two points in radians.
-
-
-
-