KPublicTransport::Location
#include <location.h>
Public Types | |
enum | Type { Place = 0 , Stop = 1 , RentedVehicleStation = 2 , RentedVehicle = 4 , Equipment = 8 , CarpoolPickupDropoff = 16 , Address = 32 } |
typedef QFlags< Type > | Types |
Public Member Functions | |
KPublicTransport::Equipment | equipment () const |
bool | hasCoordinate () const |
bool | hasFloorLevel () const |
bool | hasIdentifier (const QString &identifierType) const |
QString | iconName () const |
Q_INVOKABLE QString | identifier (const QString &identifierType) const |
QHash< QString, QString > | identifiers () const |
bool | isEmpty () const |
RentalVehicle | rentalVehicle () const |
RentalVehicleStation | rentalVehicleStation () const |
void | setCoordinate (double latitude, double longitude) |
void | setIdentifier (const QString &identifierType, const QString &id) |
void | setTimeZone (const QTimeZone &tz) |
QTimeZone | timeZone () const |
Static Public Member Functions | |
static double | distance (const Location &lhs, const Location &rhs) |
static double | distance (double lat1, double lon1, double lat2, double lon2) |
static std::vector< Location > | fromJson (const QJsonArray &a) |
static Location | fromJson (const QJsonObject &obj) |
static bool | isSame (const Location &lhs, const Location &rhs) |
static bool | isSameName (const QString &lhs, const QString &rhs) |
static Location | merge (const Location &lhs, const Location &rhs) |
static QJsonObject | toJson (const Location &loc) |
static QJsonArray | toJson (const std::vector< Location > &locs) |
Detailed Description
A location.
This can be a train station, a bus stop, a rental vehicle dock, a free-floating vehicle position, an elevator or escalator, etc.
Definition at line 29 of file location.h.
Member Typedef Documentation
◆ Types
Definition at line 45 of file location.h.
Member Enumeration Documentation
◆ Type
Type of location.
Definition at line 35 of file location.h.
Property Documentation
◆ country
|
readwrite |
Country of the location as ISO 3166-1 alpha 2 code, if known.
Definition at line 67 of file location.h.
◆ data
|
readwrite |
Location type specific data.
Depending on the location type this can be e.g. a RentalVehicleStation or an Equipment instance.
Definition at line 81 of file location.h.
◆ equipment
|
read |
Equipment information, if applicable for this location.
Definition at line 88 of file location.h.
◆ floorLevel
|
readwrite |
◆ hasCoordinate
|
read |
Definition at line 69 of file location.h.
◆ hasFloorLevel
|
read |
Indicates whether the floor level is set.
Definition at line 76 of file location.h.
◆ iconName
|
read |
Icon representing the location type.
Can be a qrc: URL or an XDG icon name.
Definition at line 93 of file location.h.
◆ latitude
|
readwrite |
Latitude of the location, in degree, NaN if unknown.
Definition at line 54 of file location.h.
◆ locality
|
readwrite |
Locality/city of the location, if known.
Definition at line 63 of file location.h.
◆ longitude
|
readwrite |
Longitude of the location, in degree, NaN if unknown.
Definition at line 56 of file location.h.
◆ name
|
readwrite |
Human-readable name of the location.
Definition at line 52 of file location.h.
◆ postalCode
|
readwrite |
Postal code of the location, if known.
Definition at line 61 of file location.h.
◆ region
|
readwrite |
Region (as in ISO 3166-2) of the location, if known.
Definition at line 65 of file location.h.
◆ rentalVehicle
|
read |
Rental vehicle information, if applicable for this location.
Definition at line 86 of file location.h.
◆ rentalVehicleStation
|
read |
Rental vehicle dock information, if applicable for this location.
Definition at line 84 of file location.h.
◆ streetAddress
|
readwrite |
Street address of the location, if known.
Definition at line 59 of file location.h.
◆ type
|
readwrite |
Location type.
Definition at line 49 of file location.h.
Member Function Documentation
◆ distance() [1/2]
Computes the distance in meters between two locations.
Returns NAN if one of the arguments has no coordinates set.
Definition at line 486 of file location.cpp.
◆ distance() [2/2]
|
staticnodiscard |
Compute the distance between two geo coordinates, in meters.
Definition at line 474 of file location.cpp.
◆ equipment()
|
nodiscard |
Definition at line 170 of file location.cpp.
◆ fromJson() [1/2]
|
staticnodiscard |
Dezerializes an array Location objects from JSON.
Definition at line 592 of file location.cpp.
◆ fromJson() [2/2]
|
staticnodiscard |
Deserialize a Location object from JSON.
Definition at line 559 of file location.cpp.
◆ hasCoordinate()
|
nodiscard |
Definition at line 110 of file location.cpp.
◆ hasFloorLevel()
|
nodiscard |
Definition at line 115 of file location.cpp.
◆ hasIdentifier()
|
nodiscard |
Definition at line 155 of file location.cpp.
◆ iconName()
|
nodiscard |
Definition at line 539 of file location.cpp.
◆ identifier()
Location identifiers.
Definition at line 144 of file location.cpp.
◆ identifiers()
Definition at line 175 of file location.cpp.
◆ isEmpty()
|
nodiscard |
Returns true
if this is an default-constructed location object not specifying any location.
Definition at line 120 of file location.cpp.
◆ isSame()
Checks if to instances refer to the same location (which does not necessarily mean they are exactly equal).
Definition at line 311 of file location.cpp.
◆ isSameName()
Checks if two location names refer to the same location.
Definition at line 370 of file location.cpp.
◆ merge()
Merge two departure instances.
This assumes isSame(lhs, rhs) and tries to preserve the most detailed information.
Definition at line 417 of file location.cpp.
◆ rentalVehicle()
|
nodiscard |
Definition at line 165 of file location.cpp.
◆ rentalVehicleStation()
|
nodiscard |
Definition at line 160 of file location.cpp.
◆ setCoordinate()
void Location::setCoordinate | ( | double | latitude, |
double | longitude ) |
Definition at line 103 of file location.cpp.
◆ setIdentifier()
Definition at line 149 of file location.cpp.
◆ setTimeZone()
void Location::setTimeZone | ( | const QTimeZone & | tz | ) |
Definition at line 138 of file location.cpp.
◆ timeZone()
|
nodiscard |
The timezone this location is in, if known.
Definition at line 125 of file location.cpp.
◆ toJson() [1/2]
|
staticnodiscard |
Serializes one Location object to JSON.
Definition at line 494 of file location.cpp.
◆ toJson() [2/2]
|
staticnodiscard |
Serializes an array of Location objects to JSON.
Definition at line 534 of file location.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:57 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.