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 |
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 41 of file geo-coordinate.h.
Enumerator | |
---|---|
SPHERE | |
WGS84 | |
GRS80 |
Definition at line 44 of file geo-coordinate.h.
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.
latitude | latitude of position, -90 ... 90 degrees |
longitude | longitude of position, -180 ... 180 degrees |
altitude | altitude of position, >= -EARTH_RADIUS |
correctIfInvalid | Correct latitude and longitude if outside bounds |
Definition at line 54 of file geo-coordinate.cc.
References Construct().
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.
latitude | latitude of position, -90 ... 90 degrees |
longitude | longitude of position, -180 ... 180 degrees |
altitude | altitude of position, >= -EARTH_RADIUS |
refEllipsoid | Reference ellipsoid to be used |
correctIfInvalid | Correct latitude and longitude if outside bounds |
Definition at line 42 of file geo-coordinate.cc.
References Construct().
ns3::GeoCoordinate::GeoCoordinate | ( | Vector | vector | ) |
Create GeoCoordinate from given vector (x, y, z).
Reference ellipsoid to be used is sphere.
vector | coordinates as Vector (x, y, z) (Cartesian) |
Definition at line 65 of file geo-coordinate.cc.
References ConstructFromVector().
ns3::GeoCoordinate::GeoCoordinate | ( | Vector | vector, |
ReferenceEllipsoid_t | refEllipsoid | ||
) |
Create GeoCoordinate from given vector (x, y, z) and reference ellipsoid.
vector | coordinates as Vector (x, y, z) (Cartesian) |
refEllipsoid | Reference ellipsoid to be used |
Definition at line 73 of file geo-coordinate.cc.
References ConstructFromVector().
ns3::GeoCoordinate::GeoCoordinate | ( | ) |
Create GeoCoordinate with zero values of longitude, latitude and altitude.
Reference ellipsoid to be used is sphere.
Definition at line 81 of file geo-coordinate.cc.
References Initialize().
|
private |
latitude | latitude of position |
longitude | longitude of position |
altitude | altitude of position |
correctIfInvalid | Correct 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 93 of file geo-coordinate.cc.
References Initialize(), IsValidAltitude(), IsValidLatitude(), IsValidLongitude(), m_altitude, m_latitude, m_longitude, and m_refEllipsoid.
Referenced by GeoCoordinate().
|
private |
Creates Geodetic coordinates from given Cartesian coordinates.
vector | reference to vector containing Cartesian coordinates for creation. |
Definition at line 250 of file geo-coordinate.cc.
References GetRadiusCurvature(), Initialize(), m_altitude, m_e2Param, m_latitude, m_longitude, and ns3::SatUtils::RadiansToDegrees().
Referenced by GeoCoordinate().
double ns3::GeoCoordinate::GetAltitude | ( | ) | const |
Gets altitude value of coordinate.
Definition at line 204 of file geo-coordinate.cc.
References m_altitude.
Referenced by ns3::SatMobilityObserver::SatMobilityObserver(), ns3::SatListPositionAllocator::Add(), SatConstellationTest1::DoRun(), ns3::SatPositionAllocator::GetNext(), ns3::SatRandomCirclePositionAllocator::GetNextGeoPosition(), ns3::operator<<(), SatCourseChange(), ns3::SatMobilityObserver::UpdateElevationAngle(), and GeoCoordinateTestCase::Validate().
double ns3::GeoCoordinate::GetLatitude | ( | ) | const |
Gets latitude value of coordinate.
Definition at line 197 of file geo-coordinate.cc.
References m_latitude.
Referenced by ns3::SatAntennaGainPattern::SatAntennaGainPattern(), ns3::SatListPositionAllocator::Add(), ns3::SatBeamHelper::CreateBeamInfo(), SatConstellationTest1::DoRun(), ns3::SatAntennaGainPattern::GetAntennaGain_lin(), ns3::SatAntennaGainPatternContainer::GetBeamGain(), ns3::SatAntennaGainPatternContainer::GetBestBeamId(), ns3::SatAntennaGainPattern::GetCenterLatitude(), ns3::SatPositionAllocator::GetNext(), ns3::SatSpotBeamPositionAllocator::GetNextGeoPosition(), ns3::SatRandomCirclePositionAllocator::GetNextGeoPosition(), ns3::SatAntennaGainPattern::GetSatelliteOffset(), ns3::SatBeamHelper::GetUtInfo(), ns3::SatAntennaGainPattern::IsValidPosition(), ns3::operator<<(), SatCourseChange(), ns3::SatMobilityObserver::UpdateElevationAngle(), and GeoCoordinateTestCase::Validate().
double ns3::GeoCoordinate::GetLongitude | ( | ) | const |
Gets longitude value of coordinate.
Definition at line 190 of file geo-coordinate.cc.
References m_longitude.
Referenced by ns3::SatAntennaGainPattern::SatAntennaGainPattern(), ns3::SatListPositionAllocator::Add(), SatConstellationTest1::DoRun(), ns3::SatAntennaGainPattern::GetAntennaGain_lin(), ns3::SatAntennaGainPatternContainer::GetBeamGain(), ns3::SatAntennaGainPatternContainer::GetBestBeamId(), ns3::SatAntennaGainPattern::GetCenterLongitude(), ns3::SatPositionAllocator::GetNext(), ns3::SatSpotBeamPositionAllocator::GetNextGeoPosition(), ns3::SatRandomCirclePositionAllocator::GetNextGeoPosition(), ns3::SatAntennaGainPattern::GetSatelliteOffset(), ns3::SatAntennaGainPattern::IsValidPosition(), ns3::operator<<(), SatCourseChange(), ns3::SatMobilityObserver::UpdateElevationAngle(), and GeoCoordinateTestCase::Validate().
|
private |
Gets the radius of curvature in the prime vertical.
latitude | latitude in radians at to get the radius of curvature. |
Definition at line 316 of file geo-coordinate.cc.
References m_e2Param, and m_equatorRadius.
Referenced by ConstructFromVector(), and ToVector().
|
inline |
Gets reference ellipsoid used by GeoCoordinate object.
Definition at line 106 of file geo-coordinate.h.
References m_refEllipsoid.
Referenced by ns3::SatMobilityObserver::SatMobilityObserver().
|
private |
This method is called to initialize needed parameters according to used reference ellipsoide.
Definition at line 161 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().
|
inlinestaticprivate |
Checks if altitude is in valid range.
altitude | to check |
Definition at line 322 of file geo-coordinate.cc.
References GRS80, polarRadius_grs80, polarRadius_sphere, polarRadius_wgs84, SPHERE, and WGS84.
Referenced by Construct(), and SetAltitude().
|
inlinestaticprivate |
Checks if latitude is in valid range.
latitude | to check |
Definition at line 189 of file geo-coordinate.h.
Referenced by Construct(), and SetLatitude().
|
inlinestaticprivate |
Checks if longitude is in valid range.
longitude | to check |
Definition at line 178 of file geo-coordinate.h.
Referenced by Construct(), and SetLongitude().
void ns3::GeoCoordinate::SetAltitude | ( | double | altitude | ) |
Sets altitude value of coordinate.
altitude | longitude to set |
Definition at line 237 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().
void ns3::GeoCoordinate::SetLatitude | ( | double | latitude | ) |
Sets latitude value of coordinate.
latitude | longitude to set |
Definition at line 224 of file geo-coordinate.cc.
References IsValidLatitude(), and m_latitude.
Referenced by SatMobilityObserverTestCase::DoRun(), and ns3::operator>>().
void ns3::GeoCoordinate::SetLongitude | ( | double | longitude | ) |
Sets longitude value of coordinate.
longitude | longitude to set |
Definition at line 211 of file geo-coordinate.cc.
References IsValidLongitude(), and m_longitude.
Referenced by SatMobilityObserverTestCase::DoRun(), and ns3::operator>>().
Vector ns3::GeoCoordinate::ToVector | ( | ) | const |
Converts Geodetic coordinates to Cartesian coordinates.
Definition at line 143 of file geo-coordinate.cc.
References ns3::SatUtils::DegreesToRadians(), GetRadiusCurvature(), m_altitude, m_e2Param, m_latitude, and m_longitude.
Referenced by ns3::SatMobilityObserver::SatMobilityObserver(), ns3::SatGroupHelper::CreateGroupFromPosition(), ns3::SatSGP4MobilityModel::DoGetPosition(), ns3::SatMobilityModel::DoGetPosition(), GeoCoordinateTestCase::DoRun(), ns3::SatTracedMobilityModel::DoSetGeoPosition(), ns3::SatTopology::GetClosestSat(), ns3::SatMobilityModel::GetDistanceFrom(), ns3::SatPositionAllocator::GetNext(), SatCourseChange(), and ns3::SatMobilityObserver::UpdateElevationAngle().
|
staticconstexpr |
Definition at line 157 of file geo-coordinate.h.
Referenced by Initialize().
|
private |
altitude of coordinate
Definition at line 244 of file geo-coordinate.h.
Referenced by Construct(), ConstructFromVector(), GetAltitude(), SetAltitude(), and ToVector().
|
private |
Definition at line 247 of file geo-coordinate.h.
Referenced by ConstructFromVector(), GetRadiusCurvature(), Initialize(), and ToVector().
|
private |
Definition at line 248 of file geo-coordinate.h.
Referenced by GetRadiusCurvature(), and Initialize().
|
private |
latitude of coordinate
Definition at line 236 of file geo-coordinate.h.
Referenced by Construct(), ConstructFromVector(), GetLatitude(), SetLatitude(), and ToVector().
|
private |
longitude of coordinate
Definition at line 240 of file geo-coordinate.h.
Referenced by Construct(), ConstructFromVector(), GetLongitude(), SetLongitude(), and ToVector().
|
private |
Definition at line 249 of file geo-coordinate.h.
Referenced by Initialize().
|
private |
Definition at line 246 of file geo-coordinate.h.
Referenced by Construct(), GetRefEllipsoid(), Initialize(), and SetAltitude().
|
staticconstexpr |
Definition at line 162 of file geo-coordinate.h.
Referenced by Initialize(), and IsValidAltitude().
|
staticconstexpr |
Definition at line 160 of file geo-coordinate.h.
Referenced by ns3::SatRandomCirclePositionAllocator::GetNextGeoPosition(), Initialize(), and IsValidAltitude().
|
staticconstexpr |
Definition at line 161 of file geo-coordinate.h.
Referenced by Initialize(), and IsValidAltitude().