dotnet/NETGeographicLib/Geoid.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
12 #include "GeographicLib/Geoid.hpp"
13 #include "Geoid.h"
14 #include "NETGeographicLib.h"
15 
16 using namespace NETGeographicLib;
17 
18 //*****************************************************************************
19 Geoid::!Geoid(void)
20 {
21  if ( m_pGeoid != NULL )
22  {
23  delete m_pGeoid;
24  m_pGeoid = NULL;
25  }
26 }
27 
28 //*****************************************************************************
29 Geoid::Geoid(System::String^ name, System::String^ path,
30  bool cubic, bool threadsafe)
31 {
32  if ( name == nullptr ) throw gcnew GeographicErr("name cannot be a null pointer.");
33  if ( path == nullptr ) throw gcnew GeographicErr("path cannot be a null pointer.");
34  try
35  {
39  cubic, threadsafe );
40  }
41  catch ( std::bad_alloc )
42  {
43  throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::Geoid" );
44  }
45  catch ( const GeographicLib::GeographicErr& err )
46  {
47  throw gcnew GeographicErr( err.what() );
48  }
49 }
50 //*****************************************************************************
51 void Geoid::CacheArea(double south, double west, double north, double east)
52 {
53  try
54  {
55  m_pGeoid->CacheArea( south, west, north, east );
56  }
57  catch ( const std::exception& err )
58  {
59  throw gcnew GeographicErr( err.what() );
60  }
61 }
62 
63 //*****************************************************************************
65 {
66  try
67  {
68  m_pGeoid->CacheAll();
69  }
70  catch ( const std::exception& err )
71  {
72  throw gcnew GeographicErr( err.what() );
73  }
74 }
75 
76 //*****************************************************************************
78 {
80 }
81 
82 //*****************************************************************************
83 double Geoid::Height(double lat, double lon)
84 {
85  try
86  {
87  return m_pGeoid->operator()( lat, lon );
88  }
89  catch ( const std::exception& err )
90  {
91  throw gcnew GeographicErr( err.what() );
92  }
93 }
94 
95 //*****************************************************************************
96 double Geoid::ConvertHeight(double lat, double lon, double h,
97  ConvertFlag d)
98 {
99  try
100  {
101  return m_pGeoid->ConvertHeight( lat, lon, h,
102  static_cast<GeographicLib::Geoid::convertflag>(d) );
103  }
104  catch ( const std::exception& err )
105  {
106  throw gcnew GeographicErr( err.what() );
107  }
108 }
109 
110 //*****************************************************************************
111 System::String^ Geoid::DefaultGeoidPath()
112 {
113  try
114  {
117  }
118  catch ( const std::exception& err )
119  {
120  throw gcnew GeographicErr( err.what() );
121  }
122 }
123 
124 //*****************************************************************************
125 System::String^ Geoid::DefaultGeoidName()
126 {
127  try
128  {
131  }
132  catch ( const std::exception& err )
133  {
134  throw gcnew GeographicErr( err.what() );
135  }
136 }
137 
138 //*****************************************************************************
139 System::String^ Geoid::Description::get()
141 
142 //*****************************************************************************
143 System::String^ Geoid::DateTime::get()
145 
146 //*****************************************************************************
147 System::String^ Geoid::GeoidFile::get()
149 
150 //*****************************************************************************
151 System::String^ Geoid::GeoidName::get()
153 
154 //*****************************************************************************
155 System::String^ Geoid::GeoidDirectory::get()
157 
158 //*****************************************************************************
159 System::String^ Geoid::Interpolation::get()
161 
162 //*****************************************************************************
163 double Geoid::MaxError::get() { return m_pGeoid->MaxError(); }
164 
165 //*****************************************************************************
166 double Geoid::RMSError::get() { return m_pGeoid->RMSError(); }
167 
168 //*****************************************************************************
169 double Geoid::Offset::get() { return m_pGeoid->Offset(); }
170 
171 //*****************************************************************************
172 double Geoid::Scale::get() { return m_pGeoid->Scale(); }
173 
174 //*****************************************************************************
175 bool Geoid::ThreadSafe::get() { return m_pGeoid->ThreadSafe(); }
176 
177 //*****************************************************************************
178 bool Geoid::Cache::get() { return m_pGeoid->Cache(); }
179 
180 //*****************************************************************************
181 double Geoid::CacheWest::get() { return m_pGeoid->CacheWest(); }
182 
183 //*****************************************************************************
184 double Geoid::CacheEast::get() { return m_pGeoid->CacheEast(); }
185 
186 //*****************************************************************************
187 double Geoid::CacheNorth::get() { return m_pGeoid->CacheNorth(); }
188 
189 //*****************************************************************************
190 double Geoid::CacheSouth::get() { return m_pGeoid->CacheSouth(); }
191 
192 //*****************************************************************************
193 double Geoid::MajorRadius::get() { return m_pGeoid->MajorRadius(); }
194 
195 //*****************************************************************************
196 double Geoid::Flattening::get() { return m_pGeoid->Flattening(); }
const std::string & GeoidDirectory() const
Definition: Geoid.hpp:343
Header for NETGeographicLib::NETGeographicLib objects.
double ConvertHeight(double lat, double lon, double h, ConvertFlag d)
Math::real MaxError() const
Definition: Geoid.hpp:358
static const double lat
Exception class for NETGeographicLib.
Math::real CacheWest() const
Definition: Geoid.hpp:398
Math::real CacheNorth() const
Definition: Geoid.hpp:417
static System::String DefaultGeoidName()
static std::string ManagedToUnmanaged(System::String^s)
const std::string & DateTime() const
Definition: Geoid.hpp:327
Header for NETGeographicLib::Geoid class.
void CacheClear() const
Definition: src/Geoid.cpp:394
Math::real MajorRadius() const
Definition: Geoid.hpp:435
static std::string DefaultGeoidPath()
Definition: src/Geoid.cpp:488
const std::string & GeoidFile() const
Definition: Geoid.hpp:332
bool Cache() const
Definition: Geoid.hpp:393
void CacheArea(real south, real west, real north, real east) const
Definition: src/Geoid.cpp:407
Math::real ConvertHeight(real lat, real lon, real h, convertflag d) const
Definition: Geoid.hpp:308
static System::String UnmanagedToManaged(const std::string &s)
const std::string Interpolation() const
Definition: Geoid.hpp:348
Math::real Offset() const
Definition: Geoid.hpp:375
Math::real RMSError() const
Definition: Geoid.hpp:367
double Height(double lat, double lon)
bool ThreadSafe() const
Definition: Geoid.hpp:388
#define NULL
Definition: ccolamd.c:609
const double h
static System::String DefaultGeoidPath()
Math::real Flattening() const
Definition: Geoid.hpp:444
Exception handling for GeographicLib.
Definition: Constants.hpp:389
Geoid(System::String^name, System::String^path, bool cubic, bool threadsafe)
static std::string DefaultGeoidName()
Definition: src/Geoid.cpp:501
const GeographicLib::Geoid * m_pGeoid
Definition: Geoid.h:75
Math::real CacheSouth() const
Definition: Geoid.hpp:425
Math::real CacheEast() const
Definition: Geoid.hpp:407
static const double lon
const std::string & Description() const
Definition: Geoid.hpp:322
Annotation for function names.
Definition: attr.h:36
const std::string & GeoidName() const
Definition: Geoid.hpp:338
Math::real Scale() const
Definition: Geoid.hpp:383
Container::iterator get(Container &c, Position position)
Header for GeographicLib::Geoid class.
void CacheArea(double south, double west, double north, double east)
void CacheAll() const
Definition: Geoid.hpp:262
Looking up the height of the geoid above the ellipsoid.
Definition: Geoid.hpp:82
.NET wrapper for GeographicLib::Geoid.
Definition: Geoid.h:71


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:08