00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef GARS_H 00004 #define GARS_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: GARS 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions from Geodetic coordinates (latitude 00012 * and longitude in radians) to a GARS coordinate string. 00013 * 00014 * ERROR HANDLING 00015 * 00016 * This component checks parameters for valid values. If an invalid value 00017 * is found, the error code is combined with the current error code using 00018 * the bitwise or. This combining allows multiple error codes to be 00019 * returned. The possible error codes are: 00020 * 00021 * GARS_NO_ERROR : No errors occurred in function 00022 * GARS_LAT_ERROR : Latitude outside of valid range 00023 * (-90 to 90 degrees) 00024 * GARS_LON_ERROR : Longitude outside of valid range 00025 * (-180 to 360 degrees) 00026 * GARS_STR_ERROR : A GARS string error: string too long, 00027 * string too short, invalid numbers/letters 00028 * GARS_STR_LAT_ERROR : The latitude part of the GARS string 00029 * (fourth and fifth characters) is invalid. 00030 * GARS_STR_LON_ERROR : The longitude part of the GARS string 00031 * (first three characters) is invalid. 00032 * GARS_STR_15_MIN_ERROR : The 15 minute part of the GARS 00033 * string is less than 1 or greater than 4. 00034 * GARS_STR_5_MIN_ERROR : The 5 minute part of the GARS 00035 * string is less than 1 or greater than 9. 00036 * GARS_PRECISION_ERROR : The precision must be between 0 and 5 00037 * inclusive. 00038 * 00039 * 00040 * REUSE NOTES 00041 * 00042 * GARS is intended for reuse by any application that performs a 00043 * conversion between Geodetic and GARS coordinates. 00044 * 00045 * REFERENCES 00046 * 00047 * Further information on GARS can be found in the Reuse Manual. 00048 * 00049 * GARS originated from : 00050 * 00051 * http://earth-info.nga.mil/GandG/coordsys/grids/gars.html 00052 * 00053 * 00054 * LICENSES 00055 * 00056 * None apply to this component. 00057 * 00058 * RESTRICTIONS 00059 * 00060 * GARS has no restrictions. 00061 * 00062 * ENVIRONMENT 00063 * 00064 * GARS was tested and certified in the following environments: 00065 * 00066 * 1. Solaris 2.5 with GCC version 2.8.1 00067 * 2. Windows XP with MS Visual C++ version 6 00068 * 00069 * MODIFICATIONS 00070 * 00071 * Date Description 00072 * ---- ----------- 00073 * 07-10-06 Original Code 00074 * 03-02-07 Original C++ Code 00075 */ 00076 00077 00078 #include "CoordinateSystem.h" 00079 00080 00081 namespace MSP 00082 { 00083 namespace CCS 00084 { 00085 class GARSCoordinates; 00086 class GeodeticCoordinates; 00087 00088 00089 /***************************************************************************/ 00090 /* 00091 * DEFINES 00092 */ 00093 00094 class GARS : public CoordinateSystem 00095 { 00096 public: 00097 00098 GARS(); 00099 00100 00101 GARS( const GARS &g ); 00102 00103 00104 ~GARS( void ); 00105 00106 00107 GARS& operator=( const GARS &g ); 00108 00109 00110 /* 00111 * The function convertFromGeodetic converts Geodetic (latitude and longitude in radians) 00112 * coordinates to a GARS coordinate string. Precision specifies the 00113 * number of digits in the GARS string for latitude and longitude: 00114 * 0: 30 minutes (5 characters) 00115 * 1: 15 minutes (6 characters) 00116 * 2: 5 minutes (7 characters) 00117 * 00118 * longitude : Longitude in radians. (input) 00119 * latitude : Latitude in radians. (input) 00120 * precision : Precision specified by the user. (input) 00121 * GARSString : GARS coordinate string. (output) 00122 * 00123 */ 00124 00125 MSP::CCS::GARSCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates, long precision ); 00126 00127 00128 /* 00129 * The function convertToGeodetic converts a GARS coordinate string to Geodetic (latitude 00130 * and longitude in radians) coordinates. 00131 * 00132 * GARSString : GARS coordinate string. (input) 00133 * longitude : Longitude in radians. (output) 00134 * latitude : Latitude in radians. (output) 00135 * 00136 */ 00137 00138 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::GARSCoordinates* garsCoordinates ); 00139 00140 }; 00141 } 00142 } 00143 00144 #endif 00145 00146 00147 // CLASSIFICATION: UNCLASSIFIED