00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef TransverseCylindricalEqualArea_H 00004 #define TransverseCylindricalEqualArea_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: TRANSVERSE CYLINDRICAL EQUAL AREA 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude in radians) and Transverse Cylindrical Equal Area 00013 * projection coordinates (easting and northing 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 * TCEA_NO_ERROR : No errors occurred in function 00023 * TCEA_LAT_ERROR : Latitude outside of valid range 00024 * (-90 to 90 degrees) 00025 * TCEA_LON_ERROR : Longitude outside of valid range 00026 * (-180 to 360 degrees) 00027 * TCEA_EASTING_ERROR : Easting outside of valid range 00028 * (False_Easting +/- ~6,500,000 m, 00029 * depending on ellipsoid parameters 00030 * and Origin_Latitude) 00031 * TCEA_NORTHING_ERROR : Northing outside of valid range 00032 * (False_Northing +/- ~20,000,000 m, 00033 * depending on ellipsoid parameters 00034 * and Origin_Latitude) 00035 * TCEA_ORIGIN_LAT_ERROR : Origin latitude outside of valid range 00036 * (-90 to 90 degrees) 00037 * TCEA_CENT_MER_ERROR : Central meridian outside of valid range 00038 * (-180 to 360 degrees) 00039 * TCEA_A_ERROR : Semi-major axis less than or equal to zero 00040 * TCEA_INV_F_ERROR : Inverse flattening outside of valid range 00041 * (250 to 350) 00042 * TCEA_SCALE_FACTOR_ERROR : Scale factor outside of valid 00043 * range (0.3 to 3.0) 00044 * TCEA_LON_WARNING : Distortion will result if longitude is more 00045 * than 90 degrees from the Central Meridian 00046 * 00047 * REUSE NOTES 00048 * 00049 * TRANSVERSE CYLINDRICAL EQUAL AREA is intended for reuse by any application that 00050 * performs a Transverse Cylindrical Equal Area projection or its inverse. 00051 * 00052 * REFERENCES 00053 * 00054 * Further information on TRANSVERSE CYLINDRICAL EQUAL AREA can be found in the Reuse Manual. 00055 * 00056 * TRANSVERSE CYLINDRICAL EQUAL AREA originated from : 00057 * U.S. Army Topographic Engineering Center 00058 * Geospatial Information Division 00059 * 7701 Telegraph Road 00060 * Alexandria, VA 22310-3864 00061 * 00062 * LICENSES 00063 * 00064 * None apply to this component. 00065 * 00066 * RESTRICTIONS 00067 * 00068 * TRANSVERSE CYLINDRICAL EQUAL AREA has no restrictions. 00069 * 00070 * ENVIRONMENT 00071 * 00072 * TRANSVERSE CYLINDRICAL EQUAL AREA was tested and certified in the following environments: 00073 * 00074 * 1. Solaris 2.5 with GCC, version 2.8.1 00075 * 2. Windows 95 with MS Visual C++, version 6 00076 * 00077 * MODIFICATIONS 00078 * 00079 * Date Description 00080 * ---- ----------- 00081 * 3-1-07 Original C++ Code 00082 * 00083 */ 00084 00085 00086 #include "CoordinateSystem.h" 00087 00088 00089 namespace MSP 00090 { 00091 namespace CCS 00092 { 00093 class MapProjection5Parameters; 00094 class MapProjectionCoordinates; 00095 class GeodeticCoordinates; 00096 00097 00098 /***************************************************************************/ 00099 /* 00100 * DEFINES 00101 */ 00102 00103 class TransverseCylindricalEqualArea : public CoordinateSystem 00104 { 00105 public: 00106 00107 /* 00108 * The constructor receives the ellipsoid parameters and 00109 * Transverse Cylindrical Equal Area projection parameters as inputs, and sets the 00110 * corresponding state variables. If any errors occur, an exception is thrown with a description 00111 * of the error. 00112 * 00113 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00114 * ellipsoidFlattening : Flattening of ellipsoid (input) 00115 * centralMeridian : Longitude in radians at the center of (input) 00116 * the projection 00117 * latitudeOfTrueScale : Latitude in radians at which the (input) 00118 * point scale factor is 1.0 00119 * falseEasting : A coordinate value in meters assigned to the 00120 * central meridian of the projection. (input) 00121 * falseNorthing : A coordinate value in meters assigned to the 00122 * origin latitude of the projection (input) 00123 * scaleFactor : Multiplier which reduces distances in the 00124 * projection to the actual distance on the 00125 * ellipsoid (input) 00126 * errorStatus : Error status (output) 00127 */ 00128 00129 TransverseCylindricalEqualArea( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double latitudeOfTrueScale, double falseEasting, double falseNorthing, double scaleFactor ); 00130 00131 00132 TransverseCylindricalEqualArea( const TransverseCylindricalEqualArea &tcea ); 00133 00134 00135 ~TransverseCylindricalEqualArea( void ); 00136 00137 00138 TransverseCylindricalEqualArea& operator=( const TransverseCylindricalEqualArea &tcea ); 00139 00140 00141 /* 00142 * The function getParameters returns the current ellipsoid 00143 * parameters, Transverse Cylindrical Equal Area projection parameters, and scale factor. 00144 * 00145 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00146 * ellipsoidFlattening : Flattening of ellipsoid (output) 00147 * centralMeridian : Longitude in radians at the center of (output) 00148 * the projection 00149 * latitudeOfTrueScale : Latitude in radians at which the (output) 00150 * point scale factor is 1.0 00151 * falseEasting : A coordinate value in meters assigned to the 00152 * central meridian of the projection. (output) 00153 * falseNorthing : A coordinate value in meters assigned to the 00154 * origin latitude of the projection (output) 00155 * scaleFactor : Multiplier which reduces distances in the 00156 * projection to the actual distance on the 00157 * ellipsoid (output) 00158 */ 00159 00160 MapProjection5Parameters* getParameters() const; 00161 00162 00163 /* 00164 * The function convertFromGeodetic converts geodetic (latitude and 00165 * longitude) coordinates to Transverse Cylindrical Equal Area projection (easting and 00166 * northing) coordinates, according to the current ellipsoid and Transverse Cylindrical 00167 * Equal Area projection parameters. If any errors occur, an exception is thrown with a 00168 * description of the error. 00169 * 00170 * longitude : Longitude (lambda) in radians (input) 00171 * latitude : Latitude (phi) in radians (input) 00172 * easting : Easting (X) in meters (output) 00173 * northing : Northing (Y) in meters (output) 00174 */ 00175 00176 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00177 00178 00179 /* 00180 * The function convertToGeodetic converts Transverse 00181 * Cylindrical Equal Area projection (easting and northing) coordinates 00182 * to geodetic (latitude and longitude) coordinates, according to the 00183 * current ellipsoid and Transverse Cylindrical Equal Area projection 00184 * coordinates. If any errors occur, an exception is thrown with a 00185 * description of the error. 00186 * 00187 * easting : Easting (X) in meters (input) 00188 * northing : Northing (Y) in meters (input) 00189 * longitude : Longitude (lambda) in radians (output) 00190 * latitude : Latitude (phi) in radians (output) 00191 */ 00192 00193 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00194 00195 private: 00196 00197 /* Ellipsoid Parameters, default to WGS 84 */ 00198 double es2; /* Eccentricity (0.08181919084262188000) squared */ 00199 double es4; /* es2 * es2 */ 00200 double es6; /* es4 * es2 */ 00201 double es; /* sqrt(es2) */ 00202 double M0; 00203 double qp; 00204 double One_MINUS_es2; /* 1.0 - es2 */ 00205 double One_OVER_2es; /* 1.0 / (2.0 * es) */ 00206 double a0; /* es2 / 3.0 + 31.0 * es4 / 180.0 + 517.0 * es6 / 5040.0 */ 00207 double a1; /* 23.0 * es4 / 360.0 + 251.0 * es6 / 3780.0 */ 00208 double a2; /* 761.0 * es6 / 45360.0 */ 00209 double b0; /* 3.0 * e1 / 2.0 - 27.0 * e3 / 32.0 */ 00210 double b1; /* 21.0 * e2 / 16.0 - 55.0 * e4 / 32.0 */ 00211 double b2; /* 151.0 * e3 / 96.0 */ 00212 double b3; /* 1097.0 * e4 / 512.0 */ 00213 double c0; /* 1.0 - es2 / 4.0 - 3.0 * es4 / 64.0 - 5.0 * es6 / 256.0 */ 00214 double c1; /* 3.0 * es2 / 8.0 + 3.0 * es4 / 32.0 + 45.0 * es6 / 1024.0 */ 00215 double c2; /* 15.0 * es4 / 256.0 + 45.0 * es6 / 1024.0 */ 00216 double c3; /* 35.0 * es6 / 3072.0 */ 00217 00218 /* Transverse Cylindrical Equal Area projection Parameters */ 00219 double Tcea_Origin_Lat; /* Latitude of origin in radians */ 00220 double Tcea_Origin_Long; /* Longitude of origin in radians */ 00221 double Tcea_False_Northing; /* False northing in meters */ 00222 double Tcea_False_Easting; /* False easting in meters */ 00223 double Tcea_Scale_Factor; /* Scale factor */ 00224 00225 /* Maximum variance for easting and northing values for WGS 84. 00226 */ 00227 double Tcea_Min_Easting; 00228 double Tcea_Max_Easting; 00229 double Tcea_Min_Northing; 00230 double Tcea_Max_Northing; 00231 00232 00233 double TCEA_Q( double sinlat, double x ); 00234 00235 double TCEA_COEFF_TIMES_SIN( double coeff, double x, double latit ); 00236 00237 double TCEA_M( double c0lat, double c1lat, double c2lat, double c3lat ); 00238 00239 double TCEA_L( double Beta, double c0lat, double c1lat, double c2lat ); 00240 00241 }; 00242 } 00243 } 00244 00245 #endif 00246 00247 00248 // CLASSIFICATION: UNCLASSIFIED