INET Framework for OMNeT++/OMNEST
inet::SimpleGeographicCoordinateSystem Class Reference

#include <CoordinateSystem.h>

Inheritance diagram for inet::SimpleGeographicCoordinateSystem:
inet::IGeographicCoordinateSystem

Public Member Functions

virtual GeoCoord getPlaygroundPosition () const override
 
virtual EulerAngles getPlaygroundOrientation () const override
 
virtual Coord computePlaygroundCoordinate (const GeoCoord &geographicCoordinate) const override
 
virtual GeoCoord computeGeographicCoordinate (const Coord &playgroundCoordinate) const override
 

Protected Member Functions

virtual void initialize (int stage) override
 

Protected Attributes

double metersPerDegree = 111320
 
double playgroundLatitude = NaN
 
double playgroundLongitude = NaN
 
double playgroundAltitude = NaN
 

Member Function Documentation

GeoCoord inet::SimpleGeographicCoordinateSystem::computeGeographicCoordinate ( const Coord playgroundCoordinate) const
overridevirtual

Implements inet::IGeographicCoordinateSystem.

47 {
48  double geograpicLatitude = playgroundLatitude - playgroundCoordinate.y / metersPerDegree;
49  double geograpicLongitude = playgroundLongitude + playgroundCoordinate.x / metersPerDegree / cos(fabs(playgroundLatitude / 180 * M_PI));
50  return GeoCoord(geograpicLatitude, geograpicLongitude, playgroundCoordinate.z - playgroundAltitude);
51 }
double playgroundLongitude
Definition: CoordinateSystem.h:62
Value cos(const value< Value, Unit > &angle)
Definition: Units.h:1201
double playgroundLatitude
Definition: CoordinateSystem.h:61
double playgroundAltitude
Definition: CoordinateSystem.h:63
#define M_PI
Definition: PlotFigure.cc:27
double metersPerDegree
Definition: CoordinateSystem.h:60
Coord inet::SimpleGeographicCoordinateSystem::computePlaygroundCoordinate ( const GeoCoord geographicCoordinate) const
overridevirtual

Implements inet::IGeographicCoordinateSystem.

40 {
41  double playgroundX = (geographicCoordinate.longitude - playgroundLongitude) * cos(fabs(playgroundLatitude / 180 * M_PI)) * metersPerDegree;
42  double playgroundY = (playgroundLatitude - geographicCoordinate.latitude) * metersPerDegree;
43  return Coord(playgroundX, playgroundY, geographicCoordinate.altitude + playgroundAltitude);
44 }
double playgroundLongitude
Definition: CoordinateSystem.h:62
Value cos(const value< Value, Unit > &angle)
Definition: Units.h:1201
double playgroundLatitude
Definition: CoordinateSystem.h:61
double playgroundAltitude
Definition: CoordinateSystem.h:63
#define M_PI
Definition: PlotFigure.cc:27
double metersPerDegree
Definition: CoordinateSystem.h:60
virtual EulerAngles inet::SimpleGeographicCoordinateSystem::getPlaygroundOrientation ( ) const
inlineoverridevirtual

Implements inet::IGeographicCoordinateSystem.

70 { return EulerAngles::ZERO; }
static const EulerAngles ZERO
Definition: EulerAngles.h:12
virtual GeoCoord inet::SimpleGeographicCoordinateSystem::getPlaygroundPosition ( ) const
inlineoverridevirtual

Implements inet::IGeographicCoordinateSystem.

double playgroundLongitude
Definition: CoordinateSystem.h:62
double playgroundLatitude
Definition: CoordinateSystem.h:61
double playgroundAltitude
Definition: CoordinateSystem.h:63
void inet::SimpleGeographicCoordinateSystem::initialize ( int  stage)
overrideprotectedvirtual
31 {
32  if (stage == INITSTAGE_LOCAL) {
33  playgroundLatitude = par("playgroundLatitude");
34  playgroundLongitude = par("playgroundLongitude");
35  playgroundAltitude = par("playgroundAltitude");
36  }
37 }
double playgroundLongitude
Definition: CoordinateSystem.h:62
double playgroundLatitude
Definition: CoordinateSystem.h:61
double playgroundAltitude
Definition: CoordinateSystem.h:63
Local initializations.
Definition: InitStages.h:35

Member Data Documentation

double inet::SimpleGeographicCoordinateSystem::metersPerDegree = 111320
protected
double inet::SimpleGeographicCoordinateSystem::playgroundAltitude = NaN
protected
double inet::SimpleGeographicCoordinateSystem::playgroundLatitude = NaN
protected
double inet::SimpleGeographicCoordinateSystem::playgroundLongitude = NaN
protected

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