dotnet/NETGeographicLib/GeodesicLineExact.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
13 #include "GeodesicLineExact.h"
14 #include "GeodesicExact.h"
15 
16 using namespace NETGeographicLib;
17 
18 const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::GeodesicLineExact";
19 
20 //*****************************************************************************
22 {
23  if ( m_pGeodesicLineExact != NULL )
24  {
25  delete m_pGeodesicLineExact;
26  m_pGeodesicLineExact = NULL;
27  }
28 }
29 
30 //*****************************************************************************
32  double lon1, double azi1, NETGeographicLib::Mask caps )
33 {
34  try
35  {
36  const GeographicLib::GeodesicExact* pGeodesicExact=
37  reinterpret_cast<const GeographicLib::GeodesicExact*>(
38  g->GetUnmanaged()->ToPointer() );
40  *pGeodesicExact, lat1, lon1, azi1, static_cast<unsigned>(caps) );
41  }
42  catch ( std::bad_alloc )
43  {
44  throw gcnew GeographicErr( BADALLOC );
45  }
46 }
47 
48 //*****************************************************************************
51 {
52  try
53  {
55  }
56  catch (std::bad_alloc)
57  {
58  throw gcnew GeographicErr(BADALLOC);
59  }
60 }
61 
62 //*****************************************************************************
63 GeodesicLineExact::GeodesicLineExact(double lat1, double lon1, double azi1,
65 {
66  try
67  {
69  GeographicLib::GeodesicExact::WGS84(), lat1, lon1, azi1,
70  static_cast<unsigned>(caps) );
71  }
72  catch ( std::bad_alloc )
73  {
74  throw gcnew GeographicErr( BADALLOC );
75  }
76 }
77 
78 //*****************************************************************************
79 double GeodesicLineExact::Position(double s12,
80  [System::Runtime::InteropServices::Out] double% lat2,
81  [System::Runtime::InteropServices::Out] double% lon2,
82  [System::Runtime::InteropServices::Out] double% azi2,
83  [System::Runtime::InteropServices::Out] double% m12,
84  [System::Runtime::InteropServices::Out] double% M12,
85  [System::Runtime::InteropServices::Out] double% M21,
86  [System::Runtime::InteropServices::Out] double% S12)
87 {
88  double llat2, llon2, lazi2, lm12, lM12, lM21, lS12;
89  double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2,
90  lm12, lM12, lM21, lS12 );
91  lat2 = llat2;
92  lon2 = llon2;
93  azi2 = lazi2;
94  m12 = lm12;
95  M12 = lM12;
96  M21 = lM21;
97  S12 = lS12;
98  return out;
99 }
100 
101 //*****************************************************************************
102 double GeodesicLineExact::Position(double s12,
103  [System::Runtime::InteropServices::Out] double% lat2,
104  [System::Runtime::InteropServices::Out] double% lon2)
105 {
106  double llat2, llon2;
107  double out = m_pGeodesicLineExact->Position( s12, llat2, llon2);
108  lat2 = llat2;
109  lon2 = llon2;
110  return out;
111 }
112 
113 //*****************************************************************************
114 double GeodesicLineExact::Position(double s12,
115  [System::Runtime::InteropServices::Out] double% lat2,
116  [System::Runtime::InteropServices::Out] double% lon2,
117  [System::Runtime::InteropServices::Out] double% azi2)
118 {
119  double llat2, llon2, lazi2;
120  double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2);
121  lat2 = llat2;
122  lon2 = llon2;
123  azi2 = lazi2;
124  return out;
125 }
126 
127 //*****************************************************************************
128 double GeodesicLineExact::Position(double s12,
129  [System::Runtime::InteropServices::Out] double% lat2,
130  [System::Runtime::InteropServices::Out] double% lon2,
131  [System::Runtime::InteropServices::Out] double% azi2,
132  [System::Runtime::InteropServices::Out] double% m12)
133 {
134  double llat2, llon2, lazi2, lm12;
135  double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2,
136  lm12 );
137  lat2 = llat2;
138  lon2 = llon2;
139  azi2 = lazi2;
140  m12 = lm12;
141  return out;
142 }
143 
144 //*****************************************************************************
145 double GeodesicLineExact::Position(double s12,
146  [System::Runtime::InteropServices::Out] double% lat2,
147  [System::Runtime::InteropServices::Out] double% lon2,
148  [System::Runtime::InteropServices::Out] double% azi2,
149  [System::Runtime::InteropServices::Out] double% M12,
150  [System::Runtime::InteropServices::Out] double% M21)
151 {
152  double llat2, llon2, lazi2, lM12, lM21;
153  double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2,
154  lM12, lM21 );
155  lat2 = llat2;
156  lon2 = llon2;
157  azi2 = lazi2;
158  M12 = lM12;
159  M21 = lM21;
160  return out;
161 }
162 
163 //*****************************************************************************
164 double GeodesicLineExact::Position(double s12,
165  [System::Runtime::InteropServices::Out] double% lat2,
166  [System::Runtime::InteropServices::Out] double% lon2,
167  [System::Runtime::InteropServices::Out] double% azi2,
168  [System::Runtime::InteropServices::Out] double% m12,
169  [System::Runtime::InteropServices::Out] double% M12,
170  [System::Runtime::InteropServices::Out] double% M21)
171 {
172  double llat2, llon2, lazi2, lm12, lM12, lM21;
173  double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2,
174  lm12, lM12, lM21 );
175  lat2 = llat2;
176  lon2 = llon2;
177  azi2 = lazi2;
178  m12 = lm12;
179  M12 = lM12;
180  M21 = lM21;
181  return out;
182 }
183 
184 //*****************************************************************************
186  [System::Runtime::InteropServices::Out] double% lat2,
187  [System::Runtime::InteropServices::Out] double% lon2,
188  [System::Runtime::InteropServices::Out] double% azi2,
189  [System::Runtime::InteropServices::Out] double% s12,
190  [System::Runtime::InteropServices::Out] double% m12,
191  [System::Runtime::InteropServices::Out] double% M12,
192  [System::Runtime::InteropServices::Out] double% M21,
193  [System::Runtime::InteropServices::Out] double% S12)
194 {
195  double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12;
196  m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12,
197  lm12, lM12, lM21, lS12 );
198  lat2 = llat2;
199  lon2 = llon2;
200  azi2 = lazi2;
201  s12 = ls12;
202  m12 = lm12;
203  M12 = lM12;
204  M21 = lM21;
205  S12 = lS12;
206 }
207 
208 //*****************************************************************************
210  [System::Runtime::InteropServices::Out] double% lat2,
211  [System::Runtime::InteropServices::Out] double% lon2)
212 {
213  double llat2, llon2;
214  m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2 );
215  lat2 = llat2;
216  lon2 = llon2;
217 }
218 
219 //*****************************************************************************
221  [System::Runtime::InteropServices::Out] double% lat2,
222  [System::Runtime::InteropServices::Out] double% lon2,
223  [System::Runtime::InteropServices::Out] double% azi2)
224 {
225  double llat2, llon2, lazi2;
226  m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2 );
227  lat2 = llat2;
228  lon2 = llon2;
229  azi2 = lazi2;
230 }
231 
232 //*****************************************************************************
234  [System::Runtime::InteropServices::Out] double% lat2,
235  [System::Runtime::InteropServices::Out] double% lon2,
236  [System::Runtime::InteropServices::Out] double% azi2,
237  [System::Runtime::InteropServices::Out] double% s12)
238 {
239  double llat2, llon2, lazi2, ls12;
240  m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12 );
241  lat2 = llat2;
242  lon2 = llon2;
243  azi2 = lazi2;
244  s12 = ls12;
245 }
246 
247 //*****************************************************************************
249  [System::Runtime::InteropServices::Out] double% lat2,
250  [System::Runtime::InteropServices::Out] double% lon2,
251  [System::Runtime::InteropServices::Out] double% azi2,
252  [System::Runtime::InteropServices::Out] double% s12,
253  [System::Runtime::InteropServices::Out] double% m12)
254 {
255  double llat2, llon2, lazi2, ls12, lm12;
256  m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12,
257  lm12 );
258  lat2 = llat2;
259  lon2 = llon2;
260  azi2 = lazi2;
261  s12 = ls12;
262  m12 = lm12;
263 }
264 
265 //*****************************************************************************
267  [System::Runtime::InteropServices::Out] double% lat2,
268  [System::Runtime::InteropServices::Out] double% lon2,
269  [System::Runtime::InteropServices::Out] double% azi2,
270  [System::Runtime::InteropServices::Out] double% s12,
271  [System::Runtime::InteropServices::Out] double% M12,
272  [System::Runtime::InteropServices::Out] double% M21)
273 {
274  double llat2, llon2, lazi2, ls12, lM12, lM21;
275  m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12,
276  lM12, lM21 );
277  lat2 = llat2;
278  lon2 = llon2;
279  azi2 = lazi2;
280  s12 = ls12;
281  M12 = lM12;
282  M21 = lM21;
283 }
284 
285 //*****************************************************************************
287  [System::Runtime::InteropServices::Out] double% lat2,
288  [System::Runtime::InteropServices::Out] double% lon2,
289  [System::Runtime::InteropServices::Out] double% azi2,
290  [System::Runtime::InteropServices::Out] double% s12,
291  [System::Runtime::InteropServices::Out] double% m12,
292  [System::Runtime::InteropServices::Out] double% M12,
293  [System::Runtime::InteropServices::Out] double% M21)
294 {
295  double llat2, llon2, lazi2, ls12, lm12, lM12, lM21;
296  m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12,
297  lm12, lM12, lM21 );
298  lat2 = llat2;
299  lon2 = llon2;
300  azi2 = lazi2;
301  s12 = ls12;
302  m12 = lm12;
303  M12 = lM12;
304  M21 = lM21;
305 }
306 
307 //*****************************************************************************
308 double GeodesicLineExact::GenPosition(bool arcmode, double s12_a12,
309  GeodesicLineExact::mask outmask,
310  [System::Runtime::InteropServices::Out] double% lat2,
311  [System::Runtime::InteropServices::Out] double% lon2,
312  [System::Runtime::InteropServices::Out] double% azi2,
313  [System::Runtime::InteropServices::Out] double% s12,
314  [System::Runtime::InteropServices::Out] double% m12,
315  [System::Runtime::InteropServices::Out] double% M12,
316  [System::Runtime::InteropServices::Out] double% M21,
317  [System::Runtime::InteropServices::Out] double% S12)
318 {
319  double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12;
320  double out = m_pGeodesicLineExact->GenPosition( arcmode, s12_a12,
321  static_cast<unsigned>(outmask),
322  llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12 );
323  lat2 = llat2;
324  lon2 = llon2;
325  azi2 = lazi2;
326  s12 = ls12;
327  m12 = lm12;
328  M12 = lM12;
329  M21 = lM21;
330  S12 = lS12;
331  return out;
332 }
333 
334 //*****************************************************************************
336 { return m_pGeodesicLineExact->Latitude(); }
337 
338 //*****************************************************************************
340 { return m_pGeodesicLineExact->Longitude(); }
341 
342 //*****************************************************************************
344 { return m_pGeodesicLineExact->Azimuth(); }
345 
346 //*****************************************************************************
349 
350 //*****************************************************************************
352 { return m_pGeodesicLineExact->EquatorialArc(); }
353 
354 //*****************************************************************************
356 { return m_pGeodesicLineExact->MajorRadius(); }
357 
358 //*****************************************************************************
360 { return m_pGeodesicLineExact->Flattening(); }
361 
362 //*****************************************************************************
364 { return m_pGeodesicLineExact->Distance(); }
365 
366 //*****************************************************************************
368 { return m_pGeodesicLineExact->Arc(); }
369 
370 //*****************************************************************************
372 { return static_cast<NETGeographicLib::Mask>(m_pGeodesicLineExact->Capabilities()); }
373 
374 //*****************************************************************************
376 { return m_pGeodesicLineExact->Capabilities(static_cast<unsigned>(testcaps)); }
377 
378 //*****************************************************************************
381 
382 //*****************************************************************************
384 { m_pGeodesicLineExact->SetArc(a13); }
385 
386 //*****************************************************************************
387 void GeodesicLineExact::GenSetDistance(bool arcmode, double s13_a13)
388 { m_pGeodesicLineExact->GenSetDistance(arcmode, s13_a13); }
389 
390 //*****************************************************************************
391 void GeodesicLineExact::AzimuthSinCos(double% sazi1, double% cazi1)
392 {
393  double x1, x2;
394  m_pGeodesicLineExact->Azimuth(x1, x2);
395  sazi1 = x1;
396  cazi1 = x2;
397 }
398 
399 //*****************************************************************************
400 void GeodesicLineExact::EquatorialAzimuthSinCos(double% sazi0, double% cazi0)
401 {
402  double x1, x2;
404  sazi0 = x1;
405  cazi0 = x2;
406 }
407 
408 //*****************************************************************************
409 double GeodesicLineExact::GenDistance(bool arcmode)
410 { return m_pGeodesicLineExact->GenDistance(arcmode); }
Math::real GenDistance(bool arcmode) const
void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12)
void ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const
Exception class for NETGeographicLib.
std::ofstream out("Result.txt")
void EquatorialAzimuthSinCos([System::Runtime::InteropServices::Out] double% sazi0, [System::Runtime::InteropServices::Out] double% cazi0)
Math::real Position(real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const
Pose3 x2(Rot3::Ypr(0.0, 0.0, 0.0), l2)
void g(const string &key, int i)
Definition: testBTree.cpp:41
void GenSetDistance(bool arcmode, real s13_a13)
void AzimuthSinCos([System::Runtime::InteropServices::Out] double% sazi1, [System::Runtime::InteropServices::Out] double% cazi1)
Header for GeographicLib::GeodesicLineExact class.
#define NULL
Definition: ccolamd.c:609
Exact geodesic calculations.
Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const
Pose3 x1
Definition: testPose3.cpp:663
Header for NETGeographicLib::GeodesicLineExact class.
double GenPosition(bool arcmode, double s12_a12, GeodesicLineExact::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12)
.NET wrapper for GeographicLib::GeodesicLineExact.
.NET wrapper for GeographicLib::GeodesicExact.
Definition: GeodesicExact.h:86
GeodesicLineExact(GeodesicExact^ g, double lat1, double lon1, double azi1, NETGeographicLib::Mask caps)
Header for NETGeographicLib::GeodesicExact class.
Container::iterator get(Container &c, Position position)
GeographicLib::GeodesicLineExact * m_pGeodesicLineExact
double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12)
static const GeodesicExact & WGS84()


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:18