7#include "Kanoop/geo/geotypes.h"
11#include "Kanoop/kanoopcommon.h"
28 _cardinalLatitude(
Geo::InvalidCardinalDirection),
29 _cardinalLongitude(
Geo::InvalidCardinalDirection),
40 _longitude(longitude),
43 _cardinalLatitude(
Geo::InvalidCardinalDirection),
44 _cardinalLongitude(
Geo::InvalidCardinalDirection),
47 GeoCoordinate::validate();
79 Geo::CardinalDirection longitudeCardinalDirection,
double longitudeDegrees,
double longitudeMinutes,
double longitudeSeconds);
176 return isNorthOf(other) || (equalAtPrecision(_latitude, other._latitude, _precision) && _cardinalLatitude == other._cardinalLatitude);
193 return isSouthOf(other) || (equalAtPrecision(_latitude, other._cardinalLatitude, _precision) && _cardinalLatitude == other._cardinalLatitude);
210 return isWestOf(other) || equalAtPrecision(_longitude, other._longitude, _precision);
227 return isEastOf(other) || equalAtPrecision(_longitude, other._longitude, _precision);
301 static bool equalAtPrecision(
double v1,
double v2,
int precision);
314 static QString TOSTRING_DELIM;
A WGS-84 geographic coordinate (latitude, longitude, altitude).
bool isEmpty() const
Test whether this coordinate equals the default-constructed (empty) value.
GeoCoordinate atDistanceAndAzimuth(double distance, double azimuth)
Return the coordinate reached by travelling a given distance and azimuth from this point.
int precision() const
Return the decimal precision used for coordinate comparisons.
void setAltitude(double value)
Set the altitude in metres.
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.
bool isWestOfOrEqualTo(const GeoCoordinate &other) const
Test whether this coordinate is west of or at the same longitude as another.
bool isValid() const
Test whether this coordinate represents a valid position.
GeoCoordinate()
Default constructor — creates an invalid coordinate at (0, 0, 0).
CoordinateFormat
Output format for toString().
@ Parsable
Format suitable for round-trip parsing by fromString()
@ Degrees
Decimal degrees (e.g. "37.7749, -122.4194")
bool operator!=(const GeoCoordinate &other) const
Inequality comparison.
bool isSouthOf(const GeoCoordinate &other) const
Test whether this coordinate is strictly south of another.
bool isWestOf(const GeoCoordinate &other) const
Test whether this coordinate is strictly west of another.
double altitude() const
Return the altitude in metres.
bool isNorthOfOrEqualTo(const GeoCoordinate &other) const
Test whether this coordinate is north of or at the same latitude as another.
void setLatitude(double value)
Set the latitude in decimal degrees.
bool isEastOf(const GeoCoordinate &other) const
Test whether this coordinate is strictly east of another.
GeoCoordinate(double latitude, double longitude, double altitude=0)
Construct a coordinate from decimal latitude, longitude, and optional altitude.
void setLongitude(double value)
Set the longitude in decimal degrees.
bool isEastOfOrEqualTo(const GeoCoordinate &other) const
Test whether this coordinate is east of or at the same longitude as another.
bool isSouthOfOrEqualTo(const GeoCoordinate &other) const
Test whether this coordinate is south of or at the same latitude as another.
bool operator==(const GeoCoordinate &other) const
Equality comparison at the configured precision.
double latitude() const
Return the latitude in decimal degrees.
static double getDistance(const GeoCoordinate &pt1, const GeoCoordinate &pt2)
Compute the great-circle distance between two coordinates in metres.
double distanceTo(const GeoCoordinate &other) const
Compute the great-circle distance to another coordinate in metres.
static bool tryParse(const QString &stringValue, GeoCoordinate &point)
Attempt to parse a coordinate string, reporting success.
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.
void setPrecision(int value)
Set the decimal precision used for coordinate comparisons.
double azimuthTo(const GeoCoordinate &other) const
Compute the azimuth (bearing) to another coordinate in degrees.
static double getAzimuth(const GeoCoordinate &pt1, const GeoCoordinate &pt2)
Compute the azimuth from one coordinate to another in degrees.
QString toString(CoordinateFormat format=Degrees, int precision=0) const
Format this coordinate as a string.
static GeoCoordinate fromString(const QString &value)
Parse a GeoCoordinate from a string representation.
static GeoCoordinate empty()
Return a default-constructed (empty) coordinate.
double longitude() const
Return the longitude in decimal degrees.
GeoCoordinate(const QString &value)
Construct a coordinate by parsing a string.
bool isNorthOf(const GeoCoordinate &other) const
Test whether this coordinate is strictly north of another.
Geographic type enumerations and string-conversion helpers for Qt geometry types.
CardinalDirection
Cardinal compass directions used by geographic coordinates.