dotnet/NETGeographicLib/UTMUPS.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
12 #include "GeographicLib/UTMUPS.hpp"
13 #include "UTMUPS.h"
14 #include "NETGeographicLib.h"
15 
16 using namespace NETGeographicLib;
17 
18 //*****************************************************************************
19 int UTMUPS::StandardZone(double lat, double lon, int setzone)
20 {
21  try
22  {
23  return GeographicLib::UTMUPS::StandardZone( lat, lon, setzone );
24  }
25  catch ( const std::exception& err )
26  {
27  throw gcnew GeographicErr( err.what() );
28  }
29 }
30 
31 //*****************************************************************************
32 void UTMUPS::Forward(double lat, double lon,
33  [System::Runtime::InteropServices::Out] int% zone,
34  [System::Runtime::InteropServices::Out] bool% northp,
35  [System::Runtime::InteropServices::Out] double% x,
36  [System::Runtime::InteropServices::Out] double% y,
37  [System::Runtime::InteropServices::Out] double% gamma,
38  [System::Runtime::InteropServices::Out] double% k,
39  int setzone, bool mgrslimits)
40 {
41  try
42  {
43  int lzone;
44  bool lnorthp;
45  double lx, ly, lgamma, lk;
47  lzone, lnorthp, lx, ly,
48  lgamma, lk,
49  setzone, mgrslimits);
50  zone = lzone;
51  northp = northp;
52  x = lx;
53  y = ly;
54  gamma = lgamma;
55  k = lk;
56  }
57  catch ( const std::exception& err )
58  {
59  throw gcnew GeographicErr( err.what() );
60  }
61 }
62 
63 //*****************************************************************************
64 void UTMUPS::Reverse(int zone, bool northp, double x, double y,
65  [System::Runtime::InteropServices::Out] double% lat,
66  [System::Runtime::InteropServices::Out] double% lon,
67  [System::Runtime::InteropServices::Out] double% gamma,
68  [System::Runtime::InteropServices::Out] double% k,
69  bool mgrslimits)
70 {
71  try
72  {
73  double llat, llon, lgamma, lk;
74  GeographicLib::UTMUPS::Reverse( zone, northp, x, y, llat, llon, lgamma,
75  lk, mgrslimits );
76  lat = llat;
77  lon = llon;
78  gamma = lgamma;
79  k = lk;
80  }
81  catch ( const std::exception& err )
82  {
83  throw gcnew GeographicErr( err.what() );
84  }
85 }
86 
87 //*****************************************************************************
88 void UTMUPS::Forward(double lat, double lon,
89  [System::Runtime::InteropServices::Out] int% zone,
90  [System::Runtime::InteropServices::Out] bool% northp,
91  [System::Runtime::InteropServices::Out] double% x,
92  [System::Runtime::InteropServices::Out] double% y,
93  int setzone, bool mgrslimits )
94 {
95  try
96  {
97  double gamma, k, lx, ly;
98  bool lnorthp;
99  int lzone;
100  GeographicLib::UTMUPS::Forward(lat, lon, lzone, lnorthp, lx, ly,
101  gamma, k, setzone, mgrslimits);
102  x = lx;
103  y = ly;
104  zone = lzone;
105  northp = lnorthp;
106  }
107  catch ( const std::exception& err )
108  {
109  throw gcnew GeographicErr( err.what() );
110  }
111 }
112 
113 //*****************************************************************************
114 void UTMUPS::Reverse(int zone, bool northp, double x, double y,
115  [System::Runtime::InteropServices::Out] double% lat,
116  [System::Runtime::InteropServices::Out] double% lon,
117  bool mgrslimits)
118 {
119  try
120  {
121  double gamma, k, llat, llon;
122  GeographicLib::UTMUPS::Reverse(zone, northp, x, y, llat, llon, gamma,
123  k, mgrslimits);
124  lat = llat;
125  lon = llon;
126  }
127  catch ( const std::exception& err )
128  {
129  throw gcnew GeographicErr( err.what() );
130  }
131 }
132 
133 //*****************************************************************************
134 void UTMUPS::Transfer(int zonein, bool northpin, double xin, double yin,
135  int zoneout, bool northpout,
136  [System::Runtime::InteropServices::Out] double% xout,
137  [System::Runtime::InteropServices::Out] double% yout,
138  [System::Runtime::InteropServices::Out] int% zone)
139 {
140  try
141  {
142  int lzone;
143  double lxout, lyout;
144  GeographicLib::UTMUPS::Transfer(zonein, northpin, xin, yin,
145  zoneout, northpout, lxout, lyout,
146  lzone);
147  xout = lxout;
148  yout = lyout;
149  zone = lzone;
150  }
151  catch ( const std::exception& err )
152  {
153  throw gcnew GeographicErr( err.what() );
154  }
155 }
156 
157 //*****************************************************************************
158 void UTMUPS::DecodeZone(System::String^ zonestr,
159  [System::Runtime::InteropServices::Out] int% zone,
160  [System::Runtime::InteropServices::Out] bool% northp)
161 {
162  try
163  {
164  std::string zoneIn = StringConvert::ManagedToUnmanaged( zonestr );
165  int lzone;
166  bool lnorthp;
167  GeographicLib::UTMUPS::DecodeZone( zoneIn, lzone, lnorthp );
168  zone = lzone;
169  northp = lnorthp;
170  }
171  catch ( const std::exception& err )
172  {
173  throw gcnew GeographicErr( err.what() );
174  }
175 }
176 
177 //*****************************************************************************
178 System::String^ UTMUPS::EncodeZone(int zone, bool northp, bool abbrev)
179 {
180  try
181  {
183  }
184  catch ( const std::exception& err )
185  {
186  throw gcnew GeographicErr( err.what() );
187  }
188 }
189 
190 //*****************************************************************************
191 void UTMUPS::DecodeEPSG(int epsg,
192  [System::Runtime::InteropServices::Out] int% zone,
193  [System::Runtime::InteropServices::Out] bool% northp)
194 {
195  int lzone;
196  bool lnorthp;
197  GeographicLib::UTMUPS::DecodeEPSG( epsg, lzone, lnorthp );
198  zone = lzone;
199  northp = lnorthp;
200 }
201 
202 //*****************************************************************************
203 int UTMUPS::EncodeEPSG(int zone, bool northp)
204 {
205  return GeographicLib::UTMUPS::EncodeEPSG( zone, northp );
206 }
207 
208 //****************************************************************************
210 
211 //****************************************************************************
213 
214 //****************************************************************************
static std::string EncodeZone(int zone, bool northp, bool abbrev=true)
Definition: src/UTMUPS.cpp:254
Header for NETGeographicLib::NETGeographicLib objects.
Scalar * y
static int StandardZone(double lat, double lon, int setzone)
static const double lat
static Math::real Flattening()
Definition: UTMUPS.hpp:414
Exception class for NETGeographicLib.
Header for GeographicLib::UTMUPS class.
static void Transfer(int zonein, bool northpin, real xin, real yin, int zoneout, bool northpout, real &xout, real &yout, int &zone)
Definition: src/UTMUPS.cpp:174
static void DecodeEPSG(int epsg, int &zone, bool &northp)
Definition: src/UTMUPS.cpp:270
static void DecodeEPSG(int epsg, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp)
static Math::real MajorRadius()
Definition: UTMUPS.hpp:405
EIGEN_DEVICE_FUNC const LgammaReturnType lgamma() const
static void Reverse(int zone, bool northp, 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, bool mgrslimits)
static void Forward(real lat, real lon, int &zone, bool &northp, real &x, real &y, real &gamma, real &k, int setzone=STANDARD, bool mgrslimits=false)
Definition: src/UTMUPS.cpp:67
static System::String UnmanagedToManaged(const std::string &s)
static void DecodeZone(System::String^ zonestr, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp)
static int EncodeEPSG(int zone, bool northp)
Definition: src/UTMUPS.cpp:287
static void DecodeZone(const std::string &zonestr, int &zone, bool &northp)
Definition: src/UTMUPS.cpp:208
static void Transfer(int zonein, bool northpin, double xin, double yin, int zoneout, bool northpout, [System::Runtime::InteropServices::Out] double% xout, [System::Runtime::InteropServices::Out] double% yout, [System::Runtime::InteropServices::Out] int% zone)
static int EncodeEPSG(int zone, bool northp)
static void Reverse(int zone, bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k, bool mgrslimits=false)
Definition: src/UTMUPS.cpp:121
static std::string ManagedToUnmanaged(System::String^ s)
static const double lon
static Math::real UTMShift()
Definition: src/UTMUPS.cpp:298
Header for NETGeographicLib::UTMUPS class.
static void Forward(double lat, double lon, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k, int setzone, bool mgrslimits)
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
static System::String EncodeZone(int zone, bool northp, bool abbrev)
static int StandardZone(real lat, real lon, int setzone=STANDARD)
Definition: src/UTMUPS.cpp:43


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:40:43