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
 
QVariantList loadInformation
 
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
 
QString iconName () const
 
const std::vector< Stopover > & intermediateStops () const
 
const std::vector< LoadInfo > & loadInformation () const
 
void setArrival (const Stopover &arrival)
 
void setDeparture (const Stopover &departure)
 
void setFeatures (std::vector< KPublicTransport::Feature > &&features)
 
void setIntermediateStops (std::vector< Stopover > &&stops)
 
void setLoadInformation (std::vector< LoadInfo > &&loadInfo)
 
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 QJsonObject toJson (const JourneySection &section)
 
static QJsonArray toJson (const std::vector< JourneySection > &sections)
 

Detailed Description

A segment of a journey plan.

Definition at line 31 of file journey.h.

Member Typedef Documentation

◆ Modes

Definition at line 49 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 39 of file journey.h.

Property Documentation

◆ arrival

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

All arrival information represented as Stopover object.

Definition at line 118 of file journey.h.

◆ arrivalDelay

int KPublicTransport::JourneySection::arrivalDelay
read

Difference to schedule in minutes.

Definition at line 75 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 105 of file journey.h.

◆ arrivalPlatformLayout

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

Platform layout information at arrival.

Definition at line 153 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 151 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 127 of file journey.h.

◆ departure

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

All departure information represented as Stopover object.

Definition at line 116 of file journey.h.

◆ departureDelay

int KPublicTransport::JourneySection::departureDelay
read

Difference to schedule in minutes.

Definition at line 64 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 96 of file journey.h.

◆ departurePlatformLayout

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

Platform layout information at departure.

Definition at line 146 of file journey.h.

◆ departureVehicleLayout

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

Vehicle coach layout information at departure.

Definition at line 144 of file journey.h.

◆ disruptionEffect

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

Disruption effect on this section, if any.

Definition at line 108 of file journey.h.

◆ distance

int JourneySection::distance
readwrite

Distance of the section in meter.

Definition at line 80 of file journey.h.

◆ duration

int KPublicTransport::JourneySection::duration
read

Duration of the section in seconds.

Definition at line 78 of file journey.h.

◆ expectedArrivalPlatform

QString JourneySection::expectedArrivalPlatform
readwrite

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

Definition at line 101 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 71 of file journey.h.

◆ expectedDeparturePlatform

QString JourneySection::expectedDeparturePlatform
readwrite

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

Definition at line 92 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 60 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 162 of file journey.h.

◆ from

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

Departure location of this segment.

Definition at line 83 of file journey.h.

◆ hasExpectedArrivalPlatform

bool KPublicTransport::JourneySection::hasExpectedArrivalPlatform
read

true if real-time platform information are available.

Definition at line 103 of file journey.h.

◆ hasExpectedArrivalTime

bool KPublicTransport::JourneySection::hasExpectedArrivalTime
read

true if this has real-time data.

Definition at line 73 of file journey.h.

◆ hasExpectedDeparturePlatform

bool KPublicTransport::JourneySection::hasExpectedDeparturePlatform
read

true if real-time platform information are available.

Definition at line 94 of file journey.h.

◆ hasExpectedDepartureTime

bool KPublicTransport::JourneySection::hasExpectedDepartureTime
read

true if this has real-time data.

Definition at line 62 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 167 of file journey.h.

◆ individualTransport

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

Individual transport details for sections using your own vehicle.

Definition at line 156 of file journey.h.

◆ intermediateStops

QVariantList KPublicTransport::JourneySection::intermediateStops
read

Intermediate stops for consumption by QML.

Definition at line 113 of file journey.h.

◆ loadInformation

QVariantList KPublicTransport::JourneySection::loadInformation
read

Vehicle load information for this journey section.

Contains LoadInfo objects for consumption by QML.

Definition at line 132 of file journey.h.

◆ mode

Mode KPublicTransport::JourneySection::mode
readwrite

Mode of transport for this section.

Definition at line 53 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 110 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 141 of file journey.h.

◆ rentalVehicle

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

Information about a rental vehicle, for sections using one.

Definition at line 135 of file journey.h.

◆ route

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

Route to take on this segment.

Definition at line 87 of file journey.h.

◆ scheduledArrivalPlatform

QString JourneySection::scheduledArrivalPlatform
readwrite

Planned arrival platform.

Definition at line 99 of file journey.h.

◆ scheduledArrivalTime

QDateTime KPublicTransport::JourneySection::scheduledArrivalTime
readwrite

Planned arrival time.

Definition at line 67 of file journey.h.

◆ scheduledDeparturePlatform

QString JourneySection::scheduledDeparturePlatform
readwrite

Planned departure platform.

Definition at line 90 of file journey.h.

◆ scheduledDepartureTime

QDateTime KPublicTransport::JourneySection::scheduledDepartureTime
readwrite

Planned departure time.

Definition at line 56 of file journey.h.

◆ to

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

Arrival location of this segment.

Definition at line 85 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 211 of file journey.cpp.

◆ addNotes()

void JourneySection::addNotes ( const QStringList & notes)

Definition at line 221 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 410 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 280 of file journey.cpp.

◆ arrivalDelay()

int JourneySection::arrivalDelay ( ) const
nodiscard

Definition at line 102 of file journey.cpp.

◆ arrivalPlatformChanged()

bool JourneySection::arrivalPlatformChanged ( ) const
nodiscard

Definition at line 206 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 253 of file journey.cpp.

◆ departureDelay()

int JourneySection::departureDelay ( ) const
nodiscard

Definition at line 89 of file journey.cpp.

◆ departurePlatformChanged()

bool JourneySection::departurePlatformChanged ( ) const
nodiscard

Definition at line 174 of file journey.cpp.

◆ duration()

int JourneySection::duration ( ) const
nodiscard

Definition at line 110 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 372 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 601 of file journey.cpp.

◆ fromJson() [2/2]

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

Deserialize an object from JSON.

Definition at line 582 of file journey.cpp.

◆ hasExpectedArrivalPlatform()

bool JourneySection::hasExpectedArrivalPlatform ( ) const
nodiscard

Definition at line 201 of file journey.cpp.

◆ hasExpectedArrivalTime()

bool JourneySection::hasExpectedArrivalTime ( ) const
nodiscard

Definition at line 97 of file journey.cpp.

◆ hasExpectedDeparturePlatform()

bool JourneySection::hasExpectedDeparturePlatform ( ) const
nodiscard

Definition at line 169 of file journey.cpp.

◆ hasExpectedDepartureTime()

bool JourneySection::hasExpectedDepartureTime ( ) const
nodiscard

Definition at line 84 of file journey.cpp.

◆ iconName()

QString JourneySection::iconName ( ) const
nodiscard

Definition at line 388 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 228 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 425 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 347 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 469 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 295 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 269 of file journey.cpp.

◆ setFeatures()

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

Definition at line 382 of file journey.cpp.

◆ setIntermediateStops()

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

Set the intermediate stops.

Definition at line 239 of file journey.cpp.

◆ setLoadInformation()

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

Set the vehicle load information for this journey section.

Definition at line 358 of file journey.cpp.

◆ takeFeatures()

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

Definition at line 377 of file journey.cpp.

◆ takeIntermediateStops()

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

Moves the intermediate stops out of this object.

Definition at line 233 of file journey.cpp.

◆ takeLoadInformation()

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

Moves the load information out of this object for modification.

Definition at line 352 of file journey.cpp.

◆ toJson() [1/2]

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

Serializes one journey section to JSON.

Definition at line 518 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 577 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-2024 The KDE developers.
Generated on Fri Jul 12 2024 11:50:22 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.