00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef EllipsoidLibrary_H 00004 #define EllipsoidLibrary_H 00005 00006 /****************************************************************************/ 00007 /* RSC IDENTIFIER: Ellipsoid Library 00008 * 00009 * ABSTRACT 00010 * 00011 * The purpose of ELLIPSOID is to provide access to ellipsoid parameters 00012 * for a collection of common ellipsoids. A particular ellipsoid can be 00013 * accessed by using its standard 2-letter code to find its index in the 00014 * ellipsoid table. The index can then be used to retrieve the ellipsoid 00015 * name and parameters. 00016 * 00017 * By sequentially retrieving all of the ellipsoid codes and/or names, a 00018 * menu of the available ellipsoids can be constructed. The index values 00019 * resulting from selections from this menu can then be used to access the 00020 * parameters of the selected ellipsoid. 00021 * 00022 * This component depends on a data file named "ellips.dat", which contains 00023 * the ellipsoid parameter values. A copy of this file must be located in 00024 * the directory specified by the environment variable "MSPCCS_DATA", if 00025 * defined, or else in the current directory, whenever a program containing 00026 * this component is executed. 00027 * 00028 * Additional ellipsoids can be added to this file, either manually or using 00029 * the Create_Ellipsoid function. However, if a large number of ellipsoids 00030 * are added, the ellipsoid table array size in this component will have to 00031 * be increased. 00032 * 00033 * ERROR HANDLING 00034 * 00035 * This component checks parameters for valid values. If an invalid value 00036 * is found, the error code is combined with the current error code using 00037 * the bitwise or. This combining allows multiple error codes to be 00038 * returned. The possible error codes are: 00039 * 00040 * ELLIPSE_NO_ERROR : No errors occured in function 00041 * ELLIPSE_FILE_OPEN_ERROR : Ellipsoid file opening error 00042 * ELLIPSE_INITIALIZE_ERROR : Ellipsoid table can not initialize 00043 * ELLIPSE_TABLE_OVERFLOW_ERROR : Ellipsoid table overflow 00044 * ELLIPSE_NOT_INITIALIZED_ERROR: Ellipsoid table not initialized properly 00045 * ELLIPSE_INVALID_INDEX_ERROR : Index is an invalid value 00046 * ELLIPSE_INVALID_CODE_ERROR : Code was not found in table 00047 * ELLIPSE_A_ERROR : Semi-major axis less than or equal to zero 00048 * ELLIPSE_INV_F_ERROR : Inverse flattening outside of valid range 00049 * (250 to 350) 00050 * ELLIPSE_NOT_USERDEF_ERROR : Ellipsoid is not user defined - cannot be 00051 * deleted 00052 * 00053 * REUSE NOTES 00054 * 00055 * Ellipsoid is intended for reuse by any application that requires Earth 00056 * approximating ellipsoids. 00057 * 00058 * REFERENCES 00059 * 00060 * Further information on Ellipsoid can be found in the Reuse Manual. 00061 * 00062 * Ellipsoid originated from : U.S. Army Topographic Engineering Center (USATEC) 00063 * Geospatial Information Division (GID) 00064 * 7701 Telegraph Road 00065 * Alexandria, VA 22310-3864 00066 * 00067 * LICENSES 00068 * 00069 * None apply to this component. 00070 * 00071 * RESTRICTIONS 00072 * 00073 * Ellipsoid has no restrictions. 00074 * 00075 * ENVIRONMENT 00076 * 00077 * Ellipsoid was tested and certified in the following environments 00078 * 00079 * 1. Solaris 2.5 00080 * 2. Windows 95 00081 * 00082 * MODIFICATIONS 00083 * 00084 * Date Description 00085 * ---- ----------- 00086 * 11-19-95 Original Code 00087 * 17-Jan-97 Moved local constants out of public interface 00088 * Improved efficiency in algorithms (GEOTRANS) 00089 * 24-May-99 Added user-defined ellipsoids (GEOTRANS for JMTK) 00090 * 06-27-06 Moved data file to data directory 00091 * 03-09-07 Original C++ Code 00092 * 00093 */ 00094 00095 00096 #include "DtccApi.h" 00097 00098 namespace MSP 00099 { 00100 namespace CCS 00101 { 00102 class EllipsoidLibraryImplementation; 00103 00104 00105 /***************************************************************************/ 00106 /* 00107 * DEFINES 00108 */ 00109 class MSP_DTCC_API EllipsoidLibrary 00110 { 00111 public: 00112 00113 /* 00114 * The constructor creates an empty list to store the ellipsoid data from ellips.dat, 00115 * which is used to build the ellipsoid table. 00116 */ 00117 00118 EllipsoidLibrary( EllipsoidLibraryImplementation* __ellipsoidLibraryImplementation ); 00119 00120 00121 EllipsoidLibrary( const EllipsoidLibrary &e ); 00122 00123 00124 EllipsoidLibrary& operator=( const EllipsoidLibrary &e ); 00125 00126 00127 ~EllipsoidLibrary( void ); 00128 00129 00130 /* 00131 * The function defineEllipsoid creates a new ellipsoid with the specified 00132 * Code, name, and axes. If the ellipsoid table has not been initialized, 00133 * the specified code is already in use, or a new version of the ellips.dat 00134 * file cannot be created, an exception is thrown. 00135 * Note that the indexes of all ellipsoids in the ellipsoid 00136 * table may be changed by this function. 00137 * 00138 * code : 2-letter ellipsoid code. (input) 00139 * name : Name of the new ellipsoid (input) 00140 * semiMajorAxis : Semi-major axis, in meters, of new ellipsoid (input) 00141 * flattening : Flattening of new ellipsoid. (input) 00142 * 00143 */ 00144 00145 void defineEllipsoid( const char* code, const char* name, double semiMajorAxis, double flattening ); 00146 00147 00148 /* 00149 * The function removeEllipsoid deletes a user defined ellipsoid with 00150 * the specified Code. If the ellipsoid table has not been created, 00151 * the specified code is in use by a user defined datum, or a new version 00152 * of the ellips.dat file cannot be created, exception is thrown. 00153 * Note that the indexes of all 00154 * ellipsoids in the ellipsoid table may be changed by this function. 00155 * 00156 * code : 2-letter ellipsoid code. (input) 00157 * 00158 */ 00159 00160 void removeEllipsoid( const char* code ); 00161 00162 00163 /* 00164 * The function getEllipsoidCount returns the number of ellipsoids in the 00165 * ellipsoid table. If the ellipsoid table has not been initialized, 00166 * an exception is thrown. 00167 * 00168 * count : The number of ellipsoids in the ellipsoid table. (output) 00169 * 00170 */ 00171 00172 void getEllipsoidCount ( long *count ); 00173 00174 00175 /* 00176 * The function getEllipsoidIndex returns the index of the ellipsoid in 00177 * the ellipsoid table with the specified code. If ellipsoid code is not found, 00178 * an exception is thrown. 00179 * 00180 * code : 2-letter ellipsoid code. (input) 00181 * index : Index of the ellipsoid in the ellipsoid table with the 00182 * specified code (output) 00183 * 00184 */ 00185 00186 void getEllipsoidIndex( const char *code, long* index ); 00187 00188 00189 /* 00190 * The Function getEllipsoidInfo returns the 2-letter code and name of the 00191 * ellipsoid in the ellipsoid table with the specified index. If index is 00192 * invalid, an exception is thrown. 00193 * 00194 * index : Index of a given ellipsoid in the ellipsoid table (input) 00195 * code : 2-letter ellipsoid code. (output) 00196 * name : Name of the ellipsoid referencd by index (output) 00197 * 00198 */ 00199 00200 void getEllipsoidInfo( const long index, char *code, char *name ); 00201 00202 00203 /* 00204 * The function getEllipsoidParameters returns the semi-major axis and flattening 00205 * for the ellipsoid with the specified index. If index is invalid, 00206 * an exception is thrown. 00207 * 00208 * index : Index of a given ellipsoid in the ellipsoid table (input) 00209 * a : Semi-major axis, in meters, of ellipsoid (output) 00210 * f : Flattening of ellipsoid. (output) 00211 * 00212 */ 00213 00214 void getEllipsoidParameters( const long index, double *a, double *f ); 00215 00216 00217 private: 00218 00219 EllipsoidLibraryImplementation* _ellipsoidLibraryImplementation; 00220 00221 }; 00222 } 00223 } 00224 00225 #endif 00226 00227 00228 // CLASSIFICATION: UNCLASSIFIED