00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef AlbersEqualAreaConic_H 00004 #define AlbersEqualAreaConic_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: ALBERS 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude in radians) and Albers Equal Area Conic 00013 * projection coordinates (easting and northing in meters) defined 00014 * by two standard parallels. 00015 * 00016 * ERROR HANDLING 00017 * 00018 * This component checks parameters for valid values. If an invalid value 00019 * is found the error code is combined with the current error code using 00020 * the bitwise or. This combining allows multiple error codes to be 00021 * returned. The possible error codes are: 00022 * 00023 * ALBERS_NO_ERROR : No errors occurred in function 00024 * ALBERS_LAT_ERROR : Latitude outside of valid range 00025 * (-90 to 90 degrees) 00026 * ALBERS_LON_ERROR : Longitude outside of valid range 00027 * (-180 to 360 degrees) 00028 * ALBERS_EASTING_ERROR : Easting outside of valid range 00029 * (depends on ellipsoid and projection 00030 * parameters) 00031 * ALBERS_NORTHING_ERROR : Northing outside of valid range 00032 * (depends on ellipsoid and projection 00033 * parameters) 00034 * ALBERS_FIRST_STDP_ERROR : First standard parallel outside of valid 00035 * range (-90 to 90 degrees) 00036 * ALBERS_SECOND_STDP_ERROR : Second standard parallel outside of valid 00037 * range (-90 to 90 degrees) 00038 * ALBERS_ORIGIN_LAT_ERROR : Origin latitude outside of valid range 00039 * (-90 to 90 degrees) 00040 * ALBERS_CENT_MER_ERROR : Central meridian outside of valid range 00041 * (-180 to 360 degrees) 00042 * ALBERS_A_ERROR : Semi-major axis less than or equal to zero 00043 * ALBERS_INV_F_ERROR : Inverse flattening outside of valid range 00044 * (250 to 350) 00045 * ALBERS_HEMISPHERE_ERROR : Standard parallels cannot be opposite 00046 * latitudes 00047 * ALBERS_FIRST_SECOND_ERROR : The 1st & 2nd standard parallels cannot 00048 * both be 0 00049 * 00050 * 00051 * REUSE NOTES 00052 * 00053 * ALBERS is intended for reuse by any application that performs an Albers 00054 * Equal Area Conic projection or its inverse. 00055 * 00056 * REFERENCES 00057 * 00058 * Further information on ALBERS can be found in the Reuse Manual. 00059 * 00060 * ALBERS originated from: U.S. Army Topographic Engineering Center 00061 * Geospatial Information Division 00062 * 7701 Telegraph Road 00063 * Alexandria, VA 22310-3864 00064 * 00065 * LICENSES 00066 * 00067 * None apply to this component. 00068 * 00069 * RESTRICTIONS 00070 * 00071 * ALBERS has no restrictions. 00072 * 00073 * ENVIRONMENT 00074 * 00075 * ALBERS was tested and certified in the following environments: 00076 * 00077 * 1. Solaris 2.5 with GCC, version 2.8.1 00078 * 2. MSDOS with MS Visual C++, version 6 00079 * 00080 * MODIFICATIONS 00081 * 00082 * Date Description 00083 * ---- ----------- 00084 * 07-09-99 Original Code 00085 * 03-08-07 Original C++ Code 00086 * 00087 * 00088 */ 00089 00090 00091 #include "CoordinateSystem.h" 00092 00093 #include "DtccApi.h" 00094 00095 00096 00097 namespace MSP 00098 { 00099 namespace CCS 00100 { 00101 class MapProjection6Parameters; 00102 class MapProjectionCoordinates; 00103 class GeodeticCoordinates; 00104 00105 00106 /***************************************************************************/ 00107 /* 00108 * DEFINES 00109 */ 00110 00111 class MSP_DTCC_API AlbersEqualAreaConic : public CoordinateSystem 00112 { 00113 public: 00114 00115 /* 00116 * The constructor receives the ellipsoid parameters and 00117 * projection parameters as inputs, and sets the corresponding state 00118 * variables. If any errors occur, an exception is thrown with a description 00119 * of the error. 00120 * 00121 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00122 * ellipsoidFlattening : Flattening of ellipsoid (input) 00123 * centralMeridian : Longitude in radians at the center of (input) 00124 * the projection 00125 * originLatitude : Latitude in radians at which the (input) 00126 * point scale factor is 1.0 00127 * standardParallel1 : First standard parallel (input) 00128 * standardParallel2 : Second standard parallel (input) 00129 * falseEasting : A coordinate value in meters assigned to the 00130 * central meridian of the projection. (input) 00131 * falseNorthing : A coordinate value in meters assigned to the 00132 * origin latitude of the projection (input) 00133 */ 00134 00135 AlbersEqualAreaConic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double standardParallel1, double standardParallel2, double falseEasting, double falseNorthing ); 00136 00137 00138 AlbersEqualAreaConic( const AlbersEqualAreaConic &aeac ); 00139 00140 00141 ~AlbersEqualAreaConic( void ); 00142 00143 00144 AlbersEqualAreaConic& operator=( const AlbersEqualAreaConic &aeac ); 00145 00146 00147 /* 00148 * The function getParameters returns the current ellipsoid 00149 * parameters, and Albers projection parameters. 00150 * 00151 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00152 * ellipsoidFlattening : Flattening of ellipsoid (output) 00153 * centralMeridian : Longitude in radians at the center of (output) 00154 * the projection 00155 * originLatitude : Latitude in radians at which the (output) 00156 * point scale factor is 1.0 00157 * standardParallel1 : First standard parallel (output) 00158 * standardParallel2 : Second standard parallel (output) 00159 * falseEasting : A coordinate value in meters assigned to the 00160 * central meridian of the projection. (output) 00161 * falseNorthing : A coordinate value in meters assigned to the 00162 * origin latitude of the projection (output) 00163 */ 00164 00165 MapProjection6Parameters* getParameters() const; 00166 00167 00168 /* 00169 * The function convertFromGeodetic converts geodetic (latitude and 00170 * longitude) coordinates to Albers projection (easting and northing) 00171 * coordinates, according to the current ellipsoid and Albers projection 00172 * parameters. If any errors occur, an exception is thrown with a description 00173 * of the error. 00174 * 00175 * longitude : Longitude (lambda) in radians (input) 00176 * latitude : Latitude (phi) in radians (input) 00177 * easting : Easting (X) in meters (output) 00178 * northing : Northing (Y) in meters (output) 00179 */ 00180 00181 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00182 00183 00184 /* 00185 * The function convertToGeodetic converts Albers projection 00186 * (easting and northing) coordinates to geodetic (latitude and longitude) 00187 * coordinates, according to the current ellipsoid and Albers projection 00188 * coordinates. If any errors occur, an exception is thrown with a description 00189 * of the error. 00190 * 00191 * easting : Easting (X) in meters (input) 00192 * northing : Northing (Y) in meters (input) 00193 * latitude : Latitude (phi) in radians (output) 00194 * longitude : Longitude (lambda) in radians (output) 00195 */ 00196 00197 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00198 00199 private: 00200 00201 /* Ellipsoid Parameters, default to WGS 84 */ 00202 double es; /* Eccentricity of ellipsoid */ 00203 double es2; /* Eccentricity squared */ 00204 double C; /* constant c */ 00205 double rho0; /* height above ellipsoid */ 00206 double n; /* ratio between meridians */ 00207 double Albers_a_OVER_n; /* Albers_a / n */ 00208 double one_MINUS_es2; /* 1 - es2 */ 00209 double two_es; /* 2 * es */ 00210 00211 /* Albers Projection Parameters */ 00212 double Albers_Origin_Lat; /* Latitude of origin in radians */ 00213 double Albers_Origin_Long; /* Longitude of origin in radians */ 00214 double Albers_Std_Parallel_1; 00215 double Albers_Std_Parallel_2; 00216 double Albers_False_Easting; 00217 double Albers_False_Northing; 00218 00219 double Albers_Delta_Northing; 00220 double Albers_Delta_Easting; 00221 00222 double esSine( double sinlat ); 00223 00224 double albersQ( double slat, double oneminussqressin, double essin ); 00225 00226 }; 00227 } 00228 } 00229 00230 #endif 00231 00232 00233 // CLASSIFICATION: UNCLASSIFIED