KPublicTransport::Vehicle

Search for usage in LXR

#include <vehicle.h>

Properties

std::vector< KPublicTransport::FeaturecombinedFeatures
 
Direction direction
 
std::vector< KPublicTransport::Featurefeatures
 
QString name
 
float platformPositionBegin
 
float platformPositionEnd
 
QVariantList sections
 

Public Member Functions

std::vector< KPublicTransport::FeaturecombinedFeatures () const
 
const std::vector< KPublicTransport::Feature > & features () const
 
bool hasPlatformPositions () const
 
bool hasPlatformSectionNames () const
 
bool isEmpty () const
 
float platformPositionBegin () const
 
float platformPositionEnd () const
 
Q_INVOKABLE float platformPositionForSection (const QString &sectionName) const
 
const std::vector< VehicleSection > & sections () const
 
void setFeatures (std::vector< KPublicTransport::Feature > &&features)
 
void setSections (const std::vector< VehicleSection > &sections)
 
void setSections (std::vector< VehicleSection > &&sections)
 
std::vector< KPublicTransport::Feature > && takeFeatures ()
 
std::vector< VehicleSection > && takeSections ()
 

Static Public Member Functions

static std::vector< VehiclefromJson (const QJsonArray &array)
 
static Vehicle fromJson (const QJsonObject &obj)
 
static Vehicle merge (const Vehicle &lhs, const Vehicle &rhs)
 
static QJsonArray toJson (const std::vector< Vehicle > &vehicles)
 
static QJsonObject toJson (const Vehicle &vehicle)
 

Detailed Description

Information about the vehicle used on a journey.

This is typically only available for trains, and describes their coach layout.

A vehicle object always is tied to a specific Platform object, to which all positions refer to.

See also
Platform

Definition at line 185 of file vehicle.h.

Property Documentation

◆ combinedFeatures

std::vector<KPublicTransport::Feature> KPublicTransport::Vehicle::combinedFeatures
read

Features of the entire vehicle including a union of all features of the individual sections.

Definition at line 217 of file vehicle.h.

◆ direction

Direction KPublicTransport::Vehicle::direction
readwrite

Direction of travel of this vehicle.

Definition at line 199 of file vehicle.h.

◆ features

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

Features of this vehicle as a whole, not including the features of individual sections.

Definition at line 214 of file vehicle.h.

◆ name

QString KPublicTransport::Vehicle::name
readwrite

Human readable identifier of this vehicle, typically a train number.

Definition at line 189 of file vehicle.h.

◆ platformPositionBegin

float KPublicTransport::Vehicle::platformPositionBegin
read

Relative position [0-1] of the begin of this vehicle on the platform.

0 representing the begin of the platform in platform coordinate (

See also
Platform), 1 being the opposite end.

Definition at line 207 of file vehicle.h.

◆ platformPositionEnd

float KPublicTransport::Vehicle::platformPositionEnd
read

Relative position [0-1] of the end of this vehicle on the platform.

0 representing the begin of the platform in platform coordinate (

See also
Platform), 1 being the opposite end.

Definition at line 211 of file vehicle.h.

◆ sections

QVariantList KPublicTransport::Vehicle::sections
read

Journey sections for consumption by QML.

Definition at line 202 of file vehicle.h.

Member Function Documentation

◆ combinedFeatures()

std::vector< KPublicTransport::Feature > Vehicle::combinedFeatures ( ) const
nodiscard

Combined vehicle features.

Definition at line 396 of file vehicle.cpp.

◆ features()

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

Vehicle features.

Definition at line 380 of file vehicle.cpp.

◆ fromJson() [1/2]

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

Deserialize multiple objects from JSON.

Definition at line 365 of file vehicle.cpp.

◆ fromJson() [2/2]

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

Deserialize an object from JSON.

Definition at line 357 of file vehicle.cpp.

◆ hasPlatformPositions()

bool Vehicle::hasPlatformPositions ( ) const
nodiscard

Checks whether all vehicle sections have platform positions set.

Definition at line 370 of file vehicle.cpp.

◆ hasPlatformSectionNames()

bool Vehicle::hasPlatformSectionNames ( ) const
nodiscard

Check whether all vehicle sections have platform section names set.

Definition at line 375 of file vehicle.cpp.

◆ isEmpty()

bool Vehicle::isEmpty ( ) const
nodiscard

Returns true if this object contains no information beyond the default values.

Definition at line 252 of file vehicle.cpp.

◆ merge()

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

Merge two Vehicle instances.

Definition at line 316 of file vehicle.cpp.

◆ platformPositionBegin()

float Vehicle::platformPositionBegin ( ) const
nodiscard

Definition at line 288 of file vehicle.cpp.

◆ platformPositionEnd()

float Vehicle::platformPositionEnd ( ) const
nodiscard

Definition at line 297 of file vehicle.cpp.

◆ platformPositionForSection()

float Vehicle::platformPositionForSection ( const QString & sectionName) const
nodiscard

Returns the center position of the vehicle section named sectionName in relative platform coordinates.

Useful for centering a view on a selected section for example.

Definition at line 306 of file vehicle.cpp.

◆ sections()

const std::vector< VehicleSection > & Vehicle::sections ( ) const
nodiscard

The vehicle sections.

Definition at line 257 of file vehicle.cpp.

◆ setFeatures()

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

Definition at line 390 of file vehicle.cpp.

◆ setSections() [1/2]

void Vehicle::setSections ( const std::vector< VehicleSection > & sections)

Definition at line 274 of file vehicle.cpp.

◆ setSections() [2/2]

void Vehicle::setSections ( std::vector< VehicleSection > && sections)

Sets the vehicle sections.

Definition at line 268 of file vehicle.cpp.

◆ takeFeatures()

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

Definition at line 385 of file vehicle.cpp.

◆ takeSections()

std::vector< VehicleSection > && Vehicle::takeSections ( )
nodiscard

Moves the vehicle sections out of this object.

Definition at line 262 of file vehicle.cpp.

◆ toJson() [1/2]

QJsonArray Vehicle::toJson ( const std::vector< Vehicle > & vehicles)
staticnodiscard

Serializes multiple vehicle objects to JSON.

Definition at line 352 of file vehicle.cpp.

◆ toJson() [2/2]

QJsonObject Vehicle::toJson ( const Vehicle & vehicle)
staticnodiscard

Serializes one vehicle object to JSON.

Definition at line 340 of file vehicle.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 19 2024 11:50:59 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.