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