source: trunk/gdal/frmts/nitf/mgrs.h

Last change on this file was 35897, checked in by Kurt Schwehr, 8 years ago

Define / set one var per line / statement in frmts.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.6 KB
Line 
1#ifndef MGRS_H
2 #define MGRS_H
3
4/***************************************************************************
5 * $Id: mgrs.h 35897 2016-10-24 11:54:24Z goatbar $
6 *
7 * Project: MGRS Converter
8 * Purpose: Geotrans declarations for MGRS translation (slightly adapted)
9 * Author: Unknown (NIMA)
10 *
11 ***************************************************************************
12 ***************************************************************************
13 * RSC IDENTIFIER: MGRS
14 *
15 * ABSTRACT
16 *
17 * This component converts between geodetic coordinates (latitude and
18 * longitude) and Military Grid Reference System (MGRS) coordinates.
19 *
20 * ERROR HANDLING
21 *
22 * This component checks parameters for valid values. If an invalid value
23 * is found, the error code is combined with the current error code using
24 * the bitwise or. This combining allows multiple error codes to be
25 * returned. The possible error codes are:
26 *
27 * MGRS_NO_ERROR : No errors occurred in function
28 * MGRS_LAT_ERROR : Latitude outside of valid range
29 * (-90 to 90 degrees)
30 * MGRS_LON_ERROR : Longitude outside of valid range
31 * (-180 to 360 degrees)
32 * MGRS_STR_ERROR : An MGRS string error: string too long,
33 * too short, or badly formed
34 * MGRS_PRECISION_ERROR : The precision must be between 0 and 5
35 * inclusive.
36 * MGRS_A_ERROR : Semi-major axis less than or equal to zero
37 * MGRS_INV_F_ERROR : Inverse flattening outside of valid range
38 * (250 to 350)
39 * MGRS_EASTING_ERROR : Easting outside of valid range
40 * (100,000 to 900,000 meters for UTM)
41 * (0 to 4,000,000 meters for UPS)
42 * MGRS_NORTHING_ERROR : Northing outside of valid range
43 * (0 to 10,000,000 meters for UTM)
44 * (0 to 4,000,000 meters for UPS)
45 * MGRS_ZONE_ERROR : Zone outside of valid range (1 to 60)
46 * MGRS_HEMISPHERE_ERROR : Invalid hemisphere ('N' or 'S')
47 *
48 * REUSE NOTES
49 *
50 * MGRS is intended for reuse by any application that does conversions
51 * between geodetic coordinates and MGRS coordinates.
52 *
53 * REFERENCES
54 *
55 * Further information on MGRS can be found in the Reuse Manual.
56 *
57 * MGRS originated from : 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 *
69 * ENVIRONMENT
70 *
71 * MGRS was tested and certified in the following environments:
72 *
73 * 1. Solaris 2.5 with GCC version 2.8.1
74 * 2. Windows 95 with MS Visual C++ version 6
75 *
76 * MODIFICATIONS
77 *
78 * Date Description
79 * ---- -----------
80 * 16-11-94 Original Code
81 * 15-09-99 Reengineered upper layers
82 *
83 */
84
85/***************************************************************************/
86/*
87 * DEFINES
88 */
89
90 #define MGRS_NO_ERROR 0x0000
91 #define MGRS_LAT_ERROR 0x0001
92 #define MGRS_LON_ERROR 0x0002
93 #define MGRS_STRING_ERROR 0x0004
94 #define MGRS_PRECISION_ERROR 0x0008
95 #define MGRS_A_ERROR 0x0010
96 #define MGRS_INV_F_ERROR 0x0020
97 #define MGRS_EASTING_ERROR 0x0040
98 #define MGRS_NORTHING_ERROR 0x0080
99 #define MGRS_ZONE_ERROR 0x0100
100 #define MGRS_HEMISPHERE_ERROR 0x0200
101
102/***************************************************************************/
103/*
104 * FUNCTION PROTOTYPES
105 */
106
107/* ensure proper linkage to c++ programs */
108 #ifdef __cplusplus
109extern "C" {
110 #endif
111
112#ifdef unused
113 long Set_MGRS_Parameters(double a,
114 double f,
115 char *Ellipsoid_Code);
116#endif
117/*
118 * The function Set_MGRS_Parameters receives the ellipsoid parameters and sets
119 * the corresponding state variables. If any errors occur, the error code(s)
120 * are returned by the function, otherwise MGRS_NO_ERROR is returned.
121 *
122 * a : Semi-major axis of ellipsoid in meters (input)
123 * f : Flattening of ellipsoid (input)
124 * Ellipsoid_Code : 2-letter code for ellipsoid (input)
125 */
126
127 void Get_MGRS_Parameters(double *a,
128 double *f,
129 char *Ellipsoid_Code);
130/*
131 * The function Get_MGRS_Parameters returns the current ellipsoid
132 * parameters.
133 *
134 * a : Semi-major axis of ellipsoid, in meters (output)
135 * f : Flattening of ellipsoid (output)
136 * Ellipsoid_Code : 2-letter code for ellipsoid (output)
137 */
138
139 long Convert_Geodetic_To_MGRS (double Latitude,
140 double Longitude,
141 long Precision,
142 char *MGRS);
143/*
144 * The function Convert_Geodetic_To_MGRS converts geodetic (latitude and
145 * longitude) coordinates to an MGRS coordinate string, according to the
146 * current ellipsoid parameters. If any errors occur, the error code(s)
147 * are returned by the function, otherwise MGRS_NO_ERROR is returned.
148 *
149 * Latitude : Latitude in radians (input)
150 * Longitude : Longitude in radians (input)
151 * Precision : Precision level of MGRS string (input)
152 * MGRS : MGRS coordinate string (output)
153 *
154 */
155
156 long Convert_MGRS_To_Geodetic (char *MGRS,
157 double *Latitude,
158 double *Longitude);
159/*
160 * This function converts an MGRS coordinate string to Geodetic (latitude
161 * and longitude in radians) coordinates. If any errors occur, the error
162 * code(s) are returned by the function, otherwise MGRS_NO_ERROR is returned.
163 *
164 * MGRS : MGRS coordinate string (input)
165 * Latitude : Latitude in radians (output)
166 * Longitude : Longitude in radians (output)
167 *
168 */
169
170 long Convert_UTM_To_MGRS (long Zone,
171 char Hemisphere,
172 double Easting,
173 double Northing,
174 long Precision,
175 char *MGRS);
176/*
177 * The function Convert_UTM_To_MGRS converts UTM (zone, easting, and
178 * northing) coordinates to an MGRS coordinate string, according to the
179 * current ellipsoid parameters. If any errors occur, the error code(s)
180 * are returned by the function, otherwise MGRS_NO_ERROR is returned.
181 *
182 * Zone : UTM zone (input)
183 * Hemisphere : North or South hemisphere (input)
184 * Easting : Easting (X) in meters (input)
185 * Northing : Northing (Y) in meters (input)
186 * Precision : Precision level of MGRS string (input)
187 * MGRS : MGRS coordinate string (output)
188 */
189
190 long Convert_MGRS_To_UTM (char *MGRS,
191 long *Zone,
192 char *Hemisphere,
193 double *Easting,
194 double *Northing);
195/*
196 * The function Convert_MGRS_To_UTM converts an MGRS coordinate string
197 * to UTM projection (zone, hemisphere, easting and northing) coordinates
198 * according to the current ellipsoid parameters. If any errors occur,
199 * the error code(s) are returned by the function, otherwise UTM_NO_ERROR
200 * is returned.
201 *
202 * MGRS : MGRS coordinate string (input)
203 * Zone : UTM zone (output)
204 * Hemisphere : North or South hemisphere (output)
205 * Easting : Easting (X) in meters (output)
206 * Northing : Northing (Y) in meters (output)
207 */
208
209 long Convert_UPS_To_MGRS ( char Hemisphere,
210 double Easting,
211 double Northing,
212 long Precision,
213 char *MGRS);
214
215/*
216 * The function Convert_UPS_To_MGRS converts UPS (hemisphere, easting,
217 * and northing) coordinates to an MGRS coordinate string according to
218 * the current ellipsoid parameters. If any errors occur, the error
219 * code(s) are returned by the function, otherwise UPS_NO_ERROR is
220 * returned.
221 *
222 * Hemisphere : Hemisphere either 'N' or 'S' (input)
223 * Easting : Easting/X in meters (input)
224 * Northing : Northing/Y in meters (input)
225 * Precision : Precision level of MGRS string (input)
226 * MGRS : MGRS coordinate string (output)
227 */
228
229 long Convert_MGRS_To_UPS ( char *MGRS,
230 char *Hemisphere,
231 double *Easting,
232 double *Northing);
233/*
234 * The function Convert_MGRS_To_UPS converts an MGRS coordinate string
235 * to UPS (hemisphere, easting, and northing) coordinates, according
236 * to the current ellipsoid parameters. If any errors occur, the error
237 * code(s) are returned by the function, otherwise UPS_NO_ERROR is returned.
238 *
239 * MGRS : MGRS coordinate string (input)
240 * Hemisphere : Hemisphere either 'N' or 'S' (output)
241 * Easting : Easting/X in meters (output)
242 * Northing : Northing/Y in meters (output)
243 */
244
245 #ifdef __cplusplus
246}
247 #endif
248
249#endif /* MGRS_H */
Note: See TracBrowser for help on using the repository browser.