Rose
Public Member Functions | Public Attributes | List of all members
rose::GeoPosition Class Reference

An abstraction of a geographic position. More...

#include <MapProjection.h>

Inheritance diagram for rose::GeoPosition:
Inheritance graph
[legend]
Collaboration diagram for rose::GeoPosition:
Collaboration graph
[legend]

Public Member Functions

constexpr GeoPosition (bool endPoint)
 
constexpr GeoPosition (double latitude, double longitude, bool rad=false)
 Create a geographic position. More...
 
GeoPosition constexpr toRadians () const
 Convert the position from degrees to radians. More...
 
GeoPosition constexpr toDegrees () const
 Convert the position from radians to degrees. More...
 
double distance (const GeoPosition &other) const
 Computer the Great Circle distance between this GeoPosition and another. More...
 
GeoPosition midpoint (const GeoPosition &other, double distance, double fraction=0.5) const
 Find a mid-point on the Great Circle between this GeoPosition and another. More...
 
GeoPosition midpoint (const GeoPosition &other, double fraction=0.5) const
 Find a mid-point on the Great Circle between this GeoPosition and another. More...
 
std::ostream & printOn (std::ostream &strm) const
 
constexpr GeoPosition (double lat, double lon) noexcept
 
constexpr GeoPosition (std::tuple< double, double > geo)
 
GeoPositionoperator= (const std::tuple< double, double > &geo)
 
GeoPosition radians () const
 
constexpr double & lat () noexcept
 
constexpr double & lon () noexcept
 
constexpr double lat () const noexcept
 
constexpr double lon () const noexcept
 

Public Attributes

double lat {0.}
 Latitude value.
 
double lon {0.}
 Longitude value.
 
bool radians {false}
 Values are in radians when true.
 
bool end {false}
 Is equal to end when used as iterator.
 

Detailed Description

An abstraction of a geographic position.

A geographic position holding Latitude and Longitude.

Constructor & Destructor Documentation

◆ GeoPosition()

constexpr rose::GeoPosition::GeoPosition ( double  latitude,
double  longitude,
bool  rad = false 
)
inline

Create a geographic position.

Parameters
latitudeThe latitude.
longitudeThe longitude.
radWhen true interpret latitude and longitude as degrees, otherwise as radians.

Member Function Documentation

◆ distance()

double rose::GeoPosition::distance ( const GeoPosition other) const
inline

Computer the Great Circle distance between this GeoPosition and another.

Parameters
otherThe other GeoPosition.
Returns
The Great Circle distance in Radians.

◆ midpoint() [1/2]

GeoPosition rose::GeoPosition::midpoint ( const GeoPosition other,
double  distance,
double  fraction = 0.5 
) const
inline

Find a mid-point on the Great Circle between this GeoPosition and another.

Parameters
otherThe other GeoPosition.
distanceThe pre-computed distance between the two positions in Radians.
fractionThe fraction of the distance between the two positions the desired mid-point is from this GeoPosition
Returns
The computed GeoPosition.

◆ midpoint() [2/2]

GeoPosition rose::GeoPosition::midpoint ( const GeoPosition other,
double  fraction = 0.5 
) const
inline

Find a mid-point on the Great Circle between this GeoPosition and another.

Parameters
otherThe other GeoPosition.
fractionThe fraction of the distance between the two positions the desired mid-point is from this GeoPosition
Returns
The computed GeoPosition.

◆ toDegrees()

GeoPosition constexpr rose::GeoPosition::toDegrees ( ) const
inline

Convert the position from radians to degrees.

Returns
The position in degrees.

◆ toRadians()

GeoPosition constexpr rose::GeoPosition::toRadians ( ) const
inline

Convert the position from degrees to radians.

Returns
The position in radians.

The documentation for this class was generated from the following files: