UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
GeoidLibrary.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef GeoidLibrary_H
4 #define GeoidLibrary_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: Geoid Library
8  *
9  * ABSTRACT
10  *
11  * The purpose of GEOID is to support conversions between WGS84 ellipsoid
12  * heights and WGS84 geoid heights.
13  *
14  *
15  * ERROR HANDLING
16  *
17  * This component checks parameters for valid values. If an invalid value
18  * is found, the error code is combined with the current error code using
19  * the bitwise or. This combining allows multiple error codes to be
20  * returned. The possible error codes are:
21  *
22  * GEOID_NO_ERROR : No errors occurred in function
23  * GEOID_FILE_OPEN_ERROR : Geoid file opening error
24  * GEOID_INITIALIZE_ERROR : Geoid separation database can not initialize
25  * GEOID_LAT_ERROR : Latitude out of valid range
26  * (-90 to 90 degrees)
27  * GEOID_LON_ERROR : Longitude out of valid range
28  * (-180 to 360 degrees)
29  *
30  * REUSE NOTES
31  *
32  * Geoid is intended for reuse by any application that requires conversion
33  * between WGS84 ellipsoid heights and WGS84 geoid heights.
34  *
35  * REFERENCES
36  *
37  * Further information on Geoid can be found in the Reuse Manual.
38  *
39  * Geoid originated from : U.S. Army Topographic Engineering Center
40  * Geospatial Information Division
41  * 7701 Telegraph Road
42  * Alexandria, VA 22310-3864
43  *
44  * LICENSES
45  *
46  * None apply to this component.
47  *
48  * RESTRICTIONS
49  *
50  * Geoid has no restrictions.
51  *
52  * ENVIRONMENT
53  *
54  * Geoid was tested and certified in the following environments
55  *
56  * 1. Solaris 2.5 with GCC 2.8.1
57  * 2. MS Windows XP with MS Visual C++ 6.0
58  *
59  *
60  * MODIFICATIONS
61  *
62  * Date Description
63  * ---- -----------
64  * 24-May-99 Original Code
65  * 09-Jan-06 Added new geoid height interpolation methods
66  * 03-14-07 Original C++ Code
67  * 05-12-10 S. Gillis, BAEts26542, MSL-HAE for 30 minute grid added
68  * 07-21-10 Read in full file at once instead of one post at a time
69  * 12-17-10 RD Craig added pointer to EGM2008 interpolator (BAEts26267).
70  *
71  */
72 
73 #include "egm2008_geoid_grid.h"
74 
75 #include "DtccApi.h"
76 
77 namespace MSP
78 {
79  class CCSThreadMutex;
80  namespace CCS
81  {
133  {
134  friend class GeoidLibraryCleaner;
135 
136  public:
137 
143  static GeoidLibrary* getInstance();
144 
145 
151  static void removeInstance();
152 
153 
154  ~GeoidLibrary( void );
155 
156 
171  void convertEllipsoidToEGM96FifteenMinBilinearGeoidHeight(
172  double longitude,
173  double latitude,
174  double ellipsoidHeight,
175  double *geoidHeight );
176 
177 
192  void convertEllipsoidToEGM96VariableNaturalSplineHeight(
193  double longitude,
194  double latitude,
195  double ellipsoidHeight,
196  double *geoidHeight );
197 
212  void convertEllipsoidToEGM84TenDegBilinearHeight(
213  double longitude,
214  double latitude,
215  double ellipsoidHeight,
216  double *geoidHeight );
217 
232  void convertEllipsoidToEGM84TenDegNaturalSplineHeight(
233  double longitude,
234  double latitude,
235  double ellipsoidHeight,
236  double *geoidHeight );
237 
251  void convertEllipsoidToEGM84ThirtyMinBiLinearHeight(
252  double longitude,
253  double latitude,
254  double ellipsoidHeight,
255  double *geoidHeight );
256 
269  void
270  convertEllipsoidHeightToEGM2008GeoidHeight(
271  double longitude,
272  double latitude,
273  double ellipsoidHeight,
274  double *geoidHeight );
275 
290  void convertEGM96FifteenMinBilinearGeoidToEllipsoidHeight(
291  double longitude,
292  double latitude,
293  double geoidHeight,
294  double *ellipsoidHeight );
295 
310  void convertEGM96VariableNaturalSplineToEllipsoidHeight(
311  double longitude,
312  double latitude,
313  double geoidHeight,
314  double *ellipsoidHeight );
315 
316 
331  void convertEGM84TenDegBilinearToEllipsoidHeight(
332  double longitude,
333  double latitude,
334  double geoidHeight,
335  double *ellipsoidHeight );
336 
351  void convertEGM84TenDegNaturalSplineToEllipsoidHeight(
352  double longitude,
353  double latitude,
354  double geoidHeight,
355  double *ellipsoidHeight );
356 
370  void convertEGM84ThirtyMinBiLinearToEllipsoidHeight(
371  double longitude,
372  double latitude,
373  double geoidHeight,
374  double *ellipsoidHeight );
375 
388  void convertEGM2008GeoidHeightToEllipsoidHeight(
389  double longitude,
390  double latitude,
391  double geoidHeight,
392  double *ellipsoidHeight );
393 
394  protected:
395 
405  GeoidLibrary();
406 
407 
408  GeoidLibrary( const GeoidLibrary &gl );
409 
410 
411  GeoidLibrary& operator=( const GeoidLibrary &gl );
412 
413 
414  private:
415 
416  static CCSThreadMutex mutex;
417  static GeoidLibrary* instance;
418  static int instanceCount;
419 
420  /* List of EGM96 elevations */
421  float *egm96GeoidList;
422 
423  /* List of EGM84 elevations */
424  float *egm84GeoidList;
425 
426  /* List of EGM84 thirty minute elevations */
427  double *egm84ThirtyMinGeoidList;
428 
429  /* Pointer to EGM2008 interpolator object */
430 
431  Egm2008GeoidGrid* egm2008Geoid;
432 
446  void loadGeoids();
447 
459  void initializeEGM96Geoid();
460 
472  void initializeEGM84Geoid();
473 
485  void initializeEGM84ThirtyMinGeoid();
486 
506  void initializeEGM2008Geoid();
507 
525  void bilinearInterpolateDoubleHeights(
526  double longitude,
527  double latitude,
528  double scale_factor,
529  int num_cols,
530  int num_rows,
531  double *height_buffer,
532  double *delta_height );
533 
550  void bilinearInterpolate(
551  double longitude,
552  double latitude,
553  double scale_factor,
554  int num_cols,
555  int num_rows,
556  float *height_buffer,
557  double *delta_height );
558 
576  void naturalSplineInterpolate(
577  double longitude,
578  double latitude,
579  double scale_factor,
580  int num_cols,
581  int num_rows,
582  int max_index,
583  float *height_buffer,
584  double *delta_height );
585 
590  static void deleteInstance();
591  };
592  }
593 }
594 
595 #endif
596 
597 
598 // CLASSIFICATION: UNCLASSIFIED