UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Geocentric.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef Geocentric_H
4 #define Geocentric_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: GEOCENTRIC
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between Geodetic coordinates (latitude,
12  * longitude in radians and height in meters) and Geocentric coordinates
13  * (X, Y, Z) in meters.
14  *
15  * ERROR HANDLING
16  *
17  * This component checks parameters for valid values. If an invalid value
18  * is found, the error code is combined with the current error code using
19  * the bitwise or. This combining allows multiple error codes to be
20  * returned. The possible error codes are:
21  *
22  * GEOCENT_NO_ERROR : No errors occurred in function
23  * GEOCENT_LAT_ERROR : Latitude out of valid range
24  * (-90 to 90 degrees)
25  * GEOCENT_LON_ERROR : Longitude out of valid range
26  * (-180 to 360 degrees)
27  * GEOCENT_A_ERROR : Semi-major axis less than or equal to zero
28  * GEOCENT_INV_F_ERROR : Inverse flattening outside of valid range
29  * (250 to 350)
30  *
31  *
32  * REUSE NOTES
33  *
34  * GEOCENTRIC is intended for reuse by any application that performs
35  * coordinate conversions between geodetic coordinates and geocentric
36  * coordinates.
37  *
38  *
39  * REFERENCES
40  *
41  * An Improved Algorithm for Geocentric to Geodetic Coordinate Conversion,
42  * Ralph Toms, February 1996 UCRL-JC-123138.
43  *
44  * Further information on GEOCENTRIC can be found in the Reuse Manual.
45  *
46  * GEOCENTRIC originated from : U.S. Army Topographic Engineering Center
47  * Geospatial Information Division
48  * 7701 Telegraph Road
49  * Alexandria, VA 22310-3864
50  *
51  * LICENSES
52  *
53  * None apply to this component.
54  *
55  * RESTRICTIONS
56  *
57  * GEOCENTRIC has no restrictions.
58  *
59  * ENVIRONMENT
60  *
61  * GEOCENTRIC was tested and certified in the following environments:
62  *
63  * 1. Solaris 2.5 with GCC version 2.8.1
64  * 2. Windows 95 with MS Visual C++ version 6
65  *
66  * MODIFICATIONS
67  *
68  * Date Description
69  * ---- -----------
70  * 25-02-97 Original Code
71  * 3-02-07 Original C++ Code
72  * 01/24/11 I. Krinsky BAEts28121
73  * Terrain Service rearchitecture
74  *
75  */
76 
77 
78 #include "DtccApi.h"
79 #include "CoordinateSystem.h"
80 
81 
82 namespace MSP
83 {
84  namespace CCS
85  {
86  class CartesianCoordinates;
87  class GeodeticCoordinates;
88 
89 
90  /***************************************************************************/
91  /*
92  * DEFINES
93  */
94 
96  {
97  public:
98 
99  /*
100  * The constructor receives the ellipsoid parameters
101  * as inputs and sets the corresponding state variables.
102  *
103  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters. (input)
104  * ellipsoidFlattening : Flattening of ellipsoid. (input)
105  */
106 
107  Geocentric( double ellipsoidSemiMajorAxis, double ellipsoidFlattening );
108 
109 
110  Geocentric( const Geocentric &g );
111 
112 
113  ~Geocentric( void );
114 
115 
116  Geocentric& operator=( const Geocentric &g );
117 
118 
119  /*
120  * The function convertFromGeodetic converts geodetic coordinates
121  * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
122  * according to the current ellipsoid parameters.
123  *
124  * longitude : Geodetic longitude in radians (input)
125  * latitude : Geodetic latitude in radians (input)
126  * height : Geodetic height, in meters (input)
127  * X : Calculated Geocentric X coordinate, in meters (output)
128  * Y : Calculated Geocentric Y coordinate, in meters (output)
129  * Z : Calculated Geocentric Z coordinate, in meters (output)
130  *
131  */
132 
133  MSP::CCS::CartesianCoordinates* convertFromGeodetic(
134  const MSP::CCS::GeodeticCoordinates* geodeticCoordinates );
135 
136 
137  /*
138  * The function convertToGeodetic converts geocentric
139  * coordinates (X, Y, Z) to geodetic coordinates (latitude, longitude,
140  * and height), according to the current ellipsoid parameters.
141  *
142  * X : Geocentric X coordinate, in meters. (input)
143  * Y : Geocentric Y coordinate, in meters. (input)
144  * Z : Geocentric Z coordinate, in meters. (input)
145  * longitude : Calculated longitude value in radians. (output)
146  * latitude : Calculated latitude value in radians. (output)
147  * height : Calculated height value, in meters. (output)
148  *
149  */
150 
151  MSP::CCS::GeodeticCoordinates* convertToGeodetic(
152  MSP::CCS::CartesianCoordinates* cartesianCoordinates );
153 
154  private:
155 
156  void geocentricToGeodetic(
157  const double x,
158  const double y,
159  const double z,
160  double &lat,
161  double &lon,
162  double &ht );
163 
164  /* Ellipsoid parameters, default to WGS 84 */
165  double Geocent_e2; /* Eccentricity squared */
166  double Geocent_ep2; /* 2nd eccentricity squared */
167 
168  enum AlgEnum { UNDEFINED, ITERATIVE, GEOTRANS };
169  AlgEnum Geocent_algorithm;
170  };
171  }
172 }
173 
174 #endif
175 
176 
177 // CLASSIFICATION: UNCLASSIFIED