NETGeographicLib::PolarStereographic Class Reference

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

#include <NETGeographicLib/PolarStereographic.h>

List of all members.

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;
using NETGeographicLib;

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

NETGeographicLib::PolarStereographic::PolarStereographic ( double  a,
double  f,
double  k0 
)

Constructor for a ellipsoid with

Parameters:
[in] a equatorial radius (meters).
[in] f flattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in] k0 central scale factor.
Exceptions:
GeographicErr if a, (1 f ) a, or k0 is not positive.
NETGeographicLib::PolarStereographic::PolarStereographic (  ) 

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

Referenced by ~PolarStereographic().

NETGeographicLib::PolarStereographic::~PolarStereographic (  )  [inline]

The destructor calls the finalizer.

Definition at line 80 of file PolarStereographic.h.

References PolarStereographic().


Member Function Documentation

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

Set the scale for the projection.

Parameters:
[in] lat (degrees) assuming northp = true.
[in] k scale at latitude lat
Exceptions:
GeographicErr k is not positive.
GeographicErr if lat is not in (90, 90] or this object was created with the default constructor.
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] northp the pole which is the center of projection (true means north, false means south).
[in] lat latitude of point (degrees).
[in] lon longitude of point (degrees).
[out] x easting of point (meters).
[out] y northing of point (meters).
[out] gamma meridian convergence at point (degrees).
[out] k scale 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; lon should be in the range [540, 540).

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] northp the pole which is the center of projection (true means north, false means south).
[in] x easting of point (meters).
[in] y northing of point (meters).
[out] lat latitude of point (degrees).
[out] lon longitude of point (degrees).
[out] gamma meridian convergence at point (degrees).
[out] k scale of projection at point.

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

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.

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

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 159 of file PolarStereographic.h.

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

Definition at line 165 of file PolarStereographic.h.

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 172 of file PolarStereographic.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends

Generated on 6 Oct 2014 for NETGeographicLib by  doxygen 1.6.1