NETGeographicLib  1.38
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Pages
PolarStereographic.h
Go to the documentation of this file.
1 #pragma once
2 /**
3  * \file NETGeographicLib/PolarStereographic.h
4  * \brief Header for NETGeographicLib::PolarStereographic class
5  *
6  * NETGeographicLib is copyright (c) Scott Heiman (2013)
7  * GeographicLib is Copyright (c) Charles Karney (2010-2012)
8  * <charles@karney.com> and licensed under the MIT/X11 License.
9  * For more information, see
10  * http://geographiclib.sourceforge.net/
11  **********************************************************************/
12 
13 namespace NETGeographicLib
14 {
15  /*!
16  \brief .NET wrapper for GeographicLib::PolarStereographic.
17 
18  This class allows .NET applications to access GeographicLib::PolarStereographic.
19  */
20  /**
21  * \brief .NET wrapper for GeographicLib::PolarStereographic.
22  *
23  * This class allows .NET applications to access GeographicLib::PolarStereographic.
24  *
25  * Implementation taken from the report,
26  * - J. P. Snyder,
27  * <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projections: A
28  * Working Manual</a>, USGS Professional Paper 1395 (1987),
29  * pp. 160--163.
30  *
31  * This is a straightforward implementation of the equations in Snyder except
32  * that Newton's method is used to invert the projection.
33  *
34  * C# Example:
35  * \include example-PolarStereographic.cs
36  * Managed C++ Example:
37  * \include example-PolarStereographic.cpp
38  * Visual Basic Example:
39  * \include example-PolarStereographic.vb
40  *
41  * <B>INTERFACE DIFFERENCES:</B><BR>
42  * A default constructor is provided that assumes WGS84 parameters and
43  * a UPS scale factor.
44  *
45  * The MajorRadius, Flattening, and CentralScale functions are
46  * implemented as properties.
47  **********************************************************************/
48  public ref class PolarStereographic
49  {
50  private:
51  // pointer to the unmanaged GeographicLib::PolarStereographic
52  GeographicLib::PolarStereographic* m_pPolarStereographic;
53 
54  // the finalizer frees the unmanaged memory when the object is destroyed.
55  !PolarStereographic(void);
56  public:
57 
58  /**
59  * Constructor for a ellipsoid with
60  *
61  * @param[in] a equatorial radius (meters).
62  * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
63  * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening
64  * to 1/\e f.
65  * @param[in] k0 central scale factor.
66  * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k0 is
67  * not positive.
68  **********************************************************************/
69  PolarStereographic(double a, double f, double k0);
70 
71  /**
72  * An instantiation of PolarStereographic with the WGS84 ellipsoid
73  * and the UPS scale factor.
74  **********************************************************************/
76 
77  /**
78  * The destructor calls the finalizer.
79  **********************************************************************/
81  { this->!PolarStereographic(); }
82 
83  /**
84  * Set the scale for the projection.
85  *
86  * @param[in] lat (degrees) assuming \e northp = true.
87  * @param[in] k scale at latitude \e lat
88  * @exception GeographicErr \e k is not positive.
89  * @exception GeographicErr if \e lat is not in (&minus;90&deg;,
90  * 90&deg;] or this object was created with the default constructor.
91  **********************************************************************/
92  void SetScale(double lat, double k);
93 
94  /**
95  * Forward projection, from geographic to polar stereographic.
96  *
97  * @param[in] northp the pole which is the center of projection (true means
98  * north, false means south).
99  * @param[in] lat latitude of point (degrees).
100  * @param[in] lon longitude of point (degrees).
101  * @param[out] x easting of point (meters).
102  * @param[out] y northing of point (meters).
103  * @param[out] gamma meridian convergence at point (degrees).
104  * @param[out] k scale of projection at point.
105  *
106  * No false easting or northing is added. \e lat should be in the range
107  * (&minus;90&deg;, 90&deg;] for \e northp = true and in the range
108  * [&minus;90&deg;, 90&deg;) for \e northp = false; \e lon should
109  * be in the range [&minus;540&deg;, 540&deg;).
110  **********************************************************************/
111  void Forward(bool northp, double lat, double lon,
112  [System::Runtime::InteropServices::Out] double% x,
113  [System::Runtime::InteropServices::Out] double% y,
114  [System::Runtime::InteropServices::Out] double% gamma,
115  [System::Runtime::InteropServices::Out] double% k);
116 
117  /**
118  * Reverse projection, from polar stereographic to geographic.
119  *
120  * @param[in] northp the pole which is the center of projection (true means
121  * north, false means south).
122  * @param[in] x easting of point (meters).
123  * @param[in] y northing of point (meters).
124  * @param[out] lat latitude of point (degrees).
125  * @param[out] lon longitude of point (degrees).
126  * @param[out] gamma meridian convergence at point (degrees).
127  * @param[out] k scale of projection at point.
128  *
129  * No false easting or northing is added. The value of \e lon returned is
130  * in the range [&minus;180&deg;, 180&deg;).
131  **********************************************************************/
132  void Reverse(bool northp, double x, double y,
133  [System::Runtime::InteropServices::Out] double% lat,
134  [System::Runtime::InteropServices::Out] double% lon,
135  [System::Runtime::InteropServices::Out] double% gamma,
136  [System::Runtime::InteropServices::Out] double% k);
137 
138  /**
139  * PolarStereographic::Forward without returning the convergence and scale.
140  **********************************************************************/
141  void Forward(bool northp, double lat, double lon,
142  [System::Runtime::InteropServices::Out] double% x,
143  [System::Runtime::InteropServices::Out] double% y);
144 
145  /**
146  * PolarStereographic::Reverse without returning the convergence and scale.
147  **********************************************************************/
148  void Reverse(bool northp, double x, double y,
149  [System::Runtime::InteropServices::Out] double% lat,
150  [System::Runtime::InteropServices::Out] double% lon);
151 
152  /** \name Inspector functions
153  **********************************************************************/
154  ///@{
155  /**
156  * @return \e a the equatorial radius of the ellipsoid (meters). This is
157  * the value used in the constructor.
158  **********************************************************************/
159  property double MajorRadius { double get(); }
160 
161  /**
162  * @return \e f the flattening of the ellipsoid. This is the value used in
163  * the constructor.
164  **********************************************************************/
165  property double Flattening { double get(); }
166 
167  /**
168  * The central scale for the projection. This is the value of \e k0 used
169  * in the constructor and is the scale at the pole unless overridden by
170  * PolarStereographic::SetScale.
171  **********************************************************************/
172  property double CentralScale { double get(); }
173  ///@}
174  };
175 } //namespace NETGeographicLib
void SetScale(double lat, double k)
void Reverse(bool northp, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k)
.NET wrapper for GeographicLib::PolarStereographic.
void Forward(bool northp, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k)