NETGeographicLib
1.43
|
.NET wrapper for GeographicLib::PolygonArea and PolygonAreaExact. More...
#include <NETGeographicLib/PolygonArea.h>
Public Member Functions | |
PolygonArea (Geodesic^ earth, bool polyline) | |
PolygonArea (const bool polyline) | |
~PolygonArea () | |
void | Clear () |
void | AddPoint (double lat, double lon) |
void | AddEdge (double azi, double s) |
unsigned | Compute (bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) |
unsigned | TestPoint (double lat, double lon, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) |
unsigned | TestEdge (double azi, double s, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) |
Inspector functions | |
double | MajorRadius [get] |
double | Flattening [get] |
void | CurrentPoint ([System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) |
.NET wrapper for GeographicLib::PolygonArea and PolygonAreaExact.
This class allows .NET applications to access GeographicLib::PolygonArea.
This computes the area of a geodesic polygon using the method given Section 6 of
This class lets you add vertices one at a time to the polygon. The area and perimeter are accumulated in two times the standard floating point precision to guard against the loss of accuracy with many-sided polygons. At any point you can ask for the perimeter and area so far. There's an option to treat the points as defining a polyline instead of a polygon; in that case, only the perimeter is computed.
C# Example:
Managed C++ Example:
Visual Basic Example:
INTERFACE DIFFERENCES:
The MajorRadius and Flattening functions are implemented as properties.
Definition at line 49 of file PolygonArea.h.
NETGeographicLib::PolygonArea::PolygonArea | ( | Geodesic^ | earth, |
bool | polyline | ||
) |
Constructor for PolygonArea.
[in] | earth | the Geodesic object to use for geodesic calculations. |
[in] | polyline | if true that treat the points as defining a polyline instead of a polygon. |
Referenced by ~PolygonArea().
NETGeographicLib::PolygonArea::PolygonArea | ( | const bool | polyline | ) |
Constructor for PolygonArea that assumes a WGS84 ellipsoid.
[in] | polyline | if true that treat the points as defining a polyline instead of a polygon. |
|
inline |
The destructor calls the finalizer.
Definition at line 79 of file PolygonArea.h.
References AddEdge(), AddPoint(), Clear(), Compute(), PolygonArea(), TestEdge(), and TestPoint().
void NETGeographicLib::PolygonArea::Clear | ( | ) |
Clear PolygonArea, allowing a new polygon to be started.
Referenced by ~PolygonArea(), NETGeographicLib::PolygonAreaExact::~PolygonAreaExact(), and NETGeographicLib::PolygonAreaRhumb::~PolygonAreaRhumb().
void NETGeographicLib::PolygonArea::AddPoint | ( | double | lat, |
double | lon | ||
) |
Add a point to the polygon or polyline.
[in] | lat | the latitude of the point (degrees). |
[in] | lon | the longitude of the point (degrees). |
lat should be in the range [−90°, 90°] and lon should be in the range [−540°, 540°).
Referenced by ~PolygonArea(), NETGeographicLib::PolygonAreaExact::~PolygonAreaExact(), and NETGeographicLib::PolygonAreaRhumb::~PolygonAreaRhumb().
void NETGeographicLib::PolygonArea::AddEdge | ( | double | azi, |
double | s | ||
) |
Add an edge to the polygon or polyline.
[in] | azi | azimuth at current point (degrees). |
[in] | s | distance from current point to next point (meters). |
azi should be in the range [−540°, 540°). This does nothing if no points have been added yet. Use PolygonArea::CurrentPoint to determine the position of the new vertex.
Referenced by ~PolygonArea(), NETGeographicLib::PolygonAreaExact::~PolygonAreaExact(), and NETGeographicLib::PolygonAreaRhumb::~PolygonAreaRhumb().
unsigned NETGeographicLib::PolygonArea::Compute | ( | bool | reverse, |
bool | sign, | ||
[System::Runtime::InteropServices::Out] double% | perimeter, | ||
[System::Runtime::InteropServices::Out] double% | area | ||
) |
Return the results so far.
[in] | reverse | if true then clockwise (instead of counter-clockwise) traversal counts as a positive area. |
[in] | sign | if true then return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the area for the rest of the earth. |
[out] | perimeter | the perimeter of the polygon or length of the polyline (meters). |
[out] | area | the area of the polygon (meters2); only set if polyline is false in the constructor. |
Referenced by ~PolygonArea(), NETGeographicLib::PolygonAreaExact::~PolygonAreaExact(), and NETGeographicLib::PolygonAreaRhumb::~PolygonAreaRhumb().
unsigned NETGeographicLib::PolygonArea::TestPoint | ( | double | lat, |
double | lon, | ||
bool | reverse, | ||
bool | sign, | ||
[System::Runtime::InteropServices::Out] double% | perimeter, | ||
[System::Runtime::InteropServices::Out] double% | area | ||
) |
Return the results assuming a tentative final test point is added; however, the data for the test point is not saved. This lets you report a running result for the perimeter and area as the user moves the mouse cursor. Ordinary floating point arithmetic is used to accumulate the data for the test point; thus the area and perimeter returned are less accurate than if PolygonArea::AddPoint and PolygonArea::Compute are used.
[in] | lat | the latitude of the test point (degrees). |
[in] | lon | the longitude of the test point (degrees). |
[in] | reverse | if true then clockwise (instead of counter-clockwise) traversal counts as a positive area. |
[in] | sign | if true then return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the area for the rest of the earth. |
[out] | perimeter | the approximate perimeter of the polygon or length of the polyline (meters). |
[out] | area | the approximate area of the polygon (meters2); only set if polyline is false in the constructor. |
lat should be in the range [−90°, 90°] and lon should be in the range [−540°, 540°).
Referenced by ~PolygonArea(), NETGeographicLib::PolygonAreaExact::~PolygonAreaExact(), and NETGeographicLib::PolygonAreaRhumb::~PolygonAreaRhumb().
unsigned NETGeographicLib::PolygonArea::TestEdge | ( | double | azi, |
double | s, | ||
bool | reverse, | ||
bool | sign, | ||
[System::Runtime::InteropServices::Out] double% | perimeter, | ||
[System::Runtime::InteropServices::Out] double% | area | ||
) |
Return the results assuming a tentative final test point is added via an azimuth and distance; however, the data for the test point is not saved. This lets you report a running result for the perimeter and area as the user moves the mouse cursor. Ordinary floating point arithmetic is used to accumulate the data for the test point; thus the area and perimeter returned are less accurate than if PolygonArea::AddEdge and PolygonArea::Compute are used.
[in] | azi | azimuth at current point (degrees). |
[in] | s | distance from current point to final test point (meters). |
[in] | reverse | if true then clockwise (instead of counter-clockwise) traversal counts as a positive area. |
[in] | sign | if true then return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the area for the rest of the earth. |
[out] | perimeter | the approximate perimeter of the polygon or length of the polyline (meters). |
[out] | area | the approximate area of the polygon (meters2); only set if polyline is false in the constructor. |
azi should be in the range [−540°, 540°).
Referenced by ~PolygonArea(), NETGeographicLib::PolygonAreaExact::~PolygonAreaExact(), and NETGeographicLib::PolygonAreaRhumb::~PolygonAreaRhumb().
void NETGeographicLib::PolygonArea::CurrentPoint | ( | [System::Runtime::InteropServices::Out] double% | lat, |
[System::Runtime::InteropServices::Out] double% | lon | ||
) |
Report the previous vertex added to the polygon or polyline.
[out] | lat | the latitude of the point (degrees). |
[out] | lon | the longitude of the point (degrees). |
If no points have been added, then NaNs are returned. Otherwise, lon will be in the range [−180°, 180°).
|
get |
Definition at line 194 of file PolygonArea.h.
|
get |
Definition at line 200 of file PolygonArea.h.