dotnet/NETGeographicLib/Gnomonic.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
13 #include "Gnomonic.h"
14 #include "Geodesic.h"
15 #include "NETGeographicLib.h"
16 
17 using namespace NETGeographicLib;
18 
19 const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::Gnomonic";
20 
21 //*****************************************************************************
23 {
24  if ( m_pGnomonic != NULL )
25  {
26  delete m_pGnomonic;
27  m_pGnomonic = NULL;
28  }
29 }
30 
31 //*****************************************************************************
33 {
34  try
35  {
36  const GeographicLib::Geodesic* pGeodesic =
37  reinterpret_cast<const GeographicLib::Geodesic*>(
38  earth->GetUnmanaged()->ToPointer() );
39  m_pGnomonic = new GeographicLib::Gnomonic( *pGeodesic );
40  }
41  catch ( std::bad_alloc )
42  {
43  throw gcnew GeographicErr( BADALLOC );
44  }
45 }
46 
47 //*****************************************************************************
49 {
50  try
51  {
53  }
54  catch ( std::bad_alloc )
55  {
56  throw gcnew GeographicErr( BADALLOC );
57  }
58 }
59 
60 //*****************************************************************************
61 void Gnomonic::Forward(double lat0, double lon0, double lat, double lon,
62  [System::Runtime::InteropServices::Out] double% x,
63  [System::Runtime::InteropServices::Out] double% y,
64  [System::Runtime::InteropServices::Out] double% azi,
65  [System::Runtime::InteropServices::Out] double% rk)
66 {
67  double lx, ly, lazi, lrk;
68  m_pGnomonic->Forward( lat0, lon0, lat, lon, lx, ly, lazi, lrk );
69  x = lx;
70  y = ly;
71  azi = lazi;
72  rk = lrk;
73 }
74 
75 //*****************************************************************************
76 void Gnomonic::Reverse(double lat0, double lon0, double x, double y,
77  [System::Runtime::InteropServices::Out] double% lat,
78  [System::Runtime::InteropServices::Out] double% lon,
79  [System::Runtime::InteropServices::Out] double% azi,
80  [System::Runtime::InteropServices::Out] double% rk)
81 {
82  double llat, llon, lazi, lrk;
83  m_pGnomonic->Reverse( lat0, lon0, x, y, llat, llon, lazi, lrk );
84  lat = llat;
85  lon = llon;
86  azi = lazi;
87  rk = lrk;
88 }
89 
90 //*****************************************************************************
91 void Gnomonic::Forward(double lat0, double lon0, double lat, double lon,
92  [System::Runtime::InteropServices::Out] double% x,
93  [System::Runtime::InteropServices::Out] double% y)
94 {
95  double lx, ly;
96  m_pGnomonic->Forward( lat0, lon0, lat, lon, lx, ly );
97  x = lx;
98  y = ly;
99 }
100 
101 //*****************************************************************************
102 void Gnomonic::Reverse(double lat0, double lon0, double x, double y,
103  [System::Runtime::InteropServices::Out] double% lat,
104  [System::Runtime::InteropServices::Out] double% lon)
105 {
106  double llat, llon;
107  m_pGnomonic->Reverse( lat0, lon0, x, y, llat, llon );
108  lat = llat;
109  lon = llon;
110 }
111 
112 //*****************************************************************************
113 double Gnomonic::MajorRadius::get() { return m_pGnomonic->MajorRadius(); }
114 
115 //*****************************************************************************
116 double Gnomonic::Flattening::get() { return m_pGnomonic->Flattening(); }
NETGeographicLib::Gnomonic::Reverse
void Reverse(double lat0, double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk)
Definition: dotnet/NETGeographicLib/Gnomonic.cpp:76
NETGeographicLib::Gnomonic
.NET wrapper for GeographicLib::Gnomonic.
Definition: Gnomonic.h:104
Geodesic.h
Header for NETGeographicLib::Geodesic class.
GeographicLib::Geodesic::WGS84
static const Geodesic & WGS84()
Definition: src/Geodesic.cpp:89
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
GeographicLib::Gnomonic::Forward
void Forward(real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const
Definition: src/Gnomonic.cpp:30
BADALLOC
const char BADALLOC[]
Definition: dotnet/NETGeographicLib/Gnomonic.cpp:19
NETGeographicLib::Gnomonic::Forward
void Forward(double lat0, double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk)
Definition: dotnet/NETGeographicLib/Gnomonic.cpp:61
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
GeographicLib::Gnomonic
Gnomonic projection
Definition: Gnomonic.hpp:102
Gnomonic.h
Header for NETGeographicLib::Gnomonic class.
NETGeographicLib::Gnomonic::Gnomonic
Gnomonic()
Definition: dotnet/NETGeographicLib/Gnomonic.cpp:48
example::lat0
const double lat0
Definition: testGPSFactor.cpp:41
example::lon0
const double lon0
Definition: testGPSFactor.cpp:41
NETGeographicLib::Geodesic
.NET wrapper for GeographicLib::Geodesic.
Definition: Geodesic.h:170
stdafx.h
GeographicLib::Gnomonic::Reverse
void Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const
Definition: src/Gnomonic.cpp:47
NETGeographicLib.h
Header for NETGeographicLib::NETGeographicLib objects.
y
Scalar * y
Definition: level1_cplx_impl.h:124
Gnomonic.hpp
Header for GeographicLib::Gnomonic class.
NETGeographicLib::Gnomonic::m_pGnomonic
const GeographicLib::Gnomonic * m_pGnomonic
Definition: Gnomonic.h:108
lon
static const double lon
Definition: testGeographicLib.cpp:34
NULL
#define NULL
Definition: ccolamd.c:609
get
Container::iterator get(Container &c, Position position)
Definition: stdlist_overload.cpp:29
NETGeographicLib
Definition: Accumulator.h:13
GeographicLib::Geodesic
Geodesic calculations
Definition: Geodesic.hpp:172
lat
static const double lat
Definition: testGeographicLib.cpp:34
NETGeographicLib::Geodesic::GetUnmanaged
System::IntPtr GetUnmanaged()
Definition: dotnet/NETGeographicLib/Geodesic.cpp:465


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:38