00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef PolarStereographic_H 00004 #define PolarStereographic_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: POLAR STEREOGRAPHIC 00008 * 00009 * 00010 * ABSTRACT 00011 * 00012 * This component provides conversions between geodetic (latitude and 00013 * longitude) coordinates and Polar Stereographic (easting and northing) 00014 * coordinates. 00015 * 00016 * ERROR HANDLING 00017 * 00018 * This component checks parameters for valid values. If an invalid 00019 * value is found the error code is combined with the current error code 00020 * using the bitwise or. This combining allows multiple error codes to 00021 * be returned. The possible error codes are: 00022 * 00023 * POLAR_NO_ERROR : No errors occurred in function 00024 * POLAR_LAT_ERROR : Latitude outside of valid range 00025 * (-90 to 90 degrees) 00026 * POLAR_LON_ERROR : Longitude outside of valid range 00027 * (-180 to 360 degrees) 00028 * POLAR_ORIGIN_LAT_ERROR : Latitude of true scale outside of valid 00029 * range (-90 to 90 degrees) 00030 * POLAR_ORIGIN_LON_ERROR : Longitude down from pole outside of valid 00031 * range (-180 to 360 degrees) 00032 * POLAR_EASTING_ERROR : Easting outside of valid range, 00033 * depending on ellipsoid and 00034 * projection parameters 00035 * POLAR_NORTHING_ERROR : Northing outside of valid range, 00036 * depending on ellipsoid and 00037 * projection parameters 00038 * POLAR_RADIUS_ERROR : Coordinates too far from pole, 00039 * depending on ellipsoid and 00040 * projection parameters 00041 * POLAR_A_ERROR : Semi-major axis less than or equal to zero 00042 * POLAR_INV_F_ERROR : Inverse flattening outside of valid range 00043 * (250 to 350) 00044 * 00045 * 00046 * REUSE NOTES 00047 * 00048 * POLAR STEREOGRAPHIC is intended for reuse by any application that 00049 * performs a Polar Stereographic projection. 00050 * 00051 * 00052 * REFERENCES 00053 * 00054 * Further information on POLAR STEREOGRAPHIC can be found in the 00055 * Reuse Manual. 00056 * 00057 * 00058 * POLAR STEREOGRAPHIC originated from : 00059 * U.S. Army Topographic Engineering Center 00060 * Geospatial Information Division 00061 * 7701 Telegraph Road 00062 * Alexandria, VA 22310-3864 00063 * 00064 * 00065 * LICENSES 00066 * 00067 * None apply to this component. 00068 * 00069 * 00070 * RESTRICTIONS 00071 * 00072 * POLAR STEREOGRAPHIC has no restrictions. 00073 * 00074 * 00075 * ENVIRONMENT 00076 * 00077 * POLAR STEREOGRAPHIC was tested and certified in the following 00078 * environments: 00079 * 00080 * 1. Solaris 2.5 with GCC, version 2.8.1 00081 * 2. Window 95 with MS Visual C++, version 6 00082 * 00083 * 00084 * MODIFICATIONS 00085 * 00086 * Date Description 00087 * ---- ----------- 00088 * 2-27-07 Original Code 00089 * 00090 * 00091 */ 00092 00093 00094 #include "CoordinateSystem.h" 00095 #include "CoordinateType.h" 00096 00097 00098 namespace MSP 00099 { 00100 namespace CCS 00101 { 00102 class PolarStereographicStandardParallelParameters; 00103 class PolarStereographicScaleFactorParameters; 00104 class MapProjectionCoordinates; 00105 class GeodeticCoordinates; 00106 00107 00108 /**********************************************************************/ 00109 /* 00110 * DEFINES 00111 */ 00112 00113 class PolarStereographic : public CoordinateSystem 00114 { 00115 public: 00116 00117 /* 00118 * The constructor receives the ellipsoid 00119 * parameters and Polar Stereograpic (Standard Parallel) projection parameters as inputs, and 00120 * sets the corresponding state variables. If any errors occur, an exception 00121 * is thrown with a description of the error. 00122 * 00123 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00124 * ellipsoidFlattening : Flattening of ellipsoid (input) 00125 * centralMeridian : Longitude down from pole, in radians (input) 00126 * standardParallel : Latitude of true scale, in radians (input) 00127 * falseEasting : Easting (X) at center of projection, in meters (input) 00128 * falseNorthing : Northing (Y) at center of projection, in meters (input) 00129 */ 00130 00131 PolarStereographic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double standardParallel, double falseEasting, double falseNorthing ); 00132 00133 00134 /* 00135 * The constructor receives the ellipsoid 00136 * parameters and Polar Stereograpic (Scale Factor) projection parameters as inputs, and 00137 * sets the corresponding state variables. If any errors occur, an 00138 * exception is thrown with a description of the error. 00139 * 00140 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00141 * ellipsoidFlattening : Flattening of ellipsoid (input) 00142 * centralMeridian : Longitude down from pole, in radians (input) 00143 * scaleFactor : Scale Factor (input) 00144 * falseEasting : Easting (X) at center of projection, in meters (input) 00145 * falseNorthing : Northing (Y) at center of projection, in meters (input) 00146 */ 00147 00148 PolarStereographic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double scaleFactor, char hemisphere, double falseEasting, double falseNorthing ); 00149 00150 00151 PolarStereographic( const PolarStereographic &ps ); 00152 00153 00154 ~PolarStereographic( void ); 00155 00156 00157 PolarStereographic& operator=( const PolarStereographic &ps ); 00158 00159 00160 /* 00161 * The function getStandardParallelParameters returns the current 00162 * ellipsoid parameters and Polar (Standard Parallel) projection parameters. 00163 * 00164 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00165 * ellipsoidFlattening : Flattening of ellipsoid (output) 00166 * centralMeridian : Longitude down from pole, in radians (output) 00167 * standardParallel : Latitude of true scale, in radians (output) 00168 * falseEasting : Easting (X) at center of projection, in meters (output) 00169 * falseNorthing : Northing (Y) at center of projection, in meters (output) 00170 */ 00171 00172 PolarStereographicStandardParallelParameters* getStandardParallelParameters() const; 00173 00174 00175 /* 00176 * The function getScaleFactorParameters returns the current 00177 * ellipsoid parameters and Polar (Scale Factor) projection parameters. 00178 * 00179 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00180 * ellipsoidFlattening : Flattening of ellipsoid (output) 00181 * centralMeridian : Longitude down from pole, in radians (output) 00182 * scaleFactor : Scale factor (output) 00183 * falseEasting : Easting (X) at center of projection, in meters (output) 00184 * falseNorthing : Northing (Y) at center of projection, in meters (output) 00185 */ 00186 00187 PolarStereographicScaleFactorParameters* getScaleFactorParameters() const; 00188 00189 00190 /* 00191 * The function convertFromGeodetic converts geodetic 00192 * coordinates (latitude and longitude) to Polar Stereographic coordinates 00193 * (easting and northing), according to the current ellipsoid 00194 * and Polar Stereographic projection parameters. If any errors occur, 00195 * an exception is thrown with a description of the error. 00196 * 00197 * longitude : Longitude, in radians (input) 00198 * latitude : Latitude, in radians (input) 00199 * easting : Easting (X), in meters (output) 00200 * northing : Northing (Y), in meters (output) 00201 */ 00202 00203 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00204 00205 00206 /* 00207 * The function convertToGeodetic converts Polar 00208 * Stereographic coordinates (easting and northing) to geodetic 00209 * coordinates (latitude and longitude) according to the current ellipsoid 00210 * and Polar Stereographic projection Parameters. If any errors occur, 00211 * an exception is thrown with a description of the error. 00212 * 00213 * easting : Easting (X), in meters (input) 00214 * northing : Northing (Y), in meters (input) 00215 * longitude : Longitude, in radians (output) 00216 * latitude : Latitude, in radians (output) 00217 * 00218 */ 00219 00220 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00221 00222 private: 00223 00224 CoordinateType::Enum coordinateType; 00225 00226 double es; /* Eccentricity of ellipsoid */ 00227 double es_OVER_2; /* es / 2.0 */ 00228 double Southern_Hemisphere; /* Flag variable */ 00229 double Polar_tc; 00230 double Polar_k90; 00231 double Polar_a_mc; /* Polar_a * mc */ 00232 double two_Polar_a; /* 2.0 * Polar_a */ 00233 00234 /* Polar Stereographic projection Parameters */ 00235 double Polar_Standard_Parallel; /* Latitude of origin in radians */ 00236 double Polar_Central_Meridian; /* Longitude of origin in radians */ 00237 double Polar_False_Easting; /* False easting in meters */ 00238 double Polar_False_Northing; /* False northing in meters */ 00239 00240 /* Maximum variance for easting and northing values for WGS 84. */ 00241 double Polar_Delta_Easting; 00242 double Polar_Delta_Northing; 00243 00244 double Polar_Scale_Factor; 00245 00246 double polarPow( double esSin); 00247 }; 00248 } 00249 } 00250 00251 #endif 00252 00253 00254 // CLASSIFICATION: UNCLASSIFIED