00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef VanDerGrinten_H 00004 #define VanDerGrinten_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: VAN DER GRINTEN 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude in radians) and Van Der Grinten projection 00013 * coordinates (easting and northing in meters). The Van Der Grinten 00014 * projection employs a spherical Earth model. The Spherical Radius 00015 * used is the the radius of the sphere having the same area as the 00016 * ellipsoid. 00017 * 00018 * ERROR HANDLING 00019 * 00020 * This component checks parameters for valid values. If an invalid value 00021 * is found, the error code is combined with the current error code using 00022 * the bitwise or. This combining allows multiple error codes to be 00023 * returned. The possible error codes are: 00024 * 00025 * GRIN_NO_ERROR : No errors occurred in function 00026 * GRIN_LAT_ERROR : Latitude outside of valid range 00027 * (-90 to 90 degrees) 00028 * GRIN_LON_ERROR : Longitude outside of valid range 00029 * (-180 to 360 degrees) 00030 * GRIN_EASTING_ERROR : Easting outside of valid range 00031 * (False_Easting +/- ~20,000,000 m, 00032 * depending on ellipsoid parameters) 00033 * GRIN_NORTHING_ERROR : Northing outside of valid range 00034 * (False_Northing +/- ~20,000,000 m, 00035 * depending on ellipsoid parameters) 00036 * GRIN_RADIUS_ERROR : Coordinates too far from pole, 00037 * depending on ellipsoid and 00038 * projection parameters 00039 * GRIN_CENT_MER_ERROR : Central meridian outside of valid range 00040 * (-180 to 360 degrees) 00041 * GRIN_A_ERROR : Semi-major axis less than or equal to zero 00042 * GRIN_INV_F_ERROR : Inverse flattening outside of valid range 00043 * (250 to 350) 00044 * 00045 * REUSE NOTES 00046 * 00047 * VAN DER GRINTEN is intended for reuse by any application that performs a 00048 * Van Der Grinten projection or its inverse. 00049 * 00050 * REFERENCES 00051 * 00052 * Further information on VAN DER GRINTEN can be found in the Reuse Manual. 00053 * 00054 * VAN DER GRINTEN 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 * VAN DER GRINTEN has no restrictions. 00066 * 00067 * ENVIRONMENT 00068 * 00069 * VAN DER GRINTEN 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 * 3-1-07 Original Code 00079 * 00080 */ 00081 00082 00083 #include "CoordinateSystem.h" 00084 00085 00086 namespace MSP 00087 { 00088 namespace CCS 00089 { 00090 class MapProjection3Parameters; 00091 class MapProjectionCoordinates; 00092 class GeodeticCoordinates; 00093 00094 00095 /***************************************************************************/ 00096 /* 00097 * DEFINES 00098 */ 00099 00100 class VanDerGrinten : public CoordinateSystem 00101 { 00102 public: 00103 00104 /* 00105 * The constructor receives the ellipsoid parameters and 00106 * projection parameters as inputs, and sets the corresponding state 00107 * variables. If any errors occur, an exception is thrown with a description 00108 * of the error. 00109 * 00110 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input) 00111 * ellipsoidFlattening : Flattening of ellipsoid (input) 00112 * centralMeridian : Longitude in radians at the center of (input) 00113 * the projection 00114 * falseEasting : A coordinate value in meters assigned to the 00115 * central meridian of the projection. (input) 00116 * falseNorthing : A coordinate value in meters assigned to the 00117 * origin latitude of the projection (input) 00118 */ 00119 00120 VanDerGrinten( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double falseEasting, double falseNorthing ); 00121 00122 00123 VanDerGrinten( const VanDerGrinten &v ); 00124 00125 00126 ~VanDerGrinten( void ); 00127 00128 00129 VanDerGrinten& operator=( const VanDerGrinten &v ); 00130 00131 00132 /* 00133 * The function getParameters returns the current ellipsoid 00134 * parameters, and Van Der Grinten projection parameters. 00135 * 00136 * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output) 00137 * ellipsoidFlattening : Flattening of ellipsoid (output) 00138 * centralMeridian : Longitude in radians at the center of (output) 00139 * the projection 00140 * falseEasting : A coordinate value in meters assigned to the 00141 * central meridian of the projection. (output) 00142 * falseNorthing : A coordinate value in meters assigned to the 00143 * origin latitude of the projection (output) 00144 */ 00145 00146 MapProjection3Parameters* getParameters() const; 00147 00148 00149 /* 00150 * The function convertFromGeodetic converts geodetic (latitude and 00151 * longitude) coordinates to Van Der Grinten projection (easting and northing) 00152 * coordinates, according to the current ellipsoid and Van Der Grinten projection 00153 * parameters. If any errors occur, an exception is thrown with a description 00154 * of the error. 00155 * 00156 * longitude : Longitude (lambda) in radians (input) 00157 * latitude : Latitude (phi) in radians (input) 00158 * easting : Easting (X) in meters (output) 00159 * northing : Northing (Y) in meters (output) 00160 */ 00161 00162 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00163 00164 00165 /* 00166 * The function convertToGeodetic converts Grinten projection 00167 * (easting and northing) coordinates to geodetic (latitude and longitude) 00168 * coordinates, according to the current ellipsoid and Grinten projection 00169 * coordinates. If any errors occur, an exception is thrown with a description 00170 * of the error. 00171 * 00172 * easting : Easting (X) in meters (input) 00173 * northing : Northing (Y) in meters (input) 00174 * longitude : Longitude (lambda) in radians (output) 00175 * latitude : Latitude (phi) in radians (output) 00176 */ 00177 00178 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00179 00180 private: 00181 00182 /* Ellipsoid Parameters, default to WGS 84 */ 00183 double es2; /* Eccentricity (0.08181919084262188000) squared */ 00184 double es4; /* es2 * es2 */ 00185 double es6; /* es4 * es2 */ 00186 double Ra; /* Spherical Radius */ 00187 double PI_Ra; 00188 00189 /* Van Der Grinten projection Parameters */ 00190 double Grin_Origin_Long; /* Longitude of origin in radians */ 00191 double Grin_False_Easting; 00192 double Grin_False_Northing; 00193 00194 00195 double floatEq( double x, double v, double epsilon ); 00196 }; 00197 } 00198 } 00199 00200 #endif 00201 00202 00203 // CLASSIFICATION: UNCLASSIFIED