KPublicTransport
vehicle.cpp
53KPUBLICTRANSPORT_MAKE_PROPERTY(VehicleSection, float, platformPositionBegin, setPlatformPositionBegin)
54KPUBLICTRANSPORT_MAKE_PROPERTY(VehicleSection, float, platformPositionEnd, setPlatformPositionEnd)
58KPUBLICTRANSPORT_MAKE_PROPERTY(VehicleSection, VehicleSection::Sides, connectedSides, setConnectedSides)
59KPUBLICTRANSPORT_MAKE_PROPERTY(VehicleSection, QString, platformSectionName, setPlatformSectionName)
60KPUBLICTRANSPORT_MAKE_PROPERTY(VehicleSection, KPublicTransport::Disruption::Effect, disruptionEffect, setDisruptionEffect)
113 if (lhs.name() != rhs.name()) { // safety check, as we don't properly check for equalness before merging yet
118 res.setPlatformPositionBegin(lhs.platformPositionBegin() < 0.0 ? rhs.platformPositionBegin() : lhs.platformPositionBegin());
119 res.setPlatformPositionEnd(lhs.platformPositionEnd() < 0.0 ? rhs.platformPositionEnd() : lhs.platformPositionEnd());
121 if (res.type() == VehicleSection::PassengerCar && lhs.type() != VehicleSection::UnknownType && rhs.type() != VehicleSection::UnknownType) {
127 res.setPlatformSectionName(MergeUtil::mergeString(lhs.platformSectionName(), rhs.platformSectionName()));
208 std::transform(d->sections.begin(), d->sections.end(), std::back_inserter(l), [](const auto &sec) { return QVariant::fromValue(sec); });
243 res.setDirection(lhs.direction() == Vehicle::UnknownDirection ? rhs.direction() : lhs.direction());
256 res.setSections(lhs.sections().size() < rhs.sections().size() ? rhs.sections() : lhs.sections());
An amenity, facility or other relevant property of a vehicle (train, bus, etc), vehicle part (e....
Definition feature.h:20
static Feature fromJson(const QJsonObject &obj)
Deserialize an object from JSON.
Definition feature.cpp:143
static QJsonObject toJson(const Feature &feature)
Serializes one object to JSON.
Definition feature.cpp:129
QString name
Human readable identifier of this section, typically the coach number.
Definition vehicle.h:31
std::vector< KPublicTransport::Feature > sectionFeatures
Features of this section, for consumption by QML.
Definition vehicle.h:73
QString platformSectionName
Name of the platform section(s) this coach is position in.
Definition vehicle.h:115
KPublicTransport::Disruption::Effect disruptionEffect
Distruption affecting this coach.
Definition vehicle.h:107
float platformPositionBegin
Relative position [0-1] of the begin of this vehicle section on the platform.
Definition vehicle.h:36
Sides connectedSides
Sides on which this vehicle section is connected to neighboring sections in a way that passengers can...
Definition vehicle.h:102
float platformPositionEnd
Relative position [0-1] of the end of this vehicle section on the platform.
Definition vehicle.h:40
static QJsonObject toJson(const Vehicle &vehicle)
Serializes one vehicle object to JSON.
Definition vehicle.cpp:264
void setSections(std::vector< VehicleSection > &§ions)
Sets the vehicle sections.
Definition vehicle.cpp:192
float platformPositionBegin
Relative position [0-1] of the begin of this vehicle on the platform.
Definition vehicle.h:180
bool hasPlatformPositions() const
Checks whether all vehicle sections have platform positions set.
Definition vehicle.cpp:294
static Vehicle fromJson(const QJsonObject &obj)
Deserialize an object from JSON.
Definition vehicle.cpp:281
float platformPositionEnd
Relative position [0-1] of the end of this vehicle on the platform.
Definition vehicle.h:184
bool hasPlatformSectionNames() const
Check whether all vehicle sections have platform section names set.
Definition vehicle.cpp:299
std::vector< KPublicTransport::Feature > combinedFeatures
Features of the entire vehicle including a union of all features of the individual sections.
Definition vehicle.h:190
std::vector< KPublicTransport::Feature > features
Features of this vehicle as a whole, not including the features of individual sections.
Definition vehicle.h:187
std::vector< VehicleSection > && takeSections()
Moves the vehicle sections out of this object.
Definition vehicle.cpp:186
Q_INVOKABLE float platformPositionForSection(const QString §ionName) const
Returns the center position of the vehicle section named sectionName in relative platform coordinates...
Definition vehicle.cpp:230
static Vehicle merge(const Vehicle &lhs, const Vehicle &rhs)
Merge two Vehicle instances.
Definition vehicle.cpp:240
QString name
Human readable identifier of this vehicle, typically a train number.
Definition vehicle.h:162
Effect
Disruption effects, numerical sorted so that higher values imply more severe disruptions.
Definition disruption.h:25
Query operations and data types for accessing realtime public transport information from online servi...
Definition attribution.cpp:16
iterator insert(QLatin1StringView key, const QJsonValue &value)
QJsonValue value(QLatin1StringView key) const const
QJsonArray toArray() const const
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:57:19 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:57:19 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.