00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef TransverseMercator_H 00004 #define TransverseMercator_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: TRANSVERSE MERCATOR 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude) and Transverse Mercator projection coordinates 00013 * (easting and northing). 00014 * 00015 * ERROR HANDLING 00016 * 00017 * This component checks parameters for valid values. If an invalid value 00018 * is found the error code is combined with the current error code using 00019 * the bitwise or. This combining allows multiple error codes to be 00020 * returned. The possible error codes are: 00021 * 00022 * TRANMERC_NO_ERROR : No errors occurred in function 00023 * TRANMERC_LAT_ERROR : Latitude outside of valid range 00024 * (-90 to 90 degrees) 00025 * TRANMERC_LON_ERROR : Longitude outside of valid range 00026 * (-180 to 360 degrees, and within 00027 * +/-90 of Central Meridian) 00028 * TRANMERC_EASTING_ERROR : Easting outside of valid range 00029 * (depending on ellipsoid and 00030 * projection parameters) 00031 * TRANMERC_NORTHING_ERROR : Northing outside of valid range 00032 * (depending on ellipsoid and 00033 * projection parameters) 00034 * TRANMERC_ORIGIN_LAT_ERROR : Origin latitude outside of valid range 00035 * (-90 to 90 degrees) 00036 * TRANMERC_CENT_MER_ERROR : Central meridian outside of valid range 00037 * (-180 to 360 degrees) 00038 * TRANMERC_A_ERROR : Semi-major axis less than or equal to zero 00039 * TRANMERC_INV_F_ERROR : Inverse flattening outside of valid range 00040 * (250 to 350) 00041 * TRANMERC_SCALE_FACTOR_ERROR : Scale factor outside of valid 00042 * range (0.3 to 3.0) 00043 * TRANMERC_LON_WARNING : Distortion will result if longitude is more 00044 * than 9 degrees from the Central Meridian 00045 * 00046 * REUSE NOTES 00047 * 00048 * TRANSVERSE MERCATOR is intended for reuse by any application that 00049 * performs a Transverse Mercator projection or its inverse. 00050 * 00051 * REFERENCES 00052 * 00053 * Further information on TRANSVERSE MERCATOR can be found in the 00054 * Reuse Manual. 00055 * 00056 * TRANSVERSE MERCATOR originated from : 00057 * U.S. Army Topographic Engineering Center 00058 * Geospatial Information Division 00059 * 7701 Telegraph Road 00060 * Alexandria, VA 22310-3864 00061 * 00062 * LICENSES 00063 * 00064 * None apply to this component. 00065 * 00066 * RESTRICTIONS 00067 * 00068 * TRANSVERSE MERCATOR has no restrictions. 00069 * 00070 * ENVIRONMENT 00071 * 00072 * TRANSVERSE MERCATOR was tested and certified in the following 00073 * environments: 00074 * 00075 * 1. Solaris 2.5 with GCC, version 2.8.1 00076 * 2. Windows 95 with MS Visual C++, version 6 00077 * 00078 * MODIFICATIONS 00079 * 00080 * Date Description 00081 * ---- ----------- 00082 * 2-26-07 Original C++ Code 00083 * 00084 */ 00085 00086 00087 #include "DtccApi.h" 00088 #include "CoordinateSystem.h" 00089 00090 00091 namespace MSP 00092 { 00093 namespace CCS 00094 { 00095 class MapProjection5Parameters; 00096 class MapProjectionCoordinates; 00097 class GeodeticCoordinates; 00098 00099 00100 /***************************************************************************/ 00101 /* 00102 * DEFINES 00103 */ 00104 00105 class MSP_DTCC_API TransverseMercator : public CoordinateSystem 00106 { 00107 public: 00108 00109 /* 00110 * The constructor receives the ellipsoid 00111 * parameters and Tranverse Mercator projection parameters as inputs, and 00112 * sets the corresponding state variables. If any errors occur, an exception 00113 * is thrown with a description of the error. 00114 * 00115 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00116 * ellipsoidFlattening : Flattening of ellipsoid (input) 00117 * centralMeridian : Longitude in radians at the center of the (input) 00118 * projection 00119 * latitudeOfTrueScale : Latitude in radians at the origin of the (input) 00120 * projection 00121 * falseEasting : Easting/X at the center of the projection (input) 00122 * falseNorthing : Northing/Y at the center of the projection (input) 00123 * scaleFactor : Projection scale factor (input) 00124 */ 00125 00126 TransverseMercator( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double latitudeOfTrueScale, double falseEasting, double falseNorthing, double scaleFactor ); 00127 00128 00129 TransverseMercator( const TransverseMercator &tm ); 00130 00131 00132 ~TransverseMercator( void ); 00133 00134 00135 TransverseMercator& operator=( const TransverseMercator &tm ); 00136 00137 00138 /* 00139 * The function getParameters returns the current 00140 * ellipsoid and Transverse Mercator projection parameters. 00141 * 00142 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00143 * ellipsoidFlattening : Flattening of ellipsoid (output) 00144 * centralMeridian : Longitude in radians at the center of the (output) 00145 * projection 00146 * latitudeOfTrueScale : Latitude in radians at the origin of the (output) 00147 * projection 00148 * falseEasting : Easting/X at the center of the projection (output) 00149 * falseNorthing : Northing/Y at the center of the projection (output) 00150 * scaleFactor : Projection scale factor (output) 00151 */ 00152 00153 MapProjection5Parameters* getParameters() const; 00154 00155 00156 /* 00157 * The function convertFromGeodetic converts geodetic 00158 * (latitude and longitude) coordinates to Transverse Mercator projection 00159 * (easting and northing) coordinates, according to the current ellipsoid 00160 * and Transverse Mercator projection coordinates. If any errors occur, 00161 * an exception is thrown with a description of the error. 00162 * 00163 * longitude : Longitude in radians (input) 00164 * latitude : Latitude in radians (input) 00165 * easting : Easting/X in meters (output) 00166 * northing : Northing/Y in meters (output) 00167 */ 00168 00169 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00170 00171 00172 /* 00173 * The function convertToGeodetic converts Transverse 00174 * Mercator projection (easting and northing) coordinates to geodetic 00175 * (latitude and longitude) coordinates, according to the current ellipsoid 00176 * and Transverse Mercator projection parameters. If any errors occur, 00177 * an exception is thrown with a description of the error. 00178 * 00179 * easting : Easting/X in meters (input) 00180 * northing : Northing/Y in meters (input) 00181 * longitude : Longitude in radians (output) 00182 * latitude : Latitude in radians (output) 00183 */ 00184 00185 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00186 00187 private: 00188 00189 /* Ellipsoid Parameters */ 00190 double TranMerc_es; /* Eccentricity squared */ 00191 double TranMerc_ebs; /* Second Eccentricity squared */ 00192 00193 /* Transverse_Mercator projection Parameters */ 00194 double TranMerc_Origin_Lat; /* Latitude of origin in radians */ 00195 double TranMerc_Origin_Long; /* Longitude of origin in radians */ 00196 double TranMerc_False_Northing; /* False northing in meters */ 00197 double TranMerc_False_Easting; /* False easting in meters */ 00198 double TranMerc_Scale_Factor; /* Scale factor */ 00199 00200 /* Isometric to geodetic latitude parameters */ 00201 double TranMerc_ap; 00202 double TranMerc_bp; 00203 double TranMerc_cp; 00204 double TranMerc_dp; 00205 double TranMerc_ep; 00206 00207 /* Maximum variance for easting and northing values */ 00208 double TranMerc_Delta_Easting; 00209 double TranMerc_Delta_Northing; 00210 00211 00212 double sphtmd( double latitude ); 00213 double sphsn( double latitude ); 00214 double sphsr( double latitude ); 00215 }; 00216 } 00217 } 00218 00219 #endif 00220 00221 00222 // CLASSIFICATION: UNCLASSIFIED