UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
BritishNationalGrid.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef BritishNationalGrid_H
4 #define BritishNationalGrid_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: BRITISH NATIONAL GRID
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between Geodetic coordinates
12  * (latitude and longitude) and British National Grid coordinates.
13  *
14  * ERROR HANDLING
15  *
16  * This component checks parameters for valid values. If an invalid value
17  * is found the error code is combined with the current error code using
18  * the bitwise or. This combining allows multiple error codes to be
19  * returned. The possible error codes are:
20  *
21  * BNG_NO_ERROR : No errors occurred in function
22  * BNG_LAT_ERROR : Latitude outside of valid range
23  * (49.5 to 61.5 degrees)
24  * BNG_LON_ERROR : Longitude outside of valid range
25  * (-10.0 to 3.5 degrees)
26  * BNG_EASTING_ERROR : Easting outside of valid range
27  * (depending on ellipsoid and
28  * projection parameters)
29  * BNG_NORTHING_ERROR : Northing outside of valid range
30  * (depending on ellipsoid and
31  * projection parameters)
32  * BNG_STRING_ERROR : A BNG string error: string too long,
33  * too short, or badly formed
34  * BNG_INVALID_AREA_ERROR : Coordinate is outside of valid area
35  * BNG_ELLIPSOID_ERROR : Invalid ellipsoid - must be Airy
36  *
37  * REUSE NOTES
38  *
39  * BRITISH NATIONAL GRID is intended for reuse by any application that
40  * performs a British National Grid projection or its inverse.
41  *
42  * REFERENCES
43  *
44  * Further information on BRITISH NATIONAL GRID can be found in the
45  * Reuse Manual.
46  *
47  * BRITISH NATIONAL GRID originated from :
48  * 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  * BRITISH NATIONAL GRID has no restrictions.
60  *
61  * ENVIRONMENT
62  *
63  * BRITISH NATIONAL GRID was tested and certified in the following
64  * environments:
65  *
66  * 1. Solaris 2.5 with GCC, version 2.8.1
67  * 2. Windows 95 with MS Visual C++, version 6
68  *
69  * MODIFICATIONS
70  *
71  * Date Description
72  * ---- -----------
73  * 09-06-00 Original Code
74  * 03-02-07 Original C++ Code
75  *
76  *
77  */
78 
79 #include "DtccApi.h"
80 #include "CoordinateSystem.h"
81 
82 
83 
84 namespace MSP
85 {
86  namespace CCS
87  {
88  class EllipsoidParameters;
89  class TransverseMercator;
90  class BNGCoordinates;
91  class GeodeticCoordinates;
92 
93 
94  /***************************************************************************/
95  /*
96  * DEFINES
97  */
99  {
100  public:
101 
102  /*
103  * The constructor receives the ellipsoid code and sets
104  * the corresponding state variables. If any errors occur, an exception is thrown
105  * with a description of the error.
106  *
107  * ellipsoidCode : 2-letter code for ellipsoid (input)
108  */
109 
110  BritishNationalGrid( char *ellipsoidCode );
111 
112 
114 
115 
116  ~BritishNationalGrid( void );
117 
118 
119  BritishNationalGrid& operator=( const BritishNationalGrid &bng );
120 
121 
122  /*
123  * The function getParameters returns the current ellipsoid
124  * code.
125  *
126  * ellipsoidCode : 2-letter code for ellipsoid (output)
127  */
128 
129  EllipsoidParameters* getParameters() const;
130 
131 
132  /*
133  * The function convertFromGeodetic converts geodetic (latitude and
134  * longitude) coordinates to a BNG coordinate string, according to the
135  * current ellipsoid parameters. If any errors occur, an exception is thrown
136  * with a description of the error.
137  *
138  * longitude : Longitude, in radians (input)
139  * latitude : Latitude, in radians (input)
140  * precision : Precision level of BNG string (input)
141  * BNGString : British National Grid coordinate string (output)
142  *
143  */
144 
145  MSP::CCS::BNGCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates, long precision );
146 
147 
148  /*
149  * The function convertToGeodetic converts a BNG coordinate string
150  * to geodetic (latitude and longitude) coordinates, according to the current
151  * ellipsoid parameters. If any errors occur, an exception is thrown
152  * with a description of the error.
153  *
154  * BNGString : British National Grid coordinate string (input)
155  * longitude : Longitude, in radians (output)
156  * latitude : Latitude, in radians (output)
157  *
158  */
159 
160  MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::BNGCoordinates* bngCoordinates );
161 
162 
163  /*
164  * The function convertFromTransverseMercator converts Transverse Mercator
165  * (easting and northing) coordinates to a BNG coordinate string, according
166  * to the current ellipsoid parameters. If any errors occur, an exception is thrown
167  * with a description of the error.
168  *
169  * easting : Easting (X), in meters (input)
170  * northing : Northing (Y), in meters (input)
171  * precision : Precision level of BNG string (input)
172  * BNGString : British National Grid coordinate string (output)
173  */
174 
175  MSP::CCS::BNGCoordinates* convertFromTransverseMercator( MapProjectionCoordinates* mapProjectionCoordinates, long precision );
176 
177 
178  /*
179  * The function convertToTransverseMercator converts a BNG coordinate string
180  * to Transverse Mercator projection (easting and northing) coordinates
181  * according to the current ellipsoid parameters. If any errors occur, an exception is thrown
182  * with a description of the error.
183  *
184  * BNGString : British National Grid coordinate string (input)
185  * easting : Easting (X), in meters (output)
186  * northing : Northing (Y), in meters (output)
187  */
188 
189  MSP::CCS::MapProjectionCoordinates* convertToTransverseMercator( MSP::CCS::BNGCoordinates* bngCoordinates );
190 
191  private:
192 
193  TransverseMercator* transverseMercator;
194 
195  char BNG_Letters[3];
196  double BNG_Easting;
197  double BNG_Northing;
198  char BNG_Ellipsoid_Code[3];
199 
200  };
201  }
202 }
203 
204 #endif
205 
206 
207 // CLASSIFICATION: UNCLASSIFIED