00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef Polyconic_H 00004 #define Polyconic_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: POLYCONIC 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude in radians) and Polyconic projection coordinates 00013 * (easting and northing in meters). 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 * POLY_NO_ERROR : No errors occurred in function 00023 * POLY_LAT_ERROR : Latitude outside of valid range 00024 * (-90 to 90 degrees) 00025 * POLY_LON_ERROR : Longitude outside of valid range 00026 * (-180 to 360 degrees) 00027 * POLY_EASTING_ERROR : Easting outside of valid range 00028 * (False_Easting +/- ~20,500,000 m, 00029 * depending on ellipsoid parameters 00030 * and Origin_Latitude) 00031 * POLY_NORTHING_ERROR : Northing outside of valid range 00032 * (False_Northing +/- ~15,500,000 m, 00033 * depending on ellipsoid parameters 00034 * and Origin_Latitude) 00035 * POLY_ORIGIN_LAT_ERROR : Origin latitude outside of valid range 00036 * (-90 to 90 degrees) 00037 * POLY_CENT_MER_ERROR : Central meridian outside of valid range 00038 * (-180 to 360 degrees) 00039 * POLY_A_ERROR : Semi-major axis less than or equal to zero 00040 * POLY_INV_F_ERROR : Inverse flattening outside of valid range 00041 * (250 to 350) 00042 * POLY_LON_WARNING : Distortion will result if longitude is more 00043 * than 90 degrees from the Central Meridian 00044 * 00045 * REUSE NOTES 00046 * 00047 * POLYCONIC is intended for reuse by any application that performs a 00048 * Polyconic projection or its inverse. 00049 * 00050 * REFERENCES 00051 * 00052 * Further information on POLYCONIC can be found in the Reuse Manual. 00053 * 00054 * POLYCONIC originated from : U.S. Army Topographic Engineering Center 00055 * Geospatial Information Division 00056 * 7701 Telegraph Road 00057 * Alexandria, VA 22310-3864 00058 * 00059 * LICENSES 00060 * 00061 * None apply to this component. 00062 * 00063 * RESTRICTIONS 00064 * 00065 * POLYCONIC has no restrictions. 00066 * 00067 * ENVIRONMENT 00068 * 00069 * POLYCONIC 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 * MODIFICATIONS 00075 * 00076 * Date Description 00077 * ---- ----------- 00078 * 10-06-99 Original Code 00079 * 03-05-07 Original C++ Code 00080 * 00081 */ 00082 00083 00084 #include "CoordinateSystem.h" 00085 00086 00087 namespace MSP 00088 { 00089 namespace CCS 00090 { 00091 class MapProjection4Parameters; 00092 class MapProjectionCoordinates; 00093 class GeodeticCoordinates; 00094 00095 00096 /***************************************************************************/ 00097 /* 00098 * DEFINES 00099 */ 00100 00101 class Polyconic : public CoordinateSystem 00102 { 00103 public: 00104 00105 /* 00106 * The constructor receives the ellipsoid parameters and 00107 * Polyconic projection parameters as inputs, and sets the corresponding state 00108 * variables. If any errors occur, an exception is thrown with a description 00109 * of the error. 00110 * 00111 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00112 * ellipsoidFlattening : Flattening of ellipsoid (input) 00113 * centralMeridian : Longitude in radians at the center of (input) 00114 * the projection 00115 * originLatitude : Latitude in radians at which the (input) 00116 * point scale factor is 1.0 00117 * falseEasting : A coordinate value in meters assigned to the 00118 * central meridian of the projection. (input) 00119 * falseNorthing : A coordinate value in meters assigned to the 00120 * origin latitude of the projection (input) 00121 */ 00122 00123 Polyconic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double falseEasting, double falseNorthing ); 00124 00125 00126 Polyconic( const Polyconic &p ); 00127 00128 00129 ~Polyconic( void ); 00130 00131 00132 Polyconic& operator=( const Polyconic &p ); 00133 00134 00135 /* 00136 * The function getParameters returns the current ellipsoid 00137 * parameters, and Polyconic projection parameters. 00138 * 00139 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00140 * ellipsoidFlattening : Flattening of ellipsoid (output) 00141 * centralMeridian : Longitude in radians at the center of (output) 00142 * the projection 00143 * originLatitude : Latitude in radians at which the (output) 00144 * point scale factor is 1.0 00145 * falseEasting : A coordinate value in meters assigned to the 00146 * central meridian of the projection. (output) 00147 * falseNorthing : A coordinate value in meters assigned to the 00148 * origin latitude of the projection (output) 00149 */ 00150 00151 MapProjection4Parameters* getParameters() const; 00152 00153 00154 /* 00155 * The function convertFromGeodetic converts geodetic (latitude and 00156 * longitude) coordinates to Polyconic projection (easting and northing) 00157 * coordinates, according to the current ellipsoid and Polyconic projection 00158 * parameters. If any errors occur, an exception is thrown with a description 00159 * of the error. 00160 * 00161 * longitude : Longitude (lambda) in radians (input) 00162 * latitude : Latitude (phi) in radians (input) 00163 * easting : Easting (X) in meters (output) 00164 * northing : Northing (Y) in meters (output) 00165 */ 00166 00167 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00168 00169 00170 /* 00171 * The function convertToGeodetic converts Polyconic projection 00172 * (easting and northing) coordinates to geodetic (latitude and longitude) 00173 * coordinates, according to the current ellipsoid and Polyconic projection 00174 * coordinates. If any errors occur, an exception is thrown with a description 00175 * of the error. 00176 * easting : Easting (X) in meters (input) 00177 * northing : Northing (Y) in meters (input) 00178 * longitude : Longitude (lambda) in radians (output) 00179 * latitude : Latitude (phi) in radians (output) 00180 */ 00181 00182 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00183 00184 private: 00185 00186 /* Ellipsoid Parameters, default to WGS 84 */ 00187 double es2; /* Eccentricity (0.08181919084262188000) squared */ 00188 double es4; /* es2 * es2 */ 00189 double es6; /* es4 * es2 */ 00190 double M0; 00191 double c0; /* 1 - es2 / 4.0 - 3.0 * es4 / 64.0 - 5.0 * es6 / 256.0 */ 00192 double c1; /* 3.0 * es2 / 8.0 + 3.0 * es4 / 32.0 + 45.0 * es6 / 1024.0 */ 00193 double c2; /* 15.0 * es4 / 256.0 + 45.0 * es6 / 1024.0 */ 00194 double c3; /* 35.0 * es6 / 3072.0 */ 00195 00196 /* Polyconic projection Parameters */ 00197 double Poly_Origin_Lat; /* Latitude of origin in radians */ 00198 double Poly_Origin_Long; /* Longitude of origin in radians */ 00199 double Poly_False_Northing; /* False northing in meters */ 00200 double Poly_False_Easting; /* False easting in meters */ 00201 00202 /* Maximum variance for easting and northing values for WGS 84.*/ 00203 double Poly_Max_Easting; 00204 double Poly_Max_Northing; 00205 double Poly_Min_Easting; 00206 double Poly_Min_Northing; 00207 00208 00209 double polyM( double c0lat, double c1s2lat, double c2s4lat, double c3s6lat ); 00210 00211 double floatEq( double x, double v, double epsilon ); 00212 00213 }; 00214 } 00215 } 00216 00217 #endif 00218 00219 00220 // CLASSIFICATION: UNCLASSIFIED