UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
EllipsoidLibrary.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef EllipsoidLibrary_H
4 #define EllipsoidLibrary_H
5 
6 /****************************************************************************/
7 /* RSC IDENTIFIER: Ellipsoid Library
8  *
9  * ABSTRACT
10  *
11  * The purpose of ELLIPSOID is to provide access to ellipsoid parameters
12  * for a collection of common ellipsoids. A particular ellipsoid can be
13  * accessed by using its standard 2-letter code to find its index in the
14  * ellipsoid table. The index can then be used to retrieve the ellipsoid
15  * name and parameters.
16  *
17  * By sequentially retrieving all of the ellipsoid codes and/or names, a
18  * menu of the available ellipsoids can be constructed. The index values
19  * resulting from selections from this menu can then be used to access the
20  * parameters of the selected ellipsoid.
21  *
22  * This component depends on a data file named "ellips.dat", which contains
23  * the ellipsoid parameter values. A copy of this file must be located in
24  * the directory specified by the environment variable "MSPCCS_DATA", if
25  * defined, or else in the current directory, whenever a program containing
26  * this component is executed.
27  *
28  * Additional ellipsoids can be added to this file, either manually or using
29  * the Create_Ellipsoid function. However, if a large number of ellipsoids
30  * are added, the ellipsoid table array size in this component will have to
31  * be increased.
32  *
33  * ERROR HANDLING
34  *
35  * This component checks parameters for valid values. If an invalid value
36  * is found, the error code is combined with the current error code using
37  * the bitwise or. This combining allows multiple error codes to be
38  * returned. The possible error codes are:
39  *
40  * ELLIPSE_NO_ERROR : No errors occured in function
41  * ELLIPSE_FILE_OPEN_ERROR : Ellipsoid file opening error
42  * ELLIPSE_INITIALIZE_ERROR : Ellipsoid table can not initialize
43  * ELLIPSE_NOT_INITIALIZED_ERROR: Ellipsoid table not initialized properly
44  * ELLIPSE_INVALID_INDEX_ERROR : Index is an invalid value
45  * ELLIPSE_INVALID_CODE_ERROR : Code was not found in table
46  * ELLIPSE_A_ERROR : Semi-major axis less than or equal to zero
47  * ELLIPSE_INV_F_ERROR : Inverse flattening outside of valid range
48  * (250 to 350)
49  * ELLIPSE_NOT_USERDEF_ERROR : Ellipsoid is not user defined - cannot be
50  * deleted
51  *
52  * REUSE NOTES
53  *
54  * Ellipsoid is intended for reuse by any application that requires Earth
55  * approximating ellipsoids.
56  *
57  * REFERENCES
58  *
59  * Further information on Ellipsoid can be found in the Reuse Manual.
60  *
61  * Ellipsoid originated from : U.S. Army Topographic Engineering Center (USATEC)
62  * Geospatial Information Division (GID)
63  * 7701 Telegraph Road
64  * Alexandria, VA 22310-3864
65  *
66  * LICENSES
67  *
68  * None apply to this component.
69  *
70  * RESTRICTIONS
71  *
72  * Ellipsoid has no restrictions.
73  *
74  * ENVIRONMENT
75  *
76  * Ellipsoid was tested and certified in the following environments
77  *
78  * 1. Solaris 2.5
79  * 2. Windows 95
80  *
81  * MODIFICATIONS
82  *
83  * Date Description
84  * ---- -----------
85  * 11-19-95 Original Code
86  * 17-Jan-97 Moved local constants out of public interface
87  * Improved efficiency in algorithms (GEOTRANS)
88  * 24-May-99 Added user-defined ellipsoids (GEOTRANS for JMTK)
89  * 06-27-06 Moved data file to data directory
90  * 03-09-07 Original C++ Code
91  *
92  */
93 
94 
95 #include "DtccApi.h"
96 
97 namespace MSP
98 {
99  namespace CCS
100  {
101  class EllipsoidLibraryImplementation;
102 
103 
104  /***************************************************************************/
105  /*
106  * DEFINES
107  */
109  {
110  public:
111 
112  /*
113  * The constructor creates an empty list to store the ellipsoid data from ellips.dat,
114  * which is used to build the ellipsoid table.
115  */
116 
117  EllipsoidLibrary( EllipsoidLibraryImplementation* __ellipsoidLibraryImplementation );
118 
119 
121 
122 
123  EllipsoidLibrary& operator=( const EllipsoidLibrary &e );
124 
125 
126  ~EllipsoidLibrary( void );
127 
128 
129  /*
130  * The function defineEllipsoid creates a new ellipsoid with the specified
131  * Code, name, and axes. If the ellipsoid table has not been initialized,
132  * the specified code is already in use, or a new version of the ellips.dat
133  * file cannot be created, an exception is thrown.
134  * Note that the indexes of all ellipsoids in the ellipsoid
135  * table may be changed by this function.
136  *
137  * code : 2-letter ellipsoid code. (input)
138  * name : Name of the new ellipsoid (input)
139  * semiMajorAxis : Semi-major axis, in meters, of new ellipsoid (input)
140  * flattening : Flattening of new ellipsoid. (input)
141  *
142  */
143 
144  void defineEllipsoid( const char* code, const char* name, double semiMajorAxis, double flattening );
145 
146 
147  /*
148  * The function removeEllipsoid deletes a user defined ellipsoid with
149  * the specified Code. If the ellipsoid table has not been created,
150  * the specified code is in use by a user defined datum, or a new version
151  * of the ellips.dat file cannot be created, exception is thrown.
152  * Note that the indexes of all
153  * ellipsoids in the ellipsoid table may be changed by this function.
154  *
155  * code : 2-letter ellipsoid code. (input)
156  *
157  */
158 
159  void removeEllipsoid( const char* code );
160 
161 
162  /*
163  * The function getEllipsoidCount returns the number of ellipsoids in the
164  * ellipsoid table. If the ellipsoid table has not been initialized,
165  * an exception is thrown.
166  *
167  * count : The number of ellipsoids in the ellipsoid table. (output)
168  *
169  */
170 
171  void getEllipsoidCount ( long *count );
172 
173 
174  /*
175  * The function getEllipsoidIndex returns the index of the ellipsoid in
176  * the ellipsoid table with the specified code. If ellipsoid code is not found,
177  * an exception is thrown.
178  *
179  * code : 2-letter ellipsoid code. (input)
180  * index : Index of the ellipsoid in the ellipsoid table with the
181  * specified code (output)
182  *
183  */
184 
185  void getEllipsoidIndex( const char *code, long* index );
186 
187 
188  /*
189  * The Function getEllipsoidInfo returns the 2-letter code and name of the
190  * ellipsoid in the ellipsoid table with the specified index. If index is
191  * invalid, an exception is thrown.
192  *
193  * index : Index of a given ellipsoid in the ellipsoid table (input)
194  * code : 2-letter ellipsoid code. (output)
195  * name : Name of the ellipsoid referencd by index (output)
196  *
197  */
198 
199  void getEllipsoidInfo( const long index, char *code, char *name );
200 
201 
202  /*
203  * The function getEllipsoidParameters returns the semi-major axis and flattening
204  * for the ellipsoid with the specified index. If index is invalid,
205  * an exception is thrown.
206  *
207  * index : Index of a given ellipsoid in the ellipsoid table (input)
208  * a : Semi-major axis, in meters, of ellipsoid (output)
209  * f : Flattening of ellipsoid. (output)
210  *
211  */
212 
213  void getEllipsoidParameters( const long index, double *a, double *f );
214 
215 
216  private:
217 
218  EllipsoidLibraryImplementation* _ellipsoidLibraryImplementation;
219 
220  };
221  }
222 }
223 
224 #endif
225 
226 
227 // CLASSIFICATION: UNCLASSIFIED