Search for usage in LXR

#include <location.h>

Public Types

enum  Type {
  Place = 0, Stop = 1, RentedVehicleStation = 2, RentedVehicle = 4,
  Equipment = 8, CarpoolPickupDropoff = 16
typedef QFlags< TypeTypes


QString country
QVariant data
KPublicTransport::Equipment equipment
bool hasCoordinate
float latitude
QString locality
float longitude
QString name
QString postalCode
QString region
KPublicTransport::RentalVehicle rentalVehicle
KPublicTransport::RentalVehicleStation rentalVehicleStation
QString streetAddress
Type type

Public Member Functions

KPublicTransport::Equipment equipment () const
bool hasCoordinate () const
QString identifier (const QString &identifierType) const
QHash< QString, QStringidentifiers () const
bool isEmpty () const
RentalVehicle rentalVehicle () const
RentalVehicleStation rentalVehicleStation () const
void setCoordinate (float latitude, float longitude)
void setIdentifier (const QString &identifierType, const QString &id)
void setRentalVehicleStation (const RentalVehicleStation &dock)
void setTimeZone (const QTimeZone &tz)
QTimeZone timeZone () const

Static Public Member Functions

static int distance (float lat1, float lon1, float lat2, float lon2)
static int distance (const Location &lhs, const Location &rhs)
static Location fromJson (const QJsonObject &obj)
static std::vector< LocationfromJson (const QJsonArray &a)
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 Enumeration Documentation

Type of location.


a location that isn't of any specific type


a public transport stop (train station, bus stop, etc)


a pick-up/drop-off point for dock-based rental bike/scooter systems


a free-floating rental bike/scooter




a pickup or dropoff location for a carpool trip

Definition at line 34 of file location.h.

Property Documentation

QString KPublicTransport::Location::country

Country of the location as ISO 3166-1 alpha 2 code, if known.

Definition at line 65 of file location.h.

QVariant KPublicTransport::Location::data

Location type specific data.

Depending on the location type this can be e.g. a RentalVehicleStation or an Equipment instance.

Definition at line 72 of file location.h.

KPublicTransport::Equipment Location::equipment

Equipment information, if applicable for this location.

Definition at line 79 of file location.h.

float KPublicTransport::Location::latitude

Latitude of the location, in degree, NaN if unknown.

Definition at line 52 of file location.h.

QString KPublicTransport::Location::locality

Locality/city of the location, if known.

Definition at line 61 of file location.h.

float KPublicTransport::Location::longitude

Longitude of the location, in degree, NaN if unknown.

Definition at line 54 of file location.h.

QString KPublicTransport::Location::name

Human-readable name of the location.

Definition at line 50 of file location.h.

QString KPublicTransport::Location::postalCode

Postal code of the location, if known.

Definition at line 59 of file location.h.

QString KPublicTransport::Location::region

Region (as in ISO 3166-2) of the location, if known.

Definition at line 63 of file location.h.

RentalVehicle Location::rentalVehicle

Rental vehicle information, if applicable for this location.

Definition at line 77 of file location.h.

RentalVehicleStation Location::rentalVehicleStation

Rental vehicle dock information, if applicable for this location.

Definition at line 75 of file location.h.

QString KPublicTransport::Location::streetAddress

Street address of the location, if known.

Definition at line 57 of file location.h.

Type KPublicTransport::Location::type

Location type.

Definition at line 47 of file location.h.

Member Function Documentation

int Location::distance ( float  lat1,
float  lon1,
float  lat2,
float  lon2 

Compute the distance between two geo coordinates, in meters.

Definition at line 424 of file location.cpp.

int Location::distance ( const Location lhs,
const Location rhs 

Computes the distance in meters between two locations.

Returns MAX_INT if one of the arguments has no coordinates set.

Definition at line 436 of file location.cpp.

Location Location::fromJson ( const QJsonObject obj)

Deserialize a Location object from JSON.

Definition at line 485 of file location.cpp.

std::vector< Location > Location::fromJson ( const QJsonArray a)

Dezerializes an array Location objects from JSON.

Definition at line 517 of file location.cpp.

QString Location::identifier ( const QString identifierType) const

Location identifiers.

Definition at line 92 of file location.cpp.

bool Location::isEmpty ( ) const

Returns true if this is an default-constructed location object not specifying any location.

Definition at line 76 of file location.cpp.

bool Location::isSame ( const Location lhs,
const Location rhs 

Checks if to instances refer to the same location (which does not necessarily mean they are exactly equal).

Definition at line 262 of file location.cpp.

bool Location::isSameName ( const QString lhs,
const QString rhs 

Checks if two location names refer to the same location.

Definition at line 321 of file location.cpp.

Location Location::merge ( const Location lhs,
const Location rhs 

Merge two departure instances.

This assumes isSame(lhs, rhs) and tries to preserve the most detailed information.

Definition at line 368 of file location.cpp.

QTimeZone Location::timeZone ( ) const

The timezone this location is in, if known.

Definition at line 81 of file location.cpp.

QJsonObject Location::toJson ( const Location loc)

Serializes one Location object to JSON.

Definition at line 444 of file location.cpp.

QJsonArray Location::toJson ( const std::vector< Location > &  locs)

Serializes an array of Location objects to JSON.

Definition at line 480 of file location.cpp.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Sep 27 2021 23:07:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.