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

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

#include <NETGeographicLib/PolarStereographic.h>

Public Member Functions

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

Properties

Inspector functions
double MajorRadius [get]
 
double Flattening [get]
 
double CentralScale [get]
 

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:

using namespace System;
using namespace NETGeographicLib;
int main(array<System::String ^> ^/*args*/)
{
try {
PolarStereographic^ proj = gcnew PolarStereographic(); // WGS84
bool northp = true;
{
// Sample forward calculation
double lat = 61.2, lon = -149.9; // Anchorage
double x, y;
proj->Forward(northp, lat, lon, x, 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, lat, lon);
Console::WriteLine(String::Format("{0} {1}", lat, lon));
}
}
catch (GeographicErr^ e) {
Console::WriteLine(String::Format("Caught exception: {0}", e->Message));
return -1;
}
return 0;
}

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() [1/2]

NETGeographicLib::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.

◆ PolarStereographic() [2/2]

NETGeographicLib::PolarStereographic::PolarStereographic ( )

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

Referenced by ~PolarStereographic().

◆ ~PolarStereographic()

NETGeographicLib::PolarStereographic::~PolarStereographic ( )
inline

The destructor calls the finalizer.

Definition at line 79 of file PolarStereographic.h.

References Forward(), PolarStereographic(), Reverse(), and SetScale().

Member Function Documentation

◆ SetScale()

void NETGeographicLib::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.

Referenced by ~PolarStereographic().

◆ Forward() [1/2]

void NETGeographicLib::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.

Referenced by ~PolarStereographic().

◆ Reverse() [1/2]

void NETGeographicLib::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°).

Referenced by ~PolarStereographic().

◆ Forward() [2/2]

void NETGeographicLib::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.

◆ Reverse() [2/2]

void NETGeographicLib::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.

Property Documentation

◆ MajorRadius

double NETGeographicLib::PolarStereographic::MajorRadius
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.

◆ Flattening

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

Definition at line 163 of file PolarStereographic.h.

◆ CentralScale

double NETGeographicLib::PolarStereographic::CentralScale
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.


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