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

« back to all changes in this revision

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