00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef Stereographic_H 00004 #define Stereographic_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: STEREOGRAPHIC 00008 * 00009 * 00010 * ABSTRACT 00011 * 00012 * This component provides conversions between geodetic (latitude and 00013 * longitude) coordinates and 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 * STEREO_NO_ERROR : No errors occurred in function 00024 * STEREO_LAT_ERROR : Latitude outside of valid range 00025 * (-90 to 90 degrees) 00026 * STEREO_LON_ERROR : Longitude outside of valid range 00027 * (-180 to 360 degrees) 00028 * STEREO_ORIGIN_LAT_ERROR : Origin latitude outside of valid range 00029 * (-90 to 90 degrees) 00030 * STEREO_CENT_MER_ERROR : Central meridian outside of valid range 00031 * (-180 to 360 degrees) 00032 * STEREO_EASTING_ERROR : Easting outside of valid range, 00033 * (False_Easting +/- ~1,460,090,226 m, 00034 * depending on ellipsoid and projection 00035 * parameters) 00036 * STEREO_NORTHING_ERROR : Northing outside of valid range, 00037 * (False_Northing +/- ~1,460,090,226 m, 00038 * depending on ellipsoid and projection 00039 * parameters) 00040 * STEREO_A_ERROR : Semi-major axis less than or equal to zero 00041 * STEREO_INV_F_ERROR : Inverse flattening outside of valid range 00042 * (250 to 350) 00043 * 00044 * 00045 * REUSE NOTES 00046 * 00047 * STEREOGRAPHIC is intended for reuse by any application that 00048 * performs a Stereographic projection. 00049 * 00050 * 00051 * REFERENCES 00052 * 00053 * Further information on STEREOGRAPHIC can be found in the 00054 * Reuse Manual. 00055 * 00056 * 00057 * STEREOGRAPHIC originated from : 00058 * U.S. Army Topographic Engineering Center 00059 * Geospatial Information Division 00060 * 7701 Telegraph Road 00061 * Alexandria, VA 22310-3864 00062 * 00063 * 00064 * LICENSES 00065 * 00066 * None apply to this component. 00067 * 00068 * 00069 * RESTRICTIONS 00070 * 00071 * STEREOGRAPHIC has no restrictions. 00072 * 00073 * 00074 * ENVIRONMENT 00075 * 00076 * STEREOGRAPHIC was tested and certified in the following 00077 * environments: 00078 * 00079 * 1. Solaris 2.5 with GCC, version 2.8.1 00080 * 2. Window 95 with MS Visual C++, version 6 00081 * 00082 * 00083 * MODIFICATIONS 00084 * 00085 * Date Description 00086 * ---- ----------- 00087 * 3-1-07 Original Code 00088 * 00089 */ 00090 00091 00092 #include "CoordinateSystem.h" 00093 00094 00095 namespace MSP 00096 { 00097 namespace CCS 00098 { 00099 class MapProjection4Parameters; 00100 class MapProjectionCoordinates; 00101 class GeodeticCoordinates; 00102 00103 00104 /***************************************************************************/ 00105 /* 00106 * DEFINES 00107 */ 00108 00109 class Stereographic : public CoordinateSystem 00110 { 00111 public: 00112 00113 /* 00114 * The constructor receives the ellipsoid 00115 * parameters and Stereograpic projection parameters as inputs, and 00116 * sets the corresponding state variables. If any errors occur, an 00117 * exception is thrown with a description of the error. 00118 * 00119 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00120 * ellipsoidFlattening : Flattening of ellipsoid (input) 00121 * centralMeridian : Longitude, in radians, at the center of (input) 00122 * the projection 00123 * originLatitude : Latitude, in radians, at the center of (input) 00124 * the projection 00125 * falseEasting : Easting (X) at center of projection, in meters (input) 00126 * falseNorthing : Northing (Y) at center of projection, in meters (input) 00127 */ 00128 00129 Stereographic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double falseEasting, double falseNorthing ); 00130 00131 00132 Stereographic( const Stereographic &s ); 00133 00134 00135 ~Stereographic( void ); 00136 00137 00138 Stereographic& operator=( const Stereographic &s ); 00139 00140 00141 /* 00142 * The function getParameters returns the current ellipsoid 00143 * parameters and Stereographic projection parameters. 00144 * 00145 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00146 * ellipsoidFlattening : Flattening of ellipsoid (output) 00147 * centralMeridian : Longitude, in radians, at the center of (output) 00148 * the projection 00149 * originLatitude : Latitude, in radians, at the center of (output) 00150 * the projection 00151 * falseEasting : A coordinate value, in meters, assigned to the 00152 * central meridian of the projection. (output) 00153 * falseNorthing : A coordinate value, in meters, assigned to the 00154 * origin latitude of the projection (output) 00155 */ 00156 00157 MapProjection4Parameters* getParameters() const; 00158 00159 00160 /* 00161 * The function convertFromGeodetic converts geodetic 00162 * coordinates (latitude and longitude) to Stereographic coordinates 00163 * (easting and northing), according to the current ellipsoid 00164 * and Stereographic projection parameters. If any errors occur, an 00165 * exception is thrown with a description of the error. 00166 * 00167 * longitude : Longitude, in radians (input) 00168 * latitude : Latitude, in radians (input) 00169 * easting : Easting (X), in meters (output) 00170 * northing : Northing (Y), in meters (output) 00171 */ 00172 00173 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00174 00175 00176 /* 00177 * The function convertToGeodetic converts Stereographic projection 00178 * (easting and northing) coordinates to geodetic (latitude and longitude) 00179 * coordinates, according to the current ellipsoid and Stereographic projection 00180 * coordinates. If any errors occur, an exception is thrown with a description 00181 * of the error. 00182 * 00183 * easting : Easting (X), in meters (input) 00184 * northing : Northing (Y), in meters (input) 00185 * longitude : Longitude (lambda), in radians (output) 00186 * latitude : Latitude (phi), in radians (output) 00187 */ 00188 00189 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00190 00191 private: 00192 00193 /* Ellipsoid Parameters, default to WGS 84 */ 00194 double Stereo_Ra; /* Spherical Radius */ 00195 double Two_Stereo_Ra; /* 2 * Spherical Radius */ 00196 long Stereo_At_Pole; /* Flag variable */ 00197 00198 /* Stereographic projection Parameters */ 00199 double Stereo_Origin_Lat; /* Latitude of origin, in radians */ 00200 double Stereo_Origin_Long; /* Longitude of origin, in radians */ 00201 double Stereo_False_Easting; /* False easting, in meters */ 00202 double Stereo_False_Northing; /* False northing, in meters */ 00203 double Sin_Stereo_Origin_Lat; /* sin(Stereo_Origin_Lat) */ 00204 double Cos_Stereo_Origin_Lat; /* cos(Stereo_Origin_Lat) */ 00205 00206 /* Maximum variance for easting and northing values for WGS 84. */ 00207 double Stereo_Delta_Easting; 00208 double Stereo_Delta_Northing; 00209 }; 00210 } 00211 } 00212 00213 #endif 00214 00215 00216 // CLASSIFICATION: UNCLASSIFIED