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  {
74  m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( a, f, stdlat, k0 );
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  {
112  m_pAlbersEqualArea->SetScale( lat, k );
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(); }
Header for NETGeographicLib::NETGeographicLib objects.
void Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const
GeographicLib::AlbersEqualArea * m_pAlbersEqualArea
Scalar * y
static const double lat
Exception class for NETGeographicLib.
static const AlbersEqualArea & CylindricalEqualArea()
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)
Header for NETGeographicLib::AlbersEqualArea class.
Array33i a
Header for GeographicLib::AlbersEqualArea class.
Albers equal area conic projection.
const mpreal gamma(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Definition: mpreal.h:2262
static const AlbersEqualArea & AzimuthalEqualAreaNorth()
cylindrical equal area projection (stdlat = 0, and k0 = 1)
.NET Wrapper for GeographicLib::AlbersEqualArea.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
const double lon0
#define NULL
Definition: ccolamd.c:609
Lambert azimuthal equal area projection (stdlat = 90°, and k0 = 1)
Exception handling for GeographicLib.
Definition: Constants.hpp:389
void Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const
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)
Math::real OriginLatitude() const
static const AlbersEqualArea & AzimuthalEqualAreaSouth()
static const double lon
Container::iterator get(Container &c, Position position)
Lambert azimuthal equal area projection (stdlat = −90°, and k0 = 1)
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
EIGEN_DEVICE_FUNC const LgammaReturnType lgamma() const
void SetScale(real lat, real k=real(1))


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:41:36