ns3::GeoCoordinate Class Reference

GeoCoordinate class is used to store and operate with geodetic coordinates. More...

#include "geo-coordinate.h"

Public Types

enum  ReferenceEllipsoid_t { SPHERE , WGS84 , GRS80 }
 

Public Member Functions

 GeoCoordinate ()
 Create GeoCoordinate with zero values of longitude, latitude and altitude. More...
 
 GeoCoordinate (double latitude, double longitude, double altitude, bool correctIfInvalid=false)
 Create GeoCoordinate from given latitude, longitude and altitude decimal degree values. More...
 
 GeoCoordinate (double latitude, double longitude, double altitude, ReferenceEllipsoid_t refEllipsoid, bool correctIfInvalid=false)
 Create GeoCoordinate from given latitude, longitude and altitude decimal degree values. More...
 
 GeoCoordinate (Vector vector)
 Create GeoCoordinate from given vector (x, y, z). More...
 
 GeoCoordinate (Vector vector, ReferenceEllipsoid_t refEllipsoid)
 Create GeoCoordinate from given vector (x, y, z) and reference ellipsoid. More...
 
double GetAltitude () const
 Gets altitude value of coordinate. More...
 
double GetLatitude () const
 Gets latitude value of coordinate. More...
 
double GetLongitude () const
 Gets longitude value of coordinate. More...
 
ReferenceEllipsoid_t GetRefEllipsoid ()
 Gets reference ellipsoid used by GeoCoordinate object. More...
 
void SetAltitude (double altitude)
 Sets altitude value of coordinate. More...
 
void SetLatitude (double latitude)
 Sets latitude value of coordinate. More...
 
void SetLongitude (double longitude)
 Sets longitude value of coordinate. More...
 
Vector ToVector () const
 Converts Geodetic coordinates to Cartesian coordinates. More...
 

Static Public Attributes

static constexpr double equatorRadius = 6378137.0
 
static constexpr double polarRadius_grs80 = 6356752.314103
 
static constexpr double polarRadius_sphere = 6378137.0
 
static constexpr double polarRadius_wgs84 = 6356752.314245
 

Private Member Functions

void Construct (double latitude, double longitude, double altitude, bool correctIfInvalid)
 
void ConstructFromVector (const Vector &vector)
 Creates Geodetic coordinates from given Cartesian coordinates. More...
 
double GetRadiusCurvature (double latitude) const
 Gets the radius of curvature in the prime vertical. More...
 
void Initialize ()
 This method is called to initialize needed parameters according to used reference ellipsoide. More...
 

Static Private Member Functions

static bool IsValidAltitude (double altitude, ReferenceEllipsoid_t refEllipsoide)
 Checks if altitude is in valid range. More...
 
static bool IsValidLatitude (double latitude)
 Checks if latitude is in valid range. More...
 
static bool IsValidLongitude (double longitude)
 Checks if longitude is in valid range. More...
 

Private Attributes

double m_altitude
 altitude of coordinate More...
 
double m_e2Param
 
double m_equatorRadius
 
double m_latitude
 latitude of coordinate More...
 
double m_longitude
 longitude of coordinate More...
 
double m_polarRadius
 
ReferenceEllipsoid_t m_refEllipsoid
 

Detailed Description

GeoCoordinate class is used to store and operate with geodetic coordinates.

Latitude is in the degree range (-90, 90) with negative values -> south Longitude is in the degree range (-180, 180) with negative values -> west Altitude is in meters.

Definition at line 38 of file geo-coordinate.h.

Member Enumeration Documentation

◆ ReferenceEllipsoid_t

Enumerator
SPHERE 
WGS84 
GRS80 

Definition at line 41 of file geo-coordinate.h.

Constructor & Destructor Documentation

◆ GeoCoordinate() [1/5]

ns3::GeoCoordinate::GeoCoordinate ( double  latitude,
double  longitude,
double  altitude,
bool  correctIfInvalid = false 
)

Create GeoCoordinate from given latitude, longitude and altitude decimal degree values.

Reference ellipsoid to be used is sphere.

Parameters
latitudelatitude of position, -90 ... 90 degrees
longitudelongitude of position, -180 ... 180 degrees
altitudealtitude of position, >= -EARTH_RADIUS
correctIfInvalidCorrect latitude and longitude if outside bounds

Definition at line 50 of file geo-coordinate.cc.

References Construct().

+ Here is the call graph for this function:

◆ GeoCoordinate() [2/5]

ns3::GeoCoordinate::GeoCoordinate ( double  latitude,
double  longitude,
double  altitude,
ReferenceEllipsoid_t  refEllipsoid,
bool  correctIfInvalid = false 
)

Create GeoCoordinate from given latitude, longitude and altitude decimal degree values.

Parameters
latitudelatitude of position, -90 ... 90 degrees
longitudelongitude of position, -180 ... 180 degrees
altitudealtitude of position, >= -EARTH_RADIUS
refEllipsoidReference ellipsoid to be used
correctIfInvalidCorrect latitude and longitude if outside bounds

Definition at line 38 of file geo-coordinate.cc.

References Construct().

+ Here is the call graph for this function:

◆ GeoCoordinate() [3/5]

ns3::GeoCoordinate::GeoCoordinate ( Vector  vector)

Create GeoCoordinate from given vector (x, y, z).

Reference ellipsoid to be used is sphere.

Parameters
vectorcoordinates as Vector (x, y, z) (Cartesian)

Definition at line 61 of file geo-coordinate.cc.

References ConstructFromVector().

+ Here is the call graph for this function:

◆ GeoCoordinate() [4/5]

ns3::GeoCoordinate::GeoCoordinate ( Vector  vector,
ReferenceEllipsoid_t  refEllipsoid 
)

Create GeoCoordinate from given vector (x, y, z) and reference ellipsoid.

Parameters
vectorcoordinates as Vector (x, y, z) (Cartesian)
refEllipsoidReference ellipsoid to be used

Definition at line 69 of file geo-coordinate.cc.

References ConstructFromVector().

+ Here is the call graph for this function:

◆ GeoCoordinate() [5/5]

ns3::GeoCoordinate::GeoCoordinate ( )

Create GeoCoordinate with zero values of longitude, latitude and altitude.

Reference ellipsoid to be used is sphere.

Definition at line 77 of file geo-coordinate.cc.

References Initialize().

+ Here is the call graph for this function:

Member Function Documentation

◆ Construct()

void ns3::GeoCoordinate::Construct ( double  latitude,
double  longitude,
double  altitude,
bool  correctIfInvalid 
)
private
Parameters
latitudelatitude of position
longitudelongitude of position
altitudealtitude of position
correctIfInvalidCorrect latitude and longitude if outside bounds

Helper for constructor to create GeoCoordinate from given latitude, longitude and altitude decimal degree values.

Accepted values:

Latitude: -90 ... 90 degrees Longitude: -180 ... 180 degrees Altitude: >= -EARTH_RADIUS

Definition at line 89 of file geo-coordinate.cc.

References Initialize(), IsValidAltitude(), IsValidLatitude(), IsValidLongitude(), m_altitude, m_latitude, m_longitude, and m_refEllipsoid.

Referenced by GeoCoordinate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConstructFromVector()

void ns3::GeoCoordinate::ConstructFromVector ( const Vector &  vector)
private

Creates Geodetic coordinates from given Cartesian coordinates.

Parameters
vectorreference to vector containing Cartesian coordinates for creation.

Definition at line 246 of file geo-coordinate.cc.

References GetRadiusCurvature(), Initialize(), m_altitude, m_e2Param, m_latitude, m_longitude, and ns3::SatUtils::RadiansToDegrees().

Referenced by GeoCoordinate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAltitude()

◆ GetLatitude()

◆ GetLongitude()

◆ GetRadiusCurvature()

double ns3::GeoCoordinate::GetRadiusCurvature ( double  latitude) const
private

Gets the radius of curvature in the prime vertical.

Parameters
latitudelatitude in radians at to get the radius of curvature.
Returns
value of the radius of curvature (meters)

Definition at line 312 of file geo-coordinate.cc.

References m_e2Param, and m_equatorRadius.

Referenced by ConstructFromVector(), and ToVector().

+ Here is the caller graph for this function:

◆ GetRefEllipsoid()

ReferenceEllipsoid_t ns3::GeoCoordinate::GetRefEllipsoid ( )
inline

Gets reference ellipsoid used by GeoCoordinate object.

Returns
reference ellipsoid.

Definition at line 103 of file geo-coordinate.h.

References m_refEllipsoid.

Referenced by ns3::SatMobilityObserver::SatMobilityObserver().

+ Here is the caller graph for this function:

◆ Initialize()

void ns3::GeoCoordinate::Initialize ( )
private

This method is called to initialize needed parameters according to used reference ellipsoide.

Definition at line 157 of file geo-coordinate.cc.

References equatorRadius, GRS80, m_e2Param, m_equatorRadius, m_polarRadius, m_refEllipsoid, polarRadius_grs80, polarRadius_sphere, polarRadius_wgs84, SPHERE, and WGS84.

Referenced by GeoCoordinate(), Construct(), and ConstructFromVector().

+ Here is the caller graph for this function:

◆ IsValidAltitude()

bool ns3::GeoCoordinate::IsValidAltitude ( double  altitude,
ReferenceEllipsoid_t  refEllipsoide 
)
inlinestaticprivate

Checks if altitude is in valid range.

Parameters
altitudeto check
Returns
bool true altitude valid, false invalid.

Definition at line 318 of file geo-coordinate.cc.

References GRS80, polarRadius_grs80, polarRadius_sphere, polarRadius_wgs84, SPHERE, and WGS84.

Referenced by Construct(), and SetAltitude().

+ Here is the caller graph for this function:

◆ IsValidLatitude()

static bool ns3::GeoCoordinate::IsValidLatitude ( double  latitude)
inlinestaticprivate

Checks if latitude is in valid range.

Parameters
latitudeto check
Returns
bool true latitude valid, false invalid

Definition at line 186 of file geo-coordinate.h.

Referenced by Construct(), and SetLatitude().

+ Here is the caller graph for this function:

◆ IsValidLongitude()

static bool ns3::GeoCoordinate::IsValidLongitude ( double  longitude)
inlinestaticprivate

Checks if longitude is in valid range.

Parameters
longitudeto check
Returns
bool true longitude valid, false invalid

Definition at line 175 of file geo-coordinate.h.

Referenced by Construct(), and SetLongitude().

+ Here is the caller graph for this function:

◆ SetAltitude()

void ns3::GeoCoordinate::SetAltitude ( double  altitude)

Sets altitude value of coordinate.

Parameters
altitudelongitude to set

Definition at line 233 of file geo-coordinate.cc.

References IsValidAltitude(), m_altitude, and m_refEllipsoid.

Referenced by SatMobilityObserverTestCase::DoRun(), ns3::SatSpotBeamPositionAllocator::GetNextGeoPosition(), ns3::operator>>(), and ns3::SatMobilityObserver::UpdateElevationAngle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetLatitude()

void ns3::GeoCoordinate::SetLatitude ( double  latitude)

Sets latitude value of coordinate.

Parameters
latitudelongitude to set

Definition at line 220 of file geo-coordinate.cc.

References IsValidLatitude(), and m_latitude.

Referenced by SatMobilityObserverTestCase::DoRun(), and ns3::operator>>().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetLongitude()

void ns3::GeoCoordinate::SetLongitude ( double  longitude)

Sets longitude value of coordinate.

Parameters
longitudelongitude to set

Definition at line 207 of file geo-coordinate.cc.

References IsValidLongitude(), and m_longitude.

Referenced by SatMobilityObserverTestCase::DoRun(), and ns3::operator>>().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToVector()

Member Data Documentation

◆ equatorRadius

constexpr double ns3::GeoCoordinate::equatorRadius = 6378137.0
staticconstexpr

Definition at line 154 of file geo-coordinate.h.

Referenced by Initialize().

◆ m_altitude

double ns3::GeoCoordinate::m_altitude
private

altitude of coordinate

Definition at line 241 of file geo-coordinate.h.

Referenced by Construct(), ConstructFromVector(), GetAltitude(), SetAltitude(), and ToVector().

◆ m_e2Param

double ns3::GeoCoordinate::m_e2Param
private

Definition at line 244 of file geo-coordinate.h.

Referenced by ConstructFromVector(), GetRadiusCurvature(), Initialize(), and ToVector().

◆ m_equatorRadius

double ns3::GeoCoordinate::m_equatorRadius
private

Definition at line 245 of file geo-coordinate.h.

Referenced by GetRadiusCurvature(), and Initialize().

◆ m_latitude

double ns3::GeoCoordinate::m_latitude
private

latitude of coordinate

Definition at line 233 of file geo-coordinate.h.

Referenced by Construct(), ConstructFromVector(), GetLatitude(), SetLatitude(), and ToVector().

◆ m_longitude

double ns3::GeoCoordinate::m_longitude
private

longitude of coordinate

Definition at line 237 of file geo-coordinate.h.

Referenced by Construct(), ConstructFromVector(), GetLongitude(), SetLongitude(), and ToVector().

◆ m_polarRadius

double ns3::GeoCoordinate::m_polarRadius
private

Definition at line 246 of file geo-coordinate.h.

Referenced by Initialize().

◆ m_refEllipsoid

ReferenceEllipsoid_t ns3::GeoCoordinate::m_refEllipsoid
private

Definition at line 243 of file geo-coordinate.h.

Referenced by Construct(), GetRefEllipsoid(), Initialize(), and SetAltitude().

◆ polarRadius_grs80

constexpr double ns3::GeoCoordinate::polarRadius_grs80 = 6356752.314103
staticconstexpr

Definition at line 159 of file geo-coordinate.h.

Referenced by Initialize(), and IsValidAltitude().

◆ polarRadius_sphere

constexpr double ns3::GeoCoordinate::polarRadius_sphere = 6378137.0
staticconstexpr

◆ polarRadius_wgs84

constexpr double ns3::GeoCoordinate::polarRadius_wgs84 = 6356752.314245
staticconstexpr

Definition at line 158 of file geo-coordinate.h.

Referenced by Initialize(), and IsValidAltitude().


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