UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
VanDerGrinten.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef VanDerGrinten_H
4 #define VanDerGrinten_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: VAN DER GRINTEN
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between Geodetic coordinates
12  * (latitude and longitude in radians) and Van Der Grinten projection
13  * coordinates (easting and northing in meters). The Van Der Grinten
14  * projection employs a spherical Earth model. The Spherical Radius
15  * used is the the radius of the sphere having the same area as the
16  * ellipsoid.
17  *
18  * ERROR HANDLING
19  *
20  * This component checks parameters for valid values. If an invalid value
21  * is found, the error code is combined with the current error code using
22  * the bitwise or. This combining allows multiple error codes to be
23  * returned. The possible error codes are:
24  *
25  * GRIN_NO_ERROR : No errors occurred in function
26  * GRIN_LAT_ERROR : Latitude outside of valid range
27  * (-90 to 90 degrees)
28  * GRIN_LON_ERROR : Longitude outside of valid range
29  * (-180 to 360 degrees)
30  * GRIN_EASTING_ERROR : Easting outside of valid range
31  * (False_Easting +/- ~20,000,000 m,
32  * depending on ellipsoid parameters)
33  * GRIN_NORTHING_ERROR : Northing outside of valid range
34  * (False_Northing +/- ~20,000,000 m,
35  * depending on ellipsoid parameters)
36  * GRIN_RADIUS_ERROR : Coordinates too far from pole,
37  * depending on ellipsoid and
38  * projection parameters
39  * GRIN_CENT_MER_ERROR : Central meridian outside of valid range
40  * (-180 to 360 degrees)
41  * GRIN_A_ERROR : Semi-major axis less than or equal to zero
42  * GRIN_INV_F_ERROR : Inverse flattening outside of valid range
43  * (250 to 350)
44  *
45  * REUSE NOTES
46  *
47  * VAN DER GRINTEN is intended for reuse by any application that performs a
48  * Van Der Grinten projection or its inverse.
49  *
50  * REFERENCES
51  *
52  * Further information on VAN DER GRINTEN can be found in the Reuse Manual.
53  *
54  * VAN DER GRINTEN originated from : U.S. Army Topographic Engineering Center
55  * Geospatial Information Division
56  * 7701 Telegraph Road
57  * Alexandria, VA 22310-3864
58  *
59  * LICENSES
60  *
61  * None apply to this component.
62  *
63  * RESTRICTIONS
64  *
65  * VAN DER GRINTEN has no restrictions.
66  *
67  * ENVIRONMENT
68  *
69  * VAN DER GRINTEN was tested and certified in the following environments:
70  *
71  * 1. Solaris 2.5 with GCC, version 2.8.1
72  * 2. Windows 95 with MS Visual C++, version 6
73  *
74  * MODIFICATIONS
75  *
76  * Date Description
77  * ---- -----------
78  * 3-1-07 Original Code
79  *
80  */
81 
82 
83 #include "CoordinateSystem.h"
84 
85 
86 namespace MSP
87 {
88  namespace CCS
89  {
90  class MapProjection3Parameters;
91  class MapProjectionCoordinates;
92  class GeodeticCoordinates;
93 
94 
95  /***************************************************************************/
96  /*
97  * DEFINES
98  */
99 
101  {
102  public:
103 
104  /*
105  * The constructor receives the ellipsoid parameters and
106  * projection parameters as inputs, and sets the corresponding state
107  * variables. If any errors occur, an exception is thrown with a description
108  * of the error.
109  *
110  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input)
111  * ellipsoidFlattening : Flattening of ellipsoid (input)
112  * centralMeridian : Longitude in radians at the center of (input)
113  * the projection
114  * falseEasting : A coordinate value in meters assigned to the
115  * central meridian of the projection. (input)
116  * falseNorthing : A coordinate value in meters assigned to the
117  * origin latitude of the projection (input)
118  */
119 
120  VanDerGrinten( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double falseEasting, double falseNorthing );
121 
122 
123  VanDerGrinten( const VanDerGrinten &v );
124 
125 
126  ~VanDerGrinten( void );
127 
128 
130 
131 
132  /*
133  * The function getParameters returns the current ellipsoid
134  * parameters, and Van Der Grinten projection parameters.
135  *
136  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output)
137  * ellipsoidFlattening : Flattening of ellipsoid (output)
138  * centralMeridian : Longitude in radians at the center of (output)
139  * the projection
140  * falseEasting : A coordinate value in meters assigned to the
141  * central meridian of the projection. (output)
142  * falseNorthing : A coordinate value in meters assigned to the
143  * origin latitude of the projection (output)
144  */
145 
147 
148 
149  /*
150  * The function convertFromGeodetic converts geodetic (latitude and
151  * longitude) coordinates to Van Der Grinten projection (easting and northing)
152  * coordinates, according to the current ellipsoid and Van Der Grinten projection
153  * parameters. If any errors occur, an exception is thrown with a description
154  * of the error.
155  *
156  * longitude : Longitude (lambda) in radians (input)
157  * latitude : Latitude (phi) in radians (input)
158  * easting : Easting (X) in meters (output)
159  * northing : Northing (Y) in meters (output)
160  */
161 
163 
164 
165  /*
166  * The function convertToGeodetic converts Grinten projection
167  * (easting and northing) coordinates to geodetic (latitude and longitude)
168  * coordinates, according to the current ellipsoid and Grinten projection
169  * coordinates. If any errors occur, an exception is thrown with a description
170  * of the error.
171  *
172  * easting : Easting (X) in meters (input)
173  * northing : Northing (Y) in meters (input)
174  * longitude : Longitude (lambda) in radians (output)
175  * latitude : Latitude (phi) in radians (output)
176  */
177 
179 
180  private:
181 
182  /* Ellipsoid Parameters, default to WGS 84 */
183  double es2; /* Eccentricity (0.08181919084262188000) squared */
184  double es4; /* es2 * es2 */
185  double es6; /* es4 * es2 */
186  double Ra; /* Spherical Radius */
187  double PI_Ra;
188 
189  /* Van Der Grinten projection Parameters */
190  double Grin_Origin_Long; /* Longitude of origin in radians */
191  double Grin_False_Easting;
192  double Grin_False_Northing;
193 
194 
195  double floatEq( double x, double v, double epsilon );
196  };
197  }
198 }
199 
200 #endif
201 
202 
203 // CLASSIFICATION: UNCLASSIFIED