00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef Gnomonic_H 00004 #define Gnomonic_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: GNOMONIC 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude in radians) and Gnomonic 00013 * projection coordinates (easting and northing in meters). This projection 00014 * employs a spherical Earth model. The spherical radius used is the radius 00015 * of the sphere having the same area as the ellipsoid. 00016 * 00017 * ERROR HANDLING 00018 * 00019 * This component checks parameters for valid values. If an invalid value 00020 * is found the error code is combined with the current error code using 00021 * the bitwise or. This combining allows multiple error codes to be 00022 * returned. The possible error codes are: 00023 * 00024 * GNOM_NO_ERROR : No errors occurred in function 00025 * GNOM_LAT_ERROR : Latitude outside of valid range 00026 * (-90 to 90 degrees) 00027 * GNOM_LON_ERROR : Longitude outside of valid range 00028 * (-180 to 360 degrees) 00029 * GNOM_EASTING_ERROR : Easting outside of valid range 00030 * (depends on ellipsoid and projection 00031 * parameters) 00032 * GNOM_NORTHING_ERROR : Northing outside of valid range 00033 * (depends on ellipsoid and projection 00034 * parameters) 00035 * GNOM_ORIGIN_LAT_ERROR : Origin latitude outside of valid range 00036 * (-90 to 90 degrees) 00037 * GNOM_CENT_MER_ERROR : Central meridian outside of valid range 00038 * (-180 to 360 degrees) 00039 * GNOM_A_ERROR : Semi-major axis less than or equal to zero 00040 * GNOM_INV_F_ERROR : Inverse flattening outside of valid range 00041 * (250 to 350) 00042 * 00043 * 00044 * REUSE NOTES 00045 * 00046 * GNOMONIC is intended for reuse by any application that 00047 * performs a Gnomonic projection or its inverse. 00048 * 00049 * REFERENCES 00050 * 00051 * Further information on GNOMONIC can be found in the Reuse Manual. 00052 * 00053 * GNOMONIC originated from: U.S. Army Topographic Engineering Center 00054 * Geospatial Information Division 00055 * 7701 Telegraph Road 00056 * Alexandria, VA 22310-3864 00057 * 00058 * LICENSES 00059 * 00060 * None apply to this component. 00061 * 00062 * RESTRICTIONS 00063 * 00064 * GNOMONIC has no restrictions. 00065 * 00066 * ENVIRONMENT 00067 * 00068 * GNOMONIC was tested and certified in the following environments: 00069 * 00070 * 1. Solaris 2.5 with GCC, version 2.8.1 00071 * 2. MSDOS with MS Visual C++, version 6 00072 * 00073 * MODIFICATIONS 00074 * 00075 * Date Description 00076 * ---- ----------- 00077 * 05-22-00 Original Code 00078 * 03-05-07 Original C++ Code 00079 * 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 Gnomonic : public CoordinateSystem 00102 { 00103 public: 00104 00105 /* 00106 * The constructor receives the ellipsoid parameters and 00107 * 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 Gnomonic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double falseEasting, double falseNorthing ); 00124 00125 00126 Gnomonic( const Gnomonic &g ); 00127 00128 00129 ~Gnomonic( void ); 00130 00131 00132 Gnomonic& operator=( const Gnomonic &g ); 00133 00134 00135 /* 00136 * The function getParameters returns the current ellipsoid 00137 * parameters and Gnomonic 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 Gnomonic projection (easting and northing) 00157 * coordinates, according to the current ellipsoid and Gnomonic 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 Gnomonic projection 00172 * (easting and northing) coordinates to geodetic (latitude and longitude) 00173 * coordinates, according to the current ellipsoid and Gnomonic projection 00174 * coordinates. If any errors occur, an exception is thrown with a description 00175 * of the error. 00176 * 00177 * easting : Easting (X) in meters (input) 00178 * northing : Northing (Y) in meters (input) 00179 * longitude : Longitude (lambda) in radians (output) 00180 * latitude : Latitude (phi) in radians (output) 00181 */ 00182 00183 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00184 00185 private: 00186 00187 /* Ellipsoid Parameters, default to WGS 84 */ 00188 double Ra; /* Spherical Radius */ 00189 double Sin_Gnom_Origin_Lat; 00190 double Cos_Gnom_Origin_Lat; 00191 00192 /* Gnomonic projection Parameters */ 00193 double Gnom_Origin_Lat; /* Latitude of origin in radians */ 00194 double Gnom_Origin_Long; /* Longitude of origin in radians */ 00195 double Gnom_False_Northing; /* False northing in meters */ 00196 double Gnom_False_Easting; /* False easting in meters */ 00197 double abs_Gnom_Origin_Lat; 00198 00199 double Gnom_Delta_Northing; 00200 double Gnom_Delta_Easting; 00201 00202 }; 00203 } 00204 } 00205 00206 #endif 00207 00208 00209 // CLASSIFICATION: UNCLASSIFIED