UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
EllipsoidLibraryImplementation.cpp
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 /****************************************************************************/
4 /* RSC IDENTIFIER: Ellipsoid Library Implementation
5  *
6  * ABSTRACT
7  *
8  * The purpose of ELLIPSOID is to provide access to ellipsoid parameters
9  * for a collection of common ellipsoids. A particular ellipsoid can be
10  * accessed by using its standard 2-letter code to find its index in the
11  * ellipsoid table. The index can then be used to retrieve the ellipsoid
12  * name and parameters.
13  *
14  * By sequentially retrieving all of the ellipsoid codes and/or names, a
15  * menu of the available ellipsoids can be constructed. The index values
16  * resulting from selections from this menu can then be used to access the
17  * parameters of the selected ellipsoid.
18  *
19  * This component depends on a data file named "ellips.dat", which contains
20  * the ellipsoid parameter values. A copy of this file must be located in
21  * the directory specified by the environment variable "MSPCCS_DATA", if
22  * defined, or else in the current directory, whenever a program containing
23  * this component is executed.
24  *
25  * Additional ellipsoids can be added to this file, either manually or using
26  * the Create_Ellipsoid function. However, if a large number of ellipsoids
27  * are added, the ellipsoid table array size in this component will have to
28  * be increased.
29  *
30  * ERROR HANDLING
31  *
32  * This component checks parameters for valid values. If an invalid value
33  * is found, the error code is combined with the current error code using
34  * the bitwise or. This combining allows multiple error codes to be
35  * returned. The possible error codes are:
36  *
37  * ELLIPSE_NO_ERROR : No errors occured in function
38  * ELLIPSE_FILE_OPEN_ERROR : Ellipsoid file opening error
39  * ELLIPSE_INITIALIZE_ERROR : Ellipsoid table can not initialize
40  * ELLIPSE_NOT_INITIALIZED_ERROR: Ellipsoid table not initialized properly
41  * ELLIPSE_INVALID_INDEX_ERROR : Index is an invalid value
42  * ELLIPSE_INVALID_CODE_ERROR : Code was not found in table
43  * ELLIPSE_A_ERROR : Semi-major axis less than or equal to zero
44  * ELLIPSE_INV_F_ERROR : Inverse flattening outside of valid range
45  * (250 to 350)
46  * ELLIPSE_NOT_USERDEF_ERROR : Ellipsoid is not user defined - cannot be
47  * deleted
48  *
49  * REUSE NOTES
50  *
51  * Ellipsoid is intended for reuse by any application that requires Earth
52  * approximating ellipsoids.
53  *
54  * REFERENCES
55  *
56  * Further information on Ellipsoid can be found in the Reuse Manual.
57  *
58  * Ellipsoid originated from : U.S. Army Topographic Engineering Center (USATEC)
59  * Geospatial Information Division (GID)
60  * 7701 Telegraph Road
61  * Alexandria, VA 22310-3864
62  *
63  * LICENSES
64  *
65  * None apply to this component.
66  *
67  * RESTRICTIONS
68  *
69  * Ellipsoid has no restrictions.
70  *
71  * ENVIRONMENT
72  *
73  * Ellipsoid was tested and certified in the following environments
74  *
75  * 1. Solaris 2.5
76  * 2. Windows 95
77  *
78  * MODIFICATIONS
79  *
80  * Date Description
81  * ---- -----------
82  * 11-19-95 Original Code
83  * 17-Jan-97 Moved local constants out of public interface
84  * Improved efficiency in algorithms (GEOTRANS)
85  * 24-May-99 Added user-defined ellipsoids (GEOTRANS for JMTK)
86  * 06-27-06 Moved data file to data directory
87  * 03-09-07 Original C++ Code
88  * 06-11-10 S. Gillis, BAEts26724, Fixed memory error problem
89  * when MSPCCS_DATA is not set
90  * 07-07-10 K.Lam, BAEts27269, Replace C functions in threads.h
91  * with C++ methods in classes CCSThreadMutex
92  * 05-16-11 T. Thompson, BAEts27393, Inform user when MSPCCS_DATA
93  * is not defined.
94  * 07/17/12 S.Gillis,MSP_00029561,Fixed problem with creating and
95  * deleting ellipsoid
96  * 10/08/17 M. Thakkar : LSC-13195 : Fixed array out of bounds error (ELLIPSOID_NAME_LENGTH)
97  */
98 
99 
100 /***************************************************************************/
101 /*
102  * INCLUDES
103  */
104 
105 #include <stdlib.h>
106 #include <ctype.h>
107 #include <stdio.h>
108 #include <string.h>
110 #include "Ellipsoid.h"
113 #include "ErrorMessages.h"
114 #include "CCSThreadMutex.h"
115 #include "CCSThreadLock.h"
116 
117 #ifdef NDK_BUILD
118 #include <string>
119 #include <iostream>
120 #include <sstream>
121 #include <android/log.h>
122 
123 using namespace std;
124 
125 #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "GtApp", __VA_ARGS__))
126 #endif
127 
128 
129 /*
130  * ctype.h - standard C character handling library
131  * stdio.h - standard C input/output library
132  * stdlib.h - standard C general utilities library
133  * string.h - standard C string handling library
134  * DatumLibraryImplementation.h - used to determine
135  * if user defined ellipsoid is in use by a user defined datum
136  * EllipsoidLibraryImplementation.h - prototype error checking and error codes
137  * Ellipsoid.h - used to store individual ellipsoid information
138  * threads.h - used for thread safety
139  * CoordinateConversionException.h - Exception handler
140  * ErrorMessages.h - Contains exception messages
141  */
142 
143 
144 using namespace MSP::CCS;
145 using MSP::CCSThreadMutex;
146 using MSP::CCSThreadLock;
147 
148 
149 /***************************************************************************/
150 /* DEFINES
151  *
152  */
153 
154 const int ELLIPSOID_CODE_LENGTH = 3; /* Length of ellipsoid code (including null) */
155 const int ELLIPSOID_NAME_LENGTH = 30; /* Max length of ellipsoid name */
156 const int ELLIPSOID_BUF = 90;
157 const int FILENAME_LENGTH = 128;
158 const char *WGS84_Ellipsoid_Code = "WE";
159 const char *WGS72_Ellipsoid_Code = "WD";
160 
161 
162 /************************************************************************/
163 /* FUNCTIONS
164  *
165  */
166 
167 /* This class is a safeguard to make sure the singleton gets deleted
168  * when the application exits
169  */
170 namespace MSP
171 {
172  namespace CCS
173  {
175 {
176  public:
177 
179  {
180  CCSThreadLock lock(&EllipsoidLibraryImplementation::mutex);
181  EllipsoidLibraryImplementation::deleteInstance();
182  }
183 
185  }
186 }
187 
188 // Make this class a singleton, so the data file is only initialized once
189 CCSThreadMutex EllipsoidLibraryImplementation::mutex;
190 EllipsoidLibraryImplementation* EllipsoidLibraryImplementation::instance = 0;
191 int EllipsoidLibraryImplementation::instanceCount = 0;
192 
193 
194 EllipsoidLibraryImplementation* EllipsoidLibraryImplementation::getInstance()
195 {
196  CCSThreadLock lock(&mutex);
197  if( instance == 0 )
198  instance = new EllipsoidLibraryImplementation;
199 
200  instanceCount++;
201 
202  return instance;
203 }
204 
205 
206 void EllipsoidLibraryImplementation::removeInstance()
207 {
208 /*
209  * The function removeInstance removes this EllipsoidLibraryImplementation instance from the
210  * total number of instances.
211  */
212  CCSThreadLock lock(&mutex);
213  if( --instanceCount < 1 )
214  {
215  deleteInstance();
216  }
217 }
218 
219 
220 void EllipsoidLibraryImplementation::deleteInstance()
221 {
222 /*
223  * Delete the singleton.
224  */
225 
226  if( instance != 0 )
227  {
228  delete instance;
229  instance = 0;
230  }
231 }
232 
233 
234 EllipsoidLibraryImplementation::EllipsoidLibraryImplementation():
235  _datumLibraryImplementation( 0 )
236 {
237  /*
238  * The constructor loads ellipsoids from data file.
239  */
240  loadEllipsoids();
241 }
242 
243 
245 {
246  int size = el.ellipsoidList.size();
247  for( int i = 0; i < size; i++ )
248  ellipsoidList.push_back( new Ellipsoid( *( el.ellipsoidList[i] ) ) );
249 
250  _datumLibraryImplementation = el._datumLibraryImplementation;
251 }
252 
253 
255 {
256  std::vector<Ellipsoid*>::iterator iter = ellipsoidList.begin();
257  while( iter != ellipsoidList.end() )
258  {
259  delete( *iter );
260  iter++;
261  }
262  ellipsoidList.clear();
263 
264  _datumLibraryImplementation = 0;
265 }
266 
267 
269 {
270  if ( &el == this )
271  return *this;
272 
273  int size = el.ellipsoidList.size();
274  for( int i = 0; i < size; i++ )
275  ellipsoidList[i] = new Ellipsoid( *( el.ellipsoidList[i] ) );
276 
277  _datumLibraryImplementation = el._datumLibraryImplementation;
278 
279  return *this;
280 }
281 
282 
283 void EllipsoidLibraryImplementation::defineEllipsoid( const char* code, const char* name, double semiMajorAxis, double flattening )
284 {
285 /*
286  * The function defineEllipsoid creates a new ellipsoid with the specified
287  * Code, name, and axes. If the ellipsoid table has not been initialized,
288  * the specified code is already in use, or a new version of the ellips.dat
289  * file cannot be created, an exception is thrown.
290  * Note that the indexes of all ellipsoids in the ellipsoid
291  * table may be changed by this function.
292  *
293  * code : 2-letter ellipsoid code. (input)
294  * name : Name of the new ellipsoid (input)
295  * semiMajorAxis : Semi-major axis, in meters, of new ellipsoid (input)
296  * flattening : Flattening of new ellipsoid. (input)
297  *
298  */
299 
300  long code_length = 0;
301  char *PathName = NULL;
302  char FileName[FILENAME_LENGTH];
303  char ellipsoid_code[ELLIPSOID_CODE_LENGTH];
304  FILE *fp = NULL; /* File pointer to file ellips.dat */
305  long index = 0;
306  long numEllipsoids = ellipsoidList.size();
307  double inv_f = 1 / flattening;
308 
309 #ifdef NDK_BUILD
310  __android_log_print(ANDROID_LOG_VERBOSE, "GtApp", "numEllipsoid %d ", numEllipsoids );
311 #endif
312 
313  // assume the ellipsoid code is new
314  bool isNewEllipsoidCode = true;
315  try
316  {
317  // check if ellipsoid code exists
318  ellipsoidIndex( code, &index );
319  // get here if ellipsoid code is found in current ellipsoid table
320  isNewEllipsoidCode = false;
321  }
323  {
324  // the ellipsoid code is new, keep going
325  }
326 
327  // the ellipsoid code exists in current ellipsoid table, throw an error
328  if ( !isNewEllipsoidCode )
330 
331  code_length = strlen( code );
332 
333  if( ( code_length > ( ELLIPSOID_CODE_LENGTH - 1 ) ) )
335  if( semiMajorAxis <= 0.0 )
337  if( (inv_f < 250 ) || ( inv_f > 350 ) )
338  { /* Inverse flattening must be between 250 and 350 */
340  }
341 
342  strcpy( ellipsoid_code, code );
343  /* Convert code to upper case */
344  for( int i = 0; i < code_length; i++ )
345  ellipsoid_code[i] = ( char )toupper( ellipsoid_code[i] );
346 
347  double semiMinorAxis = semiMajorAxis * ( 1 - flattening );
348  double eccentricitySquared = 2.0 * flattening - flattening * flattening;
349  ellipsoidList.push_back( new Ellipsoid( index, ellipsoid_code, ( char* )name,
350  semiMajorAxis, semiMinorAxis, flattening, eccentricitySquared, true ) );
351 
352  numEllipsoids++;
353 
354  CCSThreadLock lock(&mutex);
355 
356  /*output updated ellipsoid table*/
357  PathName = getenv( "MSPCCS_DATA" );
358  if( PathName != NULL )
359  {
360  strcpy( FileName, PathName );
361  strcat( FileName, "/" );
362  }
363  else
364  {
365  strcpy( FileName, "../../data/" );
366  }
367  strcat( FileName, "ellips.dat" );
368 
369  if( ( fp = fopen( FileName, "w" ) ) == NULL )
370  { /* fatal error */
372  }
373 
374  /* write file */
375  index = 0;
376  while( index < numEllipsoids )
377  {
378  if( ellipsoidList[index]->userDefined() )
379  {
380  fprintf( fp, "*%-28s %-2s %11.9f %12.9f %13.13f \n",
381  ellipsoidList[index]->name(),
382  ellipsoidList[index]->code(),
383  ellipsoidList[index]->semiMajorAxis(),
384  ellipsoidList[index]->semiMinorAxis(),
385  1 / ellipsoidList[index]->flattening() );
386  }
387  else
388  {
389  fprintf( fp, "%-29s %-2s %11.9f %12.9f %13.13f \n",
390  ellipsoidList[index]->name(),
391  ellipsoidList[index]->code(),
392  ellipsoidList[index]->semiMajorAxis(),
393  ellipsoidList[index]->semiMinorAxis(),
394  1 / ellipsoidList[index]->flattening() );
395  }
396  index++;
397  }
398 
399  fclose( fp );
400 }
401 
402 
404 {
405 /*
406  * The function removeEllipsoid deletes a user defined ellipsoid with
407  * the specified Code. If the ellipsoid table has not been created,
408  * the specified code is in use by a user defined datum, or a new version
409  * of the ellips.dat file cannot be created, an exception is thrown.
410  * Note that the indexes of all
411  * ellipsoids in the ellipsoid table may be changed by this function.
412  *
413  * code : 2-letter ellipsoid code. (input)
414  *
415  */
416 
417  long index = 0;
418  char *PathName = NULL;
419  char FileName[FILENAME_LENGTH];
420  FILE *fp = NULL; /* File pointer to file ellips.dat */
421 
422  ellipsoidIndex( code, &index );
423  if( ellipsoidList[index]->userDefined() )
424  {
425  if( _datumLibraryImplementation )
426  {
427  if( _datumLibraryImplementation->datumUsesEllipsoid( code ) )
429  }
430  }
431  else
433 
434  ellipsoidList.erase( ellipsoidList.begin() + index );
435 
436  int numEllipsoids = ellipsoidList.size();
437 
438  CCSThreadLock lock(&mutex);
439 
440  /*output updated ellipsoid table*/
441  PathName = getenv( "MSPCCS_DATA" );
442  if( PathName != NULL )
443  {
444  strcpy( FileName, PathName );
445  strcat( FileName, "/" );
446  }
447  else
448  {
449  strcpy( FileName, "../../data/" );
450  }
451  strcat( FileName, "ellips.dat" );
452  if( ( fp = fopen( FileName, "w" ) ) == NULL )
453  { /* fatal error */
455  }
456  /* write file */
457  index = 0;
458  while( index < numEllipsoids )
459  {
460  if( ellipsoidList[index]->userDefined() )
461  {
462  fprintf(fp, "*%-28s %-2s %11.3f %12.4f %13.9f \n",
463  ellipsoidList[index]->name(),
464  ellipsoidList[index]->code(),
465  ellipsoidList[index]->semiMajorAxis(),
466  ellipsoidList[index]->semiMinorAxis(),
467  1 / ellipsoidList[index]->flattening() );
468  }
469  else
470  {
471  fprintf(fp, "*%-29s %-2s %11.3f %12.4f %13.9f \n",
472  ellipsoidList[index]->name(),
473  ellipsoidList[index]->code(),
474  ellipsoidList[index]->semiMajorAxis(),
475  ellipsoidList[index]->semiMinorAxis(),
476  1 / ellipsoidList[index]->flattening() );
477  }
478  index++;
479  }
480 
481  fclose( fp );
482 }
483 
484 
486 {
487 /*
488  * The function ellipsoidCount returns the number of ellipsoids in the
489  * ellipsoid table. If the ellipsoid table has not been initialized,
490  * an exception is thrown.
491  *
492  * count : The number of ellipsoids in the ellipsoid table. (output)
493  *
494  */
495 
496  *count = ellipsoidList.size();
497 }
498 
499 
500 void EllipsoidLibraryImplementation::ellipsoidIndex( const char *code, long* index )
501 {
502 /*
503  * The function ellipsoidIndex returns the index of the ellipsoid in
504  * the ellipsoid table with the specified code. If ellipsoid code is not found,
505  * an exception is thrown.
506  *
507  * code : 2-letter ellipsoid code. (input)
508  * index : Index of the ellipsoid in the ellipsoid table with the
509  * specified code (output)
510  *
511  */
512 
513  char temp_code[3];
514  long i = 0; /* index for ellipsoid table */
515  long j = 0;
516 
517  while( j < ELLIPSOID_CODE_LENGTH )
518  {
519  temp_code[j] = ( char )toupper(code[j]);
520  j++;
521  }
522  temp_code[ELLIPSOID_CODE_LENGTH - 1] = 0;
523 
524  int numEllipsoids = ellipsoidList.size();
525 
526 #ifdef NDK_BUILD
527  __android_log_print(ANDROID_LOG_VERBOSE, "GtApp", "ellipsoid code %s %d ", code, numEllipsoids );
528 #endif
529 
530  while( ( i < numEllipsoids )
531  && strcmp( temp_code, ellipsoidList[i]->code() ) )
532  {
533  i++;
534  }
535 
536  if( i == numEllipsoids )
538  else
539  {
540  if ( strcmp( temp_code, ellipsoidList[i]->code() ) )
542  else
543  *index = i;
544  }
545 }
546 
547 
548 void EllipsoidLibraryImplementation::ellipsoidCode( const long index, char *code )
549 {
550 /*
551  * The Function ellipsoidCode returns the 2-letter code for the
552  * ellipsoid in the ellipsoid table with the specified index. If index is
553  * invalid, an exception is thrown.
554  *
555  * index : Index of a given ellipsoid in the ellipsoid table (input)
556  * code : 2-letter ellipsoid code. (output)
557  *
558  */
559 
560  strcpy( code, "" );
561 
562  if ( ( index < 0 ) || ( index >= ellipsoidList.size() ) )
564  else
565  strcpy( code, ellipsoidList[index]->code() );
566 }
567 
568 
569 void EllipsoidLibraryImplementation::ellipsoidName( const long index, char *name )
570 {
571 /*
572  * The function ellipsoidName returns the name of the ellipsoid in
573  * the ellipsoid table with the specified index. If index is invalid,
574  * an exception is thrown.
575  *
576  * index : Index of a given ellipsoid.in the ellipsoid table with the
577  * specified index (input)
578  * name : Name of the ellipsoid referencd by index (output)
579  *
580  */
581 
582  strcpy( name,"" );
583 
584  if( ( index < 0 ) || ( index >= ellipsoidList.size() ) )
586  else
587  strcpy( name, ellipsoidList[index]->name() );
588 }
589 
590 
591 void EllipsoidLibraryImplementation::ellipsoidParameters( const long index, double *a, double *f )
592 {
593 /*
594  * The function ellipsoidParameters returns the semi-major axis and flattening
595  * for the ellipsoid with the specified index. If index is invalid,
596  * exception is thrown.
597  *
598  * index : Index of a given ellipsoid in the ellipsoid table (input)
599  * a : Semi-major axis, in meters, of ellipsoid (output)
600  * f : Flattening of ellipsoid. (output)
601  *
602  */
603 
604  *a = 0;
605  *f = 0;
606 
607  if( ( index < 0 ) || ( index >= ellipsoidList.size() ) )
609  else
610  {
611  Ellipsoid* ellipsoid = ellipsoidList[index];
612  *a = ellipsoid->semiMajorAxis();
613  *f = ellipsoid->flattening();
614  }
615 }
616 
617 
618 void EllipsoidLibraryImplementation::ellipsoidEccentricity2( const long index, double *eccentricitySquared )
619 {
620 /*
621  * The function ellipsoidEccentricity2 returns the square of the
622  * eccentricity for the ellipsoid with the specified index. If index is
623  * invalid, an exception is thrown.
624  *
625  * index : Index of a given ellipsoid in the ellipsoid table (input)
626  * eccentricitySquared : Square of eccentricity of ellipsoid (output)
627  *
628  */
629 
630  *eccentricitySquared = 0;
631 
632  if( ( index < 0 ) || ( index >= ellipsoidList.size() ) )
634  else
635  *eccentricitySquared = ellipsoidList[index]->eccentricitySquared();
636 }
637 
638 
639 void EllipsoidLibraryImplementation::ellipsoidUserDefined( const long index, long *result )
640 {
641 /*
642  * The function ellipsoidUserDefined returns 1 if the ellipsoid is user
643  * defined. Otherwise, 0 is returned. If index is invalid,
644  * an exception is thrown.
645  *
646  * index : Index of a given ellipsoid in the ellipsoid table (input)
647  * result : Indicates whether specified ellipsoid is user defined (1)
648  * or not (0) (output)
649  *
650  */
651 
652  *result = false;
653 
654  if( ( index < 0 ) || ( index >= ellipsoidList.size() ) )
656  else
657  *result = ellipsoidList[index]->userDefined();
658 }
659 
660 
662 {
663 /*
664  * The function setDatumLibraryImplementation sets the datum library information
665  * which is needed to ensure a user defined ellipsoid is not in use before being deleted.
666  *
667  * __datumLibraryImplementation : Datum library implementation (input)
668  *
669  */
670 
671  _datumLibraryImplementation = __datumLibraryImplementation;
672 }
673 
674 
675 /************************************************************************/
676 /* PRIVATE FUNCTIONS
677  *
678  */
679 
680 void EllipsoidLibraryImplementation::loadEllipsoids()
681 {
682 /*
683  * The function loadEllipsoids reads ellipsoid data from ellips.dat
684  * and builds the ellipsoid table from it. If an error occurs, an
685  * exception is thrown.
686  */
687 
688  char* PathName = NULL;
689  char* FileName = 0;
690  FILE* fp = NULL; /* File pointer to file ellips.dat */
691  char buffer[ELLIPSOID_BUF];
692  long index = 0; /* Array index */
693 
694  CCSThreadLock lock(&mutex);
695 
696  /* Check the environment for a user provided path, else current directory; */
697  /* Build a File Name, including specified or default path: */
698 
699 #ifdef NDK_BUILD
700  PathName = "/data/data/com.baesystems.msp.geotrans/lib/";
701  FileName = new char[ 80 ];
702  strcpy( FileName, PathName );
703  strcat( FileName, "libellipsdat.so" );
704 #else
705  PathName = getenv( "MSPCCS_DATA" );
706  if (PathName != NULL)
707  {
708  FileName = new char[ strlen( PathName ) + 12 ];
709  strcpy( FileName, PathName );
710  strcat( FileName, "/" );
711  }
712  else
713  {
714  FileName = new char[ 22 ];
715  strcpy( FileName, "../../data/" );
716  }
717  strcat( FileName, "ellips.dat" );
718 #endif
719 
720  /* Open the File READONLY, or Return Error Condition: */
721 
722  if( ( fp = fopen( FileName, "r" ) ) == NULL )
723  {
724  delete [] FileName;
725  FileName = 0;
726 
727  if (NULL == PathName)
728  {
729  throw CoordinateConversionException( "Environment variable undefined: MSPCCS_DATA." );
730  }
731  else
732  {
734  }
735  }
736 
737  /* read file */
738  while( !feof( fp ) )
739  {
740  if( fgets( buffer, ELLIPSOID_BUF, fp ) )
741  {
742  char name[ELLIPSOID_NAME_LENGTH];
743  char code[ELLIPSOID_CODE_LENGTH];
744  double semiMajorAxis;
745  double semiMinorAxis;
746  double recpF;
747 
748  sscanf( buffer, "%30c %s %lf %lf %lf", name, code, &semiMajorAxis, &semiMinorAxis, &recpF );
749 
750  bool userDefined = false; /* Identifies a user defined ellipsoid */
751  if( name[0] == '*' )
752  {
753  userDefined = true;
754  for( int i = 0; i < ELLIPSOID_NAME_LENGTH - 1; i++ )
755  name[i] = name[i+1];
756  }
757 
758  name[ELLIPSOID_NAME_LENGTH - 1] = '\0'; /* null terminate */
759 
760  double flattening = 1 / recpF;
761  double eccentricitySquared = 2.0 * flattening - flattening * flattening;
762 
763 #ifdef NDK_BUILD
764  // LOGW("GtApp: name=%s code=%s recpF=%f", name, code, recpF);
765  __android_log_print(ANDROID_LOG_VERBOSE, "GtApp", "name %s", name);
766  __android_log_print(ANDROID_LOG_VERBOSE, "GtApp", "code %s", code);
767  __android_log_print(ANDROID_LOG_VERBOSE, "GtApp", "major %f", semiMajorAxis);
768  __android_log_print(ANDROID_LOG_VERBOSE, "GtApp", "minor %f", semiMinorAxis);
769  __android_log_print(ANDROID_LOG_VERBOSE, "GtApp", "recpF %f", recpF);
770 #endif
771 
772  ellipsoidList.push_back( new Ellipsoid( index, code, name, semiMajorAxis, semiMinorAxis, flattening, eccentricitySquared, userDefined ) );
773 
774  index++;
775  }
776  }
777 
778  fclose( fp );
779 
780  delete [] FileName;
781  FileName = 0;
782 }
783 
784 // CLASSIFICATION: UNCLASSIFIED
static const char * ellipsoidFlattening
Definition: ErrorMessages.h:47
static const char * ellipsoidFileOpenError
Definition: ErrorMessages.h:27
const int FILENAME_LENGTH
static const char * ellipseInUse
Definition: ErrorMessages.h:43
static const char * notUserDefined
Definition: ErrorMessages.h:42
void defineEllipsoid(const char *code, const char *name, double semiMajorAxis, double flattening)
bool datumUsesEllipsoid(const char *ellipsoidCode)
const int ELLIPSOID_NAME_LENGTH
void ellipsoidUserDefined(const long index, long *result)
const char * WGS84_Ellipsoid_Code
void ellipsoidEccentricity2(const long index, double *eccentricitySquared)
static const char * semiMajorAxis
Definition: ErrorMessages.h:46
double flattening() const
Definition: Ellipsoid.cpp:92
const int ELLIPSOID_BUF
void ellipsoidParameters(const long index, double *a, double *f)
static const char * invalidIndex
Definition: ErrorMessages.h:99
static const char * invalidEllipsoidCode
Definition: ErrorMessages.h:31
EllipsoidLibraryImplementation & operator=(const EllipsoidLibraryImplementation &e)
void setDatumLibraryImplementation(DatumLibraryImplementation *__datumLibraryImplementation)
class MSP::CCS::EllipsoidLibraryImplementationCleaner ellipsoidLibraryImplementationCleanerInstance
const int ELLIPSOID_NAME_LENGTH
double semiMajorAxis() const
Definition: Ellipsoid.cpp:80
const int ELLIPSOID_CODE_LENGTH
const char * WGS72_Ellipsoid_Code