NETGeographicLib  1.38
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Pages
NETGeographicLib.h
Go to the documentation of this file.
1 #pragma once
2 /**
3  * \file NETGeographicLib/NETGeographicLib.h
4  * \brief Header for NETGeographicLib::NETGeographicLib objects
5  *
6  * NETGeographicLib is copyright (c) Scott Heiman (2013)
7  * GeographicLib is Copyright (c) Charles Karney (2010-2012)
8  * <charles@karney.com> and licensed under the MIT/X11 License.
9  * For more information, see
10  * http://geographiclib.sourceforge.net/
11  **********************************************************************/
12 #include <string>
13 
14 using namespace System;
15 
16 namespace NETGeographicLib
17 {
18  enum class captype {
19  CAP_NONE = 0U,
20  CAP_C1 = 1U<<0,
21  CAP_C1p = 1U<<1,
22  CAP_C2 = 1U<<2,
23  CAP_C3 = 1U<<3,
24  CAP_C4 = 1U<<4,
25  CAP_ALL = 0x1FU,
26  OUT_ALL = 0x7F80U,
27  };
28 
29  /**
30  * Bit masks for what calculations to do. These masks do double duty.
31  * They signify to the GeodesicLine::GeodesicLine constructor and to
32  * Geodesic::Line what capabilities should be included in the GeodesicLine
33  * object. They also specify which results to return in the general
34  * routines Geodesic::GenDirect and Geodesic::GenInverse routines.
35  **********************************************************************/
36  public enum class Mask {
37  /**
38  * No capabilities, no output.
39  * @hideinitializer
40  **********************************************************************/
41  NONE = 0U,
42  /**
43  * Calculate latitude \e lat2. (It's not necessary to include this as a
44  * capability to GeodesicLine because this is included by default.)
45  * @hideinitializer
46  **********************************************************************/
47  LATITUDE = 1U<<7 | unsigned(captype::CAP_NONE),
48  /**
49  * Calculate longitude \e lon2.
50  * @hideinitializer
51  **********************************************************************/
52  LONGITUDE = 1U<<8 | unsigned(captype::CAP_C3),
53  /**
54  * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to
55  * include this as a capability to GeodesicLine because this is included
56  * by default.)
57  * @hideinitializer
58  **********************************************************************/
59  AZIMUTH = 1U<<9 | unsigned(captype::CAP_NONE),
60  /**
61  * Calculate distance \e s12.
62  * @hideinitializer
63  **********************************************************************/
64  DISTANCE = 1U<<10 | unsigned(captype::CAP_C1),
65  /**
66  * Allow distance \e s12 to be used as input in the direct geodesic
67  * problem.
68  * @hideinitializer
69  **********************************************************************/
70  DISTANCE_IN = 1U<<11 | unsigned(captype::CAP_C1) |
71  unsigned(captype::CAP_C1p),
72  /**
73  * Calculate reduced length \e m12.
74  * @hideinitializer
75  **********************************************************************/
76  REDUCEDLENGTH = 1U<<12 | unsigned(captype::CAP_C1) |
77  unsigned(captype::CAP_C2),
78  /**
79  * Calculate geodesic scales \e M12 and \e M21.
80  * @hideinitializer
81  **********************************************************************/
82  GEODESICSCALE = 1U<<13 | unsigned(captype::CAP_C1) |
83  unsigned(captype::CAP_C2),
84  /**
85  * Calculate area \e S12.
86  * @hideinitializer
87  **********************************************************************/
88  AREA = 1U<<14 | unsigned(captype::CAP_C4),
89  /**
90  * All capabilities, calculate everything.
91  * @hideinitializer
92  **********************************************************************/
93  ALL = unsigned(captype::OUT_ALL) | unsigned(captype::CAP_ALL),
94  };
95 
96  /**
97  * @brief The version information.
98  **********************************************************************/
99  public ref class VersionInfo
100  {
101  private:
102  VersionInfo() {}
103  public:
104  /**
105  * @return The version string.
106  *******************************************************************/
107  static System::String^ GetString();
108  /**
109  * @return The major version.
110  *******************************************************************/
111  static int MajorVersion();
112  /**
113  * @return The minor version.
114  *******************************************************************/
115  static int MinorVersion();
116  /**
117  * @return The patch number.
118  *******************************************************************/
119  static int Patch();
120  };
121 
122  /**
123  * @brief Exception class for NETGeographicLib
124  **********************************************************************/
125  public ref class GeographicErr : public System::Exception
126  {
127  public:
128  /**
129  * @brief Creates an exception using an unmanaged string.
130  * @param[in] msg The error string.
131  ******************************************************************/
132  GeographicErr( const char* msg ) :
133  System::Exception( gcnew System::String( msg ) ) {}
134  /**
135  * @brief Creates an exception using a managed string.
136  * @param[in] msg The error string.
137  ******************************************************************/
138  GeographicErr( System::String^ msg ) : System::Exception( msg ) {}
139  };
140 
141  ref class StringConvert
142  {
144  public:
145  static std::string ManagedToUnmanaged( System::String^ s );
146  static System::String^ UnmanagedToManaged( const std::string& s )
147  { return gcnew System::String( s.c_str() ); }
148  };
149 
150  /**
151  * @brief Physical constants
152  *
153  * References:<br>
154  * http://www.orekit.org/static/apidocs/org/orekit/utils/Constants.html<br>
155  * A COMPENDIUM OF EARTH CONSTANTS RELEVANT TO AUSTRALIAN GEODETIC SCIENCE<br>
156  * http://espace.library.curtin.edu.au/R?func=dbin-jump-full&local_base=gen01-era02&object_id=146669
157  **********************************************************************/
158  public ref class Constants
159  {
160  private:
161  Constants() {}
162  public:
163 
164  /**
165  * @brief WGS72 Parameters
166  **********************************************************************/
167  ref class WGS72
168  {
169  private:
170  WGS72() {}
171  // The equatorial radius in meters.
172  static const double m_MajorRadius = 6378135.0;
173  // The flattening of the ellipsoid
174  static const double m_Flattening = 1.0 / 298.26;
175  // The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
176  static const double m_GravitationalConstant = 3.986008e+14;
177  // The spin rate of the Earth in radians/second.
178  static const double m_EarthRate = 7.292115147e-5;
179  // dynamical form factor
180  static const double m_J2 = 1.0826158e-3;
181  public:
182  //! The equatorial radius in meters.
183  static property double MajorRadius { double get() { return m_MajorRadius; } }
184  //! The flattening of the ellipsoid
185  static property double Flattening { double get() { return m_Flattening; } }
186  //! The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
187  static property double GravitationalConstant { double get() { return m_GravitationalConstant; } }
188  //! The spin rate of the Earth in radians/second.
189  static property double EarthRate { double get() { return m_EarthRate; } }
190  //! The dynamical form factor (J2).
191  static property double J2 { double get() { return m_J2; } }
192  };
193 
194  /**
195  * @brief WGS84 Parameters
196  **********************************************************************/
197  ref class WGS84
198  {
199  private:
200  WGS84() {}
201  // The equatorial radius in meters.
202  static const double m_MajorRadius = 6378137.0;
203  // The flattening of the ellipsoid
204  static const double m_Flattening = 1.0 / 298.257223563;
205  // The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
206  // I have also seen references that set this value to 3.986004418e+14.
207  // The following value is used to maintain consistency with GeographicLib.
208  static const double m_GravitationalConstant = 3.986005e+14;
209  // The spin rate of the Earth in radians/second.
210  static const double m_EarthRate = 7.292115e-5;
211  // dynamical form factor
212  static const double m_J2 = 1.08263e-3;
213  public:
214  //! The equatorial radius in meters.
215  static property double MajorRadius { double get() { return m_MajorRadius; } }
216  //! The flattening of the ellipsoid
217  static property double Flattening { double get() { return m_Flattening; } }
218  //! The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
219  static property double GravitationalConstant { double get() { return m_GravitationalConstant; } }
220  //! The spin rate of the Earth in radians/second.
221  static property double EarthRate { double get() { return m_EarthRate; } }
222  //! The dynamical form factor (J2).
223  static property double J2 { double get() { return m_J2; } }
224  };
225 
226  /**
227  * @brief GRS80 Parameters
228  **********************************************************************/
229  ref class GRS80
230  {
231  private:
232  GRS80() {}
233  // The equatorial radius in meters.
234  static const double m_MajorRadius = 6378137.0;
235  // The flattening of the ellipsoid
236  static const double m_Flattening = 1.0 / 298.257222100882711;
237  // The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
238  static const double m_GravitationalConstant = 3.986005e+14;
239  // The spin rate of the Earth in radians/second.
240  static const double m_EarthRate = 7.292115e-5;
241  // dynamical form factor
242  static const double m_J2 = 1.08263e-3;
243  public:
244  //! The equatorial radius in meters.
245  static property double MajorRadius { double get() { return m_MajorRadius; } }
246  //! The flattening of the ellipsoid
247  static property double Flattening { double get() { return m_Flattening; } }
248  //! The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
249  static property double GravitationalConstant { double get() { return m_GravitationalConstant; } }
250  //! The spin rate of the Earth in radians/second.
251  static property double EarthRate { double get() { return m_EarthRate; } }
252  //! The dynamical form factor (J2).
253  static property double J2 { double get() { return m_J2; } }
254  };
255  };
256 } // namespace NETGeographicLib
Exception class for NETGeographicLib.
static System::String^ UnmanagedToManaged(const std::string &s)
GeographicErr(const char *msg)
Creates an exception using an unmanaged string.
GeographicErr(System::String^ msg)
Creates an exception using a managed string.
The version information.