00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef Geocentric_H 00004 #define Geocentric_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: GEOCENTRIC 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates (latitude, 00012 * longitude in radians and height in meters) and Geocentric coordinates 00013 * (X, Y, Z) in meters. 00014 * 00015 * ERROR HANDLING 00016 * 00017 * This component checks parameters for valid values. If an invalid value 00018 * is found, the error code is combined with the current error code using 00019 * the bitwise or. This combining allows multiple error codes to be 00020 * returned. The possible error codes are: 00021 * 00022 * GEOCENT_NO_ERROR : No errors occurred in function 00023 * GEOCENT_LAT_ERROR : Latitude out of valid range 00024 * (-90 to 90 degrees) 00025 * GEOCENT_LON_ERROR : Longitude out of valid range 00026 * (-180 to 360 degrees) 00027 * GEOCENT_A_ERROR : Semi-major axis less than or equal to zero 00028 * GEOCENT_INV_F_ERROR : Inverse flattening outside of valid range 00029 * (250 to 350) 00030 * 00031 * 00032 * REUSE NOTES 00033 * 00034 * GEOCENTRIC is intended for reuse by any application that performs 00035 * coordinate conversions between geodetic coordinates and geocentric 00036 * coordinates. 00037 * 00038 * 00039 * REFERENCES 00040 * 00041 * An Improved Algorithm for Geocentric to Geodetic Coordinate Conversion, 00042 * Ralph Toms, February 1996 UCRL-JC-123138. 00043 * 00044 * Further information on GEOCENTRIC can be found in the Reuse Manual. 00045 * 00046 * GEOCENTRIC originated from : U.S. Army Topographic Engineering Center 00047 * Geospatial Information Division 00048 * 7701 Telegraph Road 00049 * Alexandria, VA 22310-3864 00050 * 00051 * LICENSES 00052 * 00053 * None apply to this component. 00054 * 00055 * RESTRICTIONS 00056 * 00057 * GEOCENTRIC has no restrictions. 00058 * 00059 * ENVIRONMENT 00060 * 00061 * GEOCENTRIC was tested and certified in the following environments: 00062 * 00063 * 1. Solaris 2.5 with GCC version 2.8.1 00064 * 2. Windows 95 with MS Visual C++ version 6 00065 * 00066 * MODIFICATIONS 00067 * 00068 * Date Description 00069 * ---- ----------- 00070 * 25-02-97 Original Code 00071 * 3-02-07 Original C++ Code 00072 * 00073 */ 00074 00075 00076 #include "DtccApi.h" 00077 #include "CoordinateSystem.h" 00078 00079 00080 namespace MSP 00081 { 00082 namespace CCS 00083 { 00084 class CartesianCoordinates; 00085 class GeodeticCoordinates; 00086 00087 00088 /***************************************************************************/ 00089 /* 00090 * DEFINES 00091 */ 00092 00093 class MSP_DTCC_API Geocentric : public CoordinateSystem 00094 { 00095 public: 00096 00097 /* 00098 * The constructor receives the ellipsoid parameters 00099 * as inputs and sets the corresponding state variables. 00100 * 00101 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters. (input) 00102 * ellipsoidFlattening : Flattening of ellipsoid. (input) 00103 */ 00104 00105 Geocentric( double ellipsoidSemiMajorAxis, double ellipsoidFlattening ); 00106 00107 00108 Geocentric( const Geocentric &g ); 00109 00110 00111 ~Geocentric( void ); 00112 00113 00114 Geocentric& operator=( const Geocentric &g ); 00115 00116 00117 /* 00118 * The function convertFromGeodetic converts geodetic coordinates 00119 * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z), 00120 * according to the current ellipsoid parameters. 00121 * 00122 * longitude : Geodetic longitude in radians (input) 00123 * latitude : Geodetic latitude in radians (input) 00124 * height : Geodetic height, in meters (input) 00125 * X : Calculated Geocentric X coordinate, in meters (output) 00126 * Y : Calculated Geocentric Y coordinate, in meters (output) 00127 * Z : Calculated Geocentric Z coordinate, in meters (output) 00128 * 00129 */ 00130 00131 MSP::CCS::CartesianCoordinates* convertFromGeodetic( const MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00132 00133 00134 /* 00135 * The function convertToGeodetic converts geocentric 00136 * coordinates (X, Y, Z) to geodetic coordinates (latitude, longitude, 00137 * and height), according to the current ellipsoid parameters. 00138 * 00139 * X : Geocentric X coordinate, in meters. (input) 00140 * Y : Geocentric Y coordinate, in meters. (input) 00141 * Z : Geocentric Z coordinate, in meters. (input) 00142 * longitude : Calculated longitude value in radians. (output) 00143 * latitude : Calculated latitude value in radians. (output) 00144 * height : Calculated height value, in meters. (output) 00145 * 00146 */ 00147 00148 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::CartesianCoordinates* cartesianCoordinates ); 00149 00150 private: 00151 00152 /* Ellipsoid parameters, default to WGS 84 */ 00153 double Geocent_e2; /* Eccentricity squared */ 00154 double Geocent_ep2; /* 2nd eccentricity squared */ 00155 }; 00156 } 00157 } 00158 00159 #endif 00160 00161 00162 // CLASSIFICATION: UNCLASSIFIED