dotnet/NETGeographicLib/AlbersEqualArea.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
13 #include "AlbersEqualArea.h"
14 #include "NETGeographicLib.h"
15 
16 using namespace NETGeographicLib;
17 
18 //*****************************************************************************
20 {
21  if ( m_pAlbersEqualArea != NULL )
22  {
23  delete m_pAlbersEqualArea;
24  m_pAlbersEqualArea = NULL;
25  }
26 }
27 
28 //*****************************************************************************
30 {
31  try
32  {
33  switch ( type )
34  {
37  break;
40  break;
43  break;
44  }
45  }
46  catch ( std::bad_alloc )
47  {
48  throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" );
49  }
50 }
51 
52 //*****************************************************************************
53 AlbersEqualArea::AlbersEqualArea(double a, double f, double stdlat1, double stdlat2, double k1)
54 {
55  try
56  {
57  m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( a, f, stdlat1, stdlat2, k1 );
58  }
59  catch ( GeographicLib::GeographicErr err )
60  {
61  throw gcnew GeographicErr( err.what() );
62  }
63  catch ( std::bad_alloc )
64  {
65  throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" );
66  }
67 }
68 
69 //*****************************************************************************
70 AlbersEqualArea::AlbersEqualArea(double a, double f, double stdlat, double k0)
71 {
72  try
73  {
75  }
76  catch ( GeographicLib::GeographicErr err )
77  {
78  throw gcnew GeographicErr( err.what() );
79  }
80  catch ( std::bad_alloc )
81  {
82  throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" );
83  }
84 }
85 
86 //*****************************************************************************
88  double sinlat1, double coslat1,
89  double sinlat2, double coslat2,
90  double k1)
91 {
92  try
93  {
95  a, f, sinlat1, coslat1, sinlat2, coslat2, k1 );
96  }
97  catch ( GeographicLib::GeographicErr err )
98  {
99  throw gcnew GeographicErr( err.what() );
100  }
101  catch ( std::bad_alloc )
102  {
103  throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" );
104  }
105 }
106 
107 //*****************************************************************************
108 void AlbersEqualArea::SetScale(double lat, double k)
109 {
110  try
111  {
113  }
114  catch ( const std::exception& xcpt )
115  {
116  throw gcnew GeographicErr( xcpt.what() );
117  }
118 }
119 
120 //*****************************************************************************
121 void AlbersEqualArea::Forward(double lon0, double lat, double lon,
122  [System::Runtime::InteropServices::Out] double% x,
123  [System::Runtime::InteropServices::Out] double% y,
124  [System::Runtime::InteropServices::Out] double% gamma,
125  [System::Runtime::InteropServices::Out] double% k)
126 {
127  double lx, ly, lgamma, lk;
128  m_pAlbersEqualArea->Forward( lon0, lat, lon, lx, ly, lgamma, lk );
129  x = lx;
130  y = ly;
131  gamma = lgamma;
132  k = lk;
133 }
134 
135 //*****************************************************************************
136 void AlbersEqualArea::Reverse(double lon0, double x, double y,
137  [System::Runtime::InteropServices::Out] double% lat,
138  [System::Runtime::InteropServices::Out] double% lon,
139  [System::Runtime::InteropServices::Out] double% gamma,
140  [System::Runtime::InteropServices::Out] double% k)
141 {
142  double llat, llon, lgamma, lk;
143  m_pAlbersEqualArea->Reverse( lon0, x, y, llat, llon, lgamma, lk );
144  lat = llat;
145  lon = llon;
146  gamma = lgamma;
147  k = lk;
148 }
149 
150 //*****************************************************************************
151 void AlbersEqualArea::Forward(double lon0, double lat, double lon,
152  [System::Runtime::InteropServices::Out] double% x,
153  [System::Runtime::InteropServices::Out] double% y)
154 {
155  double lx, ly, lgamma, lk;
156  m_pAlbersEqualArea->Forward( lon0, lat, lon, lx, ly, lgamma, lk );
157  x = lx;
158  y = ly;
159 }
160 
161 //*****************************************************************************
162 void AlbersEqualArea::Reverse(double lon0, double x, double y,
163  [System::Runtime::InteropServices::Out] double% lat,
164  [System::Runtime::InteropServices::Out] double% lon)
165 {
166  double llat, llon, lgamma, lk;
167  m_pAlbersEqualArea->Reverse( lon0, x, y, llat, llon, lgamma, lk );
168  lat = llat;
169  lon = llon;
170 }
171 
172 //*****************************************************************************
174 { return m_pAlbersEqualArea->MajorRadius(); }
175 
176 //*****************************************************************************
178 { return m_pAlbersEqualArea->Flattening(); }
179 
180 //*****************************************************************************
182 { return m_pAlbersEqualArea->OriginLatitude(); }
183 
184 //*****************************************************************************
186 { return m_pAlbersEqualArea->CentralScale(); }
GeographicLib::AlbersEqualArea
Albers equal area conic projection.
Definition: AlbersEqualArea.hpp:60
gtsam.examples.DogLegOptimizerExample.type
type
Definition: DogLegOptimizerExample.py:111
NETGeographicLib::AlbersEqualArea::StandardTypes::AzimuthalEqualAreaNorth
@ AzimuthalEqualAreaNorth
Lambert azimuthal equal area projection (stdlat = 90°, and k0 = 1)
NETGeographicLib::AlbersEqualArea::Reverse
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)
Definition: dotnet/NETGeographicLib/AlbersEqualArea.cpp:136
NETGeographicLib::AlbersEqualArea::AlbersEqualArea
AlbersEqualArea(StandardTypes type)
Definition: dotnet/NETGeographicLib/AlbersEqualArea.cpp:29
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::AlbersEqualArea::AzimuthalEqualAreaSouth
static const AlbersEqualArea & AzimuthalEqualAreaSouth()
Definition: src/AlbersEqualArea.cpp:291
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
NETGeographicLib::AlbersEqualArea::StandardTypes::CylindricalEqualArea
@ CylindricalEqualArea
cylindrical equal area projection (stdlat = 0, and k0 = 1)
GeographicLib::GeographicErr
Exception handling for GeographicLib.
Definition: Constants.hpp:389
GeographicLib::AlbersEqualArea::Reverse
void Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const
Definition: src/AlbersEqualArea.cpp:411
AlbersEqualArea.hpp
Header for GeographicLib::AlbersEqualArea class.
k0
double k0(double x)
Definition: k0.c:131
NETGeographicLib::AlbersEqualArea::m_pAlbersEqualArea
GeographicLib::AlbersEqualArea * m_pAlbersEqualArea
Definition: AlbersEqualArea.h:71
GeographicLib::AlbersEqualArea::SetScale
void SetScale(real lat, real k=real(1))
Definition: src/AlbersEqualArea.cpp:433
NETGeographicLib::AlbersEqualArea::Forward
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)
Definition: dotnet/NETGeographicLib/AlbersEqualArea.cpp:121
lgamma
const EIGEN_DEVICE_FUNC LgammaReturnType lgamma() const
Definition: ArrayCwiseUnaryOps.h:620
example::lon0
const double lon0
Definition: testGPSFactor.cpp:41
k1
double k1(double x)
Definition: k1.c:133
stdafx.h
NETGeographicLib::AlbersEqualArea
.NET Wrapper for GeographicLib::AlbersEqualArea.
Definition: AlbersEqualArea.h:67
gamma
#define gamma
Definition: mconf.h:85
NETGeographicLib.h
Header for NETGeographicLib::NETGeographicLib objects.
NETGeographicLib::AlbersEqualArea::StandardTypes
StandardTypes
Definition: AlbersEqualArea.h:79
y
Scalar * y
Definition: level1_cplx_impl.h:124
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
GeographicLib::AlbersEqualArea::AzimuthalEqualAreaNorth
static const AlbersEqualArea & AzimuthalEqualAreaNorth()
Definition: src/AlbersEqualArea.cpp:284
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
GeographicLib::AlbersEqualArea::CylindricalEqualArea
static const AlbersEqualArea & CylindricalEqualArea()
Definition: src/AlbersEqualArea.cpp:277
NETGeographicLib::AlbersEqualArea::StandardTypes::AzimuthalEqualAreaSouth
@ AzimuthalEqualAreaSouth
Lambert azimuthal equal area projection (stdlat = −90°, and k0 = 1)
GeographicLib::AlbersEqualArea::Forward
void Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const
Definition: src/AlbersEqualArea.cpp:386
AlbersEqualArea.h
Header for NETGeographicLib::AlbersEqualArea class.
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
NETGeographicLib::AlbersEqualArea::SetScale
void SetScale(double lat, double k)
Definition: dotnet/NETGeographicLib/AlbersEqualArea.cpp:108
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Mon Jul 1 2024 03:00:43