NETGeographicLib  1.51
CassiniSoldner.h
Go to the documentation of this file.
1 /**
2  * \file NETGeographicLib/CassiniSoldner.h
3  * \brief Header for NETGeographicLib::CassiniSoldner class
4  *
5  * NETGeographicLib is copyright (c) Scott Heiman (2013)
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::CassiniSoldner.
17  *
18  * This class allows .NET applications to access GeographicLib::CassiniSoldner.
19  *
20  * Cassini-Soldner projection centered at an arbitrary position, \e lat0, \e
21  * lon0, on the ellipsoid. This projection is a transverse cylindrical
22  * equidistant projection. The projection from (\e lat, \e lon) to easting
23  * and northing (\e x, \e y) is defined by geodesics as follows. Go north
24  * along a geodesic a distance \e y from the central point; then turn
25  * clockwise 90&deg; and go a distance \e x along a geodesic.
26  * (Although the initial heading is north, this changes to south if the pole
27  * is crossed.) This procedure uniquely defines the reverse projection. The
28  * forward projection is constructed as follows. Find the point (\e lat1, \e
29  * lon1) on the meridian closest to (\e lat, \e lon). Here we consider the
30  * full meridian so that \e lon1 may be either \e lon0 or \e lon0 +
31  * 180&deg;. \e x is the geodesic distance from (\e lat1, \e lon1) to
32  * (\e lat, \e lon), appropriately signed according to which side of the
33  * central meridian (\e lat, \e lon) lies. \e y is the shortest distance
34  * along the meridian from (\e lat0, \e lon0) to (\e lat1, \e lon1), again,
35  * appropriately signed according to the initial heading. [Note that, in the
36  * case of prolate ellipsoids, the shortest meridional path from (\e lat0, \e
37  * lon0) to (\e lat1, \e lon1) may not be the shortest path.] This procedure
38  * uniquely defines the forward projection except for a small class of points
39  * for which there may be two equally short routes for either leg of the
40  * path.
41  *
42  * Because of the properties of geodesics, the (\e x, \e y) grid is
43  * orthogonal. The scale in the easting direction is unity. The scale, \e
44  * k, in the northing direction is unity on the central meridian and
45  * increases away from the central meridian. The projection routines return
46  * \e azi, the true bearing of the easting direction, and \e rk = 1/\e k, the
47  * reciprocal of the scale in the northing direction.
48  *
49  * The conversions all take place using a Geodesic object (by default
50  * Geodesic::WGS84). For more information on geodesics see \ref geodesic.
51  * The determination of (\e lat1, \e lon1) in the forward projection is by
52  * solving the inverse geodesic problem for (\e lat, \e lon) and its twin
53  * obtained by reflection in the meridional plane. The scale is found by
54  * determining where two neighboring geodesics intersecting the central
55  * meridian at \e lat1 and \e lat1 + \e dlat1 intersect and taking the ratio
56  * of the reduced lengths for the two geodesics between that point and,
57  * respectively, (\e lat1, \e lon1) and (\e lat, \e lon).
58  *
59  * C# Example:
60  * \include example-CassiniSoldner.cs
61  * Managed C++ Example:
62  * \include example-CassiniSoldner.cpp
63  * Visual Basic Example:
64  * \include example-CassiniSoldner.vb
65  *
66  * <B>INTERFACE DIFFERENCES:</B><BR>
67  * The LatitudeOrigin, LongitudeOrigin, EquatorialRadius and Flattening
68  * functions are implimented as properties.
69  **********************************************************************/
70  public ref class CassiniSoldner
71  {
72  private:
73  // A pointer to the unmanaged GeographicLib::CassiniSoldner
74  GeographicLib::CassiniSoldner* m_pCassiniSoldner;
75 
76  // The finalizer frees the unmanaged memory when the object is destroyed.
77  !CassiniSoldner();
78  public:
79  /**
80  * Constructor for CassiniSoldner specifying a center point and
81  * assuming the WGS84 ellipsoid.
82  *
83  * @param[in] lat0 latitude of center point of projection (degrees).
84  * @param[in] lon0 longitude of center point of projection (degrees).
85  **********************************************************************/
86  CassiniSoldner(double lat0, double lon0);
87 
88  /**
89  * Constructor for CassiniSoldner specifying a center point.
90  *
91  * @param[in] lat0 latitude of center point of projection (degrees).
92  * @param[in] lon0 longitude of center point of projection (degrees).
93  * @param[in] earth the Geodesic object to use for geodesic calculations.
94  * By default this uses the WGS84 ellipsoid.
95  *
96  * \e lat0 should be in the range [&minus;90&deg;, 90&deg;].
97  **********************************************************************/
98  CassiniSoldner(double lat0, double lon0, Geodesic^ earth );
99 
100  /**
101  * The destructor calls the finalizer.
102  **********************************************************************/
104  { this->!CassiniSoldner(); }
105 
106  /**
107  * Set the central point of the projection
108  *
109  * @param[in] lat0 latitude of center point of projection (degrees).
110  * @param[in] lon0 longitude of center point of projection (degrees).
111  *
112  * \e lat0 should be in the range [&minus;90&deg;, 90&deg;].
113  **********************************************************************/
114  void Reset(double lat0, double lon0);
115 
116  /**
117  * Forward projection, from geographic to Cassini-Soldner.
118  *
119  * @param[in] lat latitude of point (degrees).
120  * @param[in] lon longitude of point (degrees).
121  * @param[out] x easting of point (meters).
122  * @param[out] y northing of point (meters).
123  * @param[out] azi azimuth of easting direction at point (degrees).
124  * @param[out] rk reciprocal of azimuthal northing scale at point.
125  *
126  * \e lat should be in the range [&minus;90&deg;, 90&deg;]. A call to
127  * Forward followed by a call to Reverse will return the original (\e
128  * lat, \e lon) (to within roundoff). The routine does nothing if the
129  * origin has not been set.
130  **********************************************************************/
131  void Forward(double lat, double lon,
132  [System::Runtime::InteropServices::Out] double% x,
133  [System::Runtime::InteropServices::Out] double% y,
134  [System::Runtime::InteropServices::Out] double% azi,
135  [System::Runtime::InteropServices::Out] double% rk);
136 
137  /**
138  * Reverse projection, from Cassini-Soldner to geographic.
139  *
140  * @param[in] x easting of point (meters).
141  * @param[in] y northing of point (meters).
142  * @param[out] lat latitude of point (degrees).
143  * @param[out] lon longitude of point (degrees).
144  * @param[out] azi azimuth of easting direction at point (degrees).
145  * @param[out] rk reciprocal of azimuthal northing scale at point.
146  *
147  * A call to Reverse followed by a call to Forward will return the original
148  * (\e x, \e y) (to within roundoff), provided that \e x and \e y are
149  * sufficiently small not to "wrap around" the earth. The routine does
150  * nothing if the origin has not been set.
151  **********************************************************************/
152  void Reverse(double x, double y,
153  [System::Runtime::InteropServices::Out] double% lat,
154  [System::Runtime::InteropServices::Out] double% lon,
155  [System::Runtime::InteropServices::Out] double% azi,
156  [System::Runtime::InteropServices::Out] double% rk);
157 
158  /**
159  * CassiniSoldner::Forward without returning the azimuth and scale.
160  **********************************************************************/
161  void Forward(double lat, double lon,
162  [System::Runtime::InteropServices::Out] double% x,
163  [System::Runtime::InteropServices::Out] double% y);
164 
165  /**
166  * CassiniSoldner::Reverse without returning the azimuth and scale.
167  **********************************************************************/
168  void Reverse(double x, double y,
169  [System::Runtime::InteropServices::Out] double% lat,
170  [System::Runtime::InteropServices::Out] double% lon);
171 
172  /** \name Inspector functions
173  **********************************************************************/
174  ///@{
175  /**
176  * @return \e lat0 the latitude of origin (degrees).
177  **********************************************************************/
178  property double LatitudeOrigin { double get(); }
179 
180  /**
181  * @return \e lon0 the longitude of origin (degrees).
182  **********************************************************************/
183  property double LongitudeOrigin { double get(); }
184 
185  /**
186  * @return \e a the equatorial radius of the ellipsoid (meters). This is
187  * the value inherited from the Geodesic object used in the constructor.
188  **********************************************************************/
189  property double EquatorialRadius { double get(); }
190 
191  /**
192  * @return \e f the flattening of the ellipsoid. This is the value
193  * inherited from the Geodesic object used in the constructor.
194  **********************************************************************/
195  property double Flattening { double get(); }
196  ///@}
197  };
198 } // namespace NETGeographicLib
.NET wrapper for GeographicLib::CassiniSoldner.
void Reverse(double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk)
void Forward(double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk)
void Reverse(double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon)
CassiniSoldner(double lat0, double lon0, Geodesic^ earth)
void Reset(double lat0, double lon0)
CassiniSoldner(double lat0, double lon0)
void Forward(double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y)
.NET wrapper for GeographicLib::Geodesic.
Definition: Geodesic.h:171