GeographicalLocation Class Reference
|
CPP API
|
Class representing a geographical location on the Earth's surface. More...
#include <geolocation.h>
Public Member Functions | |
| auto | default_serialize () |
| Default serialize the GeographicalLocation object. More... | |
| Distance | distance (const GeographicalLocation &other) const |
| GeographicalLocation ()=default | |
| Construct a new Geographical Location object using the default constructor to keep compatibility with ABM code. More... | |
| GeographicalLocation (ScalarType lat, ScalarType lon) | |
| Construct a new Geographical Location object. More... | |
| GeographicalLocation (std::pair< ScalarType, ScalarType > coordinates) | |
| Construct a new Geographical Location object. More... | |
| ScalarType | get_latitude () const |
| Get the latitude object. More... | |
| ScalarType | get_longitude () const |
| Get the longitude object. More... | |
| bool | is_close (const GeographicalLocation &other, Distance tol=Distance(10 *Limits< ScalarType >::zero_tolerance())) const |
| Check that this location is within a (small) distance of another. More... | |
| bool | operator!= (const GeographicalLocation &other) const |
| Compare two GeographicalLocations for inequality. More... | |
| bool | operator== (const GeographicalLocation &other) const |
| Compare two GeographicalLocations for equality. More... | |
| void | set_latitude (ScalarType lat) |
| Set the latitude object. More... | |
| void | set_longitude (ScalarType lon) |
| Set the longitude object. More... | |
Private Member Functions | |
| void | check_input () const |
| Assert that the latitude and longitude are within valid ranges. More... | |
Private Attributes | |
| ScalarType | m_latitude |
| ScalarType | m_longitude |
Static Private Attributes | |
| constexpr static mio::geo::Distance | earth_radius = mio::geo::kilometers(6371.) |
| constexpr static ScalarType | radians = std::numbers::pi / 180.0 |
Detailed Description
Class representing a geographical location on the Earth's surface.
Provides latitude and longitude in degrees and a method to calculate the distance to another location.
Constructor & Destructor Documentation
◆ GeographicalLocation() [1/3]
|
inline |
Construct a new Geographical Location object.
- Parameters
-
lat Latitude in degrees. lon Longitude in degrees.
◆ GeographicalLocation() [2/3]
|
inline |
Construct a new Geographical Location object.
- Parameters
-
coordinates Pair of latitude and longitude in degrees as ScalarTypes.
◆ GeographicalLocation() [3/3]
|
default |
Construct a new Geographical Location object using the default constructor to keep compatibility with ABM code.
Member Function Documentation
◆ check_input()
|
inlineprivate |
Assert that the latitude and longitude are within valid ranges.
◆ default_serialize()
|
inline |
Default serialize the GeographicalLocation object.
This method is used by the default serialization feature.
◆ distance()
|
inline |
◆ get_latitude()
|
inline |
Get the latitude object.
- Returns
- ScalarType latitude in degrees
◆ get_longitude()
|
inline |
Get the longitude object.
- Returns
- ScalarType longitude in degrees
◆ is_close()
|
inline |
Check that this location is within a (small) distance of another.
- Parameters
-
[in] other Any location. [in] tol The Absolute tolerance for considering two locations close.
◆ operator!=()
|
inline |
Compare two GeographicalLocations for inequality.
◆ operator==()
|
inline |
Compare two GeographicalLocations for equality.
◆ set_latitude()
|
inline |
Set the latitude object.
- Parameters
-
lat Latitude in degrees.
◆ set_longitude()
|
inline |
Set the longitude object.
- Parameters
-
lon Longitude in degrees.
Member Data Documentation
◆ earth_radius
|
staticconstexprprivate |
◆ m_latitude
|
private |
◆ m_longitude
|
private |
◆ radians
|
staticconstexprprivate |
Generated by