KItinerary
locationutil.cpp
52 return JsonLd::isA<FlightReservation>(res) || JsonLd::isA<TrainReservation>(res) || JsonLd::isA<BusReservation>(res) || JsonLd::isA<TaxiReservation>(res) || JsonLd::isA<BoatReservation>(res);
198// if the character has a canonical decomposition use that and skip the combining diacritic markers following it
268static bool isSameLocationName(const QString &lhs, const QString &rhs, LocationUtil::Accuracy accuracy)
284 if (compareSpaceCaseInsenstive(lhsNormalized, rhsNormalized) || compareSpaceCaseInsenstive(lhsNormalized, rhsTransliterated)
285 || compareSpaceCaseInsenstive(lhsTransliterated, rhsNormalized) || compareSpaceCaseInsenstive(lhsTransliterated, rhsTransliterated)) {
296 return hasCommonPrefix(lhsNormalized, rhsNormalized) || hasCommonPrefix(lhsTransliterated, rhsTransliterated);
302bool LocationUtil::isSameLocation(const QVariant &lhs, const QVariant &rhs, LocationUtil::Accuracy accuracy)
309 const auto lhsIsTransportStop = JsonLd::isA<Airport>(lhs) || JsonLd::isA<TrainStation>(lhs) || JsonLd::isA<BusStation>(lhs);
310 const auto rhsIsTransportStop = JsonLd::isA<Airport>(rhs) || JsonLd::isA<TrainStation>(rhs) || JsonLd::isA<BusStation>(rhs);
320 // airports are large but we have no local transport there, so the distance threshold needs to be higher there
331 if (d < 50000 && (lhsAddr.addressLocality().isEmpty() || rhsAddr.addressLocality().isEmpty()) && (!isNameComparable || name(lhs).isEmpty() || name(rhs).isEmpty())) {
342 return lhsAddr.streetAddress() == rhsAddr.streetAddress() && lhsAddr.addressLocality() == rhsAddr.addressLocality();
347 return isSameLocationName(lhsAddr.addressLocality(), rhsAddr.addressLocality(), LocationUtil::Exact);
362 url.setPath(QString::number(geo.latitude()) + QLatin1Char(',') + QString::number(geo.longitude()));
void setStreet(const QString &street)
void setCountry(const QString &country)
void setRegion(const QString ®ion)
void setPostalCode(const QString &code)
void setLocality(const QString &locality)
QString addressCountry
The country this address is in, as ISO 3166-1 alpha 2 code.
Definition place.h:53
bool canConvert(const QVariant &value)
Checks if the given value can be up-cast to T.
Definition datatypes.h:31
GeoCoordinates geo(const QVariant &location)
Returns the geo coordinates of a given location.
Definition locationutil.cpp:119
QString name(const QVariant &location)
Returns a description of the location.
Definition locationutil.cpp:164
QVariant location(const QVariant &res)
Returns the location of a non-transport reservation.
Definition locationutil.cpp:98
GeoCoordinates geoFromUrl(const QUrl &url)
Parses geo coordinates from a given mapping service URLs, such as Google Maps links.
Definition locationutil.cpp:131
bool isLocationChange(const QVariant &res)
Returns true if the given reservation is a location change.
Definition locationutil.cpp:42
int distance(const GeoCoordinates &coord1, const GeoCoordinates &coord2)
Computes the distance between to geo coordinates in meters.
Definition locationutil.cpp:180
bool isSameLocation(const QVariant &lhs, const QVariant &rhs, Accuracy accuracy=Exact)
Returns true if the given locations are the same.
Definition locationutil.cpp:302
QVariant departureLocation(const QVariant &res)
Returns the departure location of the given reservation.
Definition locationutil.cpp:75
QVariant arrivalLocation(const QVariant &res)
Returns the arrival location of the given reservation.
Definition locationutil.cpp:55
PostalAddress address(const QVariant &location)
Returns the address of the given location.
Definition locationutil.cpp:152
@ WalkingDistance
Locations are close enough together to not need transportation.
Definition locationutil.h:66
QUrl geoUri(const QVariant &location)
Returns a geo: URI for the given location.
Definition locationutil.cpp:355
QString transliterate(QStringView s)
Transliterate diacritics or other special characters.
Definition stringutil.cpp:171
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
Canonical
bool isLetter(char32_t ucs4)
QRegularExpressionMatch match(QStringView subjectView, qsizetype offset, MatchType matchType, MatchOptions matchOptions) const const
iterator begin()
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
iterator end()
bool isEmpty() const const
QString number(double n, char format, int precision)
void push_back(QChar ch)
void reserve(qsizetype size)
qsizetype size() const const
QChar at(qsizetype n) const const
qsizetype size() const const
bool startsWith(QChar ch) const const
CaseInsensitive
QString host(ComponentFormattingOptions options) const const
QString path(ComponentFormattingOptions options) const const
QString query(ComponentFormattingOptions options) const const
void setPath(const QString &path, ParsingMode mode)
void setQuery(const QString &query, ParsingMode mode)
void setScheme(const QString &scheme)
T value() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.