dotnet/NETGeographicLib/GeoCoords.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
13 #include "GeoCoords.h"
14 #include "UTMUPS.h"
15 #include "NETGeographicLib.h"
16 
17 using namespace NETGeographicLib;
18 
19 const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::GeoCoords";
20 
21 //*****************************************************************************
23 {
24  if ( m_pGeoCoords != NULL )
25  {
26  delete m_pGeoCoords;
27  m_pGeoCoords = NULL;
28  }
29 }
30 
31 //*****************************************************************************
33 {
34  try
35  {
37  }
38  catch ( std::bad_alloc )
39  {
40  throw gcnew GeographicErr( BADALLOC );
41  }
42 }
43 
44 //*****************************************************************************
45 GeoCoords::GeoCoords(System::String^ s, bool centerp, bool longfirst )
46 {
47  try
48  {
50  }
51  catch ( std::bad_alloc )
52  {
53  throw gcnew GeographicErr( BADALLOC );
54  }
55  catch ( const std::exception& err )
56  {
57  throw gcnew GeographicErr( err.what() );
58  }
59 }
60 
61 //*****************************************************************************
62 GeoCoords::GeoCoords(double latitude, double longitude, int zone )
63 {
64  try
65  {
66  m_pGeoCoords = new GeographicLib::GeoCoords(latitude, longitude, zone);
67  }
68  catch ( std::bad_alloc )
69  {
70  throw gcnew GeographicErr( BADALLOC );
71  }
72  catch ( const std::exception& err )
73  {
74  throw gcnew GeographicErr( err.what() );
75  }
76 }
77 
78 //*****************************************************************************
79 GeoCoords::GeoCoords(int zone, bool northp, double easting, double northing)
80 {
81  try
82  {
83  m_pGeoCoords = new GeographicLib::GeoCoords(zone, northp, easting, northing);
84  }
85  catch ( std::bad_alloc )
86  {
87  throw gcnew GeographicErr( BADALLOC );
88  }
89  catch ( const std::exception& err )
90  {
91  throw gcnew GeographicErr( err.what() );
92  }
93 }
94 
95 //*****************************************************************************
96 void GeoCoords::Reset( System::String^ s, bool centerp, bool longfirst )
97 {
98  try
99  {
100  m_pGeoCoords->Reset(StringConvert::ManagedToUnmanaged(s), centerp, longfirst);
101  }
102  catch ( const std::exception& err )
103  {
104  throw gcnew GeographicErr( err.what() );
105  }
106 }
107 
108 //*****************************************************************************
109 void GeoCoords::Reset(double latitude, double longitude, int zone)
110 {
111  try
112  {
113  m_pGeoCoords->Reset(latitude, longitude, zone);
114  }
115  catch ( const std::exception& err )
116  {
117  throw gcnew GeographicErr( err.what() );
118  }
119 }
120 
121 //*****************************************************************************
122 void GeoCoords::Reset(int zone, bool northp, double easting, double northing)
123 {
124  try
125  {
126  m_pGeoCoords->Reset(zone, northp, easting, northing);
127  }
128  catch ( const std::exception& err )
129  {
130  throw gcnew GeographicErr( err.what() );
131  }
132 }
133 
134 //*****************************************************************************
135 void GeoCoords::AltZone::set( int zone )
136 {
137  try
138  {
139  m_pGeoCoords->SetAltZone(zone);
140  }
141  catch ( GeographicLib::GeographicErr err )
142  {
143  throw gcnew GeographicErr( err.what() );
144  }
145 }
146 
147 //*****************************************************************************
148 int GeoCoords::AltZone::get() { return m_pGeoCoords->AltZone(); }
149 
150 //*****************************************************************************
151 double GeoCoords::Latitude::get() { return m_pGeoCoords->Latitude(); }
152 
153 //*****************************************************************************
154 double GeoCoords::Longitude::get() { return m_pGeoCoords->Longitude(); }
155 
156 //*****************************************************************************
157 double GeoCoords::Easting::get() { return m_pGeoCoords->Easting(); }
158 
159 //*****************************************************************************
160 double GeoCoords::Northing::get() { return m_pGeoCoords->Northing(); }
161 
162 //*****************************************************************************
163 double GeoCoords::Convergence::get() { return m_pGeoCoords->Convergence(); }
164 
165 //*****************************************************************************
166 double GeoCoords::Scale::get() { return m_pGeoCoords->Scale(); }
167 
168 //*****************************************************************************
169 bool GeoCoords::Northp::get() { return m_pGeoCoords->Northp(); }
170 
171 //*****************************************************************************
172 char GeoCoords::Hemisphere::get() { return m_pGeoCoords->Hemisphere(); }
173 
174 //*****************************************************************************
175 int GeoCoords::Zone::get() { return m_pGeoCoords->Zone(); }
176 
177 //*****************************************************************************
178 double GeoCoords::AltEasting::get() { return m_pGeoCoords->AltEasting(); }
179 
180 //*****************************************************************************
181 double GeoCoords::AltNorthing::get() { return m_pGeoCoords->AltNorthing(); }
182 
183 //*****************************************************************************
185 { return m_pGeoCoords->AltConvergence(); }
186 
187 //*****************************************************************************
188 double GeoCoords::AltScale::get() { return m_pGeoCoords->AltScale(); }
189 
190 //*****************************************************************************
192 
193 //*****************************************************************************
194 double GeoCoords::Flattening::get() { return UTMUPS::Flattening(); }
195 
196 //*****************************************************************************
197 System::String^ GeoCoords::GeoRepresentation(int prec, bool longfirst )
198 {
199  return gcnew System::String( m_pGeoCoords->GeoRepresentation(prec, longfirst).c_str() );
200 }
201 
202 //*****************************************************************************
203 System::String^ GeoCoords::DMSRepresentation(int prec, bool longfirst,
204  char dmssep )
205 {
206  return gcnew System::String( m_pGeoCoords->DMSRepresentation(prec, longfirst, dmssep).c_str() );
207 }
208 
209 //*****************************************************************************
210 System::String^ GeoCoords::MGRSRepresentation(int prec)
211 {
212  return gcnew System::String( m_pGeoCoords->MGRSRepresentation(prec).c_str() );
213 }
214 
215 //*****************************************************************************
216 System::String^ GeoCoords::UTMUPSRepresentation(int prec, bool abbrev)
217 {
218  return gcnew System::String( m_pGeoCoords->UTMUPSRepresentation(prec, abbrev).c_str() );
219 }
220 
221 //*****************************************************************************
222 System::String^ GeoCoords::UTMUPSRepresentation(bool northp, int prec, bool abbrev)
223 {
224  return gcnew System::String( m_pGeoCoords->UTMUPSRepresentation(northp, prec, abbrev).c_str() );
225 }
226 
227 //*****************************************************************************
228 System::String^ GeoCoords::AltMGRSRepresentation(int prec)
229 {
230  return gcnew System::String( m_pGeoCoords->AltMGRSRepresentation(prec).c_str() );
231 }
232 
233 //*****************************************************************************
234 System::String^ GeoCoords::AltUTMUPSRepresentation(int prec, bool abbrev)
235 {
236  return gcnew System::String( m_pGeoCoords->AltUTMUPSRepresentation(prec, abbrev).c_str() );
237 }
238 
239 //*****************************************************************************
240 System::String^ GeoCoords::AltUTMUPSRepresentation(bool northp, int prec, bool abbrev)
241 {
242  return gcnew System::String( m_pGeoCoords->AltUTMUPSRepresentation(northp, prec, abbrev).c_str() );
243 }
NETGeographicLib::UTMUPS::MajorRadius
static double MajorRadius()
Definition: dotnet/NETGeographicLib/UTMUPS.cpp:212
NETGeographicLib::GeoCoords::Reset
void Reset(System::String^ s, bool centerp, bool longfirst)
Definition: dotnet/NETGeographicLib/GeoCoords.cpp:96
GeographicLib::GeoCoords::AltMGRSRepresentation
std::string AltMGRSRepresentation(int prec=0) const
Definition: src/GeoCoords.cpp:97
NETGeographicLib::GeoCoords::AltMGRSRepresentation
System::String AltMGRSRepresentation(int prec)
Definition: dotnet/NETGeographicLib/GeoCoords.cpp:228
GeographicLib::GeoCoords::AltUTMUPSRepresentation
std::string AltUTMUPSRepresentation(int prec=0, bool abbrev=true) const
Definition: src/GeoCoords.cpp:146
s
RealScalar s
Definition: level1_cplx_impl.h:126
NETGeographicLib::GeoCoords::m_pGeoCoords
GeographicLib::GeoCoords * m_pGeoCoords
Definition: GeoCoords.h:59
GeographicLib::GeoCoords::Reset
void Reset(const std::string &s, bool centerp=true, bool longfirst=false)
Definition: src/GeoCoords.cpp:19
BADALLOC
const char BADALLOC[]
Definition: dotnet/NETGeographicLib/GeoCoords.cpp:19
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
GeoCoords.hpp
Header for GeographicLib::GeoCoords class.
GeographicLib::GeographicErr
Exception handling for GeographicLib.
Definition: Constants.hpp:389
NETGeographicLib::GeoCoords::AltUTMUPSRepresentation
System::String AltUTMUPSRepresentation(int prec, bool abbrev)
Definition: dotnet/NETGeographicLib/GeoCoords.cpp:234
GeographicLib::GeoCoords
Conversion between geographic coordinates.
Definition: GeoCoords.hpp:49
GeographicLib::GeoCoords::DMSRepresentation
std::string DMSRepresentation(int prec=0, bool longfirst=false, char dmssep=char(0)) const
Definition: src/GeoCoords.cpp:80
NETGeographicLib::GeoCoords::GeoRepresentation
System::String GeoRepresentation(int prec, bool longfirst)
Definition: dotnet/NETGeographicLib/GeoCoords.cpp:197
stdafx.h
NETGeographicLib.h
Header for NETGeographicLib::NETGeographicLib objects.
set
void set(Container &c, Position position, const Value &value)
Definition: stdlist_overload.cpp:37
NETGeographicLib::GeoCoords::UTMUPSRepresentation
System::String UTMUPSRepresentation(int prec, bool abbrev)
Definition: dotnet/NETGeographicLib/GeoCoords.cpp:216
UTMUPS.h
Header for NETGeographicLib::UTMUPS class.
NETGeographicLib::UTMUPS::Flattening
static double Flattening()
Definition: dotnet/NETGeographicLib/UTMUPS.cpp:215
GeoCoords.h
Header for NETGeographicLib::GeoCoords class.
GeographicLib::GeoCoords::UTMUPSRepresentation
std::string UTMUPSRepresentation(int prec=0, bool abbrev=true) const
Definition: src/GeoCoords.cpp:129
NETGeographicLib::GeoCoords
.NET wrapper for GeographicLib::GeoCoords.
Definition: GeoCoords.h:55
NETGeographicLib::GeoCoords::MGRSRepresentation
System::String MGRSRepresentation(int prec)
Definition: dotnet/NETGeographicLib/GeoCoords.cpp:210
NETGeographicLib::GeoCoords::DMSRepresentation
System::String DMSRepresentation(int prec, bool longfirst, char dmssep)
Definition: dotnet/NETGeographicLib/GeoCoords.cpp:203
GeographicLib::GeoCoords::MGRSRepresentation
std::string MGRSRepresentation(int prec=0) const
Definition: src/GeoCoords.cpp:89
NULL
#define NULL
Definition: ccolamd.c:609
get
Container::iterator get(Container &c, Position position)
Definition: stdlist_overload.cpp:29
NETGeographicLib::GeoCoords::GeoCoords
GeoCoords()
Definition: dotnet/NETGeographicLib/GeoCoords.cpp:32
NETGeographicLib
Definition: Accumulator.h:13
NETGeographicLib::StringConvert::ManagedToUnmanaged
static std::string ManagedToUnmanaged(System::String^ s)
Definition: NETGeographicLib.cpp:20
GeographicLib::GeoCoords::GeoRepresentation
std::string GeoRepresentation(int prec=0, bool longfirst=false) const
Definition: src/GeoCoords.cpp:62


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:21