KPublicTransport::Location

Search for usage in LXR

#include <location.h>

Public Types

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

Properties

QString country
 
QVariant data
 
KPublicTransport::Equipment equipment
 
int floorLevel
 
bool hasCoordinate
 
bool hasFloorLevel
 
QString iconName
 
QStringList identifierTypes
 
double latitude
 
QString locality
 
double 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
 
bool hasFloorLevel () const
 
bool hasIdentifier (QAnyStringView identifierType) const
 
QString iconName () const
 
Q_INVOKABLE QString identifier (const QString &identifierType) const
 
QString identifier (QAnyStringView identifierType) const
 
QString identifier (QLatin1StringView identifierType) const
 
QStringList identifierTypes () 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< LocationfromJson (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.

Enumerator
Place 

a location that isn't of any specific type

Stop 

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

RentedVehicleStation 

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

RentedVehicle 

a free-floating rental bike/scooter

Equipment 

elevator/escalator

CarpoolPickupDropoff 

a pickup or dropoff location for a carpool trip

Address 

postal addresses

Definition at line 35 of file location.h.

Property Documentation

◆ country

QString Location::country
readwrite

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

Definition at line 67 of file location.h.

◆ data

QVariant KPublicTransport::Location::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

KPublicTransport::Equipment KPublicTransport::Location::equipment
read

Equipment information, if applicable for this location.

Definition at line 88 of file location.h.

◆ floorLevel

int KPublicTransport::Location::floorLevel
readwrite

OSM floor level of this location.

Not set by default.

Definition at line 74 of file location.h.

◆ hasCoordinate

bool KPublicTransport::Location::hasCoordinate
read

Definition at line 69 of file location.h.

◆ hasFloorLevel

bool KPublicTransport::Location::hasFloorLevel
read

Indicates whether the floor level is set.

Definition at line 76 of file location.h.

◆ iconName

QString KPublicTransport::Location::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.

◆ identifierTypes

QStringList KPublicTransport::Location::identifierTypes
read

Identifier types set on this location.

Definition at line 96 of file location.h.

◆ latitude

double KPublicTransport::Location::latitude
readwrite

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

Definition at line 54 of file location.h.

◆ locality

QString KPublicTransport::Location::locality
readwrite

Locality/city of the location, if known.

Definition at line 63 of file location.h.

◆ longitude

double KPublicTransport::Location::longitude
readwrite

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

Definition at line 56 of file location.h.

◆ name

QString KPublicTransport::Location::name
readwrite

Human-readable name of the location.

Definition at line 52 of file location.h.

◆ postalCode

QString KPublicTransport::Location::postalCode
readwrite

Postal code of the location, if known.

Definition at line 61 of file location.h.

◆ region

QString Location::region
readwrite

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

Definition at line 65 of file location.h.

◆ rentalVehicle

KPublicTransport::RentalVehicle KPublicTransport::Location::rentalVehicle
read

Rental vehicle information, if applicable for this location.

Definition at line 86 of file location.h.

◆ rentalVehicleStation

KPublicTransport::RentalVehicleStation KPublicTransport::Location::rentalVehicleStation
read

Rental vehicle dock information, if applicable for this location.

Definition at line 84 of file location.h.

◆ streetAddress

QString KPublicTransport::Location::streetAddress
readwrite

Street address of the location, if known.

Definition at line 59 of file location.h.

◆ type

Type KPublicTransport::Location::type
readwrite

Location type.

Definition at line 49 of file location.h.

Member Function Documentation

◆ distance() [1/2]

double Location::distance ( const Location & lhs,
const Location & rhs )
staticnodiscard

Computes the distance in meters between two locations.

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

Definition at line 470 of file location.cpp.

◆ distance() [2/2]

double Location::distance ( double lat1,
double lon1,
double lat2,
double lon2 )
staticnodiscard

Compute the distance between two geo coordinates, in meters.

Definition at line 458 of file location.cpp.

◆ equipment()

KPublicTransport::Equipment Location::equipment ( ) const
nodiscard

Definition at line 176 of file location.cpp.

◆ fromJson() [1/2]

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

Dezerializes an array Location objects from JSON.

Definition at line 569 of file location.cpp.

◆ fromJson() [2/2]

Location Location::fromJson ( const QJsonObject & obj)
staticnodiscard

Deserialize a Location object from JSON.

Definition at line 539 of file location.cpp.

◆ hasCoordinate()

bool Location::hasCoordinate ( ) const
nodiscard

Definition at line 111 of file location.cpp.

◆ hasFloorLevel()

bool Location::hasFloorLevel ( ) const
nodiscard

Definition at line 116 of file location.cpp.

◆ hasIdentifier()

bool Location::hasIdentifier ( QAnyStringView identifierType) const
nodiscard

Definition at line 156 of file location.cpp.

◆ iconName()

QString Location::iconName ( ) const
nodiscard

Definition at line 519 of file location.cpp.

◆ identifier() [1/3]

Q_INVOKABLE QString KPublicTransport::Location::identifier ( const QString & identifierType) const
inlinenodiscard

Definition at line 112 of file location.h.

◆ identifier() [2/3]

QString Location::identifier ( QAnyStringView identifierType) const
nodiscard

Location identifiers.

Definition at line 145 of file location.cpp.

◆ identifier() [3/3]

QString KPublicTransport::Location::identifier ( QLatin1StringView identifierType) const
inlinenodiscard

Definition at line 113 of file location.h.

◆ identifierTypes()

QStringList Location::identifierTypes ( ) const
nodiscard

Definition at line 161 of file location.cpp.

◆ isEmpty()

bool Location::isEmpty ( ) const
nodiscard

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

Definition at line 121 of file location.cpp.

◆ isSame()

bool Location::isSame ( const Location & lhs,
const Location & rhs )
staticnodiscard

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

Definition at line 312 of file location.cpp.

◆ isSameName()

bool Location::isSameName ( const QString & lhs,
const QString & rhs )
staticnodiscard

Checks if two location names refer to the same location.

Definition at line 360 of file location.cpp.

◆ merge()

Location Location::merge ( const Location & lhs,
const Location & rhs )
staticnodiscard

Merge two departure instances.

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

Definition at line 407 of file location.cpp.

◆ rentalVehicle()

RentalVehicle Location::rentalVehicle ( ) const
nodiscard

Definition at line 171 of file location.cpp.

◆ rentalVehicleStation()

RentalVehicleStation Location::rentalVehicleStation ( ) const
nodiscard

Definition at line 166 of file location.cpp.

◆ setCoordinate()

void Location::setCoordinate ( double latitude,
double longitude )

Definition at line 104 of file location.cpp.

◆ setIdentifier()

void Location::setIdentifier ( const QString & identifierType,
const QString & id )

Definition at line 150 of file location.cpp.

◆ setTimeZone()

void Location::setTimeZone ( const QTimeZone & tz)

Definition at line 139 of file location.cpp.

◆ timeZone()

QTimeZone Location::timeZone ( ) const
nodiscard

The timezone this location is in, if known.

Definition at line 126 of file location.cpp.

◆ toJson() [1/2]

QJsonObject Location::toJson ( const Location & loc)
staticnodiscard

Serializes one Location object to JSON.

Definition at line 478 of file location.cpp.

◆ toJson() [2/2]

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

Serializes an array of Location objects to JSON.

Definition at line 514 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-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:50:52 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.