KPublicTransport::Vehicle

Search for usage in LXR

#include <vehicle.h>

Properties

Direction direction
 
QString name
 
float platformPositionBegin
 
float platformPositionEnd
 
QVariantList sections
 

Public Member Functions

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 setSections (std::vector< VehicleSection > &&sections)
 
void setSections (const std::vector< VehicleSection > &sections)
 
std::vector< VehicleSection > && takeSections ()
 

Static Public Member Functions

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

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 140 of file vehicle.h.

Property Documentation

Direction KPublicTransport::Vehicle::direction
readwrite

Direction of travel of this vehicle.

Definition at line 154 of file vehicle.h.

QString KPublicTransport::Vehicle::name
readwrite

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

Definition at line 144 of file vehicle.h.

float 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 162 of file vehicle.h.

float 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 166 of file vehicle.h.

const std::vector< VehicleSection > & Vehicle::sections
read

Journey sections for consumption by QML.

Definition at line 157 of file vehicle.h.

Member Function Documentation

Vehicle Vehicle::fromJson ( const QJsonObject obj)
static

Deserialize an object from JSON.

Definition at line 218 of file vehicle.cpp.

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

Deserialize multiple objects from JSON.

Definition at line 225 of file vehicle.cpp.

bool Vehicle::hasPlatformPositions ( ) const

Checks whether all vehicle sections have platform positions set.

Definition at line 230 of file vehicle.cpp.

bool Vehicle::hasPlatformSectionNames ( ) const

Check whether all vehicle sections have platform section names set.

Definition at line 235 of file vehicle.cpp.

bool Vehicle::isEmpty ( ) const

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

Definition at line 118 of file vehicle.cpp.

Vehicle Vehicle::merge ( const Vehicle lhs,
const Vehicle rhs 
)
static

Merge two Vehicle instances.

Definition at line 182 of file vehicle.cpp.

float Vehicle::platformPositionForSection ( const QString sectionName) const

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 172 of file vehicle.cpp.

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

The vehicle sections.

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

Sets the vehicle sections.

Definition at line 134 of file vehicle.cpp.

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

Moves the vehicle sections out of this object.

Definition at line 128 of file vehicle.cpp.

QJsonObject Vehicle::toJson ( const Vehicle vehicle)
static

Serializes one vehicle object to JSON.

Definition at line 204 of file vehicle.cpp.

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

Serializes multiple vehicle objects to JSON.

Definition at line 213 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-2021 The KDE developers.
Generated on Sun Oct 24 2021 23:05:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.