00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef EquidistantCylindrical_H 00004 #define EquidistantCylindrical_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: EQUIDISTANT CYLINDRICAL 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude in radians) and Equidistant Cylindrical projection coordinates 00013 * (easting and northing in meters). The Equidistant Cylindrical 00014 * projection employs a spherical Earth model. The Spherical Radius 00015 * used is the the radius of the sphere having the same area as the 00016 * ellipsoid. 00017 * 00018 * ERROR HANDLING 00019 * 00020 * This component checks parameters for valid values. If an invalid value 00021 * is found, the error code is combined with the current error code using 00022 * the bitwise or. This combining allows multiple error codes to be 00023 * returned. The possible error codes are: 00024 * 00025 * EQCY_NO_ERROR : No errors occurred in function 00026 * EQCY_LAT_ERROR : Latitude outside of valid range 00027 * (-90 to 90 degrees) 00028 * EQCY_LON_ERROR : Longitude outside of valid range 00029 * (-180 to 360 degrees) 00030 * EQCY_EASTING_ERROR : Easting outside of valid range 00031 * (False_Easting +/- ~20,000,000 m, 00032 * depending on ellipsoid parameters 00033 * and Standard Parallel) 00034 * EQCY_NORTHING_ERROR : Northing outside of valid range 00035 * (False_Northing +/- 0 to ~10,000,000 m, 00036 * depending on ellipsoid parameters 00037 * and Standard Parallel) 00038 * EQCY_STDP_ERROR : Standard parallel outside of valid range 00039 * (-90 to 90 degrees) 00040 * EQCY_CENT_MER_ERROR : Central meridian outside of valid range 00041 * (-180 to 360 degrees) 00042 * EQCY_A_ERROR : Semi-major axis less than or equal to zero 00043 * EQCY_INV_F_ERROR : Inverse flattening outside of valid range 00044 * (250 to 350) 00045 * 00046 * REUSE NOTES 00047 * 00048 * EQUIDISTANT CYLINDRICAL is intended for reuse by any application that performs a 00049 * Equidistant Cylindrical projection or its inverse. 00050 * 00051 * REFERENCES 00052 * 00053 * Further information on EQUIDISTANT CYLINDRICAL can be found in the Reuse Manual. 00054 * 00055 * EQUIDISTANT CYLINDRICAL originated from : U.S. Army Topographic Engineering Center 00056 * Geospatial Information Division 00057 * 7701 Telegraph Road 00058 * Alexandria, VA 22310-3864 00059 * 00060 * LICENSES 00061 * 00062 * None apply to this component. 00063 * 00064 * RESTRICTIONS 00065 * 00066 * EQUIDISTANT CYLINDRICAL has no restrictions. 00067 * 00068 * ENVIRONMENT 00069 * 00070 * EQUIDISTANT CYLINDRICAL was tested and certified in the following environments: 00071 * 00072 * 1. Solaris 2.5 with GCC 2.8.1 00073 * 2. MS Windows with MS Visual C++ 6 00074 * 00075 * MODIFICATIONS 00076 * 00077 * Date Description 00078 * ---- ----------- 00079 * 04-16-99 Original Code 00080 * 03-06-07 Original C++ Code 00081 * 00082 * 00083 */ 00084 00085 00086 #include "CoordinateSystem.h" 00087 00088 00089 namespace MSP 00090 { 00091 namespace CCS 00092 { 00093 class EquidistantCylindricalParameters; 00094 class MapProjectionCoordinates; 00095 class GeodeticCoordinates; 00096 00097 00098 /***************************************************************************/ 00099 /* 00100 * DEFINES 00101 */ 00102 00103 class EquidistantCylindrical : public CoordinateSystem 00104 { 00105 public: 00106 00107 /* 00108 * The function setParameters receives the ellipsoid parameters and 00109 * projection parameters as inputs, and sets the corresponding state 00110 * variables. It also calculates the spherical radius of the sphere having 00111 * the same area as the ellipsoid. If any errors occur, an exception is thrown with a description 00112 * of the error. 00113 * 00114 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00115 * ellipsoidFlattening : Flattening of ellipsoid (input) 00116 * centralMeridian : Longitude in radians at the center of (input) 00117 * the projection 00118 * standardParallel : Latitude in radians at which the (input) 00119 * point scale factor is 1.0 00120 * falseEasting : A coordinate value in meters assigned to the 00121 * central meridian of the projection. (input) 00122 * falseNorthing : A coordinate value in meters assigned to the 00123 * standard parallel of the projection (input) 00124 */ 00125 00126 EquidistantCylindrical( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double standardParallel, double falseEasting, double falseNorthing ); 00127 00128 00129 EquidistantCylindrical( const EquidistantCylindrical &ec ); 00130 00131 00132 ~EquidistantCylindrical( void ); 00133 00134 00135 EquidistantCylindrical& operator=( const EquidistantCylindrical &ec ); 00136 00137 00138 /* 00139 * The function getParameters returns the current ellipsoid 00140 * parameters and Equidistant Cylindrical projection parameters. 00141 * 00142 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00143 * ellipsoidFlattening : Flattening of ellipsoid (output) 00144 * centralMeridian : Longitude in radians at the center of (output) 00145 * the projection 00146 * standardParallel : Latitude in radians at which the (output) 00147 * point scale factor is 1.0 00148 * falseEasting : A coordinate value in meters assigned to the 00149 * central meridian of the projection. (output) 00150 * falseNorthing : A coordinate value in meters assigned to the 00151 * standard parallel of the projection (output) 00152 */ 00153 00154 EquidistantCylindricalParameters* getParameters() const; 00155 00156 00157 /* 00158 * The function convertFromGeodetic converts geodetic (latitude and 00159 * longitude) coordinates to Equidistant Cylindrical projection (easting and northing) 00160 * coordinates, according to the current ellipsoid, spherical radiius 00161 * and Equidistant Cylindrical projection parameters. 00162 * If any errors occur, an exception is thrown with a description 00163 * of the error. 00164 * 00165 * longitude : Longitude (lambda) in radians (input) 00166 * latitude : Latitude (phi) in radians (input) 00167 * easting : Easting (X) in meters (output) 00168 * northing : Northing (Y) in meters (output) 00169 */ 00170 00171 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00172 00173 00174 /* 00175 * The function convertToGeodetic converts Equidistant Cylindrical projection 00176 * (easting and northing) coordinates to geodetic (latitude and longitude) 00177 * coordinates, according to the current ellipsoid, spherical radius 00178 * and Equidistant Cylindrical projection coordinates. 00179 * If any errors occur, an exception is thrown with a description 00180 * of the error. 00181 * 00182 * easting : Easting (X) in meters (input) 00183 * northing : Northing (Y) in meters (input) 00184 * longitude : Longitude (lambda) in radians (output) 00185 * latitude : Latitude (phi) in radians (output) 00186 */ 00187 00188 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00189 00190 private: 00191 00192 /* Ellipsoid Parameters, default to WGS 84 */ 00193 double es2; /* Eccentricity (0.08181919084262188000) squared */ 00194 double es4; /* es2 * es2 */ 00195 double es6; /* es4 * es2 */ 00196 double Ra; /* Spherical Radius */ 00197 00198 /* Equidistant Cylindrical projection Parameters */ 00199 double Eqcy_Std_Parallel; /* Latitude of standard parallel in radians */ 00200 double Cos_Eqcy_Std_Parallel; /* cos(Eqcy_Std_Parallel) */ 00201 double Eqcy_Origin_Long; /* Longitude of origin in radians */ 00202 double Eqcy_False_Easting; 00203 double Eqcy_False_Northing; 00204 double Eqcy_Delta_Northing; 00205 double Eqcy_Max_Easting; 00206 double Eqcy_Min_Easting; 00207 double Ra_Cos_Eqcy_Std_Parallel; /* Ra * Cos_Eqcy_Std_Parallel */ 00208 00209 }; 00210 } 00211 } 00212 00213 #endif 00214 00215 00216 // CLASSIFICATION: UNCLASSIFIED