|
KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
|
|
A WGS-84 geographic coordinate (latitude, longitude, altitude). More...
#include <geocoordinate.h>
Public Types | |
| enum | CoordinateFormat { Degrees , Parsable } |
| Output format for toString(). More... | |
Public Member Functions | |
| GeoCoordinate () | |
| Default constructor — creates an invalid coordinate at (0, 0, 0). | |
| GeoCoordinate (double latitude, double longitude, double altitude=0) | |
| Construct a coordinate from decimal latitude, longitude, and optional altitude. | |
| GeoCoordinate (const QString &value) | |
| Construct a coordinate by parsing a string. | |
| bool | operator== (const GeoCoordinate &other) const |
| Equality comparison at the configured precision. | |
| bool | operator!= (const GeoCoordinate &other) const |
| Inequality comparison. | |
| double | latitude () const |
| Return the latitude in decimal degrees. | |
| void | setLatitude (double value) |
| Set the latitude in decimal degrees. | |
| double | longitude () const |
| Return the longitude in decimal degrees. | |
| void | setLongitude (double value) |
| Set the longitude in decimal degrees. | |
| double | altitude () const |
| Return the altitude in metres. | |
| void | setAltitude (double value) |
| Set the altitude in metres. | |
| int | precision () const |
| Return the decimal precision used for coordinate comparisons. | |
| void | setPrecision (int value) |
| Set the decimal precision used for coordinate comparisons. | |
| double | distanceTo (const GeoCoordinate &other) const |
| Compute the great-circle distance to another coordinate in metres. | |
| double | azimuthTo (const GeoCoordinate &other) const |
| Compute the azimuth (bearing) to another coordinate in degrees. | |
| GeoCoordinate | atDistanceAndAzimuth (double distance, double azimuth) |
| Return the coordinate reached by travelling a given distance and azimuth from this point. | |
| bool | isNorthOfOrEqualTo (const GeoCoordinate &other) const |
| Test whether this coordinate is north of or at the same latitude as another. | |
| bool | isNorthOf (const GeoCoordinate &other) const |
| Test whether this coordinate is strictly north of another. | |
| bool | isSouthOfOrEqualTo (const GeoCoordinate &other) const |
| Test whether this coordinate is south of or at the same latitude as another. | |
| bool | isSouthOf (const GeoCoordinate &other) const |
| Test whether this coordinate is strictly south of another. | |
| bool | isWestOfOrEqualTo (const GeoCoordinate &other) const |
| Test whether this coordinate is west of or at the same longitude as another. | |
| bool | isWestOf (const GeoCoordinate &other) const |
| Test whether this coordinate is strictly west of another. | |
| bool | isEastOfOrEqualTo (const GeoCoordinate &other) const |
| Test whether this coordinate is east of or at the same longitude as another. | |
| bool | isEastOf (const GeoCoordinate &other) const |
| Test whether this coordinate is strictly east of another. | |
| bool | isEmpty () const |
| Test whether this coordinate equals the default-constructed (empty) value. | |
| bool | isValid () const |
| Test whether this coordinate represents a valid position. | |
| QString | toString (CoordinateFormat format=Degrees, int precision=0) const |
| Format this coordinate as a string. | |
Static Public Member Functions | |
| static GeoCoordinate | fromString (const QString &value) |
| Parse a GeoCoordinate from a string representation. | |
| static GeoCoordinate | fromDMS (Geo::CardinalDirection latitudeCardinalDirection, double latitudeDegrees, double latitudeMinutes, double latitudeSeconds, Geo::CardinalDirection longitudeCardinalDirection, double longitudeDegrees, double longitudeMinutes, double longitudeSeconds) |
| Construct a coordinate from degrees-minutes-seconds components. | |
| static bool | tryParse (const QString &stringValue, GeoCoordinate &point) |
| Attempt to parse a coordinate string, reporting success. | |
| static GeoCoordinate | empty () |
| Return a default-constructed (empty) coordinate. | |
| static double | getDistance (const GeoCoordinate &pt1, const GeoCoordinate &pt2) |
| Compute the great-circle distance between two coordinates in metres. | |
| static double | getAzimuth (const GeoCoordinate &pt1, const GeoCoordinate &pt2) |
| Compute the azimuth from one coordinate to another in degrees. | |
| static GeoCoordinate | getPointAtDistanceAndAzimuth (const GeoCoordinate &origin, double distance, double azimuth) |
| Compute the coordinate reached by travelling from an origin at a given distance and azimuth. | |
A WGS-84 geographic coordinate (latitude, longitude, altitude).
Represents a geographic position as WGS-84 latitude, longitude, and altitude.
Provides distance, azimuth, and point-at-distance-and-azimuth calculations using the Haversine formula, as well as cardinal direction comparisons.
Definition at line 19 of file geocoordinate.h.
Output format for toString().
| Enumerator | |
|---|---|
| Degrees | Decimal degrees (e.g. "37.7749, -122.4194") |
| Parsable | Format suitable for round-trip parsing by fromString() |
Definition at line 84 of file geocoordinate.h.
|
inline |
Default constructor — creates an invalid coordinate at (0, 0, 0).
Definition at line 23 of file geocoordinate.h.
|
inline |
Construct a coordinate from decimal latitude, longitude, and optional altitude.
| latitude | Latitude in decimal degrees (negative = south) |
| longitude | Longitude in decimal degrees (negative = west) |
| altitude | Altitude in metres above the WGS-84 ellipsoid (default 0) |
Definition at line 38 of file geocoordinate.h.
| GeoCoordinate::GeoCoordinate | ( | const QString & | value | ) |
Construct a coordinate by parsing a string.
| value | Coordinate string (see fromString()) |
|
inline |
Return the altitude in metres.
Definition at line 127 of file geocoordinate.h.
|
inline |
Return the coordinate reached by travelling a given distance and azimuth from this point.
| distance | Distance in metres |
| azimuth | Bearing in degrees clockwise from North |
Definition at line 167 of file geocoordinate.h.
|
inline |
Compute the azimuth (bearing) to another coordinate in degrees.
| other | Destination coordinate |
Definition at line 159 of file geocoordinate.h.
|
inline |
Compute the great-circle distance to another coordinate in metres.
| other | Destination coordinate |
Definition at line 152 of file geocoordinate.h.
|
inlinestatic |
Return a default-constructed (empty) coordinate.
Definition at line 269 of file geocoordinate.h.
|
static |
Construct a coordinate from degrees-minutes-seconds components.
| latitudeCardinalDirection | North or South |
| latitudeDegrees | Whole degrees of latitude |
| latitudeMinutes | Minutes of latitude |
| latitudeSeconds | Seconds of latitude |
| longitudeCardinalDirection | East or West |
| longitudeDegrees | Whole degrees of longitude |
| longitudeMinutes | Minutes of longitude |
| longitudeSeconds | Seconds of longitude |
|
inlinestatic |
Parse a GeoCoordinate from a string representation.
| value | Coordinate string in decimal or DMS format |
Definition at line 61 of file geocoordinate.h.
|
static |
Compute the azimuth from one coordinate to another in degrees.
| pt1 | Origin coordinate |
| pt2 | Destination coordinate |
|
static |
Compute the great-circle distance between two coordinates in metres.
| pt1 | First coordinate |
| pt2 | Second coordinate |
|
static |
Compute the coordinate reached by travelling from an origin at a given distance and azimuth.
| origin | Starting coordinate |
| distance | Distance in metres |
| azimuth | Bearing in degrees clockwise from North |
|
inline |
Test whether this coordinate is strictly east of another.
| other | Coordinate to compare against |
Definition at line 235 of file geocoordinate.h.
|
inline |
Test whether this coordinate is east of or at the same longitude as another.
| other | Coordinate to compare against |
Definition at line 225 of file geocoordinate.h.
|
inline |
Test whether this coordinate equals the default-constructed (empty) value.
Definition at line 241 of file geocoordinate.h.
| bool GeoCoordinate::isNorthOf | ( | const GeoCoordinate & | other | ) | const |
Test whether this coordinate is strictly north of another.
| other | Coordinate to compare against |
|
inline |
Test whether this coordinate is north of or at the same latitude as another.
| other | Coordinate to compare against |
Definition at line 174 of file geocoordinate.h.
|
inline |
Test whether this coordinate is strictly south of another.
| other | Coordinate to compare against |
Definition at line 201 of file geocoordinate.h.
|
inline |
Test whether this coordinate is south of or at the same latitude as another.
| other | Coordinate to compare against |
Definition at line 191 of file geocoordinate.h.
|
inline |
Test whether this coordinate represents a valid position.
Definition at line 247 of file geocoordinate.h.
| bool GeoCoordinate::isWestOf | ( | const GeoCoordinate & | other | ) | const |
Test whether this coordinate is strictly west of another.
| other | Coordinate to compare against |
|
inline |
Test whether this coordinate is west of or at the same longitude as another.
| other | Coordinate to compare against |
Definition at line 208 of file geocoordinate.h.
|
inline |
Return the latitude in decimal degrees.
Definition at line 103 of file geocoordinate.h.
|
inline |
Return the longitude in decimal degrees.
Definition at line 115 of file geocoordinate.h.
|
inline |
Inequality comparison.
| other | Coordinate to compare against |
Definition at line 97 of file geocoordinate.h.
| bool GeoCoordinate::operator== | ( | const GeoCoordinate & | other | ) | const |
Equality comparison at the configured precision.
| other | Coordinate to compare against |
|
inline |
Return the decimal precision used for coordinate comparisons.
Definition at line 139 of file geocoordinate.h.
|
inline |
Set the altitude in metres.
| value | New altitude value |
Definition at line 133 of file geocoordinate.h.
|
inline |
Set the latitude in decimal degrees.
| value | New latitude value |
Definition at line 109 of file geocoordinate.h.
|
inline |
Set the longitude in decimal degrees.
| value | New longitude value |
Definition at line 121 of file geocoordinate.h.
|
inline |
Set the decimal precision used for coordinate comparisons.
| value | Number of decimal places |
Definition at line 145 of file geocoordinate.h.
| QString GeoCoordinate::toString | ( | CoordinateFormat | format = Degrees, |
| int | precision = 0 |
||
| ) | const |
Format this coordinate as a string.
| format | Output format (Degrees or Parsable) |
| precision | Decimal places for coordinate values (0 = use instance precision) |
|
static |
Attempt to parse a coordinate string, reporting success.
| stringValue | String to parse |
| point | Output receiving the parsed coordinate |