Marble
GeoDataCoordinates.cpp
33const GeoDataCoordinates GeoDataCoordinates::null = GeoDataCoordinates(0, 0, 0); // don't use default constructor!
35GeoDataCoordinates::GeoDataCoordinates(qreal _lon, qreal _lat, qreal _alt, GeoDataCoordinates::Unit unit, int _detail)
159void GeoDataCoordinates::geoCoordinates(qreal &lon, qreal &lat, GeoDataCoordinates::Unit unit) const
180void GeoDataCoordinates::geoCoordinates(qreal &lon, qreal &lat, qreal &alt, GeoDataCoordinates::Unit unit) const
396 QString eastingString = QString::number(GeoDataCoordinatesPrivate::lonLatToEasting(d->m_lon, d->m_lat), 'f', 2);
397 QString northingString = QString::number(GeoDataCoordinatesPrivate::lonLatToNorthing(d->m_lon, d->m_lat), 'f', 2);
399 return QStringLiteral("%1%2 %3 m E, %4 m N").arg(zoneString, bandString, eastingString, northingString);
401 coordString = lonToString(d->m_lon, notation, Radian, precision) + QLatin1StringView(", ") + latToString(d->m_lat, notation, Radian, precision);
407QString GeoDataCoordinates::lonToString(qreal lon, GeoDataCoordinates::Notation notation, GeoDataCoordinates::Unit unit, int precision, char format)
425 QString eastingString = QString::number(GeoDataCoordinatesPrivate::lonLatToEasting(lonRad, 0), 'f', 2);
494 lonString += QStringLiteral(" %L3\"").arg(lonSecF, precision - 1, 'f', precision - 4, QLatin1Char('0'));
496 lonString += QStringLiteral(" %L3'").arg(lonMinF, precision + 1, 'f', precision - 2, QLatin1Char('0'));
499 lonString = QString::fromUtf8("%L1\xc2\xb0").arg(lonDegF, 4 + precision, format, precision, QLatin1Char(' '));
551 lonString += QStringLiteral(" %L3\"").arg(lonSecF, precision - 1, 'f', precision - 4, QLatin1Char('0'));
563QString GeoDataCoordinates::latToString(qreal lat, GeoDataCoordinates::Notation notation, GeoDataCoordinates::Unit unit, int precision, char format)
578 QString northingString = QString::number(GeoDataCoordinatesPrivate::lonLatToNorthing(0, latRad), 'f', 2);
656 latString += QStringLiteral(" %L3\"").arg(latSecF, precision - 1, 'f', precision - 4, QLatin1Char('0'));
658 latString += QStringLiteral(" %L3'").arg(latMinF, precision + 1, 'f', precision - 2, QLatin1Char('0'));
662 latString = QString::fromUtf8("%L1\xc2\xb0").arg(latDegF, 4 + precision, format, precision, QLatin1Char(' '));
724GeoDataCoordinates GeoDataCoordinates::rotateAround(const GeoDataCoordinates &axis, qreal angle, Unit unit) const
742qreal GeoDataCoordinates::bearing(const GeoDataCoordinates &other, Unit unit, BearingType type) const
750 double const bearing = atan2(sin(delta) * cos(other.d->m_lat), cos(d->m_lat) * sin(other.d->m_lat) - sin(d->m_lat) * cos(other.d->m_lat) * cos(delta));
756 qreal newLat = asin(sin(d->m_lat) * cos(distance) + cos(d->m_lat) * sin(distance) * cos(bearing));
757 qreal newLon = d->m_lon + atan2(sin(bearing) * sin(distance) * cos(d->m_lat), cos(distance) - sin(d->m_lat) * sin(newLat));
770GeoDataCoordinates GeoDataCoordinates::interpolate(const GeoDataCoordinates &target, double t_) const
794GeoDataCoordinates::interpolate(const GeoDataCoordinates &before, const GeoDataCoordinates &target, const GeoDataCoordinates &after, double t_) const
797 Quaternion const b1 = GeoDataCoordinatesPrivate::basePoint(before.quaternion(), quaternion(), target.quaternion());
798 Quaternion const a2 = GeoDataCoordinatesPrivate::basePoint(quaternion(), target.quaternion(), after.quaternion());
893Quaternion GeoDataCoordinatesPrivate::basePoint(const Quaternion &q1, const Quaternion &q2, const Quaternion &q3)
903 qreal const n = (GeoDataCoordinatesPrivate::sm_semiMajorAxis - GeoDataCoordinatesPrivate::sm_semiMinorAxis)
907 qreal const alpha = ((GeoDataCoordinatesPrivate::sm_semiMajorAxis + GeoDataCoordinatesPrivate::sm_semiMinorAxis) / 2.0)
911 qreal const beta = (-3.0 * n / 2.0) + (9.0 * qPow(n, 3.0) / 16.0) + (-3.0 * qPow(n, 5.0) / 32.0);
923 qreal const result = alpha * (phi + (beta * qSin(2.0 * phi)) + (gamma * qSin(4.0 * phi)) + (delta * qSin(6.0 * phi)) + (epsilon * qSin(8.0 * phi)));
936 qreal const n = (GeoDataCoordinatesPrivate::sm_semiMajorAxis - GeoDataCoordinatesPrivate::sm_semiMinorAxis)
942 ((GeoDataCoordinatesPrivate::sm_semiMajorAxis + GeoDataCoordinatesPrivate::sm_semiMinorAxis) / 2.0) * (1 + (qPow(n, 2.0) / 4) + (qPow(n, 4.0) / 64));
948 qreal const beta = (3.0 * n / 2.0) + (-27.0 * qPow(n, 3.0) / 32.0) + (269.0 * qPow(n, 5.0) / 512.0);
960 qreal const result = y + (beta * qSin(2.0 * y)) + (gamma * qSin(4.0 * y)) + (delta * qSin(6.0 * y)) + (epsilon * qSin(8.0 * y));
970 const qreal ep2 = (qPow(GeoDataCoordinatesPrivate::sm_semiMajorAxis, 2.0) - qPow(GeoDataCoordinatesPrivate::sm_semiMinorAxis, 2.0))
977 const qreal N = qPow(GeoDataCoordinatesPrivate::sm_semiMajorAxis, 2.0) / (GeoDataCoordinatesPrivate::sm_semiMinorAxis * qSqrt(1 + nu2));
1007 const qreal easting = N * qCos(phi) * coef1 * l + (N / 6.0 * qPow(qCos(phi), 3.0) * coef3 * qPow(l, 3.0))
1008 + (N / 120.0 * qPow(qCos(phi), 5.0) * coef5 * qPow(l, 5.0)) + (N / 5040.0 * qPow(qCos(phi), 7.0) * coef7 * qPow(l, 7.0));
1011 const qreal northing = arcLengthOfMeridian(phi) + (t / 2.0 * N * qPow(qCos(phi), 2.0) * coef2 * qPow(l, 2.0))
1012 + (t / 24.0 * N * qPow(qCos(phi), 4.0) * coef4 * qPow(l, 4.0)) + (t / 720.0 * N * qPow(qCos(phi), 6.0) * coef6 * qPow(l, 6.0))
1044 // See problem: https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system#Exceptions
1045 // See solution: https://gis.stackexchange.com/questions/13291/computing-utm-zone-from-lat-long-point
1080 QPointF coordinates = GeoDataCoordinatesPrivate::mapLonLatToXY(lon, lat, GeoDataCoordinatesPrivate::centralMeridianUTM(zoneNumber));
1096 // Regular latitude bands between 80 S and 80 N (that is, between 10 and 170 in the [0,180] interval)
1125 QPointF coordinates = GeoDataCoordinatesPrivate::mapLonLatToXY(lon, lat, GeoDataCoordinatesPrivate::centralMeridianUTM(zoneNumber));
bool isPole(Pole=AnyPole) const
return whether our coordinates represent a pole This method can be used to check whether the coordina...
Definition GeoDataCoordinates.cpp:809
void unpack(QDataStream &stream)
Unserialize the contents of the feature from stream.
Definition GeoDataCoordinates.cpp:884
void set(qreal lon, qreal lat, qreal alt=0, GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian)
(re)set the coordinates in a GeoDataCoordinates object
Definition GeoDataCoordinates.cpp:109
static void normalizeLonLat(qreal &lon, qreal &lat, GeoDataCoordinates::Unit=GeoDataCoordinates::Radian)
normalize both longitude and latitude at the same time This method normalizes both latitude and longi...
Definition GeoDataCoordinates.cpp:305
static qreal normalizeLon(qreal lon, GeoDataCoordinates::Unit=GeoDataCoordinates::Radian)
normalize the longitude to always be -M_PI <= lon <= +M_PI (Radian).
Definition GeoDataCoordinates.cpp:238
GeoDataCoordinates moveByBearing(qreal bearing, qreal distance) const
Returns the coordinates of the resulting point after moving this point according to the distance and ...
Definition GeoDataCoordinates.cpp:754
void setLatitude(qreal lat, GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian)
set the longitude in a GeoDataCoordinates object
Definition GeoDataCoordinates.cpp:146
qreal utmNorthing() const
retrieves the UTM northing of the GeoDataCoordinates object, in meters
Definition GeoDataCoordinates.cpp:708
qreal bearing(const GeoDataCoordinates &other, Unit unit=Radian, BearingType type=InitialBearing) const
Returns the bearing (true bearing, the angle between the line defined by this point and the other and...
Definition GeoDataCoordinates.cpp:742
QString latToString() const
return a string representation of latitude of the coordinate convenience function that uses the defau...
Definition GeoDataCoordinates.cpp:667
void pack(QDataStream &stream) const
Serialize the contents of the feature to stream.
Definition GeoDataCoordinates.cpp:877
GeoDataCoordinates nlerp(const GeoDataCoordinates &target, double t) const
nlerp (normalized linear interpolation) between this coordinates and the given target coordinates
Definition GeoDataCoordinates.cpp:780
void setAltitude(const qreal altitude)
set the altitude of the Point in meters
Definition GeoDataCoordinates.cpp:682
GeoDataCoordinates rotateAround(const GeoDataCoordinates &axis, qreal angle, Unit unit=Radian) const
Rotates one coordinate around another.
Definition GeoDataCoordinates.cpp:724
@ Astro
< "RA and DEC" notation (used for astronomical sky coordinates)
Definition GeoDataCoordinates.h:75
BearingType
The BearingType enum specifies where to measure the bearing along great circle arcs.
Definition GeoDataCoordinates.h:87
qreal altitude() const
return the altitude of the Point in meters
Definition GeoDataCoordinates.cpp:688
static void setDefaultNotation(GeoDataCoordinates::Notation notation)
set the Notation of the string representation
Definition GeoDataCoordinates.cpp:232
static GeoDataCoordinates::Notation defaultNotation()
return Notation of string representation
Definition GeoDataCoordinates.cpp:226
qreal utmEasting() const
retrieves the UTM easting of the GeoDataCoordinates object, in meters.
Definition GeoDataCoordinates.cpp:698
void setLongitude(qreal lon, GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian)
set the longitude in a GeoDataCoordinates object
Definition GeoDataCoordinates.cpp:129
QString lonToString() const
return a string representation of longitude of the coordinate convenience function that uses the defa...
Definition GeoDataCoordinates.cpp:558
int utmZone() const
retrieves the UTM zone of the GeoDataCoordinates object.
Definition GeoDataCoordinates.cpp:693
static GeoDataCoordinates fromString(const QString &string, bool &successful)
try to parse the string into a coordinate pair
Definition GeoDataCoordinates.cpp:368
GeoDataCoordinates interpolate(const GeoDataCoordinates &target, double t) const
slerp (spherical linear) interpolation between this coordinate and the given target coordinate
Definition GeoDataCoordinates.cpp:770
static qreal normalizeLat(qreal lat, GeoDataCoordinates::Unit=GeoDataCoordinates::Radian)
normalize latitude to always be in -M_PI / 2.
Definition GeoDataCoordinates.cpp:260
qreal sphericalDistanceTo(const GeoDataCoordinates &other) const
This method calculates the shortest distance between two points on a sphere.
Definition GeoDataCoordinates.cpp:861
quint8 detail() const
return the detail flag detail range: 0 for most important points, 5 for least important
Definition GeoDataCoordinates.cpp:713
QString utmLatitudeBand() const
retrieves the UTM latitude band of the GeoDataCoordinates object
Definition GeoDataCoordinates.cpp:703
void geoCoordinates(qreal &lon, qreal &lat, GeoDataCoordinates::Unit unit) const
use this function to get the longitude and latitude with one call - use the unit parameter to switch ...
Definition GeoDataCoordinates.cpp:159
QString toString() const
return a string representation of the coordinate this is a convenience function which uses the defaul...
Definition GeoDataCoordinates.cpp:379
const Quaternion & quaternion() const
return a Quaternion with the used coordinates
Definition GeoDataCoordinates.cpp:762
KTEXTEDITOR_EXPORT size_t qHash(KTextEditor::Cursor cursor, size_t seed=0) noexcept
Binds a QML item to a specific geodetic location in screen coordinates.
Definition AbstractDataPlugin.cpp:23
qreal distanceSphere(qreal lon1, qreal lat1, qreal lon2, qreal lat2)
This method calculates the shortest distance between two points on a sphere.
Definition MarbleMath.h:45
qreal x() const const
qreal y() const const
QString arg(Args &&... args) const const
QString fromUtf8(QByteArrayView str)
QString number(double n, char format, int precision)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.