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()
140 { return StringConvert::UnmanagedToManaged(m_pGeoid->Description()); }
141 
142 //*****************************************************************************
143 System::String^ Geoid::DateTime::get()
144 { return StringConvert::UnmanagedToManaged(m_pGeoid->DateTime()); }
145 
146 //*****************************************************************************
147 System::String^ Geoid::GeoidFile::get()
148 { return StringConvert::UnmanagedToManaged(m_pGeoid->GeoidFile()); }
149 
150 //*****************************************************************************
151 System::String^ Geoid::GeoidName::get()
152 { return StringConvert::UnmanagedToManaged(m_pGeoid->GeoidName()); }
153 
154 //*****************************************************************************
155 System::String^ Geoid::GeoidDirectory::get()
156 { return StringConvert::UnmanagedToManaged(m_pGeoid->GeoidDirectory()); }
157 
158 //*****************************************************************************
159 System::String^ Geoid::Interpolation::get()
160 { return StringConvert::UnmanagedToManaged(m_pGeoid->Interpolation()); }
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(); }
GeographicLib::Geoid::DefaultGeoidPath
static std::string DefaultGeoidPath()
Definition: src/Geoid.cpp:488
name
Annotation for function names.
Definition: attr.h:51
d
static const double d[K][N]
Definition: igam.h:11
h
const double h
Definition: testSimpleHelicopter.cpp:19
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
NETGeographicLib::Geoid
.NET wrapper for GeographicLib::Geoid.
Definition: Geoid.h:71
Geoid.h
Header for NETGeographicLib::Geoid class.
NETGeographicLib::Geoid::DefaultGeoidName
static System::String DefaultGeoidName()
Definition: dotnet/NETGeographicLib/Geoid.cpp:125
NETGeographicLib::Geoid::Height
double Height(double lat, double lon)
Definition: dotnet/NETGeographicLib/Geoid.cpp:83
GeographicLib::GeographicErr
Exception handling for GeographicLib.
Definition: Constants.hpp:389
NETGeographicLib::StringConvert::UnmanagedToManaged
static System::String UnmanagedToManaged(const std::string &s)
Definition: NETGeographicLib.h:153
GeographicLib::Geoid::convertflag
convertflag
Definition: Geoid.hpp:182
NETGeographicLib::Geoid::DefaultGeoidPath
static System::String DefaultGeoidPath()
Definition: dotnet/NETGeographicLib/Geoid.cpp:111
GeographicLib::Geoid::CacheClear
void CacheClear() const
Definition: src/Geoid.cpp:394
NETGeographicLib::Geoid::m_pGeoid
const GeographicLib::Geoid * m_pGeoid
Definition: Geoid.h:75
Geoid.hpp
Header for GeographicLib::Geoid class.
stdafx.h
GeographicLib::Geoid::DefaultGeoidName
static std::string DefaultGeoidName()
Definition: src/Geoid.cpp:501
GeographicLib::Geoid
Looking up the height of the geoid above the ellipsoid.
Definition: Geoid.hpp:82
NETGeographicLib::Geoid::ConvertFlag
ConvertFlag
Definition: Geoid.h:84
NETGeographicLib::Geoid::ConvertHeight
double ConvertHeight(double lat, double lon, double h, ConvertFlag d)
Definition: dotnet/NETGeographicLib/Geoid.cpp:96
NETGeographicLib.h
Header for NETGeographicLib::NETGeographicLib objects.
matlab_wrap.path
path
Definition: matlab_wrap.py:66
NETGeographicLib::Geoid::Geoid
Geoid(System::String^ name, System::String^ path, bool cubic, bool threadsafe)
Definition: dotnet/NETGeographicLib/Geoid.cpp:29
GeographicLib::Geoid::CacheArea
void CacheArea(real south, real west, real north, real east) const
Definition: src/Geoid.cpp:407
NETGeographicLib::Geoid::CacheAll
void CacheAll()
Definition: dotnet/NETGeographicLib/Geoid.cpp:64
lon
static const double lon
Definition: testGeographicLib.cpp:34
NULL
#define NULL
Definition: ccolamd.c:609
GeographicLib::Geoid::CacheAll
void CacheAll() const
Definition: Geoid.hpp:262
GeographicLib::Geoid::ConvertHeight
Math::real ConvertHeight(real lat, real lon, real h, convertflag d) const
Definition: Geoid.hpp:308
get
Container::iterator get(Container &c, Position position)
Definition: stdlist_overload.cpp:29
NETGeographicLib::Geoid::CacheClear
void CacheClear()
Definition: dotnet/NETGeographicLib/Geoid.cpp:77
NETGeographicLib
Definition: Accumulator.h:13
NETGeographicLib::StringConvert::ManagedToUnmanaged
static std::string ManagedToUnmanaged(System::String^ s)
Definition: NETGeographicLib.cpp:20
lat
static const double lat
Definition: testGeographicLib.cpp:34
NETGeographicLib::Geoid::CacheArea
void CacheArea(double south, double west, double north, double east)
Definition: dotnet/NETGeographicLib/Geoid.cpp:51


gtsam
Author(s):
autogenerated on Mon Jul 1 2024 03:01:21