UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
UTM.h
Go to the documentation of this file.
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  * 1/16/2016 A. Layne MSP_DR30125 Updated constructor to receive ellipsoid
79  * code from callers
80  */
81 
82 
83 #include <map>
84 #include "CoordinateSystem.h"
85 
86 
87 namespace MSP
88 {
89  namespace CCS
90  {
91  class UTMParameters;
92  class TransverseMercator;
93  class UTMCoordinates;
94  class GeodeticCoordinates;
95 
96 
97  /***********************************************************************/
98  /*
99  * DEFINES
100  */
101 
103  {
104  public:
105 
106  /*
107  * The constructor receives the ellipsoid parameters and
108  * UTM zone override parameter as inputs, and sets the
109  * corresponding state variables. If any errors occur,
110  * an exception is thrown with a description of the error.
111  *
112  * ellipsoidSemiMajorAxis : Semi-major axis in meters (input)
113  * ellipsoidFlattening : Flattening of ellipsoid (input)
114  * override : UTM override zone, 0 indicates no override (input)
115  */
116 
117  UTM();
118 
119  UTM(
120  double ellipsoidSemiMajorAxis,
121  double ellipsoidFlattening,
122  char *ellipsoidCode,
123  long override = 0
124  );
125 
126 
127  UTM( const UTM &u );
128 
129 
130  ~UTM( void );
131 
132 
133  UTM& operator=( const UTM &u );
134 
135 
136  /*
137  * The function getParameters returns the current ellipsoid
138  * parameters and UTM zone override parameter.
139  *
140  * ellipsoidSemiMajorAxis : Semi-major axis (meters) (output)
141  * ellipsoidFlattening : Flattening of ellipsoid (output)
142  * override : UTM override zone, zero indicates no override (output)
143  */
144 
145  UTMParameters* getParameters() const;
146 
147 
148  /*
149  * The function convertFromGeodetic converts geodetic (latitude and
150  * longitude) coordinates to UTM projection (zone, hemisphere,
151  * easting and northing) coordinates according to the current
152  * ellipsoid and UTM zone override parameters. If any errors occur,
153  * an exception is thrown with a description of the error.
154  *
155  * longitude : Longitude in radians (input)
156  * latitude : Latitude in radians (input)
157  * utmZoneOverride : zone override (input)
158  * zone : UTM zone (output)
159  * hemisphere : North or South hemisphere (output)
160  * easting : Easting (X) in meters (output)
161  * northing : Northing (Y) in meters (output)
162  */
163 
164  MSP::CCS::UTMCoordinates* convertFromGeodetic(
165  MSP::CCS::GeodeticCoordinates* geodeticCoordinates,
166  int utmZoneOverride = 0 );
167 
168 
169  /*
170  * The function convertToGeodetic converts UTM projection (zone,
171  * hemisphere, easting and northing) coordinates to geodetic
172  * (latitude and longitude) coordinates, according to the
173  * current ellipsoid parameters. If any errors occur,
174  * an exception is thrown with a description of the error.
175  *
176  * zone : UTM zone (input)
177  * hemisphere : North or South hemisphere (input)
178  * easting : Easting (X) in meters (input)
179  * northing : Northing (Y) in meters (input)
180  * longitude : Longitude in radians (output)
181  * latitude : Latitude in radians (output)
182  */
183 
184  MSP::CCS::GeodeticCoordinates* convertToGeodetic(
185  MSP::CCS::UTMCoordinates* utmCoordinates );
186 
187  private:
188  char ellipsCode[3];
189 
190  std::map< int, TransverseMercator* > transverseMercatorMap;
191 
192  long UTM_Override; /* Zone override flag */
193  };
194  }
195 }
196 
197 #endif
198 
199 
200 // CLASSIFICATION: UNCLASSIFIED