00001 #pragma once 00002 /** 00003 * \file NETGeographicLib/PolarStereographic.h 00004 * \brief Header for NETGeographicLib::PolarStereographic class 00005 * 00006 * NETGeographicLib is copyright (c) Scott Heiman (2013) 00007 * GeographicLib is Copyright (c) Charles Karney (2010-2012) 00008 * <charles@karney.com> and licensed under the MIT/X11 License. 00009 * For more information, see 00010 * http://geographiclib.sourceforge.net/ 00011 **********************************************************************/ 00012 00013 namespace NETGeographicLib 00014 { 00015 /*! 00016 \brief .NET wrapper for GeographicLib::PolarStereographic. 00017 00018 This class allows .NET applications to access GeographicLib::PolarStereographic. 00019 */ 00020 /** 00021 * \brief .NET wrapper for GeographicLib::PolarStereographic. 00022 * 00023 * This class allows .NET applications to access GeographicLib::PolarStereographic. 00024 * 00025 * Implementation taken from the report, 00026 * - J. P. Snyder, 00027 * <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projections: A 00028 * Working Manual</a>, USGS Professional Paper 1395 (1987), 00029 * pp. 160--163. 00030 * 00031 * This is a straightforward implementation of the equations in Snyder except 00032 * that Newton's method is used to invert the projection. 00033 * 00034 * C# Example: 00035 * \include example-PolarStereographic.cs 00036 * Managed C++ Example: 00037 * \include example-PolarStereographic.cpp 00038 * Visual Basic Example: 00039 * \include example-PolarStereographic.vb 00040 * 00041 * <B>INTERFACE DIFFERENCES:</B><BR> 00042 * A default constructor is provided that assumes WGS84 parameters and 00043 * a UPS scale factor. 00044 * 00045 * The MajorRadius, Flattening, and CentralScale functions are 00046 * implemented as properties. 00047 **********************************************************************/ 00048 public ref class PolarStereographic 00049 { 00050 private: 00051 // pointer to the unmanaged GeographicLib::PolarStereographic 00052 GeographicLib::PolarStereographic* m_pPolarStereographic; 00053 00054 // the finalizer frees the unmanaged memory when the object is destroyed. 00055 !PolarStereographic(void); 00056 public: 00057 00058 /** 00059 * Constructor for a ellipsoid with 00060 * 00061 * @param[in] a equatorial radius (meters). 00062 * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. 00063 * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening 00064 * to 1/\e f. 00065 * @param[in] k0 central scale factor. 00066 * @exception GeographicErr if \e a, (1 − \e f ) \e a, or \e k0 is 00067 * not positive. 00068 **********************************************************************/ 00069 PolarStereographic(double a, double f, double k0); 00070 00071 /** 00072 * An instantiation of PolarStereographic with the WGS84 ellipsoid 00073 * and the UPS scale factor. 00074 **********************************************************************/ 00075 PolarStereographic(); 00076 00077 /** 00078 * The destructor calls the finalizer. 00079 **********************************************************************/ 00080 ~PolarStereographic() 00081 { this->!PolarStereographic(); } 00082 00083 /** 00084 * Set the scale for the projection. 00085 * 00086 * @param[in] lat (degrees) assuming \e northp = true. 00087 * @param[in] k scale at latitude \e lat 00088 * @exception GeographicErr \e k is not positive. 00089 * @exception GeographicErr if \e lat is not in (−90°, 00090 * 90°] or this object was created with the default constructor. 00091 **********************************************************************/ 00092 void SetScale(double lat, double k); 00093 00094 /** 00095 * Forward projection, from geographic to polar stereographic. 00096 * 00097 * @param[in] northp the pole which is the center of projection (true means 00098 * north, false means south). 00099 * @param[in] lat latitude of point (degrees). 00100 * @param[in] lon longitude of point (degrees). 00101 * @param[out] x easting of point (meters). 00102 * @param[out] y northing of point (meters). 00103 * @param[out] gamma meridian convergence at point (degrees). 00104 * @param[out] k scale of projection at point. 00105 * 00106 * No false easting or northing is added. \e lat should be in the range 00107 * (−90°, 90°] for \e northp = true and in the range 00108 * [−90°, 90°) for \e northp = false; \e lon should 00109 * be in the range [−540°, 540°). 00110 **********************************************************************/ 00111 void Forward(bool northp, double lat, double lon, 00112 [System::Runtime::InteropServices::Out] double% x, 00113 [System::Runtime::InteropServices::Out] double% y, 00114 [System::Runtime::InteropServices::Out] double% gamma, 00115 [System::Runtime::InteropServices::Out] double% k); 00116 00117 /** 00118 * Reverse projection, from polar stereographic to geographic. 00119 * 00120 * @param[in] northp the pole which is the center of projection (true means 00121 * north, false means south). 00122 * @param[in] x easting of point (meters). 00123 * @param[in] y northing of point (meters). 00124 * @param[out] lat latitude of point (degrees). 00125 * @param[out] lon longitude of point (degrees). 00126 * @param[out] gamma meridian convergence at point (degrees). 00127 * @param[out] k scale of projection at point. 00128 * 00129 * No false easting or northing is added. The value of \e lon returned is 00130 * in the range [−180°, 180°). 00131 **********************************************************************/ 00132 void Reverse(bool northp, double x, double y, 00133 [System::Runtime::InteropServices::Out] double% lat, 00134 [System::Runtime::InteropServices::Out] double% lon, 00135 [System::Runtime::InteropServices::Out] double% gamma, 00136 [System::Runtime::InteropServices::Out] double% k); 00137 00138 /** 00139 * PolarStereographic::Forward without returning the convergence and scale. 00140 **********************************************************************/ 00141 void Forward(bool northp, double lat, double lon, 00142 [System::Runtime::InteropServices::Out] double% x, 00143 [System::Runtime::InteropServices::Out] double% y); 00144 00145 /** 00146 * PolarStereographic::Reverse without returning the convergence and scale. 00147 **********************************************************************/ 00148 void Reverse(bool northp, double x, double y, 00149 [System::Runtime::InteropServices::Out] double% lat, 00150 [System::Runtime::InteropServices::Out] double% lon); 00151 00152 /** \name Inspector functions 00153 **********************************************************************/ 00154 ///@{ 00155 /** 00156 * @return \e a the equatorial radius of the ellipsoid (meters). This is 00157 * the value used in the constructor. 00158 **********************************************************************/ 00159 property double MajorRadius { double get(); } 00160 00161 /** 00162 * @return \e f the flattening of the ellipsoid. This is the value used in 00163 * the constructor. 00164 **********************************************************************/ 00165 property double Flattening { double get(); } 00166 00167 /** 00168 * The central scale for the projection. This is the value of \e k0 used 00169 * in the constructor and is the scale at the pole unless overridden by 00170 * PolarStereographic::SetScale. 00171 **********************************************************************/ 00172 property double CentralScale { double get(); } 00173 ///@} 00174 }; 00175 } //namespace NETGeographicLib