UNCLASSIFIED

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