File: NETGeographicLib.h

package info (click to toggle)
geographiclib 1.37-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,688 kB
  • ctags: 4,871
  • sloc: cpp: 31,440; sh: 11,632; cs: 9,411; ansic: 1,428; java: 1,333; python: 1,131; makefile: 758; xml: 381; pascal: 30
file content (256 lines) | stat: -rw-r--r-- 11,169 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#pragma once
/**
 * \file NETGeographicLib/NETGeographicLib.h
 * \brief Header for NETGeographicLib::NETGeographicLib objects
 *
 * NETGeographicLib is copyright (c) Scott Heiman (2013)
 * GeographicLib is Copyright (c) Charles Karney (2010-2012)
 * <charles@karney.com> and licensed under the MIT/X11 License.
 * For more information, see
 * http://geographiclib.sourceforge.net/
 **********************************************************************/
#include <string>

using namespace System;

namespace NETGeographicLib
{
    enum class captype {
      CAP_NONE = 0U,
      CAP_C1   = 1U<<0,
      CAP_C1p  = 1U<<1,
      CAP_C2   = 1U<<2,
      CAP_C3   = 1U<<3,
      CAP_C4   = 1U<<4,
      CAP_ALL  = 0x1FU,
      OUT_ALL  = 0x7F80U,
    };

    /**
     * Bit masks for what calculations to do.  These masks do double duty.
     * They signify to the GeodesicLine::GeodesicLine constructor and to
     * Geodesic::Line what capabilities should be included in the GeodesicLine
     * object.  They also specify which results to return in the general
     * routines Geodesic::GenDirect and Geodesic::GenInverse routines.
     **********************************************************************/
    public enum class Mask {
      /**
       * No capabilities, no output.
       * @hideinitializer
       **********************************************************************/
      NONE          = 0U,
      /**
       * Calculate latitude \e lat2.  (It's not necessary to include this as a
       * capability to GeodesicLine because this is included by default.)
       * @hideinitializer
       **********************************************************************/
      LATITUDE      = 1U<<7  | unsigned(captype::CAP_NONE),
      /**
       * Calculate longitude \e lon2.
       * @hideinitializer
       **********************************************************************/
      LONGITUDE     = 1U<<8  | unsigned(captype::CAP_C3),
      /**
       * Calculate azimuths \e azi1 and \e azi2.  (It's not necessary to
       * include this as a capability to GeodesicLine because this is included
       * by default.)
       * @hideinitializer
       **********************************************************************/
      AZIMUTH       = 1U<<9  | unsigned(captype::CAP_NONE),
      /**
       * Calculate distance \e s12.
       * @hideinitializer
       **********************************************************************/
      DISTANCE      = 1U<<10 | unsigned(captype::CAP_C1),
      /**
       * Allow distance \e s12 to be used as input in the direct geodesic
       * problem.
       * @hideinitializer
       **********************************************************************/
      DISTANCE_IN   = 1U<<11 | unsigned(captype::CAP_C1) |
                          unsigned(captype::CAP_C1p),
      /**
       * Calculate reduced length \e m12.
       * @hideinitializer
       **********************************************************************/
      REDUCEDLENGTH = 1U<<12 | unsigned(captype::CAP_C1) |
                          unsigned(captype::CAP_C2),
      /**
       * Calculate geodesic scales \e M12 and \e M21.
       * @hideinitializer
       **********************************************************************/
      GEODESICSCALE = 1U<<13 | unsigned(captype::CAP_C1) |
                          unsigned(captype::CAP_C2),
      /**
       * Calculate area \e S12.
       * @hideinitializer
       **********************************************************************/
      AREA          = 1U<<14 | unsigned(captype::CAP_C4),
      /**
       * All capabilities, calculate everything.
       * @hideinitializer
       **********************************************************************/
      ALL           = unsigned(captype::OUT_ALL) | unsigned(captype::CAP_ALL),
    };

    /**
     * @brief The version information.
     **********************************************************************/
    public ref class VersionInfo
    {
    private:
        VersionInfo() {}
    public:
        /**
         * @return The version string.
         *******************************************************************/
        static System::String^ GetString();
        /**
         * @return The major version.
         *******************************************************************/
        static int MajorVersion();
        /**
         * @return The minor version.
         *******************************************************************/
        static int MinorVersion();
        /**
         * @return The patch number.
         *******************************************************************/
        static int Patch();
    };

    /**
     * @brief Exception class for NETGeographicLib
     **********************************************************************/
    public ref class GeographicErr : public System::Exception
    {
    public:
        /**
         * @brief Creates an exception using an unmanaged string.
         * @param[in] msg The error string.
         ******************************************************************/
        GeographicErr( const char* msg ) :
            System::Exception( gcnew System::String( msg ) ) {}
        /**
         * @brief Creates an exception using a managed string.
         * @param[in] msg The error string.
         ******************************************************************/
        GeographicErr( System::String^ msg ) : System::Exception( msg ) {}
    };

    ref class StringConvert
    {
        StringConvert() {}
    public:
        static std::string ManagedToUnmanaged( System::String^ s );
        static System::String^ UnmanagedToManaged( const std::string& s )
        {   return gcnew System::String( s.c_str() ); }
    };

    /**
     * @brief Physical constants
     *
     * References:<br>
     * http://www.orekit.org/static/apidocs/org/orekit/utils/Constants.html<br>
     * A COMPENDIUM OF EARTH CONSTANTS RELEVANT TO AUSTRALIAN GEODETIC SCIENCE<br>
     * http://espace.library.curtin.edu.au/R?func=dbin-jump-full&local_base=gen01-era02&object_id=146669
     **********************************************************************/
    public ref class Constants
    {
    private:
        Constants() {}
    public:

        /**
         * @brief WGS72 Parameters
         **********************************************************************/
        ref class WGS72
        {
        private:
            WGS72() {}
            // The equatorial radius in meters.
            static const double m_MajorRadius = 6378135.0;
            // The flattening of the ellipsoid
            static const double m_Flattening = 1.0 / 298.26;
            // The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
            static const double m_GravitationalConstant = 3.986008e+14;
            // The spin rate of the Earth in radians/second.
            static const double m_EarthRate = 7.292115147e-5;
            // dynamical form factor
            static const double m_J2 = 1.0826158e-3;
        public:
            //! The equatorial radius in meters.
            static property double MajorRadius { double get() { return m_MajorRadius; } }
            //! The flattening of the ellipsoid
            static property double Flattening { double get() { return m_Flattening; } }
            //! The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
            static property double GravitationalConstant { double get() { return m_GravitationalConstant; } }
            //! The spin rate of the Earth in radians/second.
            static property double EarthRate { double get() { return m_EarthRate; } }
            //! The dynamical form factor (J2).
            static property double J2 { double get() { return m_J2; } }
        };

        /**
         * @brief WGS84 Parameters
         **********************************************************************/
        ref class WGS84
        {
        private:
            WGS84() {}
            // The equatorial radius in meters.
            static const double m_MajorRadius = 6378137.0;
            // The flattening of the ellipsoid
            static const double m_Flattening = 1.0 / 298.257223563;
            // The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
            // I have also seen references that set this value to 3.986004418e+14.
            // The following value is used to maintain consistency with GeographicLib.
            static const double m_GravitationalConstant = 3.986005e+14;
            // The spin rate of the Earth in radians/second.
            static const double m_EarthRate = 7.292115e-5;
            // dynamical form factor
            static const double m_J2 = 1.08263e-3;
        public:
            //! The equatorial radius in meters.
            static property double MajorRadius { double get() { return m_MajorRadius; } }
            //! The flattening of the ellipsoid
            static property double Flattening { double get() { return m_Flattening; } }
            //! The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
            static property double GravitationalConstant { double get() { return m_GravitationalConstant; } }
            //! The spin rate of the Earth in radians/second.
            static property double EarthRate { double get() { return m_EarthRate; } }
            //! The dynamical form factor (J2).
            static property double J2 { double get() { return m_J2; } }
        };

        /**
         * @brief GRS80 Parameters
         **********************************************************************/
        ref class GRS80
        {
        private:
            GRS80() {}
            // The equatorial radius in meters.
            static const double m_MajorRadius = 6378137.0;
            // The flattening of the ellipsoid
            static const double m_Flattening = 1.0 / 298.257222100882711;
            // The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
            static const double m_GravitationalConstant = 3.986005e+14;
            // The spin rate of the Earth in radians/second.
            static const double m_EarthRate = 7.292115e-5;
            // dynamical form factor
            static const double m_J2 = 1.08263e-3;
        public:
            //! The equatorial radius in meters.
            static property double MajorRadius { double get() { return m_MajorRadius; } }
            //! The flattening of the ellipsoid
            static property double Flattening { double get() { return m_Flattening; } }
            //! The gravitational constant in meters<sup>3</sup>/second<sup>2</sup>.
            static property double GravitationalConstant { double get() { return m_GravitationalConstant; } }
            //! The spin rate of the Earth in radians/second.
            static property double EarthRate { double get() { return m_EarthRate; } }
            //! The dynamical form factor (J2).
            static property double J2 { double get() { return m_J2; } }
        };
    };
}  // namespace NETGeographicLib