UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Polyconic.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef Polyconic_H
4 #define Polyconic_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: POLYCONIC
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between Geodetic coordinates
12  * (latitude and longitude in radians) and Polyconic 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  * POLY_NO_ERROR : No errors occurred in function
23  * POLY_LAT_ERROR : Latitude outside of valid range
24  * (-90 to 90 degrees)
25  * POLY_LON_ERROR : Longitude outside of valid range
26  * (-180 to 360 degrees)
27  * POLY_EASTING_ERROR : Easting outside of valid range
28  * (False_Easting +/- ~20,500,000 m,
29  * depending on ellipsoid parameters
30  * and Origin_Latitude)
31  * POLY_NORTHING_ERROR : Northing outside of valid range
32  * (False_Northing +/- ~15,500,000 m,
33  * depending on ellipsoid parameters
34  * and Origin_Latitude)
35  * POLY_ORIGIN_LAT_ERROR : Origin latitude outside of valid range
36  * (-90 to 90 degrees)
37  * POLY_CENT_MER_ERROR : Central meridian outside of valid range
38  * (-180 to 360 degrees)
39  * POLY_A_ERROR : Semi-major axis less than or equal to zero
40  * POLY_INV_F_ERROR : Inverse flattening outside of valid range
41  * (250 to 350)
42  * POLY_LON_WARNING : Distortion will result if longitude is more
43  * than 90 degrees from the Central Meridian
44  *
45  * REUSE NOTES
46  *
47  * POLYCONIC is intended for reuse by any application that performs a
48  * Polyconic projection or its inverse.
49  *
50  * REFERENCES
51  *
52  * Further information on POLYCONIC can be found in the Reuse Manual.
53  *
54  * POLYCONIC 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  * POLYCONIC has no restrictions.
66  *
67  * ENVIRONMENT
68  *
69  * POLYCONIC was tested and certified in the following environments:
70  *
71  * 1. Solaris 2.5 with GCC, version 2.8.1
72  * 2. Windows 95 with MS Visual C++, version 6
73  *
74  * MODIFICATIONS
75  *
76  * Date Description
77  * ---- -----------
78  * 10-06-99 Original Code
79  * 03-05-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 
102  {
103  public:
104 
105  /*
106  * The constructor receives the ellipsoid parameters and
107  * Polyconic 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  Polyconic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double falseEasting, double falseNorthing );
124 
125 
126  Polyconic( const Polyconic &p );
127 
128 
129  ~Polyconic( void );
130 
131 
132  Polyconic& operator=( const Polyconic &p );
133 
134 
135  /*
136  * The function getParameters returns the current ellipsoid
137  * parameters, and Polyconic 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 Polyconic projection (easting and northing)
157  * coordinates, according to the current ellipsoid and Polyconic 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 Polyconic projection
172  * (easting and northing) coordinates to geodetic (latitude and longitude)
173  * coordinates, according to the current ellipsoid and Polyconic projection
174  * coordinates. If any errors occur, an exception is thrown with a description
175  * of the error.
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  /* Ellipsoid Parameters, default to WGS 84 */
187  double es2; /* Eccentricity (0.08181919084262188000) squared */
188  double es4; /* es2 * es2 */
189  double es6; /* es4 * es2 */
190  double M0;
191  double c0; /* 1 - es2 / 4.0 - 3.0 * es4 / 64.0 - 5.0 * es6 / 256.0 */
192  double c1; /* 3.0 * es2 / 8.0 + 3.0 * es4 / 32.0 + 45.0 * es6 / 1024.0 */
193  double c2; /* 15.0 * es4 / 256.0 + 45.0 * es6 / 1024.0 */
194  double c3; /* 35.0 * es6 / 3072.0 */
195 
196  /* Polyconic projection Parameters */
197  double Poly_Origin_Lat; /* Latitude of origin in radians */
198  double Poly_Origin_Long; /* Longitude of origin in radians */
199  double Poly_False_Northing; /* False northing in meters */
200  double Poly_False_Easting; /* False easting in meters */
201 
202  /* Maximum variance for easting and northing values for WGS 84.*/
203  double Poly_Max_Easting;
204  double Poly_Max_Northing;
205  double Poly_Min_Easting;
206  double Poly_Min_Northing;
207 
208 
209  double polyM( double c0lat, double c1s2lat, double c2s4lat, double c3s6lat );
210 
211  double floatEq( double x, double v, double epsilon );
212 
213  };
214  }
215 }
216 
217 #endif
218 
219 
220 // CLASSIFICATION: UNCLASSIFIED