00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef LambertConformalConic1_H 00004 #define LambertConformalConic1_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: LAMBERT 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude in radians) and Lambert Conformal Conic 00013 * (1 or 2 Standard Parallel) projection coordinates (easting and northing in meters) defined 00014 * by one standard parallel and specified scale true along that parallel, or two standard parallels. 00015 * When both standard parallel parameters 00016 * are set to the same latitude value, the result is a Lambert 00017 * Conformal Conic projection with one standard parallel at the 00018 * specified latitude. 00019 * 00020 * ERROR HANDLING 00021 * 00022 * This component checks parameters for valid values. If an invalid value 00023 * is found the error code is combined with the current error code using 00024 * the bitwise or. This combining allows multiple error codes to be 00025 * returned. The possible error codes are: 00026 * 00027 * LAMBERT_NO_ERROR : No errors occurred in function 00028 * LAMBERT_LAT_ERROR : Latitude outside of valid range 00029 * (-90 to 90 degrees) 00030 * LAMBERT_LON_ERROR : Longitude outside of valid range 00031 * (-180 to 360 degrees) 00032 * LAMBERT_EASTING_ERROR : Easting outside of valid range 00033 * (depends on ellipsoid and projection 00034 * parameters) 00035 * LAMBERT_NORTHING_ERROR : Northing outside of valid range 00036 * (depends on ellipsoid and projection 00037 * parameters) 00038 * LAMBERT_ORIGIN_LAT_ERROR : Origin latitude outside of valid 00039 * range (-89 59 59.0 to 89 59 59.0 degrees) 00040 * or within one second of 0 degrees 00041 * LAMBERT_CENT_MER_ERROR : Central meridian outside of valid range 00042 * (-180 to 360 degrees) 00043 * LAMBERT_SCALE_FACTOR_ERROR : Scale factor greater than minimum scale 00044 * factor (1.0e-9) 00045 * LAMBERT_A_ERROR : Semi-major axis less than or equal to zero 00046 * LAMBERT_INV_F_ERROR : Inverse flattening outside of valid range 00047 * (250 to 350) 00048 * 00049 * 00050 * REUSE NOTES 00051 * 00052 * LAMBERT is intended for reuse by any application that performs a Lambert 00053 * Conformal Conic (1 or 2 Standard Parallel) projection or its inverse. 00054 * 00055 * REFERENCES 00056 * 00057 * Further information on LAMBERT can be found in the Reuse Manual. 00058 * 00059 * LAMBERT originated from: 00060 * Information Technologoy - Spatial Reference Model(SRM) 00061 * ISO/IEC FDIS 18026 00062 * 00063 * LICENSES 00064 * 00065 * None apply to this component. 00066 * 00067 * RESTRICTIONS 00068 * 00069 * LAMBERT has no restrictions. 00070 * 00071 * ENVIRONMENT 00072 * 00073 * LAMBERT was tested and certified in the following environments: 00074 * 00075 * 1. Solaris 2.5 with GCC, version 2.8.1 00076 * 2. Windows 98/2000/XP with MS Visual C++, version 6 00077 * 00078 * MODIFICATIONS 00079 * 00080 * Date Description 00081 * ---- ----------- 00082 * 03-05-2005 Original Code 00083 * 03-02-2007 Original C++ Code 00084 * 02-25-2009 Merged Lambert 1 and 2 00085 * 00086 */ 00087 00088 00089 #include "CoordinateSystem.h" 00090 #include "CoordinateType.h" 00091 00092 00093 namespace MSP 00094 { 00095 namespace CCS 00096 { 00097 class MapProjection5Parameters; 00098 class MapProjection6Parameters; 00099 class MapProjectionCoordinates; 00100 class GeodeticCoordinates; 00101 00102 00103 /***************************************************************************/ 00104 /* 00105 * DEFINES 00106 */ 00107 00108 class LambertConformalConic : public CoordinateSystem 00109 { 00110 public: 00111 00112 /* 00113 * The constructor receives the ellipsoid parameters and 00114 * Lambert Conformal Conic (1 Standard Parallel) projection parameters as inputs, and sets the 00115 * corresponding state variables. If any errors occur, an exception is thrown with a description 00116 * of the error. 00117 * 00118 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00119 * ellipsoidFlattening : Flattening of ellipsoid (input) 00120 * centralMeridian : Longitude of origin, in radians (input) 00121 * originLatitude : Latitude of origin, in radians (input) 00122 * falseEasting : False easting, in meters (input) 00123 * falseNorthing : False northing, in meters (input) 00124 * scaleFactor : Projection scale factor (input) 00125 * 00126 */ 00127 00128 LambertConformalConic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double falseEasting, double falseNorthing, double scaleFactor ); 00129 00130 00131 /* 00132 * The constructor receives the ellipsoid parameters and 00133 * Lambert Conformal Conic (2 Standard Parallel) projection parameters as inputs, and sets the 00134 * corresponding state variables. If any errors occur, an exception is thrown 00135 * with a description of the error. 00136 * 00137 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00138 * ellipsoidFlattening : Flattening of ellipsoid (input) 00139 * centralMeridian : Longitude of origin, in radians (input) 00140 * originLatitude : Latitude of origin, in radians (input) 00141 * standardParallel1 : First standard parallel, in radians (input) 00142 * standardParallel2 : Second standard parallel, in radians (input) 00143 * falseEasting : False easting, in meters (input) 00144 * falseNorthing : False northing, in meters (input) 00145 * 00146 * Note that when the two standard parallel parameters are both set to the 00147 * same latitude value, the result is a Lambert Conformal Conic projection 00148 * with one standard parallel at the specified latitude. 00149 */ 00150 00151 LambertConformalConic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double standardParallel1, double standardParallel2, double falseEasting, double falseNorthing ); 00152 00153 00154 LambertConformalConic( const LambertConformalConic &lcc1 ); 00155 00156 00157 ~LambertConformalConic( void ); 00158 00159 00160 LambertConformalConic& operator=( const LambertConformalConic &lcc1 ); 00161 00162 00163 /* 00164 * The function get1StandardParallelParameters returns the current ellipsoid 00165 * parameters and Lambert Conformal Conic (1 Standard Parallel) projection parameters. 00166 * 00167 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00168 * ellipsoidFlattening : Flattening of ellipsoid (output) 00169 * centralMeridian : Longitude of origin, in radians (output) 00170 * originLatitude : Latitude of origin, in radians (output) 00171 * falseEasting : False easting, in meters (output) 00172 * falseNorthing : False northing, in meters (output) 00173 * scaleFactor : Projection scale factor (output) 00174 */ 00175 00176 MapProjection5Parameters* get1StandardParallelParameters() const; 00177 00178 00179 /* 00180 * The function get2StandardParallelParameters returns the current ellipsoid 00181 * parameters and Lambert Conformal Conic (2 Standard Parallel) projection parameters. 00182 * 00183 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00184 * ellipsoidFlattening : Flattening of ellipsoid (output) 00185 * centralMeridian : Longitude of origin, in radians (output) 00186 * originLatitude : Latitude of origin, in radians (output) 00187 * standardParallel1 : First standard parallel, in radians (output) 00188 * standardParallel2 : Second standard parallel, in radians (output) 00189 * falseEasting : False easting, in meters (output) 00190 * falseNorthing : False northing, in meters (output) 00191 */ 00192 00193 MapProjection6Parameters* get2StandardParallelParameters() const; 00194 00195 00196 /* 00197 * The function convertFromGeodetic converts Geodetic (latitude and 00198 * longitude) coordinates to Lambert Conformal Conic (1 or 2 Standard Parallel) projection (easting 00199 * and northing) coordinates, according to the current ellipsoid and 00200 * Lambert Conformal Conic (1 or 2 Standard Parallel) projection parameters. If any errors occur, an 00201 * exception is thrown with a description of the error. 00202 * 00203 * longitude : Longitude, in radians (input) 00204 * latitude : Latitude, in radians (input) 00205 * easting : Easting (X), in meters (output) 00206 * northing : Northing (Y), in meters (output) 00207 */ 00208 00209 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00210 00211 00212 /* 00213 * The function convertToGeodetic converts Lambert Conformal 00214 * Conic (1 or 2 Standard Parallel) projection (easting and northing) coordinates to Geodetic 00215 * (latitude and longitude) coordinates, according to the current ellipsoid 00216 * and Lambert Conformal Conic (1 or 2 Standard Parallel) projection parameters. If any errors occur, 00217 * an exception is thrown with a description of the error. 00218 * 00219 * easting : Easting (X), in meters (input) 00220 * northing : Northing (Y), in meters (input) 00221 * longitude : Longitude, in radians (output) 00222 * latitude : Latitude, in radians (output) 00223 */ 00224 00225 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00226 00227 private: 00228 00229 CoordinateType::Enum coordinateType; 00230 00231 struct CommonParameters 00232 { 00233 double _lambertN; /* Ratio of angle between meridians */ 00234 double _lambertRho0; /* Height above ellipsoid */ 00235 double _lambertRhoOlat; 00236 double _lambertT0; 00237 00238 /* Lambert_Conformal_Conic projection Parameters */ 00239 double _lambertOriginLatitude; /* Latitude of origin in radians */ 00240 double _lambertFalseNorthing; /* False northing, in meters */ 00241 double _lambertScaleFactor; /* Scale Factor */ 00242 }; 00243 00244 /* Ellipsoid Parameters, default to WGS 84 */ 00245 double es; /* Eccentricity of ellipsoid */ 00246 double es_OVER_2; /* Eccentricity / 2.0 */ 00247 double Lambert_1_n; /* Ratio of angle between meridians */ 00248 double Lambert_1_rho0; /* Height above ellipsoid */ 00249 double Lambert_1_rho_olat; 00250 double Lambert_1_t0; 00251 00252 /* Lambert_Conformal_Conic projection Parameters */ 00253 double Lambert_Origin_Latitude; /* Latitude of origin in radians */ 00254 double Lambert_Origin_Long; /* Longitude of origin, in radians */ 00255 double Lambert_False_Northing; /* False northing, in meters */ 00256 double Lambert_False_Easting; /* False easting, in meters */ 00257 double Lambert_Scale_Factor; /* Scale Factor */ 00258 00259 /* Lambert_Conformal_Conic 2 projection Parameters */ 00260 double Lambert_2_Std_Parallel_1; /* Lower std. parallel, in radians */ 00261 double Lambert_2_Std_Parallel_2; /* Upper std. parallel, in radians */ 00262 double Lambert_2_Origin_Lat; /* Latitude of origin, in radians */ 00263 00264 /* Maximum variance for easting and northing values for WGS 84. */ 00265 double Lambert_Delta_Easting; 00266 double Lambert_Delta_Northing; 00267 00268 00269 CommonParameters* setCommonLambert1StandardParallelParameters(double originLatitude, double falseNorthing, double scaleFactor); 00270 00271 double calculateLambert2StandardParallel(double es2, double phi, double tempPhi, double c); 00272 00273 double lambertM( double clat, double essin ); 00274 00275 double lambertT( double lat, double essin ); 00276 00277 double esSin(double sinlat); 00278 }; 00279 } 00280 } 00281 00282 #endif 00283 00284 00285 // CLASSIFICATION: UNCLASSIFIED