~ubuntu-branches/ubuntu/wily/geotranz/wily

« back to all changes in this revision

Viewing changes to .pc/001-gxx-4-changes.patch/CCS/src/dtcc/CoordinateSystems/ellipse/EllipsoidLibraryImplementation.h

  • Committer: Bazaar Package Importer
  • Author(s): Roberto Lumbreras
  • Date: 2011-03-06 21:06:09 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110306210609-tsvzx88vdmpgc7u4
Tags: 3.1-1
* New upstream version.
* Added debian/make-orig-tar-bz2 to repackage the upstream .tgz easily.
* Dropped 005-openjdk-forms.patch, it didn't work well in all systems.
* Renamed libgeotranz3 to libgeotranz3.1 because of ABI changes.
* Added symbols64 file for alpha, s390 and 64bit architectures.
  (Closes: #609504)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// CLASSIFICATION: UNCLASSIFIED
2
 
 
3
 
#ifndef EllipsoidLibraryImplementation_H
4
 
#define EllipsoidLibraryImplementation_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_TABLE_OVERFLOW_ERROR : Ellipsoid table overflow
44
 
 *  ELLIPSE_NOT_INITIALIZED_ERROR: Ellipsoid table not initialized properly
45
 
 *  ELLIPSE_INVALID_INDEX_ERROR  : Index is an invalid value
46
 
 *  ELLIPSE_INVALID_CODE_ERROR   : Code was not found in table
47
 
 *  ELLIPSE_A_ERROR              : Semi-major axis less than or equal to zero
48
 
 *  ELLIPSE_INV_F_ERROR          : Inverse flattening outside of valid range
49
 
 *                                  (250 to 350)
50
 
 *  ELLIPSE_NOT_USERDEF_ERROR    : Ellipsoid is not user defined - cannot be
51
 
 *                                  deleted
52
 
 *
53
 
 * REUSE NOTES
54
 
 *
55
 
 *    Ellipsoid is intended for reuse by any application that requires Earth
56
 
 *    approximating ellipsoids.
57
 
 *
58
 
 * REFERENCES
59
 
 *
60
 
 *    Further information on Ellipsoid can be found in the Reuse Manual.
61
 
 *
62
 
 *    Ellipsoid originated from :  U.S. Army Topographic Engineering Center (USATEC)
63
 
 *                                 Geospatial Information Division (GID)
64
 
 *                                 7701 Telegraph Road
65
 
 *                                 Alexandria, VA  22310-3864
66
 
 *
67
 
 * LICENSES
68
 
 *
69
 
 *    None apply to this component.
70
 
 *
71
 
 * RESTRICTIONS
72
 
 *
73
 
 *    Ellipsoid has no restrictions.
74
 
 *
75
 
 * ENVIRONMENT
76
 
 *
77
 
 *    Ellipsoid was tested and certified in the following environments
78
 
 *
79
 
 *    1. Solaris 2.5
80
 
 *    2. Windows 95
81
 
 *
82
 
 * MODIFICATIONS
83
 
 *
84
 
 *    Date              Description
85
 
 *    ----              -----------
86
 
 *    11-19-95          Original Code
87
 
 *    17-Jan-97         Moved local constants out of public interface
88
 
 *                      Improved efficiency in algorithms (GEOTRANS)
89
 
 *    24-May-99         Added user-defined ellipsoids (GEOTRANS for JMTK)
90
 
 *    06-27-06          Moved data file to data directory
91
 
 *    03-09-07          Original C++ Code
92
 
 *
93
 
 */
94
 
 
95
 
 
96
 
#include <vector>
97
 
 
98
 
 
99
 
namespace MSP
100
 
{
101
 
  namespace CCS
102
 
  {
103
 
    class Ellipsoid;
104
 
    class DatumLibraryImplementation;
105
 
 
106
 
 
107
 
    /***************************************************************************/
108
 
    /*
109
 
     *                              DEFINES
110
 
     */
111
 
 
112
 
    class EllipsoidLibraryImplementation
113
 
    {
114
 
    friend class EllipsoidLibraryImplementationCleaner;
115
 
 
116
 
    public:
117
 
 
118
 
      /* 
119
 
       * The function getInstance returns an instance of the EllipsoidLibraryImplementation
120
 
       */
121
 
 
122
 
      static EllipsoidLibraryImplementation* getInstance();
123
 
 
124
 
 
125
 
      /*
126
 
       * The function removeInstance removes this EllipsoidLibraryImplementation instance from the
127
 
       * total number of instances. 
128
 
       */
129
 
 
130
 
      static void removeInstance();
131
 
 
132
 
 
133
 
            ~EllipsoidLibraryImplementation( void );
134
 
 
135
 
 
136
 
      /*
137
 
       * The function defineEllipsoid creates a new ellipsoid with the specified
138
 
       * Code, name, and axes.  If the ellipsoid table has not been initialized,
139
 
       * the specified code is already in use, or a new version of the ellips.dat
140
 
       * file cannot be created, an exception is thrown.
141
 
       * Note that the indexes of all ellipsoids in the ellipsoid
142
 
       * table may be changed by this function.
143
 
       *
144
 
       *   code           : 2-letter ellipsoid code.                      (input)
145
 
       *   name           : Name of the new ellipsoid                     (input)
146
 
       *   semiMajorAxis  : Semi-major axis, in meters, of new ellipsoid  (input)
147
 
       *   flattening     : Flattening of new ellipsoid.                  (input)
148
 
       *
149
 
       */
150
 
 
151
 
      void defineEllipsoid( const char* code, const char* name, double semiMajorAxis, double flattening );
152
 
 
153
 
 
154
 
      /*
155
 
       * The function removeEllipsoid deletes a user defined ellipsoid with
156
 
       * the specified Code.  If the ellipsoid table has not been created,
157
 
       * the specified code is in use by a user defined datum, or a new version
158
 
       * of the ellips.dat file cannot be created, an exception is thrown.
159
 
       * Note that the indexes of all
160
 
       * ellipsoids in the ellipsoid table may be changed by this function.
161
 
       *
162
 
       *   code     : 2-letter ellipsoid code.                      (input)
163
 
       *
164
 
       */
165
 
 
166
 
      void removeEllipsoid( const char* Code );
167
 
 
168
 
 
169
 
      /*
170
 
       * The function ellipsoidCount returns the number of ellipsoids in the
171
 
       * ellipsoid table.  If the ellipsoid table has not been initialized,
172
 
       * an exception is thrown.
173
 
       *
174
 
       *   count    : The number of ellipsoids in the ellipsoid table. (output)
175
 
       *
176
 
       */
177
 
 
178
 
      void ellipsoidCount ( long *count );
179
 
 
180
 
 
181
 
      /*
182
 
       *  The function ellipsoidIndex returns the index of the ellipsoid in
183
 
       *  the ellipsoid table with the specified code.  If ellipsoid code is not found,
184
 
       *  an exception is thrown.
185
 
       *
186
 
       *    code     : 2-letter ellipsoid code.                      (input)
187
 
       *    index    : Index of the ellipsoid in the ellipsoid table with the
188
 
       *                  specified code                             (output)
189
 
       *
190
 
       */
191
 
 
192
 
      void ellipsoidIndex( const char* code, long* index );
193
 
 
194
 
 
195
 
      /*
196
 
       *  The Function ellipsoidCode returns the 2-letter code for the
197
 
       *  ellipsoid in the ellipsoid table with the specified index.  If index is
198
 
       *  invalid, an exception is thrown.
199
 
       *
200
 
       *    index    : Index of a given ellipsoid in the ellipsoid table (input)
201
 
       *    code     : 2-letter ellipsoid code.                          (output)
202
 
       *
203
 
       */
204
 
 
205
 
      void ellipsoidCode( const long index, char *code );
206
 
 
207
 
 
208
 
      /*
209
 
       *  The Function ellipsoidName returns the name of the ellipsoid in
210
 
       *  the ellipsoid table with the specified index.  If index is invalid,
211
 
       *  an exception is thrown.
212
 
       *
213
 
       *    index   : Index of a given ellipsoid.in the ellipsoid table with the
214
 
       *                 specified index                             (input)
215
 
       *    name    : Name of the ellipsoid referencd by index       (output)
216
 
       *
217
 
       */
218
 
 
219
 
      void ellipsoidName( const long index, char *name );
220
 
 
221
 
 
222
 
      /*
223
 
       *  The function ellipsoidParameters returns the semi-major axis and flattening
224
 
       *  for the ellipsoid with the specified index.  If index is invalid,
225
 
       *  an exception is thrown.
226
 
       *
227
 
       *    index    : Index of a given ellipsoid in the ellipsoid table (input)
228
 
       *    a        : Semi-major axis, in meters, of ellipsoid          (output)
229
 
       *    f        : Flattening of ellipsoid.                          (output)
230
 
       *
231
 
       */
232
 
 
233
 
      void ellipsoidParameters( const long index, double *a, double *f );
234
 
 
235
 
 
236
 
      /*
237
 
       *  The function ellipsoidEccentricity2 returns the square of the
238
 
       *  eccentricity for the ellipsoid with the specified index.  If index is
239
 
       *  invalid, an exception is thrown.
240
 
       *
241
 
       *    index                : Index of a given ellipsoid in the ellipsoid table (input)
242
 
       *    eccentricitySquared  : Square of eccentricity of ellipsoid               (output)
243
 
       *
244
 
       */
245
 
 
246
 
      void ellipsoidEccentricity2( const long index, double *eccentricitySquared );
247
 
 
248
 
 
249
 
      /*
250
 
       *  The function ellipsoidUserDefined returns 1 if the ellipsoid is user
251
 
       *  defined.  Otherwise, 0 is returned.  If index is invalid an
252
 
       *  exception is thrown.
253
 
       *
254
 
       *    index    : Index of a given ellipsoid in the ellipsoid table (input)
255
 
       *    result   : Indicates whether specified ellipsoid is user defined (1)
256
 
       *               or not (0)                                        (output)
257
 
       *
258
 
       */
259
 
 
260
 
      void ellipsoidUserDefined( const long index, long *result );
261
 
 
262
 
 
263
 
      /*
264
 
       *  The function setDatumLibraryImplementation sets the datum library information
265
 
       *  which is needed to ensure a user defined ellipsoid is not in use before being deleted.
266
 
       *
267
 
       *   __datumLibraryImplementation  : Datum library implementation      (input)
268
 
       *
269
 
       */
270
 
 
271
 
      void setDatumLibraryImplementation( DatumLibraryImplementation* __datumLibraryImplementation );
272
 
 
273
 
 
274
 
    protected:
275
 
 
276
 
      /*
277
 
       * The constructor creates an empty list to store the ellipsoid data from ellips.dat,
278
 
       * which is used to build the ellipsoid table.  
279
 
       */
280
 
 
281
 
            EllipsoidLibraryImplementation();
282
 
 
283
 
 
284
 
      EllipsoidLibraryImplementation( const EllipsoidLibraryImplementation &e );
285
 
 
286
 
 
287
 
      EllipsoidLibraryImplementation& operator=( const EllipsoidLibraryImplementation &e );
288
 
 
289
 
 
290
 
 
291
 
   private:
292
 
 
293
 
      static EllipsoidLibraryImplementation* instance;
294
 
      static int instanceCount;
295
 
 
296
 
      std::vector<Ellipsoid*> ellipsoidList;
297
 
 
298
 
 
299
 
      DatumLibraryImplementation* _datumLibraryImplementation;
300
 
 
301
 
      /*
302
 
       * The function loadEllipsoids reads ellipsoid data from ellips.dat
303
 
       * and builds the ellipsoid table from it.  If an error occurs, 
304
 
       * an exception is thrown.
305
 
       */
306
 
 
307
 
      void loadEllipsoids();
308
 
 
309
 
      
310
 
      /*
311
 
       * Delete the singleton.
312
 
       */
313
 
 
314
 
      static void deleteInstance();
315
 
    };
316
 
  }
317
 
}
318
 
        
319
 
#endif 
320
 
 
321
 
// CLASSIFICATION: UNCLASSIFIED