00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef LocalCartesian_H 00004 #define LocalCartesian_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: LOCAL CARTESIAN 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates (latitude, 00012 * longitude in radians and height in meters) and Local Cartesian coordinates 00013 * (X, Y, Z). 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 * LOCCART_NO_ERROR : No errors occurred in function 00023 * LOCCART_LAT_ERROR : Latitude out of valid range 00024 * (-90 to 90 degrees) 00025 * LOCCART_LON_ERROR : Longitude out of valid range 00026 * (-180 to 360 degrees) 00027 * LOCCART_A_ERROR : Semi-major axis less than or equal to zero 00028 * LOCCART_INV_F_ERROR : Inverse flattening outside of valid range 00029 * (250 to 350) 00030 * LOCCART_ORIGIN_LAT_ERROR : Origin Latitude out of valid range 00031 * (-90 to 90 degrees) 00032 * LOCCART_ORIGIN_LON_ERROR : Origin Longitude out of valid range 00033 * (-180 to 360 degrees) 00034 * LOCCART_ORIENTATION_ERROR : Orientation angle out of valid range 00035 * (-360 to 360 degrees) 00036 * 00037 * 00038 * REUSE NOTES 00039 * 00040 * LOCCART is intended for reuse by any application that performs 00041 * coordinate conversions between geodetic coordinates or geocentric 00042 * coordinates and local cartesian coordinates.. 00043 * 00044 * 00045 * REFERENCES 00046 * 00047 * Further information on LOCAL CARTESIAN can be found in the Reuse Manual. 00048 * 00049 * LOCCART originated from : U.S. Army Topographic Engineering Center 00050 * Geospatial Inforamtion Division 00051 * 7701 Telegraph Road 00052 * Alexandria, VA 22310-3864 00053 * 00054 * LICENSES 00055 * 00056 * None apply to this component. 00057 * 00058 * RESTRICTIONS 00059 * 00060 * LOCCART has no restrictions. 00061 * 00062 * ENVIRONMENT 00063 * 00064 * LOCCART was tested and certified in the following environments: 00065 * 00066 * 1. Solaris 2.5 with GCC version 2.8.1 00067 * 2. Windows 95 with MS Visual C++ version 6 00068 * 00069 * MODIFICATIONS 00070 * 00071 * Date Description 00072 * ---- ----------- 00073 * 07-16-99 Original Code 00074 * 03-2-07 Original C++ Code 00075 * 00076 */ 00077 00078 00079 #include "CoordinateSystem.h" 00080 00081 00082 namespace MSP 00083 { 00084 namespace CCS 00085 { 00086 class LocalCartesianParameters; 00087 class Geocentric; 00088 00089 00090 /***************************************************************************/ 00091 /* 00092 * DEFINES 00093 */ 00094 00095 class LocalCartesian : public CoordinateSystem 00096 { 00097 public: 00098 00099 /* 00100 * The constructor receives the ellipsoid parameters 00101 * and local origin parameters as inputs and sets the corresponding state variables. 00102 * 00103 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00104 * ellipsoidFlattening : Flattening of ellipsoid (input) 00105 * originLongitude : Longitude of the local origin, in radians (input) 00106 * originLatitude : Latitude of the local origin, in radians (input) 00107 * originHeight : Ellipsoid height of the local origin, in meters (input) 00108 * orientation : Orientation angle of the local cartesian coordinate system, 00109 * in radians (input) 00110 */ 00111 00112 LocalCartesian( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double originLongitude, double originLatitude, double originHeight, double orientation ); 00113 00114 00115 LocalCartesian( const LocalCartesian &lc ); 00116 00117 00118 ~LocalCartesian( void ); 00119 00120 00121 LocalCartesian& operator=( const LocalCartesian &lc ); 00122 00123 00124 /* 00125 * The function getParameters returns the ellipsoid parameters 00126 * and local origin parameters. 00127 * 00128 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00129 * ellipsoidFlattening : Flattening of ellipsoid (output) 00130 * originLongitude : Longitude of the local origin, in radians (output) 00131 * originLatitude : Latitude of the local origin, in radians (output) 00132 * originHeight : Ellipsoid height of the local origin, in meters (output) 00133 * orientation : Orientation angle of the local cartesian coordinate system, 00134 * in radians (output) 00135 */ 00136 00137 LocalCartesianParameters* getParameters() const; 00138 00139 00140 /* 00141 * The function convertFromGeodetic converts geodetic coordinates 00142 * (latitude, longitude, and height) to local cartesian coordinates (X, Y, Z), 00143 * according to the current ellipsoid and local origin parameters. 00144 * 00145 * longitude : Geodetic longitude, in radians (input) 00146 * latitude : Geodetic latitude, in radians (input) 00147 * Height : Geodetic height, in meters (input) 00148 * X : Calculated local cartesian X coordinate, in meters (output) 00149 * Y : Calculated local cartesian Y coordinate, in meters (output) 00150 * Z : Calculated local cartesian Z coordinate, in meters (output) 00151 * 00152 */ 00153 00154 MSP::CCS::CartesianCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00155 00156 00157 /* 00158 * The function convertToGeodetic converts local cartesian 00159 * coordinates (X, Y, Z) to geodetic coordinates (latitude, longitude, 00160 * and height), according to the current ellipsoid and local origin parameters. 00161 * 00162 * X : Local cartesian X coordinate, in meters (input) 00163 * Y : Local cartesian Y coordinate, in meters (input) 00164 * Z : Local cartesian Z coordinate, in meters (input) 00165 * longitude : Calculated longitude value, in radians (output) 00166 * latitude : Calculated latitude value, in radians (output) 00167 * Height : Calculated height value, in meters (output) 00168 */ 00169 00170 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::CartesianCoordinates* cartesianCoordinates ); 00171 00172 /* 00173 * The function convertFromGeocentric converts geocentric 00174 * coordinates according to the current ellipsoid and local origin parameters. 00175 * 00176 * U : Geocentric latitude, in meters (input) 00177 * V : Geocentric longitude, in meters (input) 00178 * W : Geocentric height, in meters (input) 00179 * X : Calculated local cartesian X coordinate, in meters (output) 00180 * Y : Calculated local cartesian Y coordinate, in meters (output) 00181 * Z : Calculated local cartesian Z coordinate, in meters (output) 00182 * 00183 */ 00184 00185 MSP::CCS::CartesianCoordinates* convertFromGeocentric( const MSP::CCS::CartesianCoordinates* cartesianCoordinates ); 00186 00187 /* 00188 * The function Convert_Local_Cartesian_To_Geocentric converts local cartesian 00189 * coordinates (x, y, z) to geocentric coordinates (X, Y, Z) according to the 00190 * current ellipsoid and local origin parameters. 00191 * 00192 * X : Local cartesian X coordinate, in meters (input) 00193 * Y : Local cartesian Y coordinate, in meters (input) 00194 * Z : Local cartesian Z coordinate, in meters (input) 00195 * U : Calculated U value, in meters (output) 00196 * V : Calculated v value, in meters (output) 00197 * W : Calculated w value, in meters (output) 00198 */ 00199 00200 MSP::CCS::CartesianCoordinates* convertToGeocentric( const MSP::CCS::CartesianCoordinates* cartesianCoordinates ); 00201 00202 private: 00203 00204 Geocentric* geocentric; 00205 00206 /* Ellipsoid Parameters, default to WGS 84 */ 00207 double es2; /* Eccentricity (0.08181919084262188000) squared */ 00208 double u0; /* Geocentric origin coordinates in */ 00209 double v0; /* terms of Local Cartesian origin */ 00210 double w0; /* parameters */ 00211 00212 /* Local Cartesian Projection Parameters */ 00213 double LocalCart_Origin_Lat; /* Latitude of origin in radians */ 00214 double LocalCart_Origin_Long; /* Longitude of origin in radians */ 00215 double LocalCart_Origin_Height; /* Height of origin in meters */ 00216 double LocalCart_Orientation; /* Orientation of Y axis in radians */ 00217 00218 double Sin_LocalCart_Origin_Lat; /* sin(LocalCart_Origin_Lat) */ 00219 double Cos_LocalCart_Origin_Lat; /* cos(LocalCart_Origin_Lat) */ 00220 double Sin_LocalCart_Origin_Lon; /* sin(LocalCart_Origin_Lon) */ 00221 double Cos_LocalCart_Origin_Lon; /* cos(LocalCart_Origin_Lon) */ 00222 double Sin_LocalCart_Orientation; /* sin(LocalCart_Orientation) */ 00223 double Cos_LocalCart_Orientation; /* cos(LocalCart_Orientation) */ 00224 00225 double Sin_Lat_Sin_Orient; /* sin(LocalCart_Origin_Lat) * sin(LocalCart_Orientation) */ 00226 double Sin_Lat_Cos_Orient; /* sin(LocalCart_Origin_Lat) * cos(LocalCart_Orientation) */ 00227 double Cos_Lat_Cos_Orient; /* cos(LocalCart_Origin_Lat) * cos(LocalCart_Orientation) */ 00228 double Cos_Lat_Sin_Orient; /* cos(LocalCart_Origin_Lat) * sin(LocalCart_Orientation) */ 00229 00230 }; 00231 } 00232 } 00233 00234 #endif 00235 00236 00237 // CLASSIFICATION: UNCLASSIFIED