00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef UPS_H 00004 #define UPS_H 00005 00006 /********************************************************************/ 00007 /* RSC IDENTIFIER: UPS 00008 * 00009 * 00010 * ABSTRACT 00011 * 00012 * This component provides conversions between geodetic (latitude 00013 * and longitude) coordinates and Universal Polar Stereographic (UPS) 00014 * projection (hemisphere, easting, and northing) coordinates. 00015 * 00016 * 00017 * ERROR HANDLING 00018 * 00019 * This component checks parameters for valid values. If an 00020 * invalid value is found the error code is combined with the 00021 * current error code using the bitwise or. This combining allows 00022 * multiple error codes to be returned. The possible error codes 00023 * are: 00024 * 00025 * UPS_NO_ERROR : No errors occurred in function 00026 * UPS_LAT_ERROR : Latitude outside of valid range 00027 * (North Pole: 83.5 to 90, 00028 * South Pole: -79.5 to -90) 00029 * UPS_LON_ERROR : Longitude outside of valid range 00030 * (-180 to 360 degrees) 00031 * UPS_HEMISPHERE_ERROR : Invalid hemisphere ('N' or 'S') 00032 * UPS_EASTING_ERROR : Easting outside of valid range, 00033 * (0 to 4,000,000m) 00034 * UPS_NORTHING_ERROR : Northing outside of valid range, 00035 * (0 to 4,000,000m) 00036 * UPS_A_ERROR : Semi-major axis less than or equal to zero 00037 * UPS_INV_F_ERROR : Inverse flattening outside of valid range 00038 * (250 to 350) 00039 * 00040 * 00041 * REUSE NOTES 00042 * 00043 * UPS is intended for reuse by any application that performs a Universal 00044 * Polar Stereographic (UPS) projection. 00045 * 00046 * 00047 * REFERENCES 00048 * 00049 * Further information on UPS can be found in the Reuse Manual. 00050 * 00051 * UPS originated from : U.S. Army Topographic Engineering Center 00052 * Geospatial Information Division 00053 * 7701 Telegraph Road 00054 * Alexandria, VA 22310-3864 00055 * 00056 * 00057 * LICENSES 00058 * 00059 * None apply to this component. 00060 * 00061 * 00062 * RESTRICTIONS 00063 * 00064 * UPS has no restrictions. 00065 * 00066 * 00067 * ENVIRONMENT 00068 * 00069 * UPS was tested and certified in the following environments: 00070 * 00071 * 1. Solaris 2.5 with GCC version 2.8.1 00072 * 2. Windows 95 with MS Visual C++ version 6 00073 * 00074 * 00075 * MODIFICATIONS 00076 * 00077 * Date Description 00078 * ---- ----------- 00079 * 2-27-07 Original Code 00080 * 00081 * 00082 */ 00083 00084 00085 #include <map> 00086 #include "CoordinateSystem.h" 00087 00088 00089 namespace MSP 00090 { 00091 namespace CCS 00092 { 00093 class PolarStereographic; 00094 class UPSCoordinates; 00095 class GeodeticCoordinates; 00096 00097 00098 /**********************************************************************/ 00099 /* 00100 * DEFINES 00101 */ 00102 00103 class UPS : public CoordinateSystem 00104 { 00105 public: 00106 00107 /* 00108 * The constructor receives the ellipsoid parameters and sets 00109 * the corresponding state variables. If any errors occur, an exception 00110 * is thrown with a description of the error. 00111 * 00112 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid in meters (input) 00113 * ellipsoidFlattening : Flattening of ellipsoid (input) 00114 */ 00115 00116 UPS( double ellipsoidSemiMajorAxis, double ellipsoidFlattening ); 00117 00118 00119 UPS( const UPS &u ); 00120 00121 00122 ~UPS( void ); 00123 00124 00125 UPS& operator=( const UPS &u ); 00126 00127 00128 /* 00129 * The function convertFromGeodetic converts geodetic (latitude and 00130 * longitude) coordinates to UPS (hemisphere, easting, and northing) 00131 * coordinates, according to the current ellipsoid parameters. 00132 * If any errors occur, an exception is thrown with a description of the error. 00133 * 00134 * latitude : Latitude in radians (input) 00135 * longitude : Longitude in radians (input) 00136 * hemisphere : Hemisphere either 'N' or 'S' (output) 00137 * easting : Easting/X in meters (output) 00138 * northing : Northing/Y in meters (output) 00139 */ 00140 00141 MSP::CCS::UPSCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00142 00143 00144 /* 00145 * The function convertToGeodetic converts UPS (hemisphere, easting, 00146 * and northing) coordinates to geodetic (latitude and longitude) coordinates 00147 * according to the current ellipsoid parameters. If any errors occur, 00148 * an exception is thrown with a description of the error. 00149 * 00150 * hemisphere : Hemisphere either 'N' or 'S' (input) 00151 * easting : Easting/X in meters (input) 00152 * northing : Northing/Y in meters (input) 00153 * latitude : Latitude in radians (output) 00154 * longitude : Longitude in radians (output) 00155 */ 00156 00157 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::UPSCoordinates* upsCoordinates ); 00158 00159 private: 00160 00161 std::map< char, PolarStereographic* > polarStereographicMap; 00162 00163 double UPS_Origin_Latitude; /*set default = North Hemisphere */ 00164 }; 00165 } 00166 } 00167 00168 #endif 00169 00170 00171 // CLASSIFICATION: UNCLASSIFIED