1 /**********************************************************
2  * Version $Id: cassini.h 911 2011-02-14 16:38:15Z reklov_w $
3  *********************************************************/
4 #ifndef CASSINI_H
5   #define CASSINI_H
6 
7 /***************************************************************************/
8 /* RSC IDENTIFIER: CASSINI
9  *
10  * ABSTRACT
11  *
12  *    This component provides conversions between Geodetic coordinates
13  *    (latitude and longitude in radians) and Cassini projection coordinates
14  *    (easting and northing in meters).
15  *
16  * ERROR HANDLING
17  *
18  *    This component checks parameters for valid values.  If an invalid value
19  *    is found, the error code is combined with the current error code using
20  *    the bitwise or.  This combining allows multiple error codes to be
21  *    returned. The possible error codes are:
22  *
23  *          CASS_NO_ERROR           : No errors occurred in function
24  *          CASS_LAT_ERROR          : Latitude outside of valid range
25  *                                      (-90 to 90 degrees)
26  *          CASS_LON_ERROR          : Longitude outside of valid range
27  *                                      (-180 to 360 degrees)
28  *          CASS_EASTING_ERROR      : Easting outside of valid range
29  *                                      (False_Easting +/- ~20,000,000 m,
30  *                                       depending on ellipsoid parameters
31  *                                       and Origin_Latitude)
32  *          CASS_NORTHING_ERROR     : Northing outside of valid range
33  *                                      (False_Northing +/- ~57,000,000 m,
34  *                                       depending on ellipsoid parameters
35  *                                       and Origin_Latitude)
36  *          CASS_ORIGIN_LAT_ERROR   : Origin latitude outside of valid range
37  *                                      (-90 to 90 degrees)
38  *          CASS_CENT_MER_ERROR     : Central meridian outside of valid range
39  *                                      (-180 to 360 degrees)
40  *          CASS_A_ERROR            : Semi-major axis less than or equal to zero
41  *          CASS_INV_F_ERROR        : Inverse flattening outside of valid range
42  *									                    (250 to 350)
43  *			CASS_LON_WARNING        : Distortion will result if longitude is more
44  *                                      than 4 degrees from the Central Meridian
45  *
46  * REUSE NOTES
47  *
48  *    CASSINI is intended for reuse by any application that performs a
49  *    Cassini projection or its inverse.
50  *
51  * REFERENCES
52  *
53  *    Further information on CASSINI can be found in the Reuse Manual.
54  *
55  *    CASSINI originated from :  U.S. Army Topographic Engineering Center
56  *                               Geospatial Information Division
57  *                               7701 Telegraph Road
58  *                               Alexandria, VA  22310-3864
59  *
60  * LICENSES
61  *
62  *    None apply to this component.
63  *
64  * RESTRICTIONS
65  *
66  *    CASSINI has no restrictions.
67  *
68  * ENVIRONMENT
69  *
70  *    CASSINI was tested and certified in the following environments:
71  *
72  *    1. Solaris 2.5 with GCC 2.8.1
73  *    2. MS Windows 95 with MS Visual C++ 6
74  *
75  * MODIFICATIONS
76  *
77  *    Date              Description
78  *    ----              -----------
79  *    04/16/99          Original Code
80  *
81  */
82 
83 
84 /***************************************************************************/
85 /*
86  *                              DEFINES
87  */
88 
89   #define CASS_NO_ERROR           0x0000
90   #define CASS_LAT_ERROR          0x0001
91   #define CASS_LON_ERROR          0x0002
92   #define CASS_EASTING_ERROR      0x0004
93   #define CASS_NORTHING_ERROR     0x0008
94   #define CASS_ORIGIN_LAT_ERROR   0x0010
95   #define CASS_CENT_MER_ERROR     0x0020
96   #define CASS_A_ERROR            0x0040
97   #define CASS_INV_F_ERROR        0x0080
98   #define CASS_LON_WARNING        0x0100
99 
100 
101 /***************************************************************************/
102 /*
103  *                              FUNCTION PROTOTYPES
104  *                                for CASSINI.C
105  */
106 
107 /* ensure proper linkage to c++ programs */
108   #ifdef __cplusplus
109 extern "C" {
110   #endif
111 
112   long Set_Cassini_Parameters(double a,
113                               double f,
114                               double Origin_Latitude,
115                               double Central_Meridian,
116                               double False_Easting,
117                               double False_Northing);
118 /*
119  * The function Set_Cassini_Parameters receives the ellipsoid parameters and
120  * Cassini projcetion parameters as inputs, and sets the corresponding state
121  * variables.  If any errors occur, the error code(s) are returned by the
122  * function, otherwise CASS_NO_ERROR is returned.
123  *
124  *    a                 : Semi-major axis of ellipsoid, in meters   (input)
125  *    f                 : Flattening of ellipsoid						        (input)
126  *    Origin_Latitude   : Latitude in radians at which the          (input)
127  *                          point scale factor is 1.0
128  *    Central_Meridian  : Longitude in radians at the center of     (input)
129  *                          the projection
130  *    False_Easting     : A coordinate value in meters assigned to the
131  *                          central meridian of the projection.     (input)
132  *    False_Northing    : A coordinate value in meters assigned to the
133  *                          origin latitude of the projection       (input)
134  */
135 
136 
137   void Get_Cassini_Parameters(double *a,
138                               double *f,
139                               double *Origin_Latitude,
140                               double *Central_Meridian,
141                               double *False_Easting,
142                               double *False_Northing);
143 /*
144  * The function Get_Cassini_Parameters returns the current ellipsoid
145  * parameters, and Cassini projection parameters.
146  *
147  *    a                 : Semi-major axis of ellipsoid, in meters   (output)
148  *    f                 : Flattening of ellipsoid						        (output)
149  *    Origin_Latitude   : Latitude in radians at which the          (output)
150  *                          point scale factor is 1.0
151  *    Central_Meridian  : Longitude in radians at the center of     (output)
152  *                          the projection
153  *    False_Easting     : A coordinate value in meters assigned to the
154  *                          central meridian of the projection.     (output)
155  *    False_Northing    : A coordinate value in meters assigned to the
156  *                          origin latitude of the projection       (output)
157  */
158 
159 
160   long Convert_Geodetic_To_Cassini (double Latitude,
161                                     double Longitude,
162                                     double *Easting,
163                                     double *Northing);
164 /*
165  * The function Convert_Geodetic_To_Cassini converts geodetic (latitude and
166  * longitude) coordinates to Cassini projection easting, and northing
167  * coordinates, according to the current ellipsoid and Cassini projection
168  * parameters.  If any errors occur, the error code(s) are returned by the
169  * function, otherwise CASS_NO_ERROR is returned.
170  *
171  *    Latitude          : Latitude (phi) in radians           (input)
172  *    Longitude         : Longitude (lambda) in radians       (input)
173  *    Easting           : Easting (X) in meters               (output)
174  *    Northing          : Northing (Y) in meters              (output)
175  */
176 
177 
178   long Convert_Cassini_To_Geodetic(double Easting,
179                                    double Northing,
180                                    double *Latitude,
181                                    double *Longitude);
182 /*
183  * The function Convert_Cassini_To_Geodetic converts Cassini projection
184  * easting and northing coordinates to geodetic (latitude and longitude)
185  * coordinates, according to the current ellipsoid and Cassini projection
186  * coordinates.  If any errors occur, the error code(s) are returned by the
187  * function, otherwise CASS_NO_ERROR is returned.
188  *
189  *    Easting           : Easting (X) in meters                  (input)
190  *    Northing          : Northing (Y) in meters                 (input)
191  *    Latitude          : Latitude (phi) in radians              (output)
192  *    Longitude         : Longitude (lambda) in radians          (output)
193  */
194 
195   #ifdef __cplusplus
196 }
197   #endif
198 
199 #endif /* CASSINI_H */
200 
201