Public Member Functions | Private Member Functions | Private Attributes | List of all members
NETGeographicLib::PolarStereographic Class Reference

.NET wrapper for GeographicLib::PolarStereographic. More...

#include <PolarStereographic.h>

Public Member Functions

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)
 
void Forward (bool northp, double lat, double lon, [System::Runtime::InteropServices::Out] double%x, [System::Runtime::InteropServices::Out] double%y)
 
 PolarStereographic (double a, double f, double k0)
 
 PolarStereographic ()
 
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)
 
void Reverse (bool northp, double x, double y, [System::Runtime::InteropServices::Out] double%lat, [System::Runtime::InteropServices::Out] double%lon)
 
void SetScale (double lat, double k)
 
 ~PolarStereographic ()
 

Public Attributes

Inspector functions
property double MajorRadius { double get()
 
property double Flattening { double get()
 
property double CentralScale { double get()
 

Private Member Functions

 !PolarStereographic (void)
 

Private Attributes

GeographicLib::PolarStereographicm_pPolarStereographic
 

Detailed Description

.NET wrapper for GeographicLib::PolarStereographic.

This class allows .NET applications to access GeographicLib::PolarStereographic. .NET wrapper for GeographicLib::PolarStereographic.

This class allows .NET applications to access GeographicLib::PolarStereographic.

Implementation taken from the report,

This is a straightforward implementation of the equations in Snyder except that Newton's method is used to invert the projection.

C# Example:

using System;
namespace example_PolarStereographic
{
class Program
{
static void Main(string[] args)
{
try {
PolarStereographic proj = new PolarStereographic(); // WGS84
bool northp = true;
{
// Sample forward calculation
double lat = 61.2, lon = -149.9; // Anchorage
double x, y;
proj.Forward(northp, lat, lon, out x, out y);
Console.WriteLine(String.Format("{0} {1}", x, y));
}
{
// Sample reverse calculation
double x = -1637e3, y = 2824e3;
double lat, lon;
proj.Reverse(northp, x, y, out lat, out lon);
Console.WriteLine(String.Format("{0} {1}", lat, lon));
}
}
catch (GeographicErr e) {
Console.WriteLine(String.Format("Caught exception: {0}", e.Message));
}
}
}
}

Managed C++ Example:

// Example of using the GeographicLib::PolarStereographic class
#include <iostream>
#include <iomanip>
#include <exception>
using namespace std;
using namespace GeographicLib;
int main() {
try {
PolarStereographic proj(Constants::WGS84_a(), Constants::WGS84_f(),
Constants::UPS_k0());
// Alternatively:
// const PolarStereographic& proj = PolarStereographic::UPS();
bool northp = true;
{
// Sample forward calculation
double lat = 61.2, lon = -149.9; // Anchorage
double x, y;
proj.Forward(northp, lat, lon, x, y);
cout << x << " " << y << "\n";
}
{
// Sample reverse calculation
double x = -1637e3, y = 2824e3;
double lat, lon;
proj.Reverse(northp, x, y, lat, lon);
cout << lat << " " << lon << "\n";
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}

Visual Basic Example:

Imports NETGeographicLib
Module example_PolarStereographic
Sub Main()
Try
Dim proj As PolarStereographic = New PolarStereographic() ' WGS84
Dim northp As Boolean = True
' Sample forward calculation
Dim lat As Double = 61.2, lon = -149.9 ' Anchorage
Dim x, y As Double
proj.Forward(northp, lat, lon, x, y)
Console.WriteLine(String.Format("{0} {1}", x, y))
' Sample reverse calculation
x = -1637000.0 : y = 2824000.0
proj.Reverse(northp, x, y, lat, lon)
Console.WriteLine(String.Format("{0} {1}", lat, lon))
Catch ex As GeographicErr
Console.WriteLine(String.Format("Caught exception: {0}", ex.Message))
End Try
End Sub
End Module

INTERFACE DIFFERENCES:
A default constructor is provided that assumes WGS84 parameters and a UPS scale factor.

The MajorRadius, Flattening, and CentralScale functions are implemented as properties.

Definition at line 48 of file PolarStereographic.h.

Constructor & Destructor Documentation

PolarStereographic::!PolarStereographic ( void  )
private
PolarStereographic::PolarStereographic ( double  a,
double  f,
double  k0 
)

Constructor for a ellipsoid with

Parameters
[in]aequatorial radius (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.
[in]k0central scale factor.
Exceptions
GeographicErrif a, (1 − f ) a, or k0 is not positive.

Definition at line 31 of file dotnet/NETGeographicLib/PolarStereographic.cpp.

PolarStereographic::PolarStereographic ( )

An instantiation of PolarStereographic with the WGS84 ellipsoid and the UPS scale factor.

Definition at line 48 of file dotnet/NETGeographicLib/PolarStereographic.cpp.

NETGeographicLib::PolarStereographic::~PolarStereographic ( )
inline

The destructor calls the finalizer.

Definition at line 79 of file PolarStereographic.h.

Member Function Documentation

void PolarStereographic::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 
)

Forward projection, from geographic to polar stereographic.

Parameters
[in]northpthe pole which is the center of projection (true means north, false means south).
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

No false easting or northing is added. lat should be in the range (−90°, 90°] for northp = true and in the range [−90°, 90°) for northp = false.

Definition at line 75 of file dotnet/NETGeographicLib/PolarStereographic.cpp.

void PolarStereographic::Forward ( bool  northp,
double  lat,
double  lon,
[System::Runtime::InteropServices::Out] double%  x,
[System::Runtime::InteropServices::Out] double%  y 
)

PolarStereographic::Forward without returning the convergence and scale.

Definition at line 107 of file dotnet/NETGeographicLib/PolarStereographic.cpp.

void PolarStereographic::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 
)

Reverse projection, from polar stereographic to geographic.

Parameters
[in]northpthe pole which is the center of projection (true means north, false means south).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

No false easting or northing is added. The value of lon returned is in the range [−180°, 180°).

Definition at line 91 of file dotnet/NETGeographicLib/PolarStereographic.cpp.

void PolarStereographic::Reverse ( bool  northp,
double  x,
double  y,
[System::Runtime::InteropServices::Out] double%  lat,
[System::Runtime::InteropServices::Out] double%  lon 
)

PolarStereographic::Reverse without returning the convergence and scale.

Definition at line 118 of file dotnet/NETGeographicLib/PolarStereographic.cpp.

void PolarStereographic::SetScale ( double  lat,
double  k 
)

Set the scale for the projection.

Parameters
[in]lat(degrees) assuming northp = true.
[in]kscale at latitude lat
Exceptions
GeographicErrk is not positive.
GeographicErrif lat is not in (−90°, 90°] or this object was created with the default constructor.

Definition at line 62 of file dotnet/NETGeographicLib/PolarStereographic.cpp.

Member Data Documentation

property double NETGeographicLib::PolarStereographic::CentralScale { double get()

The central scale for the projection. This is the value of k0 used in the constructor and is the scale at the pole unless overridden by PolarStereographic::SetScale.

Definition at line 170 of file PolarStereographic.h.

property double NETGeographicLib::PolarStereographic::Flattening { double get()
Returns
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 163 of file PolarStereographic.h.

GeographicLib::PolarStereographic* NETGeographicLib::PolarStereographic::m_pPolarStereographic
private

Definition at line 52 of file PolarStereographic.h.

property double NETGeographicLib::PolarStereographic::MajorRadius { double get()
Returns
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 157 of file PolarStereographic.h.


The documentation for this class was generated from the following files:


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:59:11