NETGeographicLib  1.51
Georef.h
Go to the documentation of this file.
1 /**
2  * \file NETGeographicLib/Georef.h
3  * \brief Header for NETGeographicLib::Georef class
4  *
5  * NETGeographicLib is copyright (c) Scott Heiman (2013-2015)
6  * GeographicLib is Copyright (c) Charles Karney (2010-2012)
7  * <charles@karney.com> and licensed under the MIT/X11 License.
8  * For more information, see
9  * https://geographiclib.sourceforge.io/
10  **********************************************************************/
11 #pragma once
12 
13 namespace NETGeographicLib
14 {
15  /**
16  * \brief .NET wrapper for GeographicLib::Georef.
17  *
18  * The World Geographic Reference System is described in
19  * - https://en.wikipedia.org/wiki/Georef
20  * - http://earth-info.nga.mil/GandG/coordsys/grids/georef.pdf
21  * .
22  * It provides a compact string representation of a geographic area
23  * (expressed as latitude and longitude). The classes GARS and Geohash
24  * implement similar compact representations.
25  *
26  * C# Example:
27  * \include example-Georef.cs
28  * Managed C++ Example:
29  * \include example-Georef.cpp
30  * Visual Basic Example:
31  * \include example-Georef.vb
32  **********************************************************************/
33  public ref class Georef
34  {
35  private:
36  // hide the constructor since all members of this class are static.
37  Georef() {}
38 
39  public:
40  /**
41  * Convert from geographic coordinates to georef.
42  *
43  * @param[in] lat latitude of point (degrees).
44  * @param[in] lon longitude of point (degrees).
45  * @param[in] prec the precision of the resulting georef.
46  * @param[out] georef the georef string.
47  * @exception GeographicErr if \e lat is not in [&minus;90&deg;,
48  * 90&deg;] or if memory for \e georef can't be allocated.
49  *
50  * \e prec specifies the precision of \e georef as follows:
51  * - \e prec = &minus;1 (min), 15&deg;
52  * - \e prec = 0, 1&deg;
53  * - \e prec = 1, converted to \e prec = 2
54  * - \e prec = 2, 1'
55  * - \e prec = 3, 0.1'
56  * - \e prec = 4, 0.01'
57  * - \e prec = 5, 0.001'
58  * - &hellip;
59  * - \e prec = 11 (max), 10<sup>&minus;9</sup>'
60  *
61  * If \e lat or \e lon is NaN, then \e georef is set to "INVALID".
62  **********************************************************************/
63  static void Forward(double lat, double lon, int prec,
64  [System::Runtime::InteropServices::Out] System::String^% georef);
65 
66  /**
67  * Convert from Georef to geographic coordinates.
68  *
69  * @param[in] georef the Georef.
70  * @param[out] lat latitude of point (degrees).
71  * @param[out] lon longitude of point (degrees).
72  * @param[out] prec the precision of \e georef.
73  * @param[in] centerp if true (the default) return the center
74  * \e georef, otherwise return the south-west corner.
75  * @exception GeographicErr if \e georef is illegal.
76  *
77  * The case of the letters in \e georef is ignored. \e prec is in the
78  * range [&minus;1, 11] and gives the precision of \e georef as follows:
79  * - \e prec = &minus;1 (min), 15&deg;
80  * - \e prec = 0, 1&deg;
81  * - \e prec = 1, not returned
82  * - \e prec = 2, 1'
83  * - \e prec = 3, 0.1'
84  * - \e prec = 4, 0.01'
85  * - \e prec = 5, 0.001'
86  * - &hellip;
87  * - \e prec = 11 (max), 10<sup>&minus;9</sup>'
88  *
89  * If the first 3 characters of \e georef are "INV", then \e lat and \e lon
90  * are set to NaN and \e prec is unchanged.
91  **********************************************************************/
92  static void Reverse( System::String^ georef,
93  [System::Runtime::InteropServices::Out] double% lat,
94  [System::Runtime::InteropServices::Out] double% lon,
95  [System::Runtime::InteropServices::Out] int% prec,
96  bool centerp );
97 
98  /**
99  * The angular resolution of a Georef.
100  *
101  * @param[in] prec the precision of the Georef.
102  * @return the latitude-longitude resolution (degrees).
103  *
104  * Internally, \e prec is first put in the range [&minus;1, 11].
105  **********************************************************************/
106  static double Resolution(int prec);
107 
108  /**
109  * The Georef precision required to meet a given geographic resolution.
110  *
111  * @param[in] res the minimum of resolution in latitude and longitude
112  * (degrees).
113  * @return Georef precision.
114  *
115  * The returned length is in the range [0, 11].
116  **********************************************************************/
117  static int Precision(double res);
118  };
119 }
.NET wrapper for GeographicLib::Georef.
Definition: Georef.h:34
static void Forward(double lat, double lon, int prec, [System::Runtime::InteropServices::Out] System::String^% georef)
static int Precision(double res)
static void Reverse(System::String^ georef, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] int% prec, bool centerp)
static double Resolution(int prec)