dotnet/NETGeographicLib/Rhumb.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
12 #include "GeographicLib/Rhumb.hpp"
13 #include "Rhumb.h"
14 #include "NETGeographicLib.h"
15 
16 using namespace NETGeographicLib;
17 
18 //*****************************************************************************
19 Rhumb::!Rhumb(void)
20 {
21  if ( m_pRhumb != NULL )
22  {
23  delete m_pRhumb;
24  m_pRhumb = NULL;
25  }
26 }
27 
28 //*****************************************************************************
29 Rhumb::Rhumb(double a, double f, bool exact)
30 {
31  try
32  {
33  m_pRhumb = new GeographicLib::Rhumb( a, f, exact );
34  }
35  catch ( GeographicLib::GeographicErr& err )
36  {
37  throw gcnew GeographicErr( err.what() );
38  }
39  catch ( std::bad_alloc )
40  {
41  throw gcnew System::Exception("Failed to allocate memory for a Rhumb.");
42  }
43 }
44 
45 //*****************************************************************************
46 void Rhumb::Direct(double lat1, double lon1, double azi12, double s12,
47  [System::Runtime::InteropServices::Out] double% lat2,
48  [System::Runtime::InteropServices::Out] double% lon2,
49  [System::Runtime::InteropServices::Out] double% S12)
50 {
51  double ilat2, ilon2, iS12;
52  m_pRhumb->Direct( lat1, lon1, azi12, s12, ilat2, ilon2, iS12 );
53  lat2 = ilat2;
54  lon2 = ilon2;
55  S12 = iS12;
56 }
57 
58 //*****************************************************************************
59 void Rhumb::Direct(double lat1, double lon1, double azi12, double s12,
60  [System::Runtime::InteropServices::Out] double% lat2,
61  [System::Runtime::InteropServices::Out] double% lon2)
62 {
63  double ilat2, ilon2;
64  m_pRhumb->Direct( lat1, lon1, azi12, s12, ilat2, ilon2 );
65  lat2 = ilat2;
66  lon2 = ilon2;
67 }
68 
69 //*****************************************************************************
70 void Rhumb::GenDirect(double lat1, double lon1, double azi12, double s12,
71  Rhumb::mask outmask,
72  [System::Runtime::InteropServices::Out] double% lat2,
73  [System::Runtime::InteropServices::Out] double% lon2,
74  [System::Runtime::InteropServices::Out] double% S12)
75 {
76  double ilat2, ilon2, iS12;
77  unsigned int iMask = (unsigned int)outmask;
78  m_pRhumb->GenDirect( lat1, lon1, azi12, s12, iMask, ilat2, ilon2, iS12 );
79  lat2 = ilat2;
80  lon2 = ilon2;
81  S12 = iS12;
82 }
83 
84 //*****************************************************************************
85 void Rhumb::Inverse(double lat1, double lon1, double lat2, double lon2,
86  [System::Runtime::InteropServices::Out] double% s12,
87  [System::Runtime::InteropServices::Out] double% azi12,
88  [System::Runtime::InteropServices::Out] double% S12)
89 {
90  double is12, iazi12, iS12;
91  m_pRhumb->Inverse( lat1, lon1, lat2, lon2, is12, iazi12, iS12 );
92  s12 = is12;
93  azi12 = iazi12;
94  S12 = iS12;
95 }
96 
97 //*****************************************************************************
98 void Rhumb::Inverse(double lat1, double lon1, double lat2, double lon2,
99  [System::Runtime::InteropServices::Out] double% s12,
100  [System::Runtime::InteropServices::Out] double% azi12)
101 {
102  double is12, iazi12;
103  m_pRhumb->Inverse( lat1, lon1, lat2, lon2, is12, iazi12 );
104  s12 = is12;
105  azi12 = iazi12;
106 }
107 
108 //*****************************************************************************
109 void Rhumb::GenInverse(double lat1, double lon1, double lat2, double lon2,
110  Rhumb::mask outmask,
111  [System::Runtime::InteropServices::Out] double% s12,
112  [System::Runtime::InteropServices::Out] double% azi12,
113  [System::Runtime::InteropServices::Out] double% S12)
114 {
115  double is12, iazi12, iS12;
116  unsigned int iMask = (unsigned int)outmask;
117  m_pRhumb->GenInverse( lat1, lon1, lat2, lon2, iMask, is12, iazi12, iS12 );
118  s12 = is12;
119  azi12 = iazi12;
120  S12 = iS12;
121 }
122 
123 //*****************************************************************************
124 RhumbLine^ Rhumb::Line(double lat1, double lon1, double azi12)
125 {
126  return gcnew RhumbLine( new GeographicLib::RhumbLine(m_pRhumb->Line( lat1, lon1, azi12 )) );
127 }
128 
129 //*****************************************************************************
130 double Rhumb::MajorRadius::get() { return m_pRhumb->MajorRadius(); }
131 
132 //*****************************************************************************
133 double Rhumb::Flattening::get() { return m_pRhumb->Flattening(); }
134 
135 //*****************************************************************************
136 double Rhumb::EllipsoidArea::get() { return m_pRhumb->EllipsoidArea(); }
137 
138 //*****************************************************************************
140 {
143 }
144 
145 //*****************************************************************************
147 {
148  return gcnew System::IntPtr( const_cast<void*>(reinterpret_cast<const void*>(m_pRhumb)) );
149 }
150 
151 //*****************************************************************************
152 // RhumbLine functions
153 //*****************************************************************************
155 {
156  if ( m_pRhumbLine != NULL )
157  {
158  delete m_pRhumbLine;
159  m_pRhumbLine = NULL;
160  }
161 }
162 
163 //*****************************************************************************
165 {
166  if ( pRhumbLine == NULL )
167  throw gcnew System::Exception("Invalid pointer in RhumbLine constructor.");
168  m_pRhumbLine = pRhumbLine;
169 }
170 
171 //*****************************************************************************
172 void RhumbLine::Position(double s12,
173  [System::Runtime::InteropServices::Out] double% lat2,
174  [System::Runtime::InteropServices::Out] double% lon2,
175  [System::Runtime::InteropServices::Out] double% S12)
176 {
177  double ilat2, ilon2, iS12;
178  m_pRhumbLine->Position( s12, ilat2, ilon2, iS12);
179  lat2 = ilat2;
180  lon2 = ilon2;
181  S12 = iS12;
182 }
183 
184 //*****************************************************************************
185 void RhumbLine::Position(double s12,
186  [System::Runtime::InteropServices::Out] double% lat2,
187  [System::Runtime::InteropServices::Out] double% lon2)
188 {
189  double ilat2, ilon2;
190  m_pRhumbLine->Position( s12, ilat2, ilon2 );
191  lat2 = ilat2;
192  lon2 = ilon2;
193 }
194 
195 //*****************************************************************************
196 void RhumbLine::GenPosition(double s12, RhumbLine::mask outmask,
197  [System::Runtime::InteropServices::Out] double% lat2,
198  [System::Runtime::InteropServices::Out] double% lon2,
199  [System::Runtime::InteropServices::Out] double% S12)
200 {
201  double ilat2, ilon2, iS12;
202  unsigned int iMask = (unsigned int)outmask;
203  m_pRhumbLine->GenPosition( s12, iMask, ilat2, ilon2, iS12);
204  lat2 = ilat2;
205  lon2 = ilon2;
206  S12 = iS12;
207 }
208 
209 //*****************************************************************************
211 {
212  return m_pRhumbLine->Latitude();
213 }
214 
215 //*****************************************************************************
217 {
218  return m_pRhumbLine->Longitude();
219 }
220 
221 //*****************************************************************************
223 {
224  return m_pRhumbLine->Azimuth();
225 }
226 
227 //*****************************************************************************
229 {
230  return m_pRhumbLine->MajorRadius();
231 }
232 
233 //*****************************************************************************
235 {
236  return m_pRhumbLine->Flattening();
237 }
gtsam.examples.DogLegOptimizerExample.int
int
Definition: DogLegOptimizerExample.py:111
GeographicLib::Rhumb::GenInverse
void GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real &s12, real &azi12, real &, real &, real &, real &, real &S12) const
Definition: Rhumb.hpp:178
NETGeographicLib::Rhumb::GetUnmanaged
System::IntPtr GetUnmanaged()
Definition: dotnet/NETGeographicLib/Rhumb.cpp:146
GeographicLib::Rhumb
Solve of the direct and inverse rhumb problems.
Definition: Rhumb.hpp:66
Rhumb.hpp
Header for GeographicLib::Rhumb and GeographicLib::RhumbLine classes.
NETGeographicLib::Rhumb::Direct
void Direct(double lat1, double lon1, double azi12, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12)
Definition: dotnet/NETGeographicLib/Rhumb.cpp:46
NETGeographicLib::Rhumb::GenInverse
void GenInverse(double lat1, double lon1, double lat2, double lon2, Rhumb::mask outmask, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi12, [System::Runtime::InteropServices::Out] double% S12)
Definition: dotnet/NETGeographicLib/Rhumb.cpp:109
NETGeographicLib::Rhumb::Line
RhumbLine Line(double lat1, double lon1, double azi12)
Definition: dotnet/NETGeographicLib/Rhumb.cpp:124
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
GeographicLib::Rhumb::Inverse
void Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12, real &S12) const
Definition: Rhumb.hpp:338
GeographicLib::Rhumb::Direct
void Direct(real lat1, real lon1, real azi12, real s12, real &lat2, real &lon2, real &S12) const
Definition: Rhumb.hpp:271
GeographicLib::GeographicErr
Exception handling for GeographicLib.
Definition: Constants.hpp:389
NETGeographicLib::Rhumb::GenDirect
void GenDirect(double lat1, double lon1, double azi12, double s12, Rhumb::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12)
Definition: dotnet/NETGeographicLib/Rhumb.cpp:70
NETGeographicLib::Rhumb::Rhumb
Rhumb(double a, double f, bool exact)
Definition: dotnet/NETGeographicLib/Rhumb.cpp:29
GeographicLib::RhumbLine::GenPosition
void GenPosition(real s12, unsigned outmask, real &lat2, real &lon2, real &S12) const
Definition: src/Rhumb.cpp:347
NETGeographicLib::Rhumb::Inverse
void Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi12, [System::Runtime::InteropServices::Out] double% S12)
Definition: dotnet/NETGeographicLib/Rhumb.cpp:85
stdafx.h
GeographicLib::Rhumb::GenDirect
void GenDirect(real lat1, real lon1, real azi12, bool, real s12, unsigned outmask, real &lat2, real &lon2, real &, real &, real &, real &, real &, real &S12) const
Definition: Rhumb.hpp:172
NETGeographicLib.h
Header for NETGeographicLib::NETGeographicLib objects.
NETGeographicLib::RhumbLine::RhumbLine
RhumbLine(GeographicLib::RhumbLine *pRhumbLine)
Constructor.
Definition: dotnet/NETGeographicLib/Rhumb.cpp:164
GeographicLib::RhumbLine
Find a sequence of points on a single rhumb line.
Definition: Rhumb.hpp:437
NETGeographicLib::RhumbLine::m_pRhumbLine
GeographicLib::RhumbLine * m_pRhumbLine
Definition: Rhumb.h:377
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
NETGeographicLib::RhumbLine::Position
void Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12)
Definition: dotnet/NETGeographicLib/Rhumb.cpp:172
NETGeographicLib::Rhumb::WGS84
static Rhumb WGS84()
Definition: dotnet/NETGeographicLib/Rhumb.cpp:139
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
NETGeographicLib::Rhumb
.NET wrapper for GeographicLib::Rhumb.
Definition: Rhumb.h:65
NETGeographicLib::Rhumb::m_pRhumb
GeographicLib::Rhumb * m_pRhumb
Definition: Rhumb.h:68
GeographicLib::Constants::WGS84_a
static T WGS84_a()
Definition: Constants.hpp:159
NETGeographicLib::RhumbLine::GenPosition
void GenPosition(double s12, RhumbLine::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12)
Definition: dotnet/NETGeographicLib/Rhumb.cpp:196
Rhumb.h
Header for NETGeographicLib::Rhumb and NETGeographicLib::RhumbLine classes.
GeographicLib::Rhumb::Line
RhumbLine Line(real lat1, real lon1, real azi12) const
Definition: src/Rhumb.cpp:168
GeographicLib::Constants::WGS84_f
static T WGS84_f()
Definition: Constants.hpp:169
GeographicLib::RhumbLine::Position
void Position(real s12, real &lat2, real &lon2, real &S12) const
Definition: Rhumb.hpp:512
NULL
#define NULL
Definition: ccolamd.c:609
NETGeographicLib::Rhumb::mask
mask
Definition: Rhumb.h:78
NETGeographicLib::RhumbLine::mask
mask
Definition: Rhumb.h:382
get
Container::iterator get(Container &c, Position position)
Definition: stdlist_overload.cpp:29
NETGeographicLib
Definition: Accumulator.h:13
Eigen::internal::IntPtr
std::ptrdiff_t IntPtr
Definition: Meta.h:91
NETGeographicLib::RhumbLine
.NET wrapper for GeographicLib::RhumbLine.
Definition: Rhumb.h:374


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:13:08