00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef CylindricalEqualArea_H 00004 #define CylindricalEqualArea_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: CYLINDRICAL EQUAL AREA 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude in radians) and Cylindrical Equal Area projection 00013 * 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 * CYEQ_NO_ERROR : No errors occurred in function 00023 * CYEQ_LAT_ERROR : Latitude outside of valid range 00024 * (-90 to 90 degrees) 00025 * CYEQ_LON_ERROR : Longitude outside of valid range 00026 * (-180 to 360 degrees) 00027 * CYEQ_EASTING_ERROR : Easting outside of valid range 00028 * (False_Easting +/- ~20,000,000 m, 00029 * depending on ellipsoid parameters 00030 * and Origin_Latitude) 00031 * CYEQ_NORTHING_ERROR : Northing outside of valid range 00032 * (False_Northing +/- ~6,000,000 m, 00033 * depending on ellipsoid parameters 00034 * and Origin_Latitude) 00035 * CYEQ_ORIGIN_LAT_ERROR : Origin latitude outside of valid range 00036 * (-90 to 90 degrees) 00037 * CYEQ_CENT_MER_ERROR : Central meridian outside of valid range 00038 * (-180 to 360 degrees) 00039 * CYEQ_A_ERROR : Semi-major axis less than or equal to zero 00040 * CYEQ_INV_F_ERROR : Inverse flattening outside of valid range 00041 * (250 to 350) 00042 * 00043 * REUSE NOTES 00044 * 00045 * CYLINDRICAL EQUAL AREA is intended for reuse by any application that performs a 00046 * Cylindrical Equal Area projection or its inverse. 00047 * 00048 * REFERENCES 00049 * 00050 * Further information on CYLINDRICAL EQUAL AREA can be found in the Reuse Manual. 00051 * 00052 * CYLINDRICAL EQUAL AREA originated from : 00053 * U.S. Army Topographic Engineering Center 00054 * Geospatial Information Division 00055 * 7701 Telegraph Road 00056 * Alexandria, VA 22310-3864 00057 * 00058 * LICENSES 00059 * 00060 * None apply to this component. 00061 * 00062 * RESTRICTIONS 00063 * 00064 * CYLINDRICAL EQUAL AREA has no restrictions. 00065 * 00066 * ENVIRONMENT 00067 * 00068 * CYLINDRICAL EQUAL AREA was tested and certified in the following environments: 00069 * 00070 * 1. Solaris 2.5 with GCC 2.8.1 00071 * 2. MS Windows 95 with MS Visual C++ 6 00072 * 00073 * MODIFICATIONS 00074 * 00075 * Date Description 00076 * ---- ----------- 00077 * 04-16-99 Original Code 00078 * 03-07-07 Original C++ Code 00079 * 00080 */ 00081 00082 00083 #include "CoordinateSystem.h" 00084 00085 00086 namespace MSP 00087 { 00088 namespace CCS 00089 { 00090 class MapProjection4Parameters; 00091 class MapProjectionCoordinates; 00092 class GeodeticCoordinates; 00093 00094 00095 /***************************************************************************/ 00096 /* 00097 * DEFINES 00098 */ 00099 00100 class CylindricalEqualArea : public CoordinateSystem 00101 { 00102 public: 00103 00104 /* 00105 * The constructor receives the ellipsoid parameters and 00106 * Cylindrical Equal Area projcetion parameters as inputs, and sets the corresponding 00107 * state variables. If any errors occur, an exception is thrown with a description 00108 * of the error. 00109 * 00110 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00111 * ellipsoidFlattening : Flattening of ellipsoid (input) 00112 * centralMeridian : Longitude in radians at the center of (input) 00113 * the projection 00114 * originLatitude : Latitude in radians at which the (input) 00115 * point scale factor is 1.0 00116 * falseEasting : A coordinate value in meters assigned to the 00117 * central meridian of the projection. (input) 00118 * falseNorthing : A coordinate value in meters assigned to the 00119 * origin latitude of the projection (input) 00120 */ 00121 00122 CylindricalEqualArea( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double falseEasting, double falseNorthing ); 00123 00124 00125 CylindricalEqualArea( const CylindricalEqualArea &cea ); 00126 00127 00128 ~CylindricalEqualArea( void ); 00129 00130 00131 CylindricalEqualArea& operator=( const CylindricalEqualArea &cea ); 00132 00133 00134 /* 00135 * The function getParameters returns the current ellipsoid 00136 * parameters, and Cylindrical Equal Area projection parameters. 00137 * 00138 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00139 * ellipsoidFlattening : Flattening of ellipsoid (output) 00140 * centralMeridian : Longitude in radians at the center of (output) 00141 * the projection 00142 * originLatitude : Latitude in radians at which the (output) 00143 * point scale factor is 1.0 00144 * falseEasting : A coordinate value in meters assigned to the 00145 * central meridian of the projection. (output) 00146 * falseNorthing : A coordinate value in meters assigned to the 00147 * origin latitude of the projection (output) 00148 */ 00149 00150 MapProjection4Parameters* getParameters() const; 00151 00152 00153 /* 00154 * The function convertFromGeodetic converts geodetic (latitude and 00155 * longitude) coordinates to Cylindrical Equal Area projection (easting and northing) 00156 * coordinates, according to the current ellipsoid and Cylindrical Equal Area projection 00157 * parameters. If any errors occur, an exception is thrown with a description 00158 * of the error. 00159 * 00160 * longitude : Longitude (lambda) in radians (input) 00161 * latitude : Latitude (phi) in radians (input) 00162 * easting : Easting (X) in meters (output) 00163 * northing : Northing (Y) in meters (output) 00164 */ 00165 00166 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00167 00168 00169 /* 00170 * The function convertToGeodetic converts 00171 * Cylindrical Equal Area projection (easting and northing) coordinates 00172 * to geodetic (latitude and longitude) coordinates, according to the 00173 * current ellipsoid and Cylindrical Equal Area projection 00174 * coordinates. If any errors occur, an exception is thrown with a description 00175 * of the error. 00176 * 00177 * easting : Easting (X) in meters (input) 00178 * northing : Northing (Y) in meters (input) 00179 * longitude : Longitude (lambda) in radians (output) 00180 * latitude : Latitude (phi) in radians (output) 00181 */ 00182 00183 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00184 00185 private: 00186 00187 /* Ellipsoid Parameters, default to WGS 84 */ 00188 double es2; /* Eccentricity (0.08181919084262188000) squared */ 00189 double es; /* Sqrt(es2) */ 00190 double es4; /* es2 * es2 */ 00191 double es6; /* es4 * es2 */ 00192 double k0; 00193 double Cyeq_a_k0; /* Cyeq_a * k0 */ 00194 double two_k0; /* 2.0 * k0 */ 00195 double c0; /* es2 / 3.0 + 31.0 * es4 / 180.0 + 517.0 * es6 / 5040.0 */ 00196 double c1; /* 23.0 es4 / 360.0 + 251.0 * es6 / 3780.0 */ 00197 double c2; /* 761.0 * es6 / 45360.0 */ 00198 00199 /* Cylindrical Equal Area projection Parameters */ 00200 double Cyeq_Origin_Lat; /* Latitude of origin in radians */ 00201 double Cyeq_Origin_Long; /* Longitude of origin in radians */ 00202 double Cyeq_False_Northing; /* False northing in meters */ 00203 double Cyeq_False_Easting; /* False easting in meters */ 00204 00205 /* Maximum variance for easting and northing values for WGS 84.*/ 00206 double Cyeq_Max_Easting; 00207 double Cyeq_Min_Easting; 00208 double Cyeq_Delta_Northing; 00209 00210 00211 double cyleqarQ( double slat, double x ); 00212 }; 00213 } 00214 } 00215 00216 #endif 00217 00218 00219 // CLASSIFICATION: UNCLASSIFIED