00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef Sinusoidal_H 00004 #define Sinusoidal_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: SINUSOIDAL 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude in radians) and Sinusoid 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 * SINU_NO_ERROR : No errors occurred in function 00023 * SINU_LAT_ERROR : Latitude outside of valid range 00024 * (-90 to 90 degrees) 00025 * SINU_LON_ERROR : Longitude outside of valid range 00026 * (-180 to 360 degrees) 00027 * SINU_EASTING_ERROR : Easting outside of valid range 00028 * (False_Easting +/- ~20,000,000 m, 00029 * depending on ellipsoid parameters) 00030 * SINU_NORTHING_ERROR : Northing outside of valid range 00031 * (False_Northing +/- ~10,000,000 m, 00032 * depending on ellipsoid parameters) 00033 * SINU_CENT_MER_ERROR : Origin longitude outside of valid range 00034 * (-180 to 360 degrees) 00035 * SINU_A_ERROR : Semi-major axis less than or equal to zero 00036 * SINU_INV_F_ERROR : Inverse flattening outside of valid range 00037 * (250 to 350) 00038 * 00039 * REUSE NOTES 00040 * 00041 * SINUSOIDAL is intended for reuse by any application that performs a 00042 * Sinusoid projection or its inverse. 00043 * 00044 * REFERENCES 00045 * 00046 * Further information on SINUSOIDAL can be found in the Reuse Manual. 00047 * 00048 * SINUSOIDAL originated from : U.S. Army Topographic Engineering Center 00049 * Geospatial Information Division 00050 * 7701 Telegraph Road 00051 * Alexandria, VA 22310-3864 00052 * 00053 * LICENSES 00054 * 00055 * None apply to this component. 00056 * 00057 * RESTRICTIONS 00058 * 00059 * SINUSOIDAL has no restrictions. 00060 * 00061 * ENVIRONMENT 00062 * 00063 * SINUSOIDAL was tested and certified in the following environments: 00064 * 00065 * 1. Solaris 2.5 with GCC, version 2.8.1 00066 * 2. Windows 95 with MS Visual C++, version 6 00067 * 00068 * MODIFICATIONS 00069 * 00070 * Date Description 00071 * ---- ----------- 00072 * 07-15-99 Original Code 00073 * 03-05-07 Original C++ Code 00074 * 00075 */ 00076 00077 00078 #include "CoordinateSystem.h" 00079 00080 00081 namespace MSP 00082 { 00083 namespace CCS 00084 { 00085 class MapProjection3Parameters; 00086 class MapProjectionCoordinates; 00087 class GeodeticCoordinates; 00088 00089 00090 /***************************************************************************/ 00091 /* 00092 * DEFINES 00093 */ 00094 00095 class Sinusoidal : public CoordinateSystem 00096 { 00097 public: 00098 00099 /* 00100 * The constructor receives the ellipsoid parameters and 00101 * Sinusoidal projection parameters as inputs, and sets the corresponding state 00102 * variables. If any errors occur, an exception is thrown with a description 00103 * of the error. 00104 * 00105 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00106 * ellipsoidFlattening : Flattening of ellipsoid (input) 00107 * centralMeridian : Longitude in radians at the center of (input) 00108 * the projection 00109 * falseEasting : A coordinate value in meters assigned to the 00110 * central meridian of the projection. (input) 00111 * falseNorthing : A coordinate value in meters assigned to the 00112 * origin latitude of the projection (input) 00113 */ 00114 00115 Sinusoidal( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double falseEasting, double falseNorthing ); 00116 00117 00118 Sinusoidal( const Sinusoidal &s ); 00119 00120 00121 ~Sinusoidal( void ); 00122 00123 00124 Sinusoidal& operator=( const Sinusoidal &s ); 00125 00126 00127 /* 00128 * The function getParameters returns the current ellipsoid 00129 * parameters, and Sinusoidal projection parameters. 00130 * 00131 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00132 * ellipsoidFlattening : Flattening of ellipsoid (output) 00133 * centralMeridian : Longitude in radians at the center of (output) 00134 * the projection 00135 * falseEasting : A coordinate value in meters assigned to the 00136 * central meridian of the projection. (output) 00137 * falseNorthing : A coordinate value in meters assigned to the 00138 * origin latitude of the projection (output) 00139 */ 00140 00141 MapProjection3Parameters* getParameters() const; 00142 00143 00144 /* 00145 * The function convertFromGeodetic converts geodetic (latitude and 00146 * longitude) coordinates to Sinusoidal projection (easting and northing) 00147 * coordinates, according to the current ellipsoid and Sinusoidal projection 00148 * parameters. If any errors occur, an exception is thrown with a description 00149 * of the error. 00150 * 00151 * longitude : Longitude (lambda) in radians (input) 00152 * latitude : Latitude (phi) in radians (input) 00153 * easting : Easting (X) in meters (output) 00154 * northing : Northing (Y) in meters (output) 00155 */ 00156 00157 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00158 00159 00160 /* 00161 * The function convertToGeodetic converts Sinusoidal projection 00162 * (easting and northing) coordinates to geodetic (latitude and longitude) 00163 * coordinates, according to the current ellipsoid and Sinusoidal projection 00164 * coordinates. If any errors occur, an exception is thrown with a description 00165 * of the error. 00166 * 00167 * easting : Easting (X) in meters (input) 00168 * northing : Northing (Y) in meters (input) 00169 * longitude : Longitude (lambda) in radians (output) 00170 * latitude : Latitude (phi) in radians (output) 00171 */ 00172 00173 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00174 00175 private: 00176 00177 /* Ellipsoid Parameters, default to WGS 84 */ 00178 double es2; /* Eccentricity (0.08181919084262188000) squared */ 00179 double es4; /* es2 * es2 */ 00180 double es6; /* es4 * es2 */ 00181 double c0; /* 1 - es2 / 4.0 - 3.0 * es4 / 64.0 - 5.0 * es6 / 256.0 */ 00182 double c1; /* 3.0 * es2 / 8.0 + 3.0 * es4 / 32.0 + 45.0 * es6 / 1024.0 */ 00183 double c2; /* 15.0 * es4 / 256.0 + 45.0 * es6 / 1024.0 */ 00184 double c3; /* 35.0 * es6 / 3072.0 */ 00185 double a0; /* 3.0 * e1 / 2.0 - 27.0 * e3 / 32.0 */ 00186 double a1; /* 21.0 * e2 / 16.0 - 55.0 * e4 / 32.0 */ 00187 double a2; /* 151.0 * e3 / 96.0 */ 00188 double a3; /* 1097.0 * e4 / 512.0 */ 00189 00190 /* Sinusoid projection Parameters */ 00191 double Sinu_Origin_Long; /* Longitude of origin in radians */ 00192 double Sinu_False_Northing; /* False northing in meters */ 00193 double Sinu_False_Easting; /* False easting in meters */ 00194 00195 /* Maximum variance for easting and northing values for WGS 84. */ 00196 double Sinu_Max_Easting; 00197 double Sinu_Min_Easting; 00198 double Sinu_Delta_Northing; 00199 00200 }; 00201 } 00202 } 00203 #endif 00204 00205 00206 // CLASSIFICATION: UNCLASSIFIED