Package com.iizix.geo
Interface ILongitudeLatitudeAltitude
- All Superinterfaces:
ILongitudeLatitude
- All Known Implementing Classes:
GeoLocation
public interface ILongitudeLatitudeAltitude extends ILongitudeLatitude
Interface used for geolocation with longitude, latitude and altitude.Programming note: DO NOT COMPARE WITH Double.NaN as e.g.
value==Double.NaN
, use
instead as comparison is always false.Double.isNaN(double)
- Author:
- Christopher Mindus
Field Summary
Fields inherited from interface com.iizix.geo.ILongitudeLatitude
EARTH_RADIUS
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description double
getAltitude()
Gets the altitude in meters.static double
getDistance(double longitude1, double longitude2, double latitude1, double latitude2, double altitude1, double altitude2)
Calculate distance between two points in latitude and longitude taking into account height difference.default double
getDistance(ILongitudeLatitudeAltitude location, boolean useAltitude)
Gets the distance in meters between this location and another.Methods inherited from interface com.iizix.geo.ILongitudeLatitude
getDistance, getLatitude, getLongitude
Method Detail
getDistance
static double getDistance(double longitude1, double longitude2, double latitude1, double latitude2, double altitude1, double altitude2)
Calculate distance between two points in latitude and longitude taking into account height difference. Uses Haversine method as its base.- Parameters:
longitude1
- Longitude 1.longitude2
- Longitude 2.latitude1
- Latitude 1.latitude2
- Latitude 2.altitude1
- Altitude 1 in meters.altitude2
- Altitude 2 in meters.- Returns:
- Distance in Meters, or Double.NaN if either values are
Double.isNaN()
.
getAltitude
double getAltitude()
Gets the altitude in meters.- Returns:
- The altitude, or NaN if not available.
getDistance
default double getDistance(ILongitudeLatitudeAltitude location, boolean useAltitude)
Gets the distance in meters between this location and another.If the altitude is not available in either of the locations, the distance is calculated without altitude.
- Parameters:
location
- The other location.useAltitude
- Flag to calculate with altitude, if available.- Returns:
- Distance in meters, Double.NaN if longitude/latitude values are not present.