dotnet/NETGeographicLib/GravityModel.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
13 #include "GravityModel.h"
15 #include "GravityCircle.h"
16 #include "NormalGravity.h"
17 #include "NETGeographicLib.h"
18 
19 using namespace NETGeographicLib;
20 
21 //*****************************************************************************
23 {
24  if ( m_pGravityModel != NULL )
25  {
26  delete m_pGravityModel;
27  m_pGravityModel = NULL;
28  }
29 }
30 
31 //*****************************************************************************
32 GravityModel::GravityModel(System::String^ name, System::String^ path)
33 {
34  if ( name == nullptr ) throw gcnew GeographicErr("name cannot be a null pointer.");
35  if ( path == nullptr ) throw gcnew GeographicErr("path cannot be a null pointer.");
36  try
37  {
41  }
42  catch ( std::bad_alloc err )
43  {
44  throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::GravityModel" );
45  }
46  catch ( const std::exception& err )
47  {
48  throw gcnew GeographicErr( err.what() );
49  }
50 }
51 
52 //*****************************************************************************
53 double GravityModel::Gravity(double lat, double lon, double h,
54  [System::Runtime::InteropServices::Out] double% gx,
55  [System::Runtime::InteropServices::Out] double% gy,
56  [System::Runtime::InteropServices::Out] double% gz)
57 {
58  double lgx, lgy, lgz;
59  double out = m_pGravityModel->Gravity( lat, lon, h, lgx, lgy, lgz );
60  gx = lgx;
61  gy = lgy;
62  gz = lgz;
63  return out;
64 }
65 
66 //*****************************************************************************
67 double GravityModel::Disturbance(double lat, double lon, double h,
68  [System::Runtime::InteropServices::Out] double% deltax,
69  [System::Runtime::InteropServices::Out] double% deltay,
70  [System::Runtime::InteropServices::Out] double% deltaz)
71 {
72  double lgx, lgy, lgz;
73  double out = m_pGravityModel->Disturbance( lat, lon, h, lgx, lgy, lgz );
74  deltax = lgx;
75  deltay = lgy;
76  deltaz = lgz;
77  return out;
78 }
79 
80 //*****************************************************************************
81 double GravityModel::GeoidHeight(double lat, double lon)
82 {
83  return m_pGravityModel->GeoidHeight( lat, lon );
84 }
85 
86 //*****************************************************************************
87 void GravityModel::SphericalAnomaly(double lat, double lon, double h,
88  [System::Runtime::InteropServices::Out] double% Dg01,
89  [System::Runtime::InteropServices::Out] double% xi,
90  [System::Runtime::InteropServices::Out] double% eta)
91 {
92  double lgx, lgy, lgz;
93  m_pGravityModel->SphericalAnomaly( lat, lon, h, lgx, lgy, lgz );
94  Dg01 = lgx;
95  xi = lgy;
96  eta = lgz;
97 }
98 
99 //*****************************************************************************
100 double GravityModel::W(double X, double Y, double Z,
101  [System::Runtime::InteropServices::Out] double% gX,
102  [System::Runtime::InteropServices::Out] double% gY,
103  [System::Runtime::InteropServices::Out] double% gZ)
104 {
105  double lgx, lgy, lgz;
106  double out = m_pGravityModel->W( X, Y, Z, lgx, lgy, lgz );
107  gX = lgx;
108  gY = lgy;
109  gZ = lgz;
110  return out;
111 }
112 
113 //*****************************************************************************
114 double GravityModel::V(double X, double Y, double Z,
115  [System::Runtime::InteropServices::Out] double% GX,
116  [System::Runtime::InteropServices::Out] double% GY,
117  [System::Runtime::InteropServices::Out] double% GZ)
118 {
119  double lgx, lgy, lgz;
120  double out = m_pGravityModel->V( X, Y, Z, lgx, lgy, lgz );
121  GX = lgx;
122  GY = lgy;
123  GZ = lgz;
124  return out;
125 }
126 
127 //*****************************************************************************
128 double GravityModel::T(double X, double Y, double Z,
129  [System::Runtime::InteropServices::Out] double% deltaX,
130  [System::Runtime::InteropServices::Out] double% deltaY,
131  [System::Runtime::InteropServices::Out] double% deltaZ)
132 {
133  double lgx, lgy, lgz;
134  double out = m_pGravityModel->T( X, Y, Z, lgx, lgy, lgz );
135  deltaX = lgx;
136  deltaY = lgy;
137  deltaZ = lgz;
138  return out;
139 }
140 
141 //*****************************************************************************
142 double GravityModel::T(double X, double Y, double Z)
143 {
144  return m_pGravityModel->T( X, Y, Z );
145 }
146 
147 //*****************************************************************************
148 double GravityModel::U(double X, double Y, double Z,
149  [System::Runtime::InteropServices::Out] double% gammaX,
150  [System::Runtime::InteropServices::Out] double% gammaY,
151  [System::Runtime::InteropServices::Out] double% gammaZ)
152 {
153  double lgx, lgy, lgz;
154  double out = m_pGravityModel->U( X, Y, Z, lgx, lgy, lgz );
155  gammaX = lgx;
156  gammaY = lgy;
157  gammaZ = lgz;
158  return out;
159 }
160 
161 //*****************************************************************************
162 double GravityModel::Phi(double X, double Y,
163  [System::Runtime::InteropServices::Out] double% fX,
164  [System::Runtime::InteropServices::Out] double% fY)
165 {
166  double lgx, lgy;
167  double out = m_pGravityModel->Phi( X, Y, lgx, lgy );
168  fX = lgx;
169  fY = lgy;
170  return out;
171 }
172 
173 //*****************************************************************************
174 GravityCircle^ GravityModel::Circle(double lat, double h, Mask caps )
175 {
176  try
177  {
178  return gcnew GravityCircle( m_pGravityModel->Circle( lat, h, (unsigned)caps ) );
179  }
180  catch ( const std::exception& err )
181  {
182  throw gcnew GeographicErr( err.what() );
183  }
184 }
185 
186 //*****************************************************************************
187 System::String^ GravityModel::Description::get()
188 {
190 }
191 
192 //*****************************************************************************
193 System::String^ GravityModel::DateTime::get()
194 {
196 }
197 
198 //*****************************************************************************
199 System::String^ GravityModel::GravityFile::get()
200 {
202 }
203 
204 //*****************************************************************************
205 System::String^ GravityModel::GravityModelName::get()
206 {
208 }
209 
210 //*****************************************************************************
212 {
214 }
215 
216 //*****************************************************************************
218 {
219  try
220  {
222  }
223  catch ( const std::exception& err )
224  {
225  throw gcnew GeographicErr( err.what() );
226  }
227 }
228 
229 //*****************************************************************************
231 {
232  try
233  {
235  }
236  catch ( const std::exception& err )
237  {
238  throw gcnew GeographicErr( err.what() );
239  }
240 }
241 
242 //*****************************************************************************
244 {
246 }
247 
248 //*****************************************************************************
250 { return m_pGravityModel->MajorRadius(); }
251 
252 //*****************************************************************************
254 { return m_pGravityModel->MassConstant(); }
255 
256 //*****************************************************************************
259 
260 //*****************************************************************************
262 { return m_pGravityModel->AngularVelocity(); }
263 
264 //*****************************************************************************
266 { return m_pGravityModel->Flattening(); }
const std::string & GravityFile() const
Header for NETGeographicLib::NETGeographicLib objects.
static const double lat
double T(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double%deltaX, [System::Runtime::InteropServices::Out] double%deltaY, [System::Runtime::InteropServices::Out] double%deltaZ)
.NET wrapper for GeographicLib::GravityCircle.
Definition: GravityCircle.h:45
void SphericalAnomaly(real lat, real lon, real h, real &Dg01, real &xi, real &eta) const
Exception class for NETGeographicLib.
double W(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double%gX, [System::Runtime::InteropServices::Out] double%gY, [System::Runtime::InteropServices::Out] double%gZ)
Math::real T(real X, real Y, real Z, real &deltaX, real &deltaY, real &deltaZ) const
static std::string ManagedToUnmanaged(System::String^s)
Math::real Flattening() const
Header for GeographicLib::GravityModel class.
Math::real Gravity(real lat, real lon, real h, real &gx, real &gy, real &gz) const
const GeographicLib::GravityModel * m_pGravityModel
Definition: GravityModel.h:87
Math::real V(real X, real Y, real Z, real &GX, real &GY, real &GZ) const
GravityModel(System::String^name, System::String^path)
const std::string & GravityModelName() const
Math::real AngularVelocity() const
Header for NETGeographicLib::GravityModel class.
#define Z
Definition: icosphere.cpp:21
.NET wrapper for GeographicLib::NormalGravity.
Definition: NormalGravity.h:71
Math::real Disturbance(real lat, real lon, real h, real &deltax, real &deltay, real &deltaz) const
Math::real GeoidHeight(real lat, real lon) const
Header for NETGeographicLib::GravityCircle class.
Header for NETGeographicLib::NormalGravity class.
static System::String UnmanagedToManaged(const std::string &s)
const std::string & Description() const
GravityCircle Circle(real lat, real h, unsigned caps=ALL) const
double Disturbance(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double%deltax, [System::Runtime::InteropServices::Out] double%deltay, [System::Runtime::InteropServices::Out] double%deltaz)
const NormalGravity & ReferenceEllipsoid() const
const std::string & GravityModelDirectory() const
#define NULL
Definition: ccolamd.c:609
Vector xi
Definition: testPose2.cpp:150
double U(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double%gammaX, [System::Runtime::InteropServices::Out] double%gammaY, [System::Runtime::InteropServices::Out] double%gammaZ)
double Phi(double X, double Y, [System::Runtime::InteropServices::Out] double%fX, [System::Runtime::InteropServices::Out] double%fY)
void SphericalAnomaly(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double%Dg01, [System::Runtime::InteropServices::Out] double%xi, [System::Runtime::InteropServices::Out] double%eta)
Model of the earth's gravity field.
const double h
static std::string DefaultGravityName()
Math::real Phi(real X, real Y, real &fX, real &fY) const
Math::real MajorRadius() const
double Gravity(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double%gx, [System::Runtime::InteropServices::Out] double%gy, [System::Runtime::InteropServices::Out] double%gz)
Math::real MassConstant() const
static std::string DefaultGravityPath()
const std::string & DateTime() const
GravityCircle Circle(double lat, double h, Mask caps)
double V(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double%GX, [System::Runtime::InteropServices::Out] double%GY, [System::Runtime::InteropServices::Out] double%GZ)
Math::real U(real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const
static const double lon
.NET wrapper for GeographicLib::GravityModel.
Definition: GravityModel.h:83
Annotation for function names.
Definition: attr.h:36
Container::iterator get(Container &c, Position position)
Math::real ReferenceMassConstant() const
#define X
Definition: icosphere.cpp:20
Math::real W(real X, real Y, real Z, real &gX, real &gY, real &gZ) const
Header for GeographicLib::GravityCircle class.


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:10