KPublicTransport::JourneySection

Search for usage in LXR

KPublicTransport::JourneySection Class Reference

#include <journey.h>

Public Types

enum  Mode {
  Invalid = 0 , PublicTransport = 1 , Transfer = 2 , Walking = 4 ,
  Waiting = 8 , RentedVehicle = 16 , IndividualTransport = 32
}
 
typedef QFlags< ModeModes
 

Properties

KPublicTransport::Stopover arrival
 
int arrivalDelay
 
bool arrivalPlatformChanged
 
KPublicTransport::Platform arrivalPlatformLayout
 
KPublicTransport::Vehicle arrivalVehicleLayout
 
int co2Emission
 
KPublicTransport::Stopover departure
 
int departureDelay
 
bool departurePlatformChanged
 
KPublicTransport::Platform departurePlatformLayout
 
KPublicTransport::Vehicle departureVehicleLayout
 
KPublicTransport::Disruption::Effect disruptionEffect
 
int distance
 
int duration
 
QString expectedArrivalPlatform
 
QDateTime expectedArrivalTime
 
QString expectedDeparturePlatform
 
QDateTime expectedDepartureTime
 
std::vector< KPublicTransport::Featurefeatures
 
KPublicTransport::Location from
 
bool hasExpectedArrivalPlatform
 
bool hasExpectedArrivalTime
 
bool hasExpectedDeparturePlatform
 
bool hasExpectedDepartureTime
 
QString iconName
 
KPublicTransport::IndividualTransport individualTransport
 
QVariantList intermediateStops
 
QString label
 
QList< KPublicTransport::LoadInfoloadInformation
 
KPublicTransport::Load::Category maximumOccupancy
 
Mode mode
 
QStringList notes
 
KPublicTransport::Path path
 
KPublicTransport::RentalVehicle rentalVehicle
 
KPublicTransport::Route route
 
QString scheduledArrivalPlatform
 
QDateTime scheduledArrivalTime
 
QString scheduledDeparturePlatform
 
QDateTime scheduledDepartureTime
 
KPublicTransport::Location to
 

Public Member Functions

void addNote (const QString &note)
 
void addNotes (const QStringList &notes)
 
void applyMetaData (bool download)
 
Stopover arrival () const
 
int arrivalDelay () const
 
bool arrivalPlatformChanged () const
 
Stopover departure () const
 
int departureDelay () const
 
bool departurePlatformChanged () const
 
int duration () const
 
const std::vector< KPublicTransport::Feature > & features () const
 
bool hasExpectedArrivalPlatform () const
 
bool hasExpectedArrivalTime () const
 
bool hasExpectedDeparturePlatform () const
 
bool hasExpectedDepartureTime () const
 
bool hasIdentifier (QAnyStringView identifierType) const
 
bool hasIdentifiers () const
 
QString iconName () const
 
QString identifier (QAnyStringView identifierType) const
 
qsizetype indexOfStopover (const Stopover &stop) const
 
const std::vector< Stopover > & intermediateStops () const
 
QString label () const
 
const std::vector< LoadInfo > & loadInformation () const
 
Load::Category maximumOccupancy () const
 
void setArrival (const Stopover &arrival)
 
void setDeparture (const Stopover &departure)
 
void setFeatures (std::vector< KPublicTransport::Feature > &&features)
 
void setIdentifier (const QString &identifierType, const QString &id)
 
void setIntermediateStops (std::vector< Stopover > &&stops)
 
void setLoadInformation (std::vector< LoadInfo > &&loadInfo)
 
void setStopovver (qsizetype idx, const Stopover &stop)
 
Stopover stopover (qsizetype idx) const
 
JourneySection subsection (qsizetype begin, qsizetype end) const
 
std::vector< KPublicTransport::Feature > && takeFeatures ()
 
std::vector< Stopover > && takeIntermediateStops ()
 
std::vector< LoadInfo > && takeLoadInformation ()
 

Static Public Member Functions

static std::vector< JourneySectionfromJson (const QJsonArray &array)
 
static JourneySection fromJson (const QJsonObject &obj)
 
static bool isSame (const JourneySection &lhs, const JourneySection &rhs)
 
static JourneySection merge (const JourneySection &lhs, const JourneySection &rhs)
 
static Q_INVOKABLE QString modeIconName (KPublicTransport::JourneySection::Mode mode)
 
static QJsonObject toJson (const JourneySection &section)
 
static QJsonArray toJson (const std::vector< JourneySection > &sections)
 

Detailed Description

A segment of a journey plan.

Also used for trips, ie. a single full vehicle run along a route.

This consists of a departure and an arrival stopover as well as zero or more intermediate stopovers. For extracting sub-journeys those can be addresses by a numeric index. Index 0 refers to the departure, 1 to N refer to the n-th intermediate stopover and N + 1 refers to the arrival, for N intermediate stops.

Definition at line 38 of file journey.h.

Member Typedef Documentation

◆ Modes

Definition at line 56 of file journey.h.

Member Enumeration Documentation

◆ Mode

Mode of transport.

These categories are fairly coarse, for a more detailed break-down of PublicTransport see Line::Mode.

Enumerator
RentedVehicle 

free floating or dock-based rental bike service, electric scooters, car sharing services, ie. any vehicle you drive yourself but that isn't your own

IndividualTransport 

using your own vehicle (bike, car, etc).

Definition at line 46 of file journey.h.

Property Documentation

◆ arrival

KPublicTransport::Stopover KPublicTransport::JourneySection::arrival
read

All arrival information represented as Stopover object.

Definition at line 125 of file journey.h.

◆ arrivalDelay

int KPublicTransport::JourneySection::arrivalDelay
read

Difference to schedule in minutes.

Definition at line 82 of file journey.h.

◆ arrivalPlatformChanged

bool KPublicTransport::JourneySection::arrivalPlatformChanged
read

true if we have real-time platform information and the platform changed.

Definition at line 112 of file journey.h.

◆ arrivalPlatformLayout

KPublicTransport::Platform KPublicTransport::JourneySection::arrivalPlatformLayout
readwrite

Platform layout information at arrival.

Definition at line 160 of file journey.h.

◆ arrivalVehicleLayout

KPublicTransport::Vehicle KPublicTransport::JourneySection::arrivalVehicleLayout
readwrite

Vehicle coach layout information at arrival.

Note that this does not necessarily need to be the same as departureVehicleLayout, as e.g. trains can be split up or merged along the way.

Definition at line 158 of file journey.h.

◆ co2Emission

int JourneySection::co2Emission
readwrite

COâ‚‚ emission during this journey section, in gram.

In case the backend doesn't provide this value, it is estimated based on the distance travelled during this section and the mode of transport, based on average emission values from https://en.wikipedia.org/wiki/Environmental_impact_of_transport This value can be 0 (e.g. in case of walk or wait sections), or -1 if no information is available.

Definition at line 134 of file journey.h.

◆ departure

KPublicTransport::Stopover KPublicTransport::JourneySection::departure
read

All departure information represented as Stopover object.

Definition at line 123 of file journey.h.

◆ departureDelay

int KPublicTransport::JourneySection::departureDelay
read

Difference to schedule in minutes.

Definition at line 71 of file journey.h.

◆ departurePlatformChanged

bool KPublicTransport::JourneySection::departurePlatformChanged
read

true if we have real-time platform information and the platform changed.

Definition at line 103 of file journey.h.

◆ departurePlatformLayout

KPublicTransport::Platform KPublicTransport::JourneySection::departurePlatformLayout
readwrite

Platform layout information at departure.

Definition at line 153 of file journey.h.

◆ departureVehicleLayout

KPublicTransport::Vehicle KPublicTransport::JourneySection::departureVehicleLayout
readwrite

Vehicle coach layout information at departure.

Definition at line 151 of file journey.h.

◆ disruptionEffect

KPublicTransport::Disruption::Effect KPublicTransport::JourneySection::disruptionEffect
readwrite

Disruption effect on this section, if any.

Definition at line 115 of file journey.h.

◆ distance

int JourneySection::distance
readwrite

Distance of the section in meter.

Definition at line 87 of file journey.h.

◆ duration

int KPublicTransport::JourneySection::duration
read

Duration of the section in seconds.

Definition at line 85 of file journey.h.

◆ expectedArrivalPlatform

QString JourneySection::expectedArrivalPlatform
readwrite

Actual arrival platform, in case real-time information are available.

Definition at line 108 of file journey.h.

◆ expectedArrivalTime

QDateTime KPublicTransport::JourneySection::expectedArrivalTime
readwrite

Actual arrival time, if available.

Set to invalid to indicate real-time data is not available.

Definition at line 78 of file journey.h.

◆ expectedDeparturePlatform

QString JourneySection::expectedDeparturePlatform
readwrite

Actual departure platform, in case real-time information are available.

Definition at line 99 of file journey.h.

◆ expectedDepartureTime

QDateTime KPublicTransport::JourneySection::expectedDepartureTime
readwrite

Actual departure time, if available.

Set to invalid to indicate real-time data is not available.

Definition at line 67 of file journey.h.

◆ features

std::vector<KPublicTransport::Feature> KPublicTransport::JourneySection::features
read

Features of the vehicle used on this section.

This is identical to departureVehicleLayout.features and provided for convenience for cases where no more detailed vehicle information are available.

Definition at line 169 of file journey.h.

◆ from

KPublicTransport::Location KPublicTransport::JourneySection::from
readwrite

Departure location of this segment.

Definition at line 90 of file journey.h.

◆ hasExpectedArrivalPlatform

bool KPublicTransport::JourneySection::hasExpectedArrivalPlatform
read

true if real-time platform information are available.

Definition at line 110 of file journey.h.

◆ hasExpectedArrivalTime

bool KPublicTransport::JourneySection::hasExpectedArrivalTime
read

true if this has real-time data.

Definition at line 80 of file journey.h.

◆ hasExpectedDeparturePlatform

bool KPublicTransport::JourneySection::hasExpectedDeparturePlatform
read

true if real-time platform information are available.

Definition at line 101 of file journey.h.

◆ hasExpectedDepartureTime

bool KPublicTransport::JourneySection::hasExpectedDepartureTime
read

true if this has real-time data.

Definition at line 69 of file journey.h.

◆ iconName

QString KPublicTransport::JourneySection::iconName
read

The best available icon to represent this journey section.

Can be a qrc: or file: URL or an XDG icon name.

Definition at line 174 of file journey.h.

◆ individualTransport

KPublicTransport::IndividualTransport KPublicTransport::JourneySection::individualTransport
readwrite

Individual transport details for sections using your own vehicle.

Definition at line 163 of file journey.h.

◆ intermediateStops

QVariantList KPublicTransport::JourneySection::intermediateStops
read

Intermediate stops for consumption by QML.

Definition at line 120 of file journey.h.

◆ label

QString KPublicTransport::JourneySection::label
read

Label shortly describing this transport for display.

Definition at line 177 of file journey.h.

◆ loadInformation

QList<KPublicTransport::LoadInfo> KPublicTransport::JourneySection::loadInformation
readwrite

Vehicle load information for this journey section.

Contains LoadInfo objects for consumption by QML.

Definition at line 139 of file journey.h.

◆ maximumOccupancy

KPublicTransport::Load::Category KPublicTransport::JourneySection::maximumOccupancy
read

Maximum occpancy over all classes.

Definition at line 180 of file journey.h.

◆ mode

Mode KPublicTransport::JourneySection::mode
readwrite

Mode of transport for this section.

Definition at line 60 of file journey.h.

◆ notes

QStringList KPublicTransport::JourneySection::notes
readwrite

General human-readable notes on this service, e.g.

details about a disruption.

Definition at line 117 of file journey.h.

◆ path

KPublicTransport::Path KPublicTransport::JourneySection::path
readwrite

Movement path for this journey section.

This can be navigation instructions for individual transport modes and transfers, or the path a public transport vehicle takes.

Definition at line 148 of file journey.h.

◆ rentalVehicle

KPublicTransport::RentalVehicle KPublicTransport::JourneySection::rentalVehicle
readwrite

Information about a rental vehicle, for sections using one.

Definition at line 142 of file journey.h.

◆ route

KPublicTransport::Route KPublicTransport::JourneySection::route
readwrite

Route to take on this segment.

Definition at line 94 of file journey.h.

◆ scheduledArrivalPlatform

QString JourneySection::scheduledArrivalPlatform
readwrite

Planned arrival platform.

Definition at line 106 of file journey.h.

◆ scheduledArrivalTime

QDateTime KPublicTransport::JourneySection::scheduledArrivalTime
readwrite

Planned arrival time.

Definition at line 74 of file journey.h.

◆ scheduledDeparturePlatform

QString JourneySection::scheduledDeparturePlatform
readwrite

Planned departure platform.

Definition at line 97 of file journey.h.

◆ scheduledDepartureTime

QDateTime KPublicTransport::JourneySection::scheduledDepartureTime
readwrite

Planned departure time.

Definition at line 63 of file journey.h.

◆ to

KPublicTransport::Location KPublicTransport::JourneySection::to
readwrite

Arrival location of this segment.

Definition at line 92 of file journey.h.

Member Function Documentation

◆ addNote()

void JourneySection::addNote ( const QString & note)

Adds a note.

This will check for duplicates and normalize the notes.

Definition at line 224 of file journey.cpp.

◆ addNotes()

void JourneySection::addNotes ( const QStringList & notes)

Definition at line 234 of file journey.cpp.

◆ applyMetaData()

void JourneySection::applyMetaData ( bool download)

Augment line meta data.

Parameters
downloadif set to true, trigger the download of locally missing assets.

Definition at line 673 of file journey.cpp.

◆ arrival()

Stopover JourneySection::arrival ( ) const
nodiscard

Returns the arrival stopover of this journey section.

This is the same information as accessible by individual properties, so this is mainly useful if you have to interface with code expecting a Stopover object.

Definition at line 296 of file journey.cpp.

◆ arrivalDelay()

int JourneySection::arrivalDelay ( ) const
nodiscard

Definition at line 115 of file journey.cpp.

◆ arrivalPlatformChanged()

bool JourneySection::arrivalPlatformChanged ( ) const
nodiscard

Definition at line 219 of file journey.cpp.

◆ departure()

Stopover JourneySection::departure ( ) const
nodiscard

Returns the departure stopover of this journey section.

This is the same information as accessible by individual properties, so this is mainly useful if you have to interface with code expecting a Stopover object.

Definition at line 266 of file journey.cpp.

◆ departureDelay()

int JourneySection::departureDelay ( ) const
nodiscard

Definition at line 102 of file journey.cpp.

◆ departurePlatformChanged()

bool JourneySection::departurePlatformChanged ( ) const
nodiscard

Definition at line 187 of file journey.cpp.

◆ duration()

int JourneySection::duration ( ) const
nodiscard

Definition at line 123 of file journey.cpp.

◆ features()

const std::vector< KPublicTransport::Feature > & JourneySection::features ( ) const
nodiscard

Vehicle features.

This is identical to departureVehicleLayout.features and provided for convenience for cases where no more detailed vehicle information are available.

Definition at line 457 of file journey.cpp.

◆ fromJson() [1/2]

std::vector< JourneySection > JourneySection::fromJson ( const QJsonArray & array)
staticnodiscard

Deserialize a vector of journey sections from JSON.

Definition at line 882 of file journey.cpp.

◆ fromJson() [2/2]

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

Deserialize an object from JSON.

Definition at line 862 of file journey.cpp.

◆ hasExpectedArrivalPlatform()

bool JourneySection::hasExpectedArrivalPlatform ( ) const
nodiscard

Definition at line 214 of file journey.cpp.

◆ hasExpectedArrivalTime()

bool JourneySection::hasExpectedArrivalTime ( ) const
nodiscard

Definition at line 110 of file journey.cpp.

◆ hasExpectedDeparturePlatform()

bool JourneySection::hasExpectedDeparturePlatform ( ) const
nodiscard

Definition at line 182 of file journey.cpp.

◆ hasExpectedDepartureTime()

bool JourneySection::hasExpectedDepartureTime ( ) const
nodiscard

Definition at line 97 of file journey.cpp.

◆ hasIdentifier()

bool JourneySection::hasIdentifier ( QAnyStringView identifierType) const
nodiscard

Definition at line 549 of file journey.cpp.

◆ hasIdentifiers()

bool JourneySection::hasIdentifiers ( ) const
nodiscard

Returns true if there is any identifier set at all.

This is usually a prerequisite for efficient trip queries.

Definition at line 560 of file journey.cpp.

◆ iconName()

QString JourneySection::iconName ( ) const
nodiscard

Definition at line 473 of file journey.cpp.

◆ identifier()

QString JourneySection::identifier ( QAnyStringView identifierType) const
nodiscard

Backend-specific journey section identifiers.

Definition at line 544 of file journey.cpp.

◆ indexOfStopover()

qsizetype JourneySection::indexOfStopover ( const Stopover & stop) const
nodiscard

Returns the index of stop in this journey section.

Returns
-1 if stop isn't found.

Definition at line 596 of file journey.cpp.

◆ intermediateStops()

const std::vector< Stopover > & JourneySection::intermediateStops ( ) const
nodiscard

Intermediate stop-overs along this journey section.

This does not include the departure and arrival stops, and might be empty on backends not providing this information.

Definition at line 241 of file journey.cpp.

◆ isSame()

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

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

Definition at line 688 of file journey.cpp.

◆ label()

QString JourneySection::label ( ) const
nodiscard

Definition at line 515 of file journey.cpp.

◆ loadInformation()

const std::vector< LoadInfo > & JourneySection::loadInformation ( ) const
nodiscard

Vehicle load information for this journey section, if available.

Definition at line 425 of file journey.cpp.

◆ maximumOccupancy()

Load::Category JourneySection::maximumOccupancy ( ) const
nodiscard

Definition at line 537 of file journey.cpp.

◆ merge()

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

Merge two instances.

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

Definition at line 738 of file journey.cpp.

◆ modeIconName()

QString JourneySection::modeIconName ( KPublicTransport::JourneySection::Mode mode)
staticnodiscard

Icon representing the journey section mode mode.

Can be a qrc: or file: URL or an XDG icon name.

Definition at line 493 of file journey.cpp.

◆ setArrival()

void JourneySection::setArrival ( const Stopover & arrival)

Sets all arrival properties from a given Stopover.

This effects location and time, but doesn't modify intermediate stops or paths.

Definition at line 311 of file journey.cpp.

◆ setDeparture()

void JourneySection::setDeparture ( const Stopover & departure)

Sets all departure properties from a given Stopover.

This effects location and time, but doesn't modify intermediate stops or paths.

Definition at line 282 of file journey.cpp.

◆ setFeatures()

void JourneySection::setFeatures ( std::vector< KPublicTransport::Feature > && features)

Definition at line 467 of file journey.cpp.

◆ setIdentifier()

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

Definition at line 554 of file journey.cpp.

◆ setIntermediateStops()

void JourneySection::setIntermediateStops ( std::vector< Stopover > && stops)

Set the intermediate stops.

Definition at line 252 of file journey.cpp.

◆ setLoadInformation()

void JourneySection::setLoadInformation ( std::vector< LoadInfo > && loadInfo)

Set the vehicle load information for this journey section.

Definition at line 436 of file journey.cpp.

◆ setStopovver()

void JourneySection::setStopovver ( qsizetype idx,
const Stopover & stop )

Set the stopover at index idx.

If idx is not a valid index nothing is done.

Definition at line 580 of file journey.cpp.

◆ stopover()

Stopover JourneySection::stopover ( qsizetype idx) const
nodiscard

Retrieve stopover at index idx.

Definition at line 565 of file journey.cpp.

◆ subsection()

JourneySection JourneySection::subsection ( qsizetype begin,
qsizetype end ) const
nodiscard

Returns the sub-journey starting from index begin until end (inclusive).

Both begin and end have to be valid indices and end has to be strictly larger than begin, otherwise an invalid journey section is returned.

Definition at line 610 of file journey.cpp.

◆ takeFeatures()

std::vector< KPublicTransport::Feature > && JourneySection::takeFeatures ( )
nodiscard

Definition at line 462 of file journey.cpp.

◆ takeIntermediateStops()

std::vector< Stopover > && JourneySection::takeIntermediateStops ( )

Moves the intermediate stops out of this object.

Definition at line 246 of file journey.cpp.

◆ takeLoadInformation()

std::vector< LoadInfo > && JourneySection::takeLoadInformation ( )

Moves the load information out of this object for modification.

Definition at line 430 of file journey.cpp.

◆ toJson() [1/2]

QJsonObject JourneySection::toJson ( const JourneySection & section)
staticnodiscard

Serializes one journey section to JSON.

Definition at line 792 of file journey.cpp.

◆ toJson() [2/2]

QJsonArray JourneySection::toJson ( const std::vector< JourneySection > & sections)
staticnodiscard

Serializes a vector of journey sections to JSON.

Definition at line 857 of file journey.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 Feb 21 2025 11:47:41 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.