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(); }
Header for NETGeographicLib::NETGeographicLib objects.
Scalar * y
static const double lat
static const Geodesic & WGS84()
Exception class for NETGeographicLib.
Gnomonic projection
Definition: Gnomonic.hpp:102
const GeographicLib::Gnomonic * m_pGnomonic
Definition: Gnomonic.h:108
Math::real Flattening() const
Definition: Gnomonic.hpp:200
Header for GeographicLib::Gnomonic class.
const double lat0
.NET wrapper for GeographicLib::Geodesic.
Definition: Geodesic.h:170
void Forward(real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const
Header for NETGeographicLib::Gnomonic class.
.NET wrapper for GeographicLib::Gnomonic.
Definition: Gnomonic.h:104
const double lon0
#define NULL
Definition: ccolamd.c:609
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)
void Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const
const char BADALLOC[]
static const double lon
Math::real MajorRadius() const
Definition: Gnomonic.hpp:194
Container::iterator get(Container &c, Position position)
Header for NETGeographicLib::Geodesic class.
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
Geodesic calculations
Definition: Geodesic.hpp:172
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)


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