UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
ObliqueMercator.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef ObliqueMercator_H
4 #define ObliqueMercator_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: OBLIQUE MERCATOR
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between Geodetic coordinates
12  * (latitude and longitude in radians) and Oblique Mercator
13  * projection coordinates (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  * OMERC_NO_ERROR : No errors occurred in function
23  * OMERC_LAT_ERROR : Latitude outside of valid range
24  * (-90 to 90 degrees)
25  * OMERC_LON_ERROR : Longitude outside of valid range
26  * (-180 to 360 degrees)
27  * OMERC_ORIGIN_LAT_ERROR : Origin latitude outside of valid range
28  * (-89 to 89 degrees)
29  * OMERC_LAT1_ERROR : First latitude outside of valid range
30  * (-89 to 89 degrees, excluding 0)
31  * OMERC_LAT2_ERROR : First latitude outside of valid range
32  * (-89 to 89 degrees)
33  * OMERC_LON1_ERROR : First longitude outside of valid range
34  * (-180 to 360 degrees)
35  * OMERC_LON2_ERROR : Second longitude outside of valid range
36  * (-180 to 360 degrees)
37  * OMERC_LAT1_LAT2_ERROR : First and second latitudes can not be equal
38  * OMERC_DIFF_HEMISPHERE_ERROR: First and second latitudes can not be
39  * in different hemispheres
40  * OMERC_EASTING_ERROR : Easting outside of valid range
41  * (depends on ellipsoid and projection
42  * parameters)
43  * OMERC_NORTHING_ERROR : Northing outside of valid range
44  * (depends on ellipsoid and projection
45  * parameters)
46  * OMERC_A_ERROR : Semi-major axis less than or equal to zero
47  * OMERC_INV_F_ERROR : Inverse flattening outside of valid range
48  * (250 to 350)
49  * OMERC_SCALE_FACTOR_ERROR : Scale factor outside of valid
50  * range (0.3 to 3.0)
51  * OMERC_LON_WARNING : Distortion will result if longitude is 90 degrees or more
52  * from the Central Meridian
53  *
54  * REUSE NOTES
55  *
56  * OBLIQUE MERCATOR is intended for reuse by any application that
57  * performs an Oblique Mercator projection or its inverse.
58  *
59  * REFERENCES
60  *
61  * Further information on OBLIQUE MERCATOR can be found in the Reuse Manual.
62  *
63  * OBLIQUE MERCATOR originated from: U.S. Army Topographic Engineering Center
64  * Geospatial Information Division
65  * 7701 Telegraph Road
66  * Alexandria, VA 22310-3864
67  *
68  * LICENSES
69  *
70  * None apply to this component.
71  *
72  * RESTRICTIONS
73  *
74  * OBLIQUE MERCATOR has no restrictions.
75  *
76  * ENVIRONMENT
77  *
78  * OBLIQUE MERCATOR was tested and certified in the following environments:
79  *
80  * 1. Solaris 2.5 with GCC, version 2.8.1
81  * 2. MSDOS with MS Visual C++, version 6
82  *
83  * MODIFICATIONS
84  *
85  * Date Description
86  * ---- -----------
87  * 06-07-00 Original Code
88  * 03-02-07 Original C++ Code
89  *
90  *
91  */
92 
93 
94 #include "CoordinateSystem.h"
95 
96 
97 namespace MSP
98 {
99  namespace CCS
100  {
101  class ObliqueMercatorParameters;
102  class MapProjectionCoordinates;
103  class GeodeticCoordinates;
104 
105 
106  /***************************************************************************/
107  /*
108  * DEFINES
109  */
110 
112  {
113  public:
114 
115  /*
116  * The constructor receives the ellipsoid parameters and
117  * projection parameters as inputs, and sets the corresponding state
118  * variables. If any errors occur, an exception is thrown with a description
119  * of the error.
120  *
121  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input)
122  * ellipsoidFlattening : Flattening of ellipsoid (input)
123  * originLatitude : Latitude, in radians, at which the (input)
124  * point scale factor is 1.0
125  * longitude1 : Longitude, in radians, of first point lying on
126  * central line (input)
127  * latitude1 : Latitude, in radians, of first point lying on
128  * central line (input)
129  * longitude2 : Longitude, in radians, of second point lying on
130  * central line (input)
131  * latitude2 : Latitude, in radians, of second point lying on
132  * central line (input)
133  * falseEasting : A coordinate value, in meters, assigned to the
134  * central meridian of the projection (input)
135  * falseNorthing : A coordinate value, in meters, assigned to the
136  * origin latitude of the projection (input)
137  * scaleFactor : Multiplier which reduces distances in the
138  * projection to the actual distance on the
139  * ellipsoid (input)
140  * errorStatus : Error status (output)
141  */
142 
143  ObliqueMercator( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double originLatitude, double longitude1, double latitude1, double longitude2, double latitude2, double falseEasting, double falseNorthing, double scaleFactor );
144 
145 
146  ObliqueMercator( const ObliqueMercator &om );
147 
148 
149  ~ObliqueMercator( void );
150 
151 
153 
154 
155  /*
156  * The function getParameters returns the current ellipsoid
157  * parameters and Oblique Mercator projection parameters.
158  *
159  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output)
160  * ellipsoidFlattening : Flattening of ellipsoid (output)
161  * originLatitude : Latitude, in radians, at which the (output)
162  * point scale factor is 1.0
163  * longitude1 : Longitude, in radians, of first point lying on
164  * central line (output)
165  * latitude1 : Latitude, in radians, of first point lying on
166  * central line (output)
167  * longitude2 : Longitude, in radians, of second point lying on
168  * central line (output)
169  * latitude2 : Latitude, in radians, of second point lying on
170  * central line (output)
171  * falseEasting : A coordinate value, in meters, assigned to the
172  * central meridian of the projection (output)
173  * falseNorthing : A coordinate value, in meters, assigned to the
174  * origin latitude of the projection (output)
175  * scaleFactor : Multiplier which reduces distances in the
176  * projection to the actual distance on the
177  * ellipsoid (output)
178  */
179 
181 
182 
183  /*
184  * The function convertFromGeodetic converts geodetic (latitude and
185  * longitude) coordinates to Oblique Mercator projection (easting and
186  * northing) coordinates, according to the current ellipsoid and Oblique Mercator
187  * projection parameters. If any errors occur, an exception is thrown with a description
188  * of the error.
189  *
190  * longitude : Longitude (lambda), in radians (input)
191  * latitude : Latitude (phi), in radians (input)
192  * easting : Easting (X), in meters (output)
193  * northing : Northing (Y), in meters (output)
194  */
195 
197 
198 
199  /*
200  * The function convertToGeodetic converts Oblique Mercator projection
201  * (easting and northing) coordinates to geodetic (latitude and longitude)
202  * coordinates, according to the current ellipsoid and Oblique Mercator projection
203  * coordinates. If any errors occur, an exception is thrown with a description
204  * of the error.
205  *
206  * easting : Easting (X), in meters (input)
207  * northing : Northing (Y), in meters (input)
208  * longitude : Longitude (lambda), in radians (output)
209  * latitude : Latitude (phi), in radians (output)
210  */
211 
213 
214  private:
215 
216  /* Ellipsoid Parameters, default to WGS 84 */
217  double es;
218  double es_OVER_2;
219  double OMerc_A;
220  double OMerc_B;
221  double OMerc_E;
222  double OMerc_gamma;
223  double OMerc_azimuth; /* Azimuth of central line as it crosses origin lat */
224  double OMerc_Origin_Long; /* Longitude at center of projection */
225  double cos_gamma;
226  double sin_gamma;
227  double sin_azimuth;
228  double cos_azimuth;
229  double A_over_B;
230  double B_over_A;
231  double OMerc_u; /* Coordinates for center point (uc , vc), vc = 0 */
232  /* at center lat and lon */
233  /* Oblique Mercator projection Parameters */
234  double OMerc_Origin_Lat; /* Latitude of projection center, in radians */
235  double OMerc_Lat_1; /* Latitude of first point lying on central line */
236  double OMerc_Lon_1; /* Longitude of first point lying on central line */
237  double OMerc_Lat_2; /* Latitude of second point lying on central line */
238  double OMerc_Lon_2; /* Longitude of second point lying on central line */
239  double OMerc_Scale_Factor; /* Scale factor at projection center */
240  double OMerc_False_Northing; /* False northing, in meters, at projection center */
241  double OMerc_False_Easting; /* False easting, in meters, at projection center */
242 
243  double OMerc_Delta_Northing;
244  double OMerc_Delta_Easting;
245 
246 
247  double omercT( double lat, double e_sinlat, double e_over_2 );
248 
249  };
250  }
251 }
252 
253 #endif
254 
255 
256 // CLASSIFICATION: UNCLASSIFIED