NETGeographicLib  1.43
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  * http://geographiclib.sourceforge.net/
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, MajorRadius 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;] and \e
97  * lon0 should be in the range [&minus;540&deg;, 540&deg;).
98  **********************************************************************/
99  CassiniSoldner(double lat0, double lon0, Geodesic^ earth );
100 
101  /**
102  * The destructor calls the finalizer.
103  **********************************************************************/
105  { this->!CassiniSoldner(); }
106 
107  /**
108  * Set the central point of the projection
109  *
110  * @param[in] lat0 latitude of center point of projection (degrees).
111  * @param[in] lon0 longitude of center point of projection (degrees).
112  *
113  * \e lat0 should be in the range [&minus;90&deg;, 90&deg;] and \e
114  * lon0 should be in the range [&minus;540&deg;, 540&deg;).
115  **********************************************************************/
116  void Reset(double lat0, double lon0);
117 
118  /**
119  * Forward projection, from geographic to Cassini-Soldner.
120  *
121  * @param[in] lat latitude of point (degrees).
122  * @param[in] lon longitude of point (degrees).
123  * @param[out] x easting of point (meters).
124  * @param[out] y northing of point (meters).
125  * @param[out] azi azimuth of easting direction at point (degrees).
126  * @param[out] rk reciprocal of azimuthal northing scale at point.
127  *
128  * \e lat should be in the range [&minus;90&deg;, 90&deg;] and \e
129  * lon should be in the range [&minus;540&deg;, 540&deg;). A call
130  * to Forward followed by a call to Reverse will return the original (\e
131  * lat, \e lon) (to within roundoff). The routine does nothing if the
132  * origin has not been set.
133  **********************************************************************/
134  void Forward(double lat, double lon,
135  [System::Runtime::InteropServices::Out] double% x,
136  [System::Runtime::InteropServices::Out] double% y,
137  [System::Runtime::InteropServices::Out] double% azi,
138  [System::Runtime::InteropServices::Out] double% rk);
139 
140  /**
141  * Reverse projection, from Cassini-Soldner to geographic.
142  *
143  * @param[in] x easting of point (meters).
144  * @param[in] y northing of point (meters).
145  * @param[out] lat latitude of point (degrees).
146  * @param[out] lon longitude of point (degrees).
147  * @param[out] azi azimuth of easting direction at point (degrees).
148  * @param[out] rk reciprocal of azimuthal northing scale at point.
149  *
150  * A call to Reverse followed by a call to Forward will return the original
151  * (\e x, \e y) (to within roundoff), provided that \e x and \e y are
152  * sufficiently small not to "wrap around" the earth. The routine does
153  * nothing if the origin has not been set.
154  **********************************************************************/
155  void Reverse(double x, double y,
156  [System::Runtime::InteropServices::Out] double% lat,
157  [System::Runtime::InteropServices::Out] double% lon,
158  [System::Runtime::InteropServices::Out] double% azi,
159  [System::Runtime::InteropServices::Out] double% rk);
160 
161  /**
162  * CassiniSoldner::Forward without returning the azimuth and scale.
163  **********************************************************************/
164  void Forward(double lat, double lon,
165  [System::Runtime::InteropServices::Out] double% x,
166  [System::Runtime::InteropServices::Out] double% y);
167 
168  /**
169  * CassiniSoldner::Reverse without returning the azimuth and scale.
170  **********************************************************************/
171  void Reverse(double x, double y,
172  [System::Runtime::InteropServices::Out] double% lat,
173  [System::Runtime::InteropServices::Out] double% lon);
174 
175  /** \name Inspector functions
176  **********************************************************************/
177  ///@{
178  /**
179  * @return \e lat0 the latitude of origin (degrees).
180  **********************************************************************/
181  property double LatitudeOrigin { double get(); }
182 
183  /**
184  * @return \e lon0 the longitude of origin (degrees).
185  **********************************************************************/
186  property double LongitudeOrigin { double get(); }
187 
188  /**
189  * @return \e a the equatorial radius of the ellipsoid (meters). This is
190  * the value inherited from the Geodesic object used in the constructor.
191  **********************************************************************/
192  property double MajorRadius { double get(); }
193 
194  /**
195  * @return \e f the flattening of the ellipsoid. This is the value
196  * inherited from the Geodesic object used in the constructor.
197  **********************************************************************/
198  property double Flattening { double get(); }
199  ///@}
200  };
201 } // 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)
.NET wrapper for GeographicLib::Geodesic.
Definition: Geodesic.h:170
CassiniSoldner(double lat0, double lon0)
void Reset(double lat0, double lon0)