UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Mercator.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef Mercator_H
4 #define Mercator_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: MERCATOR
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between Geodetic coordinates
12  * (latitude and longitude in radians) and Mercator 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  * MERC_NO_ERROR : No errors occurred in function
23  * MERC_LAT_ERROR : Latitude outside of valid range
24  * (-89.5 to 89.5 degrees)
25  * MERC_LON_ERROR : Longitude outside of valid range
26  * (-180 to 360 degrees)
27  * MERC_EASTING_ERROR : Easting outside of valid range
28  * (False_Easting +/- ~20,500,000 m,
29  * depending on ellipsoid parameters
30  * and Origin_Latitude)
31  * MERC_NORTHING_ERROR : Northing outside of valid range
32  * (False_Northing +/- ~23,500,000 m,
33  * depending on ellipsoid parameters
34  * and Origin_Latitude)
35  * MERC_LAT_OF_TRUE_SCALE_ERROR : Latitude of true scale outside of valid range
36  * (-89.5 to 89.5 degrees)
37  * MERC_CENT_MER_ERROR : Central meridian outside of valid range
38  * (-180 to 360 degrees)
39  * MERC_A_ERROR : Semi-major axis less than or equal to zero
40  * MERC_INV_F_ERROR : Inverse flattening outside of valid range
41  * (250 to 350)
42  *
43  * REUSE NOTES
44  *
45  * MERCATOR is intended for reuse by any application that performs a
46  * Mercator projection or its inverse.
47  *
48  * REFERENCES
49  *
50  * Further information on MERCATOR can be found in the Reuse Manual.
51  *
52  * MERCATOR 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  * MERCATOR has no restrictions.
64  *
65  * ENVIRONMENT
66  *
67  * MERCATOR was tested and certified in the following environments:
68  *
69  * 1. Solaris 2.5 with GCC, version 2.8.1
70  * 2. Windows 95 with MS Visual C++, version 6
71  *
72  * MODIFICATIONS
73  *
74  * Date Description
75  * ---- -----------
76  * 10-02-97 Original Code
77  * 03-06-07 Original C++ Code
78  *
79  */
80 
81 
82 #include "CoordinateSystem.h"
83 #include "CoordinateType.h"
84 
85 
86 namespace MSP
87 {
88  namespace CCS
89  {
90  class MercatorStandardParallelParameters;
91  class MercatorScaleFactorParameters;
92  class MapProjectionCoordinates;
93  class GeodeticCoordinates;
94 
95 
96  /***************************************************************************/
97  /*
98  * DEFINES
99  */
100 
101  class Mercator : public CoordinateSystem
102  {
103  public:
104 
105  /*
106  * The constructor receives the ellipsoid parameters and
107  * Mercator projection parameters as inputs, and sets the corresponding state
108  * variables. It calculates and returns the scale factor. If any errors occur,
109  * an exception is thrown with a description 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  * standardParallel : 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  * scaleFactor : Multiplier which reduces distances in the
122  * projection to the actual distance on the
123  * ellipsoid (output)
124  */
125 
126  Mercator( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double standardParallel, double falseEasting, double falseNorthing, double* scaleFactor );
127 
128 
129  /*
130  * The constructor receives the ellipsoid parameters and
131  * Mercator projection parameters as inputs, and sets the corresponding state
132  * variables. It receives the scale factor as input. If any errors occur,
133  * an exception is thrown with a description of the error.
134  *
135  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input)
136  * ellipsoidFlattening : Flattening of ellipsoid (input)
137  * centralMeridian : Longitude in radians at the center of (input)
138  * the projection
139  * falseEasting : A coordinate value in meters assigned to the
140  * central meridian of the projection. (input)
141  * falseNorthing : A coordinate value in meters assigned to the
142  * origin latitude of the projection (input)
143  * scaleFactor : Multiplier which reduces distances in the
144  * projection to the actual distance on the
145  * ellipsoid (input)
146  */
147 
148  Mercator( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double falseEasting, double falseNorthing, double scaleFactor );
149 
150 
151  Mercator( const Mercator &m );
152 
153 
154  ~Mercator( void );
155 
156 
157  Mercator& operator=( const Mercator &m );
158 
159 
160  /*
161  * The function getStandardParallelParameters returns the current ellipsoid
162  * parameters and Mercator (Standard Parallel) projection parameters.
163  *
164  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output)
165  * ellipsoidFlattening : Flattening of ellipsoid (output)
166  * centralMeridian : Longitude in radians at the center of (output)
167  * the projection
168  * standardParallel : Latitude in radians at which the (output)
169  * point scale factor is 1.0
170  * falseEasting : A coordinate value in meters assigned to the
171  * central meridian of the projection. (output)
172  * falseNorthing : A coordinate value in meters assigned to the
173  * origin latitude of the projection (output)
174  */
175 
177 
178 
179  /*
180  * The function getScaleFactorParameters returns the current ellipsoid
181  * parameters and Mercator (Scale Factor) projection parameters.
182  *
183  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output)
184  * ellipsoidFlattening : Flattening of ellipsoid (output)
185  * centralMeridian : Longitude in radians at the center of (output)
186  * the projection
187  * falseEasting : A coordinate value in meters assigned to the
188  * central meridian of the projection. (output)
189  * falseNorthing : A coordinate value in meters assigned to the
190  * origin latitude of the projection (output)
191  * scaleFactor : Multiplier which reduces distances in the
192  * projection to the actual distance on the
193  * ellipsoid (output)
194  */
195 
197 
198 
199  /*
200  * The function convertFromGeodetic converts geodetic (latitude and
201  * longitude) coordinates to Mercator projection (easting and northing)
202  * coordinates, according to the current ellipsoid and Mercator projection
203  * parameters. If any errors occur, an exception is thrown with a description
204  * of the error.
205  *
206  * longitude : Longitude (lambda) in radians (input)
207  * latitude : Latitude (phi) in radians (input)
208  * easting : Easting (X) in meters (output)
209  * northing : Northing (Y) in meters (output)
210  */
211 
213 
214 
215  /*
216  * The function convertToGeodetic converts Mercator projection
217  * (easting and northing) coordinates to geodetic (latitude and longitude)
218  * coordinates, according to the current ellipsoid and Mercator projection
219  * coordinates. If any errors occur, an exception is thrown with a description
220  * of the error.
221  *
222  * easting : Easting (X) in meters (input)
223  * northing : Northing (Y) in meters (input)
224  * longitude : Longitude (lambda) in radians (output)
225  * latitude : Latitude (phi) in radians (output)
226  */
227 
229 
230  private:
231 
232  CoordinateType::Enum coordinateType;
233 
234  /* Ellipsoid Parameters, default to WGS 84 */
235  double Merc_e; /* Eccentricity of ellipsoid */
236  double Merc_es; /* Eccentricity squared */
237 
238  /* Mercator projection Parameters */
239  double Merc_Standard_Parallel; /* Latitude of true scale in radians */
240  double Merc_Cent_Mer; /* Central meridian in radians */
241  double Merc_False_Northing; /* False northing in meters */
242  double Merc_False_Easting; /* False easting in meters */
243  double Merc_Scale_Factor; /* Scale factor */
244 
245  /* Isometric to geodetic latitude parameters, default to WGS 84 */
246  double Merc_ab;
247  double Merc_bb;
248  double Merc_cb;
249  double Merc_db;
250 
251  /* Maximum variance for easting and northing values for WGS 84.*/
252 
253  double Merc_Delta_Easting;
254  double Merc_Delta_Northing;
255 
256  };
257  }
258 }
259 
260 #endif
261 
262 
263 // CLASSIFICATION: UNCLASSIFIED