UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Cassini.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef Cassini_H
4 #define Cassini_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: CASSINI
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between Geodetic coordinates
12  * (latitude and longitude in radians) and Cassini projection coordinates
13  * (easting and northing in meters).
14  *
15  * ERROR HANDLING
16  *
17  * This component checks parameters for valid values. If an invalid value
18  * is found, the error code is combined with the current error code using
19  * the bitwise or. This combining allows multiple error codes to be
20  * returned. The possible error codes are:
21  *
22  * CASS_NO_ERROR : No errors occurred in function
23  * CASS_LAT_ERROR : Latitude outside of valid range
24  * (-90 to 90 degrees)
25  * CASS_LON_ERROR : Longitude outside of valid range
26  * (-180 to 360 degrees)
27  * CASS_EASTING_ERROR : Easting outside of valid range
28  * (False_Easting +/- ~20,000,000 m,
29  * depending on ellipsoid parameters
30  * and Origin_Latitude)
31  * CASS_NORTHING_ERROR : Northing outside of valid range
32  * (False_Northing +/- ~57,000,000 m,
33  * depending on ellipsoid parameters
34  * and Origin_Latitude)
35  * CASS_ORIGIN_LAT_ERROR : Origin latitude outside of valid range
36  * (-90 to 90 degrees)
37  * CASS_CENT_MER_ERROR : Central meridian outside of valid range
38  * (-180 to 360 degrees)
39  * CASS_A_ERROR : Semi-major axis less than or equal to zero
40  * CASS_INV_F_ERROR : Inverse flattening outside of valid range
41  * (250 to 350)
42  * CASS_LON_WARNING : Distortion will result if longitude is more
43  * than 4 degrees from the Central Meridian
44  *
45  * REUSE NOTES
46  *
47  * CASSINI is intended for reuse by any application that performs a
48  * Cassini projection or its inverse.
49  *
50  * REFERENCES
51  *
52  * Further information on CASSINI can be found in the Reuse Manual.
53  *
54  * CASSINI originated from : U.S. Army Topographic Engineering Center
55  * Geospatial Information Division
56  * 7701 Telegraph Road
57  * Alexandria, VA 22310-3864
58  *
59  * LICENSES
60  *
61  * None apply to this component.
62  *
63  * RESTRICTIONS
64  *
65  * CASSINI has no restrictions.
66  *
67  * ENVIRONMENT
68  *
69  * CASSINI was tested and certified in the following environments:
70  *
71  * 1. Solaris 2.5 with GCC 2.8.1
72  * 2. MS Windows 95 with MS Visual C++ 6
73  *
74  * MODIFICATIONS
75  *
76  * Date Description
77  * ---- -----------
78  * 04-16-99 Original Code
79  * 03-07-07 Original C++ Code
80  *
81  */
82 
83 
84 #include "CoordinateSystem.h"
85 
86 
87 namespace MSP
88 {
89  namespace CCS
90  {
91  class MapProjection4Parameters;
92  class MapProjectionCoordinates;
93  class GeodeticCoordinates;
94 
95 
96  /***************************************************************************/
97  /*
98  * DEFINES
99  */
100 
101  class Cassini : public CoordinateSystem
102  {
103  public:
104 
105  /*
106  * The constructor receives the ellipsoid parameters and
107  * Cassini projection parameters as inputs, and sets the corresponding state
108  * variables. If any errors occur, an exception is thrown with a description
109  * of the error.
110  *
111  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input)
112  * ellipsoidFlattening : Flattening of ellipsoid (input)
113  * centralMeridian : Longitude in radians at the center of (input)
114  * the projection
115  * originLatitude : Latitude in radians at which the (input)
116  * point scale factor is 1.0
117  * falseEasting : A coordinate value in meters assigned to the
118  * central meridian of the projection. (input)
119  * falseNorthing : A coordinate value in meters assigned to the
120  * origin latitude of the projection (input)
121  */
122 
123  Cassini( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double falseEasting, double falseNorthing );
124 
125 
126  Cassini( const Cassini &c );
127 
128 
129  ~Cassini( void );
130 
131 
132  Cassini& operator=( const Cassini &c );
133 
134 
135  /*
136  * The function getParameters returns the current ellipsoid
137  * parameters, Cassini projection parameters.
138  *
139  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output)
140  * ellipsoidFlattening : Flattening of ellipsoid (output)
141  * centralMeridian : Longitude in radians at the center of (output)
142  * the projection
143  * originLatitude : Latitude in radians at which the (output)
144  * point scale factor is 1.0
145  * falseEasting : A coordinate value in meters assigned to the
146  * central meridian of the projection. (output)
147  * falseNorthing : A coordinate value in meters assigned to the
148  * origin latitude of the projection (output)
149  */
150 
152 
153 
154  /*
155  * The function convertFromGeodetic converts geodetic (latitude and
156  * longitude) coordinates to Cassini projection (easting and northing)
157  * coordinates, according to the current ellipsoid and Cassini projection
158  * parameters. If any errors occur, an exception is thrown with a description
159  * of the error.
160  *
161  * longitude : Longitude (lambda) in radians (input)
162  * latitude : Latitude (phi) in radians (input)
163  * easting : Easting (X) in meters (output)
164  * northing : Northing (Y) in meters (output)
165  */
166 
168 
169 
170  /*
171  * The function convertToGeodetic converts Cassini projection
172  * (easting and northing) coordinates to geodetic (latitude and longitude)
173  * coordinates, according to the current ellipsoid and Cassini projection
174  * coordinates. If any errors occur, an exception is thrown with a description
175  * of the error.
176  *
177  * easting : Easting (X) in meters (input)
178  * northing : Northing (Y) in meters (input)
179  * longitude : Longitude (lambda) in radians (output)
180  * latitude : Latitude (phi) in radians (output)
181  */
182 
184 
185  private:
186 
187  /* Ellipsoid Parameters, default to WGS 84 */
188  double es2; /* Eccentricity (0.08181919084262188000) squared */
189  double es4; /* es2 * es2 */
190  double es6; /* es4 * es2 */
191  double M0;
192  double c0; /* 1 - es2 / 4.0 - 3.0 * es4 / 64.0 - 5.0 * es6 / 256.0 */
193  double c1; /* 3.0 * es2 / 8.0 + 3.0 * es4 / 32.0 + 45.0 * es6 / 1024.0 */
194  double c2; /* 15.0 * es4 / 256.0 + 45.0 * es6 / 1024.0 */
195  double c3; /* 35.0 * es6 / 3072.0 */
196  double One_Minus_es2; /* 1.0 - es2 */
197  double a0; /* 3.0 * e1 / 2.0 - 27.0 * e3 / 32.0 */
198  double a1; /* 21.0 * e2 / 16.0 - 55.0 * e4 / 32.0 */
199  double a2; /* 151.0 * e3 / 96.0 */
200  double a3; /* 1097.0 * e4 /512.0 */
201 
202  /* Cassini projection Parameters */
203  double Cass_Origin_Lat; /* Latitude of origin in radians */
204  double Cass_Origin_Long; /* Longitude of origin in radians */
205  double Cass_False_Northing; /* False northing in meters */
206  double Cass_False_Easting; /* False easting in meters */
207 
208  /* Maximum variance for easting and northing values for WGS 84.*/
209  double Cass_Min_Easting;
210  double Cass_Max_Easting;
211  double Cass_Min_Northing;
212  double Cass_Max_Northing;
213 
214 
215  double cassM( double c0lat, double c1s2lat, double c2s4lat, double c3s6lat );
216 
217  double cassRd( double sinlat );
218 
219  double floatEq( double x, double v, double epsilon );
220  };
221  }
222 }
223 
224 #endif
225 
226 
227 // CLASSIFICATION: UNCLASSIFIED