00001 #pragma once 00002 /** 00003 * \file NETGeographicLib/NETGeographicLib.h 00004 * \brief Header for NETGeographicLib::NETGeographicLib objects 00005 * 00006 * NETGeographicLib is copyright (c) Scott Heiman (2013) 00007 * GeographicLib is Copyright (c) Charles Karney (2010-2012) 00008 * <charles@karney.com> and licensed under the MIT/X11 License. 00009 * For more information, see 00010 * http://geographiclib.sourceforge.net/ 00011 **********************************************************************/ 00012 #include <string> 00013 00014 using namespace System; 00015 00016 namespace NETGeographicLib 00017 { 00018 enum class captype { 00019 CAP_NONE = 0U, 00020 CAP_C1 = 1U<<0, 00021 CAP_C1p = 1U<<1, 00022 CAP_C2 = 1U<<2, 00023 CAP_C3 = 1U<<3, 00024 CAP_C4 = 1U<<4, 00025 CAP_ALL = 0x1FU, 00026 OUT_ALL = 0x7F80U, 00027 }; 00028 00029 /** 00030 * Bit masks for what calculations to do. These masks do double duty. 00031 * They signify to the GeodesicLine::GeodesicLine constructor and to 00032 * Geodesic::Line what capabilities should be included in the GeodesicLine 00033 * object. They also specify which results to return in the general 00034 * routines Geodesic::GenDirect and Geodesic::GenInverse routines. 00035 **********************************************************************/ 00036 public enum class Mask { 00037 /** 00038 * No capabilities, no output. 00039 * @hideinitializer 00040 **********************************************************************/ 00041 NONE = 0U, 00042 /** 00043 * Calculate latitude \e lat2. (It's not necessary to include this as a 00044 * capability to GeodesicLine because this is included by default.) 00045 * @hideinitializer 00046 **********************************************************************/ 00047 LATITUDE = 1U<<7 | unsigned(captype::CAP_NONE), 00048 /** 00049 * Calculate longitude \e lon2. 00050 * @hideinitializer 00051 **********************************************************************/ 00052 LONGITUDE = 1U<<8 | unsigned(captype::CAP_C3), 00053 /** 00054 * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to 00055 * include this as a capability to GeodesicLine because this is included 00056 * by default.) 00057 * @hideinitializer 00058 **********************************************************************/ 00059 AZIMUTH = 1U<<9 | unsigned(captype::CAP_NONE), 00060 /** 00061 * Calculate distance \e s12. 00062 * @hideinitializer 00063 **********************************************************************/ 00064 DISTANCE = 1U<<10 | unsigned(captype::CAP_C1), 00065 /** 00066 * Allow distance \e s12 to be used as input in the direct geodesic 00067 * problem. 00068 * @hideinitializer 00069 **********************************************************************/ 00070 DISTANCE_IN = 1U<<11 | unsigned(captype::CAP_C1) | 00071 unsigned(captype::CAP_C1p), 00072 /** 00073 * Calculate reduced length \e m12. 00074 * @hideinitializer 00075 **********************************************************************/ 00076 REDUCEDLENGTH = 1U<<12 | unsigned(captype::CAP_C1) | 00077 unsigned(captype::CAP_C2), 00078 /** 00079 * Calculate geodesic scales \e M12 and \e M21. 00080 * @hideinitializer 00081 **********************************************************************/ 00082 GEODESICSCALE = 1U<<13 | unsigned(captype::CAP_C1) | 00083 unsigned(captype::CAP_C2), 00084 /** 00085 * Calculate area \e S12. 00086 * @hideinitializer 00087 **********************************************************************/ 00088 AREA = 1U<<14 | unsigned(captype::CAP_C4), 00089 /** 00090 * All capabilities, calculate everything. 00091 * @hideinitializer 00092 **********************************************************************/ 00093 ALL = unsigned(captype::OUT_ALL) | unsigned(captype::CAP_ALL), 00094 }; 00095 00096 /** 00097 * @brief The version information. 00098 **********************************************************************/ 00099 public ref class VersionInfo 00100 { 00101 private: 00102 VersionInfo() {} 00103 public: 00104 /** 00105 * @return The version string. 00106 *******************************************************************/ 00107 static System::String^ GetString(); 00108 /** 00109 * @return The major version. 00110 *******************************************************************/ 00111 static int MajorVersion(); 00112 /** 00113 * @return The minor version. 00114 *******************************************************************/ 00115 static int MinorVersion(); 00116 /** 00117 * @return The patch number. 00118 *******************************************************************/ 00119 static int Patch(); 00120 }; 00121 00122 /** 00123 * @brief Exception class for NETGeographicLib 00124 **********************************************************************/ 00125 public ref class GeographicErr : public System::Exception 00126 { 00127 public: 00128 /** 00129 * @brief Creates an exception using an unmanaged string. 00130 * @param[in] msg The error string. 00131 ******************************************************************/ 00132 GeographicErr( const char* msg ) : 00133 System::Exception( gcnew System::String( msg ) ) {} 00134 /** 00135 * @brief Creates an exception using a managed string. 00136 * @param[in] msg The error string. 00137 ******************************************************************/ 00138 GeographicErr( System::String^ msg ) : System::Exception( msg ) {} 00139 }; 00140 00141 ref class StringConvert 00142 { 00143 StringConvert() {} 00144 public: 00145 static std::string ManagedToUnmanaged( System::String^ s ); 00146 static System::String^ UnmanagedToManaged( const std::string& s ) 00147 { return gcnew System::String( s.c_str() ); } 00148 }; 00149 00150 /** 00151 * @brief Physical constants 00152 * 00153 * References:<br> 00154 * http://www.orekit.org/static/apidocs/org/orekit/utils/Constants.html<br> 00155 * A COMPENDIUM OF EARTH CONSTANTS RELEVANT TO AUSTRALIAN GEODETIC SCIENCE<br> 00156 * http://espace.library.curtin.edu.au/R?func=dbin-jump-full&local_base=gen01-era02&object_id=146669 00157 **********************************************************************/ 00158 public ref class Constants 00159 { 00160 private: 00161 Constants() {} 00162 public: 00163 00164 /** 00165 * @brief WGS72 Parameters 00166 **********************************************************************/ 00167 ref class WGS72 00168 { 00169 private: 00170 WGS72() {} 00171 // The equatorial radius in meters. 00172 static const double m_MajorRadius = 6378135.0; 00173 // The flattening of the ellipsoid 00174 static const double m_Flattening = 1.0 / 298.26; 00175 // The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>. 00176 static const double m_GravitationalConstant = 3.986008e+14; 00177 // The spin rate of the Earth in radians/second. 00178 static const double m_EarthRate = 7.292115147e-5; 00179 // dynamical form factor 00180 static const double m_J2 = 1.0826158e-3; 00181 public: 00182 //! The equatorial radius in meters. 00183 static property double MajorRadius { double get() { return m_MajorRadius; } } 00184 //! The flattening of the ellipsoid 00185 static property double Flattening { double get() { return m_Flattening; } } 00186 //! The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>. 00187 static property double GravitationalConstant { double get() { return m_GravitationalConstant; } } 00188 //! The spin rate of the Earth in radians/second. 00189 static property double EarthRate { double get() { return m_EarthRate; } } 00190 //! The dynamical form factor (J2). 00191 static property double J2 { double get() { return m_J2; } } 00192 }; 00193 00194 /** 00195 * @brief WGS84 Parameters 00196 **********************************************************************/ 00197 ref class WGS84 00198 { 00199 private: 00200 WGS84() {} 00201 // The equatorial radius in meters. 00202 static const double m_MajorRadius = 6378137.0; 00203 // The flattening of the ellipsoid 00204 static const double m_Flattening = 1.0 / 298.257223563; 00205 // The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>. 00206 // I have also seen references that set this value to 3.986004418e+14. 00207 // The following value is used to maintain consistency with GeographicLib. 00208 static const double m_GravitationalConstant = 3.986005e+14; 00209 // The spin rate of the Earth in radians/second. 00210 static const double m_EarthRate = 7.292115e-5; 00211 // dynamical form factor 00212 static const double m_J2 = 1.08263e-3; 00213 public: 00214 //! The equatorial radius in meters. 00215 static property double MajorRadius { double get() { return m_MajorRadius; } } 00216 //! The flattening of the ellipsoid 00217 static property double Flattening { double get() { return m_Flattening; } } 00218 //! The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>. 00219 static property double GravitationalConstant { double get() { return m_GravitationalConstant; } } 00220 //! The spin rate of the Earth in radians/second. 00221 static property double EarthRate { double get() { return m_EarthRate; } } 00222 //! The dynamical form factor (J2). 00223 static property double J2 { double get() { return m_J2; } } 00224 }; 00225 00226 /** 00227 * @brief GRS80 Parameters 00228 **********************************************************************/ 00229 ref class GRS80 00230 { 00231 private: 00232 GRS80() {} 00233 // The equatorial radius in meters. 00234 static const double m_MajorRadius = 6378137.0; 00235 // The flattening of the ellipsoid 00236 static const double m_Flattening = 1.0 / 298.257222100882711; 00237 // The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>. 00238 static const double m_GravitationalConstant = 3.986005e+14; 00239 // The spin rate of the Earth in radians/second. 00240 static const double m_EarthRate = 7.292115e-5; 00241 // dynamical form factor 00242 static const double m_J2 = 1.08263e-3; 00243 public: 00244 //! The equatorial radius in meters. 00245 static property double MajorRadius { double get() { return m_MajorRadius; } } 00246 //! The flattening of the ellipsoid 00247 static property double Flattening { double get() { return m_Flattening; } } 00248 //! The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>. 00249 static property double GravitationalConstant { double get() { return m_GravitationalConstant; } } 00250 //! The spin rate of the Earth in radians/second. 00251 static property double EarthRate { double get() { return m_EarthRate; } } 00252 //! The dynamical form factor (J2). 00253 static property double J2 { double get() { return m_J2; } } 00254 }; 00255 }; 00256 } // namespace NETGeographicLib