~ubuntu-branches/ubuntu/raring/geotranz/raring

« back to all changes in this revision

Viewing changes to dt_cc/albers/albers.h

  • Committer: Bazaar Package Importer
  • Author(s): Roberto Lumbreras
  • Date: 2008-10-17 14:43:09 UTC
  • Revision ID: james.westby@ubuntu.com-20081017144309-jb7uzfi1y1lvez8j
Tags: upstream-2.4.2
ImportĀ upstreamĀ versionĀ 2.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef ALBERS_H
 
2
  #define ALBERS_H
 
3
 
 
4
/***************************************************************************/
 
5
/* RSC IDENTIFIER: ALBERS
 
6
 *
 
7
 * ABSTRACT
 
8
 *
 
9
 *    This component provides conversions between Geodetic coordinates 
 
10
 *    (latitude and longitude in radians) and Albers Equal Area Conic
 
11
 *    projection coordinates (easting and northing in meters) defined 
 
12
 *    by two standard parallels.
 
13
 *
 
14
 * ERROR HANDLING
 
15
 *
 
16
 *    This component checks parameters for valid values.  If an invalid value
 
17
 *    is found the error code is combined with the current error code using 
 
18
 *    the bitwise or.  This combining allows multiple error codes to be
 
19
 *    returned. The possible error codes are:
 
20
 *
 
21
 *       ALBERS_NO_ERROR           : No errors occurred in function
 
22
 *       ALBERS_LAT_ERROR          : Latitude outside of valid range
 
23
 *                                     (-90 to 90 degrees)
 
24
 *       ALBERS_LON_ERROR          : Longitude outside of valid range
 
25
 *                                     (-180 to 360 degrees)
 
26
 *       ALBERS_EASTING_ERROR      : Easting outside of valid range
 
27
 *                                     (depends on ellipsoid and projection
 
28
 *                                     parameters)
 
29
 *       ALBERS_NORTHING_ERROR     : Northing outside of valid range
 
30
 *                                     (depends on ellipsoid and projection
 
31
 *                                     parameters)
 
32
 *       ALBERS_FIRST_STDP_ERROR   : First standard parallel outside of valid
 
33
 *                                     range (-90 to 90 degrees)
 
34
 *       ALBERS_SECOND_STDP_ERROR  : Second standard parallel outside of valid
 
35
 *                                     range (-90 to 90 degrees)
 
36
 *       ALBERS_ORIGIN_LAT_ERROR   : Origin latitude outside of valid range
 
37
 *                                     (-90 to 90 degrees)
 
38
 *       ALBERS_CENT_MER_ERROR     : Central meridian outside of valid range
 
39
 *                                     (-180 to 360 degrees)
 
40
 *       ALBERS_A_ERROR            : Semi-major axis less than or equal to zero
 
41
 *       ALBERS_INV_F_ERROR        : Inverse flattening outside of valid range
 
42
 *                                                                                         (250 to 350)
 
43
 *       ALBERS_HEMISPHERE_ERROR   : Standard parallels cannot be opposite
 
44
 *                                     latitudes
 
45
 *       ALBERS_FIRST_SECOND_ERROR : The 1st & 2nd standard parallels cannot
 
46
 *                                   both be 0
 
47
 *
 
48
 *
 
49
 * REUSE NOTES
 
50
 *
 
51
 *    ALBERS is intended for reuse by any application that performs an Albers
 
52
 *    Equal Area Conic projection or its inverse.
 
53
 *    
 
54
 * REFERENCES
 
55
 *
 
56
 *    Further information on ALBERS can be found in the Reuse Manual.
 
57
 *
 
58
 *    ALBERS originated from:     U.S. Army Topographic Engineering Center
 
59
 *                                Geospatial Information Division
 
60
 *                                7701 Telegraph Road
 
61
 *                                Alexandria, VA  22310-3864
 
62
 *
 
63
 * LICENSES
 
64
 *
 
65
 *    None apply to this component.
 
66
 *
 
67
 * RESTRICTIONS
 
68
 *
 
69
 *    ALBERS has no restrictions.
 
70
 *
 
71
 * ENVIRONMENT
 
72
 *
 
73
 *    ALBERS was tested and certified in the following environments:
 
74
 *
 
75
 *    1. Solaris 2.5 with GCC, version 2.8.1
 
76
 *    2. MSDOS with MS Visual C++, version 6
 
77
 *
 
78
 * MODIFICATIONS
 
79
 *
 
80
 *    Date              Description
 
81
 *    ----              -----------
 
82
 *    07-09-99          Original Code
 
83
 *
 
84
 */
 
85
 
 
86
 
 
87
 
 
88
/***************************************************************************/
 
89
/*
 
90
 *                              DEFINES
 
91
 */
 
92
 
 
93
  #define ALBERS_NO_ERROR           0x0000
 
94
  #define ALBERS_LAT_ERROR          0x0001
 
95
  #define ALBERS_LON_ERROR          0x0002
 
96
  #define ALBERS_EASTING_ERROR      0x0004
 
97
  #define ALBERS_NORTHING_ERROR     0x0008
 
98
  #define ALBERS_ORIGIN_LAT_ERROR   0x0010
 
99
  #define ALBERS_CENT_MER_ERROR     0x0020
 
100
  #define ALBERS_A_ERROR            0x0040
 
101
  #define ALBERS_INV_F_ERROR        0x0080
 
102
  #define ALBERS_FIRST_STDP_ERROR   0x0100
 
103
  #define ALBERS_SECOND_STDP_ERROR  0x0200
 
104
  #define ALBERS_FIRST_SECOND_ERROR 0x0400
 
105
  #define ALBERS_HEMISPHERE_ERROR   0x0800
 
106
 
 
107
/***************************************************************************/
 
108
/*
 
109
 *                              FUNCTION PROTOTYPES
 
110
 *                                for ALBERS.C
 
111
 */
 
112
 
 
113
/* ensure proper linkage to c++ programs */
 
114
 
 
115
 
 
116
  #ifdef __cplusplus
 
117
extern "C" {
 
118
  #endif
 
119
 
 
120
 
 
121
 
 
122
  long Set_Albers_Parameters(double a,
 
123
                             double f,
 
124
                             double Origin_Latitude,
 
125
                             double Central_Meridian,
 
126
                             double Std_Parallel_1,
 
127
                             double Std_Parallel_2,
 
128
                             double False_Easting,
 
129
                             double False_Northing);
 
130
 
 
131
/* The function Set_Albers_Parameters receives the ellipsoid parameters and
 
132
 * projection parameters as inputs, and sets the corresponding state
 
133
 * variables.  If any errors occur, the error code(s) are returned by the function, 
 
134
 * otherwise ALBERS_NO_ERROR is returned.
 
135
 *
 
136
 *    a                 : Semi-major axis of ellipsoid, in meters   (input)
 
137
 *    f                 : Flattening of ellipsoid                                                       (input)
 
138
 *    Origin_Latitude   : Latitude in radians at which the          (input)
 
139
 *                          point scale factor is 1.0
 
140
 *    Central_Meridian  : Longitude in radians at the center of     (input)
 
141
 *                          the projection (central meridian)
 
142
 *    Std_Parallel_1    : First standard parallel                   (input)
 
143
 *    Std_Parallel_2    : Second standard parallel                  (input)
 
144
 *    False_Easting     : A coordinate value in meters assigned to the
 
145
 *                          central meridian of the projection.     (input)
 
146
 *    False_Northing    : A coordinate value in meters assigned to the
 
147
 *                          origin latitude of the projection       (input)
 
148
 */
 
149
 
 
150
 
 
151
  void Get_Albers_Parameters(double *a,
 
152
                             double *f,
 
153
                             double *Origin_Latitude,
 
154
                             double *Central_Meridian,
 
155
                             double *Std_Parallel_1,
 
156
                             double *Std_Parallel_2,
 
157
                             double *False_Easting,
 
158
                             double *False_Northing);
 
159
 
 
160
/* The function Get_Albers_Parameters returns the current ellipsoid
 
161
 * parameters, and Albers projection parameters.
 
162
 *
 
163
 *    a                 : Semi-major axis of ellipsoid, in meters   (output)
 
164
 *    f                 : Flattening of ellipsoid                                                       (output)
 
165
 *    Origin_Latitude   : Latitude in radians at which the          (output)
 
166
 *                          point scale factor is 1.0
 
167
 *    Central_Meridian  : Longitude in radians at the center of     (output)
 
168
 *                          the projection
 
169
 *    Std_Parallel_1    : First standard parallel                   (output)
 
170
 *    Std_Parallel_2    : Second standard parallel                  (output)
 
171
 *    False_Easting     : A coordinate value in meters assigned to the
 
172
 *                          central meridian of the projection.     (output)
 
173
 *    False_Northing    : A coordinate value in meters assigned to the
 
174
 *                          origin latitude of the projection       (output)
 
175
 */
 
176
 
 
177
 
 
178
  long Convert_Geodetic_To_Albers (double Latitude,
 
179
                                   double Longitude,
 
180
                                   double *Easting,
 
181
                                   double *Northing);
 
182
 
 
183
/* The function Convert_Geodetic_To_Albers converts geodetic (latitude and
 
184
 * longitude) coordinates to Albers projection (easting and northing)
 
185
 * coordinates, according to the current ellipsoid and Albers projection
 
186
 * parameters.  If any errors occur, the error code(s) are returned by the
 
187
 * function, otherwise ALBERS_NO_ERROR is returned.
 
188
 *
 
189
 *    Latitude          : Latitude (phi) in radians           (input)
 
190
 *    Longitude         : Longitude (lambda) in radians       (input)
 
191
 *    Easting           : Easting (X) in meters               (output)
 
192
 *    Northing          : Northing (Y) in meters              (output)
 
193
 */
 
194
 
 
195
 
 
196
  long Convert_Albers_To_Geodetic(double Easting,
 
197
                                  double Northing,
 
198
                                  double *Latitude,
 
199
                                  double *Longitude);
 
200
 
 
201
/* The function Convert_Albers_To_Geodetic converts Albers projection
 
202
 * (easting and northing) coordinates to geodetic (latitude and longitude)
 
203
 * coordinates, according to the current ellipsoid and Albers projection
 
204
 * coordinates.  If any errors occur, the error code(s) are returned by the
 
205
 * function, otherwise ALBERS_NO_ERROR is returned.
 
206
 *
 
207
 *    Easting           : Easting (X) in meters                  (input)
 
208
 *    Northing          : Northing (Y) in meters                 (input)
 
209
 *    Latitude          : Latitude (phi) in radians              (output)
 
210
 *    Longitude         : Longitude (lambda) in radians          (output)
 
211
 */
 
212
 
 
213
 
 
214
  #ifdef __cplusplus
 
215
}
 
216
  #endif
 
217
 
 
218
#endif