.NET wrapper for GeographicLib::GeoCoords. More...
#include <GeoCoords.h>
Public Member Functions | |
Initializing the GeoCoords object | |
GeoCoords () | |
GeoCoords (System::String^ s, bool centerp, bool longfirst) | |
GeoCoords (double latitude, double longitude, int zone) | |
GeoCoords (int zone, bool northp, double easting, double northing) | |
~GeoCoords () | |
void | Reset (System::String^ s, bool centerp, bool longfirst) |
void | Reset (double latitude, double longitude, int zone) |
void | Reset (int zone, bool northp, double easting, double northing) |
String representations of the GeoCoords object | |
System::String | GeoRepresentation (int prec, bool longfirst) |
System::String | DMSRepresentation (int prec, bool longfirst, char dmssep) |
System::String | MGRSRepresentation (int prec) |
System::String | UTMUPSRepresentation (int prec, bool abbrev) |
System::String | UTMUPSRepresentation (bool northp, int prec, bool abbrev) |
System::String | AltMGRSRepresentation (int prec) |
System::String | AltUTMUPSRepresentation (int prec, bool abbrev) |
System::String | AltUTMUPSRepresentation (bool northp, int prec, bool abbrev) |
Public Attributes | |
property double | AltConvergence { double get() |
property double | AltEasting { double get() |
property double | AltNorthing { double get() |
property double | AltScale { double get() |
Inspector functions | |
property double | MajorRadius { double get() |
property double | Flattening { double get() |
Private Member Functions | |
!GeoCoords () | |
Private Attributes | |
GeographicLib::GeoCoords * | m_pGeoCoords |
Querying the GeoCoords object | |
property double | Latitude { double get() |
property double | Longitude { double get() |
property double | Easting { double get() |
property double | Northing { double get() |
property double | Convergence { double get() |
property double | Scale { double get() |
property bool | Northp { bool get() |
property char | Hemisphere { char get() |
property int | Zone { int get() |
property int | AltZone |
void | set (int zone) |
.NET wrapper for GeographicLib::GeoCoords.
This class allows .NET applications to access GeographicLib::GeoCoords.
This class stores a geographic position which may be set via the constructors or Reset via
The state consists of the latitude and longitude and the supplied UTM or UPS coordinates (possibly derived from the MGRS coordinates). If latitude and longitude were given then the UTM/UPS coordinates follows the standard conventions.
The mutable state consists of the UTM or UPS coordinates for a alternate zone. A method SetAltZone is provided to set the alternate UPS/UTM zone.
Methods are provided to return the geographic coordinates, the input UTM or UPS coordinates (and associated meridian convergence and scale), or alternate UTM or UPS coordinates (and their associated meridian convergence and scale).
Once the input string has been parsed, you can print the result out in any of the formats, decimal degrees, degrees minutes seconds, MGRS, UTM/UPS.
C# Example:
Managed C++ Example:
Visual Basic Example:
INTERFACE DIFFERENCES:
The following functions are implemented as properties: MajorRadius, Flattening, Latitude, Longitude, Easting, Northing, Convergence, Scale, Northp, Hemisphere, Zone, AltZone, AltEasting, AltNorthing, AltConvergence, and AltScale.
Definition at line 55 of file GeoCoords.h.
|
private |
Definition at line 22 of file dotnet/NETGeographicLib/GeoCoords.cpp.
GeoCoords::GeoCoords | ( | ) |
The default constructor sets the coordinate as undefined.
Definition at line 32 of file dotnet/NETGeographicLib/GeoCoords.cpp.
GeoCoords::GeoCoords | ( | System::String^ | s, |
bool | centerp, | ||
bool | longfirst | ||
) |
Construct from a string.
[in] | s | 1-element, 2-element, or 3-element string representation of the position. |
[in] | centerp | governs the interpretation of MGRS coordinates (see below). |
[in] | longfirst | governs the interpretation of geographic coordinates (see below). |
GeographicErr | if the s is malformed (see below). |
Parse as a string and interpret it as a geographic position. The input string is broken into space (or comma) separated pieces and Basic decision on which format is based on number of components
The following inputs are approximately the same (Ar Ramadi Bridge, Iraq)
Latitude and Longitude parsing: Latitude precedes longitude, unless a N, S, E, W hemisphere designator is used on one or both coordinates. If longfirst = true (default is false), then longitude precedes latitude in the absence of a hemisphere designator. Thus (with longfirst = false)
are all the same position. The coordinates may be given in decimal degrees, degrees and decimal minutes, degrees, minutes, seconds, etc. Use d, ', and " to mark off the degrees, minutes and seconds. Various alternative symbols for degrees, minutes, and seconds are allowed. Alternatively, use : to separate these components. (See DMS::Decode for details.) Thus
all specify the same angle. The leading sign applies to all components so -1d30 is -(1+30/60) = -1.5. Latitudes must be in the range [−90°, 90°]. Internally longitudes are reduced to the range [−180°, 180°).
UTM/UPS parsing: For UTM zones (−80° ≤ Lat < 84°), the zone designator is made up of a zone number (for 1 to 60) and a hemisphere letter (N or S), e.g., 38N. The latitude zone designer ([C–M] in the southern hemisphere and [N–X] in the northern) should NOT be used. (This is part of the MGRS coordinate.) The zone designator for the poles (where UPS is employed) is a hemisphere letter by itself, i.e., N or S.
MGRS parsing interprets the grid references as square area at the specified precision (1m, 10m, 100m, etc.). If centerp = true (the default), the center of this square is then taken to be the precise position; thus:
Otherwise, the "south-west" corner of the square is used, i.e.,
Definition at line 45 of file dotnet/NETGeographicLib/GeoCoords.cpp.
GeoCoords::GeoCoords | ( | double | latitude, |
double | longitude, | ||
int | zone | ||
) |
Construct from geographic coordinates.
[in] | latitude | (degrees). |
[in] | longitude | (degrees). |
[in] | zone | if specified, force the UTM/UPS representation to use a specified zone using the rules given in UTMUPS::zonespec. |
GeographicErr | if latitude is not in [−90°, 90°]. |
GeographicErr | if zone cannot be used for this location. |
Definition at line 62 of file dotnet/NETGeographicLib/GeoCoords.cpp.
GeoCoords::GeoCoords | ( | int | zone, |
bool | northp, | ||
double | easting, | ||
double | northing | ||
) |
Construct from UTM/UPS coordinates.
[in] | zone | UTM zone (zero means UPS). |
[in] | northp | hemisphere (true means north, false means south). |
[in] | easting | (meters). |
[in] | northing | (meters). |
GeographicErr | if zone, easting, or northing is outside its allowed range. |
Definition at line 79 of file dotnet/NETGeographicLib/GeoCoords.cpp.
|
inline |
The destructor calls the finalizer.
Definition at line 187 of file GeoCoords.h.
System::String GeoCoords::AltMGRSRepresentation | ( | int | prec | ) |
MGRS string for the alternate zone. See GeoCoords::MGRSRepresentation.
[in] | prec | precision (relative to about 1m). |
std::bad_alloc | if memory for the string can't be allocated. |
Definition at line 228 of file dotnet/NETGeographicLib/GeoCoords.cpp.
System::String GeoCoords::AltUTMUPSRepresentation | ( | bool | northp, |
int | prec, | ||
bool | abbrev | ||
) |
UTM/UPS string for the alternate zone, with hemisphere override.
[in] | northp | hemisphere override |
[in] | prec | precision (relative to about 1m) |
[in] | abbrev | if true (the default) use abbreviated (n/s) notation for hemisphere; otherwise spell out the hemisphere (north/south) |
GeographicErr | if the hemisphere override attempts to change UPS n to UPS s or vice verse. |
std::bad_alloc | if memory for the string can't be allocated. |
Definition at line 240 of file dotnet/NETGeographicLib/GeoCoords.cpp.
System::String GeoCoords::AltUTMUPSRepresentation | ( | int | prec, |
bool | abbrev | ||
) |
UTM/UPS string for the alternate zone. See GeoCoords::UTMUPSRepresentation.
[in] | prec | precision (relative to about 1m) |
[in] | abbrev | if true (the default) use abbreviated (n/s) notation for hemisphere; otherwise spell out the hemisphere (north/south) |
std::bad_alloc | if memory for the string can't be allocated. |
Definition at line 234 of file dotnet/NETGeographicLib/GeoCoords.cpp.
System::String GeoCoords::DMSRepresentation | ( | int | prec, |
bool | longfirst, | ||
char | dmssep | ||
) |
String representation with latitude and longitude as degrees, minutes, seconds, and hemisphere.
[in] | prec | precision (relative to about 1m) |
[in] | longfirst | if true give longitude first (default = false) |
[in] | dmssep | if non-null, use as the DMS separator character (instead of d, ', " delimiters). |
std::bad_alloc | if memory for the string can't be allocated. |
Precision specifies accuracy of representation as follows:
Definition at line 203 of file dotnet/NETGeographicLib/GeoCoords.cpp.
System::String GeoCoords::GeoRepresentation | ( | int | prec, |
bool | longfirst | ||
) |
String representation with latitude and longitude as signed decimal degrees.
[in] | prec | precision (relative to about 1m). |
[in] | longfirst | if true give longitude first (default = false) |
std::bad_alloc | if memory for the string can't be allocated. |
Precision specifies accuracy of representation as follows:
Definition at line 197 of file dotnet/NETGeographicLib/GeoCoords.cpp.
System::String GeoCoords::MGRSRepresentation | ( | int | prec | ) |
MGRS string.
[in] | prec | precision (relative to about 1m). |
std::bad_alloc | if memory for the string can't be allocated. |
This gives the coordinates of the enclosing grid square with size given by the precision. Thus 38N 444180 3684790 converted to a MGRS coordinate at precision −2 (100m) is 38SMB441847 and not 38SMB442848. prec specifies the precision of the MGRS string as follows:
Definition at line 210 of file dotnet/NETGeographicLib/GeoCoords.cpp.
void GeoCoords::Reset | ( | double | latitude, |
double | longitude, | ||
int | zone | ||
) |
Reset the location in terms of geographic coordinates. See GeoCoords(double latitude, double longitude, int zone).
[in] | latitude | (degrees). |
[in] | longitude | (degrees). |
[in] | zone | if specified, force the UTM/UPS representation to use a specified zone using the rules given in UTMUPS::zonespec. |
GeographicErr | if latitude is not in [−90°, 90°]. |
GeographicErr | if zone cannot be used for this location. |
Definition at line 109 of file dotnet/NETGeographicLib/GeoCoords.cpp.
void GeoCoords::Reset | ( | int | zone, |
bool | northp, | ||
double | easting, | ||
double | northing | ||
) |
Reset the location in terms of UPS/UPS coordinates. See GeoCoords(int zone, bool northp, double easting, double northing).
[in] | zone | UTM zone (zero means UPS). |
[in] | northp | hemisphere (true means north, false means south). |
[in] | easting | (meters). |
[in] | northing | (meters). |
GeographicErr | if zone, easting, or northing is outside its allowed range. |
Definition at line 122 of file dotnet/NETGeographicLib/GeoCoords.cpp.
void GeoCoords::Reset | ( | System::String^ | s, |
bool | centerp, | ||
bool | longfirst | ||
) |
Reset the location from a string. See GeoCoords(const std::string& s, bool centerp, bool longfirst).
[in] | s | 1-element, 2-element, or 3-element string representation of the position. |
[in] | centerp | governs the interpretation of MGRS coordinates. |
[in] | longfirst | governs the interpretation of geographic coordinates. |
GeographicErr | if the s is malformed. |
Definition at line 96 of file dotnet/NETGeographicLib/GeoCoords.cpp.
void NETGeographicLib::GeoCoords::set | ( | int | zone | ) |
System::String GeoCoords::UTMUPSRepresentation | ( | bool | northp, |
int | prec, | ||
bool | abbrev | ||
) |
UTM/UPS string with hemisphere override.
[in] | northp | hemisphere override |
[in] | prec | precision (relative to about 1m) |
[in] | abbrev | if true (the default) use abbreviated (n/s) notation for hemisphere; otherwise spell out the hemisphere (north/south) |
GeographicErr | if the hemisphere override attempts to change UPS N to UPS S or vice versa. |
std::bad_alloc | if memory for the string can't be allocated. |
Definition at line 222 of file dotnet/NETGeographicLib/GeoCoords.cpp.
System::String GeoCoords::UTMUPSRepresentation | ( | int | prec, |
bool | abbrev | ||
) |
UTM/UPS string.
[in] | prec | precision (relative to about 1m) |
[in] | abbrev | if true (the default) use abbreviated (n/s) notation for hemisphere; otherwise spell out the hemisphere (north/south) |
std::bad_alloc | if memory for the string can't be allocated. |
Precision specifies accuracy of representation as follows:
Definition at line 216 of file dotnet/NETGeographicLib/GeoCoords.cpp.
property double NETGeographicLib::GeoCoords::AltConvergence { double get() |
Definition at line 308 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::AltEasting { double get() |
Definition at line 298 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::AltNorthing { double get() |
Definition at line 303 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::AltScale { double get() |
Definition at line 313 of file GeoCoords.h.
property int NETGeographicLib::GeoCoords::AltZone |
Gets/Sets the current alternate zone (0 = UPS).
GeographicErr | if zone cannot be used for this location. |
See UTMUPS::zonespec for more information on the interpretation of zone. Note that zone == UTMUPS::STANDARD (the default) use the standard UPS or UTM zone, UTMUPS::MATCH does nothing retaining the existing alternate representation. Before this is called the alternate zone is the input zone.
Definition at line 289 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::Convergence { double get() |
Definition at line 256 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::Easting { double get() |
Definition at line 246 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::Flattening { double get() |
(The WGS84 value is returned because the UTM and UPS projections are based on this ellipsoid.)
Definition at line 473 of file GeoCoords.h.
property char NETGeographicLib::GeoCoords::Hemisphere { char get() |
Definition at line 271 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::Latitude { double get() |
Definition at line 236 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::Longitude { double get() |
Definition at line 241 of file GeoCoords.h.
|
private |
Definition at line 59 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::MajorRadius { double get() |
(The WGS84 value is returned because the UTM and UPS projections are based on this ellipsoid.)
Definition at line 465 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::Northing { double get() |
Definition at line 251 of file GeoCoords.h.
property bool NETGeographicLib::GeoCoords::Northp { bool get() |
Definition at line 266 of file GeoCoords.h.
property double NETGeographicLib::GeoCoords::Scale { double get() |
Definition at line 261 of file GeoCoords.h.
Definition at line 276 of file GeoCoords.h.