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 {
189  return StringConvert::UnmanagedToManaged( m_pGravityModel->Description() );
190 }
191 
192 //*****************************************************************************
193 System::String^ GravityModel::DateTime::get()
194 {
195  return StringConvert::UnmanagedToManaged( m_pGravityModel->DateTime() );
196 }
197 
198 //*****************************************************************************
199 System::String^ GravityModel::GravityFile::get()
200 {
201  return StringConvert::UnmanagedToManaged( m_pGravityModel->GravityFile() );
202 }
203 
204 //*****************************************************************************
205 System::String^ GravityModel::GravityModelName::get()
206 {
207  return StringConvert::UnmanagedToManaged( m_pGravityModel->GravityModelName() );
208 }
209 
210 //*****************************************************************************
212 {
213  return StringConvert::UnmanagedToManaged( m_pGravityModel->GravityModelDirectory() );
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 //*****************************************************************************
258 { return m_pGravityModel->ReferenceMassConstant(); }
259 
260 //*****************************************************************************
262 { return m_pGravityModel->AngularVelocity(); }
263 
264 //*****************************************************************************
266 { return m_pGravityModel->Flattening(); }
NETGeographicLib::GravityModel::W
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)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:100
GeographicLib::GravityModel::U
Math::real U(real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const
Definition: GravityModel.hpp:363
name
Annotation for function names.
Definition: attr.h:51
NETGeographicLib::GravityModel::DefaultGravityPath
static System::String DefaultGravityPath()
Definition: dotnet/NETGeographicLib/GravityModel.cpp:217
NETGeographicLib::GravityCircle
.NET wrapper for GeographicLib::GravityCircle.
Definition: GravityCircle.h:45
GeographicLib::GravityModel::Phi
Math::real Phi(real X, real Y, real &fX, real &fY) const
Definition: GravityModel.hpp:381
screwPose2::xi
Vector xi
Definition: testPose2.cpp:148
gtsam::Y
GaussianFactorGraphValuePair Y
Definition: HybridGaussianProductFactor.cpp:29
NETGeographicLib::GravityModel::V
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)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:114
NETGeographicLib::GravityModel::Mask
Mask
Definition: GravityModel.h:109
NETGeographicLib::GravityModel::Disturbance
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)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:67
NETGeographicLib::GravityModel
.NET wrapper for GeographicLib::GravityModel.
Definition: GravityModel.h:83
X
#define X
Definition: icosphere.cpp:20
NETGeographicLib::GravityModel::U
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)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:148
GravityModel.h
Header for NETGeographicLib::GravityModel class.
h
const double h
Definition: testSimpleHelicopter.cpp:19
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
GravityModel.hpp
Header for GeographicLib::GravityModel class.
GeographicLib::GravityModel::ReferenceEllipsoid
const NormalGravity & ReferenceEllipsoid() const
Definition: GravityModel.hpp:430
NETGeographicLib::StringConvert::UnmanagedToManaged
static System::String UnmanagedToManaged(const std::string &s)
Definition: NETGeographicLib.h:153
NETGeographicLib::GravityModel::GravityModel
GravityModel(System::String^ name, System::String^ path)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:32
NETGeographicLib::NormalGravity
.NET wrapper for GeographicLib::NormalGravity.
Definition: NormalGravity.h:71
GravityCircle.hpp
Header for GeographicLib::GravityCircle class.
GeographicLib::GravityModel::Gravity
Math::real Gravity(real lat, real lon, real h, real &gx, real &gy, real &gz) const
Definition: src/GravityModel.cpp:289
NETGeographicLib::GravityModel::Circle
GravityCircle Circle(double lat, double h, Mask caps)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:174
NETGeographicLib::GravityModel::GeoidHeight
double GeoidHeight(double lat, double lon)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:81
GeographicLib::GravityModel::Disturbance
Math::real Disturbance(real lat, real lon, real h, real &deltax, real &deltay, real &deltaz) const
Definition: src/GravityModel.cpp:297
NETGeographicLib::GravityModel::Phi
double Phi(double X, double Y, [System::Runtime::InteropServices::Out] double% fX, [System::Runtime::InteropServices::Out] double% fY)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:162
stdafx.h
NormalGravity.h
Header for NETGeographicLib::NormalGravity class.
NETGeographicLib::GravityModel::DefaultGravityName
static System::String DefaultGravityName()
Definition: dotnet/NETGeographicLib/GravityModel.cpp:230
NETGeographicLib::GravityModel::SphericalAnomaly
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)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:87
NETGeographicLib.h
Header for NETGeographicLib::NETGeographicLib objects.
out
std::ofstream out("Result.txt")
GeographicLib::GravityModel::DefaultGravityName
static std::string DefaultGravityName()
Definition: src/GravityModel.cpp:354
matlab_wrap.path
path
Definition: matlab_wrap.py:66
GravityCircle.h
Header for NETGeographicLib::GravityCircle class.
NETGeographicLib::GravityModel::m_pGravityModel
const GeographicLib::GravityModel * m_pGravityModel
Definition: GravityModel.h:87
NETGeographicLib::GravityModel::Gravity
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)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:53
GeographicLib::GravityModel::DefaultGravityPath
static std::string DefaultGravityPath()
Definition: src/GravityModel.cpp:341
GeographicLib::GravityModel::Circle
GravityCircle Circle(real lat, real h, unsigned caps=ALL) const
Definition: src/GravityModel.cpp:307
GeographicLib::GravityModel::V
Math::real V(real X, real Y, real Z, real &GX, real &GY, real &GZ) const
Definition: src/GravityModel.cpp:228
lon
static const double lon
Definition: testGeographicLib.cpp:34
NULL
#define NULL
Definition: ccolamd.c:609
GeographicLib::GravityModel::SphericalAnomaly
void SphericalAnomaly(real lat, real lon, real h, real &Dg01, real &xi, real &eta) const
Definition: src/GravityModel.cpp:249
NETGeographicLib::GravityModel::ReferenceEllipsoid
NormalGravity ReferenceEllipsoid()
Definition: dotnet/NETGeographicLib/GravityModel.cpp:243
NETGeographicLib::GravityModel::T
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)
Definition: dotnet/NETGeographicLib/GravityModel.cpp:128
Z
#define Z
Definition: icosphere.cpp:21
GeographicLib::GravityModel
Model of the earth's gravity field.
Definition: GravityModel.hpp:83
get
Container::iterator get(Container &c, Position position)
Definition: stdlist_overload.cpp:29
GeographicLib::GravityModel::GeoidHeight
Math::real GeoidHeight(real lat, real lon) const
Definition: src/GravityModel.cpp:275
NETGeographicLib
Definition: Accumulator.h:13
GeographicLib::GravityModel::W
Math::real W(real X, real Y, real Z, real &gX, real &gY, real &gZ) const
Definition: src/GravityModel.cpp:240
NETGeographicLib::StringConvert::ManagedToUnmanaged
static std::string ManagedToUnmanaged(System::String^ s)
Definition: NETGeographicLib.cpp:20
lat
static const double lat
Definition: testGeographicLib.cpp:34
GeographicLib::GravityModel::T
Math::real T(real X, real Y, real Z, real &deltaX, real &deltaY, real &deltaZ) const
Definition: GravityModel.hpp:326


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:23