UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Functions Enumerations
UTM.h
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef UTM_H
4 #define UTM_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: UTM
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between geodetic coordinates
12  * (latitude and longitudes) and Universal Transverse Mercator (UTM)
13  * projection (zone, hemisphere, easting, and northing) coordinates.
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  * UTM_NO_ERROR : No errors occurred in function
23  * UTM_LAT_ERROR : Latitude outside of valid range
24  * (-80.5 to 84.5 degrees)
25  * UTM_LON_ERROR : Longitude outside of valid range
26  * (-180 to 360 degrees)
27  * UTM_EASTING_ERROR : Easting outside of valid range
28  * (100,000 to 900,000 meters)
29  * UTM_NORTHING_ERROR : Northing outside of valid range
30  * (0 to 10,000,000 meters)
31  * UTM_ZONE_ERROR : Zone outside of valid range (1 to 60)
32  * UTM_HEMISPHERE_ERROR : Invalid hemisphere ('N' or 'S')
33  * UTM_ZONE_OVERRIDE_ERROR: Zone outside of valid range
34  * (1 to 60) and within 1 of 'natural' zone
35  * UTM_A_ERROR : Semi-major axis less than or equal to zero
36  * UTM_INV_F_ERROR : Inverse flattening outside of valid range
37  * (250 to 350)
38  *
39  * REUSE NOTES
40  *
41  * UTM is intended for reuse by any application that performs a Universal
42  * Transverse Mercator (UTM) projection or its inverse.
43  *
44  * REFERENCES
45  *
46  * Further information on UTM can be found in the Reuse Manual.
47  *
48  * UTM originated from : U.S. Army Topographic Engineering Center
49  * Geospatial Information Division
50  * 7701 Telegraph Road
51  * Alexandria, VA 22310-3864
52  *
53  * LICENSES
54  *
55  * None apply to this component.
56  *
57  * RESTRICTIONS
58  *
59  * UTM has no restrictions.
60  *
61  * ENVIRONMENT
62  *
63  * UTM was tested and certified in the following environments:
64  *
65  * 1. Solaris 2.5 with GCC, version 2.8.1
66  * 2. MSDOS with MS Visual C++, version 6
67  *
68  * MODIFICATIONS
69  *
70  * Date Description
71  * ---- -----------
72  * 2-27-07 Original C++ Code
73  * 5-02-11 DR 28872, interface added to allow setting zone override
74  * for each fromGeodetic call. The override in the call has
75  * precedence over what is set in the class constructor.
76  * 5-09-11 DR 28908, add default constructor
77  */
78 
79 
80 #include <map>
81 #include "CoordinateSystem.h"
82 
83 
84 namespace MSP
85 {
86  namespace CCS
87  {
88  class UTMParameters;
89  class TransverseMercator;
90  class UTMCoordinates;
91  class GeodeticCoordinates;
92 
93 
94  /***********************************************************************/
95  /*
96  * DEFINES
97  */
98 
99  class MSP_DTCC_API UTM : public CoordinateSystem
100  {
101  public:
102 
103  /*
104  * The constructor receives the ellipsoid parameters and
105  * UTM zone override parameter as inputs, and sets the
106  * corresponding state variables. If any errors occur,
107  * an exception is thrown with a description of the error.
108  *
109  * ellipsoidSemiMajorAxis : Semi-major axis in meters (input)
110  * ellipsoidFlattening : Flattening of ellipsoid (input)
111  * override : UTM override zone, 0 indicates no override (input)
112  */
113 
114  UTM();
115 
116  UTM(
117  double ellipsoidSemiMajorAxis,
118  double ellipsoidFlattening,
119  long override = 0 );
120 
121 
122  UTM( const UTM &u );
123 
124 
125  ~UTM( void );
126 
127 
128  UTM& operator=( const UTM &u );
129 
130 
131  /*
132  * The function getParameters returns the current ellipsoid
133  * parameters and UTM zone override parameter.
134  *
135  * ellipsoidSemiMajorAxis : Semi-major axis (meters) (output)
136  * ellipsoidFlattening : Flattening of ellipsoid (output)
137  * override : UTM override zone, zero indicates no override (output)
138  */
139 
140  UTMParameters* getParameters() const;
141 
142 
143  /*
144  * The function convertFromGeodetic converts geodetic (latitude and
145  * longitude) coordinates to UTM projection (zone, hemisphere,
146  * easting and northing) coordinates according to the current
147  * ellipsoid and UTM zone override parameters. If any errors occur,
148  * an exception is thrown with a description of the error.
149  *
150  * longitude : Longitude in radians (input)
151  * latitude : Latitude in radians (input)
152  * utmZoneOverride : zone override (input)
153  * zone : UTM zone (output)
154  * hemisphere : North or South hemisphere (output)
155  * easting : Easting (X) in meters (output)
156  * northing : Northing (Y) in meters (output)
157  */
158 
159  MSP::CCS::UTMCoordinates* convertFromGeodetic(
160  MSP::CCS::GeodeticCoordinates* geodeticCoordinates,
161  int utmZoneOverride = 0 );
162 
163 
164  /*
165  * The function convertToGeodetic converts UTM projection (zone,
166  * hemisphere, easting and northing) coordinates to geodetic
167  * (latitude and longitude) coordinates, according to the
168  * current ellipsoid parameters. If any errors occur,
169  * an exception is thrown with a description of the error.
170  *
171  * zone : UTM zone (input)
172  * hemisphere : North or South hemisphere (input)
173  * easting : Easting (X) in meters (input)
174  * northing : Northing (Y) in meters (input)
175  * longitude : Longitude in radians (output)
176  * latitude : Latitude in radians (output)
177  */
178 
179  MSP::CCS::GeodeticCoordinates* convertToGeodetic(
180  MSP::CCS::UTMCoordinates* utmCoordinates );
181 
182  private:
183 
184  std::map< int, TransverseMercator* > transverseMercatorMap;
185 
186  long UTM_Override; /* Zone override flag */
187  };
188  }
189 }
190 
191 #endif
192 
193 
194 // CLASSIFICATION: UNCLASSIFIED