UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Functions Enumerations
TransverseMercator.h
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef TransverseMercator_H
4 #define TransverseMercator_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: TRANSVERSE MERCATOR
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between Geodetic coordinates
12  * (latitude and longitude) and Transverse Mercator projection coordinates
13  * (easting and northing).
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  * TRANMERC_NO_ERROR : No errors occurred in function
23  * TRANMERC_LAT_ERROR : Latitude outside of valid range
24  * (-90 to 90 degrees)
25  * TRANMERC_LON_ERROR : Longitude outside of valid range
26  * (-180 to 360 degrees, and within
27  * +/-90 of Central Meridian)
28  * TRANMERC_EASTING_ERROR : Easting outside of valid range
29  * (depending on ellipsoid and
30  * projection parameters)
31  * TRANMERC_NORTHING_ERROR : Northing outside of valid range
32  * (depending on ellipsoid and
33  * projection parameters)
34  * TRANMERC_ORIGIN_LAT_ERROR : Origin latitude outside of valid range
35  * (-90 to 90 degrees)
36  * TRANMERC_CENT_MER_ERROR : Central meridian outside of valid range
37  * (-180 to 360 degrees)
38  * TRANMERC_A_ERROR : Semi-major axis less than or equal to zero
39  * TRANMERC_INV_F_ERROR : Inverse flattening outside of valid range
40  * (250 to 350)
41  * TRANMERC_SCALE_FACTOR_ERROR : Scale factor outside of valid
42  * range (0.3 to 3.0)
43  * TRANMERC_LON_WARNING : Distortion will result if longitude is more
44  * than 9 degrees from the Central Meridian
45  *
46  * REUSE NOTES
47  *
48  * TRANSVERSE MERCATOR is intended for reuse by any application that
49  * performs a Transverse Mercator projection or its inverse.
50  *
51  * REFERENCES
52  *
53  * Further information on TRANSVERSE MERCATOR can be found in the
54  * Reuse Manual.
55  *
56  * TRANSVERSE MERCATOR originated from :
57  * U.S. Army Topographic Engineering Center
58  * Geospatial Information Division
59  * 7701 Telegraph Road
60  * Alexandria, VA 22310-3864
61  *
62  * LICENSES
63  *
64  * None apply to this component.
65  *
66  * RESTRICTIONS
67  *
68  * TRANSVERSE MERCATOR has no restrictions.
69  *
70  * ENVIRONMENT
71  *
72  * TRANSVERSE MERCATOR was tested and certified in the following
73  * environments:
74  *
75  * 1. Solaris 2.5 with GCC, version 2.8.1
76  * 2. Windows 95 with MS Visual C++, version 6
77  *
78  * MODIFICATIONS
79  *
80  * Date Description
81  * ---- -----------
82  * 2-26-07 Original C++ Code
83  *
84  */
85 
86 
87 #include "DtccApi.h"
88 #include "CoordinateSystem.h"
89 
90 
91 namespace MSP
92 {
93  namespace CCS
94  {
95  class MapProjection5Parameters;
96  class MapProjectionCoordinates;
97  class GeodeticCoordinates;
98 
99 
100  /***************************************************************************/
101  /*
102  * DEFINES
103  */
104 
105  class MSP_DTCC_API TransverseMercator : public CoordinateSystem
106  {
107  public:
108 
109  /*
110  * The constructor receives the ellipsoid
111  * parameters and Tranverse Mercator projection parameters as inputs, and
112  * sets the corresponding state variables. If any errors occur, an exception
113  * is thrown with a description of the error.
114  *
115  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input)
116  * ellipsoidFlattening : Flattening of ellipsoid (input)
117  * centralMeridian : Longitude in radians at the center of the (input)
118  * projection
119  * latitudeOfTrueScale : Latitude in radians at the origin of the (input)
120  * projection
121  * falseEasting : Easting/X at the center of the projection (input)
122  * falseNorthing : Northing/Y at the center of the projection (input)
123  * scaleFactor : Projection scale factor (input)
124  */
125 
126  TransverseMercator( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double latitudeOfTrueScale, double falseEasting, double falseNorthing, double scaleFactor );
127 
128 
130 
131 
132  ~TransverseMercator( void );
133 
134 
135  TransverseMercator& operator=( const TransverseMercator &tm );
136 
137 
138  /*
139  * The function getParameters returns the current
140  * ellipsoid and Transverse Mercator projection parameters.
141  *
142  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output)
143  * ellipsoidFlattening : Flattening of ellipsoid (output)
144  * centralMeridian : Longitude in radians at the center of the (output)
145  * projection
146  * latitudeOfTrueScale : Latitude in radians at the origin of the (output)
147  * projection
148  * falseEasting : Easting/X at the center of the projection (output)
149  * falseNorthing : Northing/Y at the center of the projection (output)
150  * scaleFactor : Projection scale factor (output)
151  */
152 
153  MapProjection5Parameters* getParameters() const;
154 
155 
156  /*
157  * The function convertFromGeodetic converts geodetic
158  * (latitude and longitude) coordinates to Transverse Mercator projection
159  * (easting and northing) coordinates, according to the current ellipsoid
160  * and Transverse Mercator projection coordinates. If any errors occur,
161  * an exception is thrown with a description of the error.
162  *
163  * longitude : Longitude in radians (input)
164  * latitude : Latitude in radians (input)
165  * easting : Easting/X in meters (output)
166  * northing : Northing/Y in meters (output)
167  */
168 
169  MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates );
170 
171 
172  /*
173  * The function convertToGeodetic converts Transverse
174  * Mercator projection (easting and northing) coordinates to geodetic
175  * (latitude and longitude) coordinates, according to the current ellipsoid
176  * and Transverse Mercator projection parameters. If any errors occur,
177  * an exception is thrown with a description of the error.
178  *
179  * easting : Easting/X in meters (input)
180  * northing : Northing/Y in meters (input)
181  * longitude : Longitude in radians (output)
182  * latitude : Latitude in radians (output)
183  */
184 
185  MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates );
186 
187  private:
188 
189  /* Ellipsoid Parameters */
190  double TranMerc_es; /* Eccentricity squared */
191  double TranMerc_ebs; /* Second Eccentricity squared */
192 
193  /* Transverse_Mercator projection Parameters */
194  double TranMerc_Origin_Lat; /* Latitude of origin in radians */
195  double TranMerc_Origin_Long; /* Longitude of origin in radians */
196  double TranMerc_False_Northing; /* False northing in meters */
197  double TranMerc_False_Easting; /* False easting in meters */
198  double TranMerc_Scale_Factor; /* Scale factor */
199 
200  /* Isometric to geodetic latitude parameters */
201  double TranMerc_ap;
202  double TranMerc_bp;
203  double TranMerc_cp;
204  double TranMerc_dp;
205  double TranMerc_ep;
206 
207  /* Maximum variance for easting and northing values */
208  double TranMerc_Delta_Easting;
209  double TranMerc_Delta_Northing;
210 
211 
212  double sphtmd( double latitude, double sinLat, double cosLat );
213  double sphsn( double sinLat );
214  double sphsr( double sinLat );
215  };
216  }
217 }
218 
219 #endif
220 
221 
222 // CLASSIFICATION: UNCLASSIFIED