dotnet/NETGeographicLib/TransverseMercator.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
13 #include "TransverseMercator.h"
14 #include "NETGeographicLib.h"
15 
16 using namespace NETGeographicLib;
17 
18 const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::TransverseMercator";
19 
20 //*****************************************************************************
22 {
23  if ( m_pTransverseMercator != NULL )
24  {
25  delete m_pTransverseMercator;
26  m_pTransverseMercator = NULL;
27  }
28 }
29 
30 //*****************************************************************************
31 TransverseMercator::TransverseMercator(double a, double f, double k0)
32 {
33  try
34  {
36  }
37  catch (std::bad_alloc )
38  {
39  throw gcnew GeographicErr( BADALLOC );
40  }
41  catch (std::exception err )
42  {
43  throw gcnew GeographicErr( err.what() );
44  }
45 }
46 
47 //*****************************************************************************
49 {
50  try
51  {
54  }
55  catch (std::bad_alloc )
56  {
57  throw gcnew GeographicErr( BADALLOC );
58  }
59 }
60 
61 //*****************************************************************************
62 void TransverseMercator::Forward(double lon0, double lat, double lon,
63  [System::Runtime::InteropServices::Out] double% x,
64  [System::Runtime::InteropServices::Out] double% y,
65  [System::Runtime::InteropServices::Out] double% gamma,
66  [System::Runtime::InteropServices::Out] double% k)
67 {
68  double lx, ly, lgamma, lk;
69  m_pTransverseMercator->Forward( lon0, lat, lon, lx, ly, lgamma, lk );
70  x = lx;
71  y = ly;
72  gamma = lgamma;
73  k = lk;
74 }
75 
76 //*****************************************************************************
77 void TransverseMercator::Reverse(double lon0, double x, double y,
78  [System::Runtime::InteropServices::Out] double% lat,
79  [System::Runtime::InteropServices::Out] double% lon,
80  [System::Runtime::InteropServices::Out] double% gamma,
81  [System::Runtime::InteropServices::Out] double% k)
82 {
83  double llat, llon, lgamma, lk;
84  m_pTransverseMercator->Reverse( lon0, x, y, llat, llon, lgamma, lk );
85  lat = llat;
86  lon = llon;
87  gamma = lgamma;
88  k = lk;
89 }
90 
91 //*****************************************************************************
92 void TransverseMercator::Forward(double lon0, double lat, double lon,
93  [System::Runtime::InteropServices::Out] double% x,
94  [System::Runtime::InteropServices::Out] double% y)
95 {
96  double lx, ly;
97  m_pTransverseMercator->Forward( lon0, lat, lon, lx, ly );
98  x = lx;
99  y = ly;
100 }
101 
102 //*****************************************************************************
103 void TransverseMercator::Reverse(double lon0, double x, double y,
104  [System::Runtime::InteropServices::Out] double% lat,
105  [System::Runtime::InteropServices::Out] double% lon)
106 {
107  double llat, llon;
108  m_pTransverseMercator->Reverse( lon0, x, y, llat, llon );
109  lat = llat;
110  lon = llon;
111 }
112 
113 //*****************************************************************************
115 { return m_pTransverseMercator->MajorRadius(); }
116 
117 //*****************************************************************************
119 { return m_pTransverseMercator->Flattening(); }
120 
121 //*****************************************************************************
123 { return m_pTransverseMercator->CentralScale(); }
void Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double%lat, [System::Runtime::InteropServices::Out] double%lon, [System::Runtime::InteropServices::Out] double%gamma, [System::Runtime::InteropServices::Out] double%k)
Header for NETGeographicLib::NETGeographicLib objects.
Scalar * y
static const double lat
Exception class for NETGeographicLib.
void Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const
Transverse Mercator projection.
static const TransverseMercator & UTM()
Header for GeographicLib::TransverseMercator class.
Array33i a
const mpreal gamma(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Definition: mpreal.h:2262
const GeographicLib::TransverseMercator * m_pTransverseMercator
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
const double lon0
#define NULL
Definition: ccolamd.c:609
void Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const
Header for NETGeographicLib::TransverseMercator class.
.NET wrapper for GeographicLib::TransverseMercator.
static const double lon
Container::iterator get(Container &c, Position position)
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
void Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double%x, [System::Runtime::InteropServices::Out] double%y, [System::Runtime::InteropServices::Out] double%gamma, [System::Runtime::InteropServices::Out] double%k)
EIGEN_DEVICE_FUNC const LgammaReturnType lgamma() const


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:51:10