KPublicTransport

journey.h
1/*
2 SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KPUBLICTRANSPORT_JOURNEY_H
8#define KPUBLICTRANSPORT_JOURNEY_H
9
10#include "datatypes.h"
11#include "disruption.h"
12#include "individualtransport.h"
13#include "line.h"
14#include "load.h"
15#include "location.h"
16#include "path.h"
17#include "platform.h"
18#include "vehicle.h"
19
20#include <QDateTime>
21
22#include <vector>
23
24namespace KPublicTransport {
25
26class JourneySectionPrivate;
27class RentalVehicle;
28class Stopover;
29
30/** A segment of a journey plan.
31 *
32 * Also used for trips, ie. a single full vehicle run along a route.
33 *
34 * This consists of a departure and an arrival stopover as well as zero or more intermediate stopovers.
35 * For extracting sub-journeys those can be addresses by a numeric index. Index 0 refers to the departure,
36 * 1 to N refer to the n-th intermediate stopover and N + 1 refers to the arrival, for N intermediate stops.
37 */
38class KPUBLICTRANSPORT_EXPORT JourneySection
39{
40 KPUBLICTRANSPORT_GADGET(JourneySection)
41
42public:
43 /** Mode of transport.
44 * These categories are fairly coarse, for a more detailed break-down of PublicTransport see Line::Mode.
45 */
46 enum Mode {
47 Invalid = 0,
48 PublicTransport = 1,
49 Transfer = 2,
50 Walking = 4,
51 Waiting = 8,
52 RentedVehicle = 16, ///< 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
53 IndividualTransport = 32, ///< using your own vehicle (bike, car, etc).
54 };
55 Q_ENUM(Mode)
56 Q_DECLARE_FLAGS(Modes, Mode)
57 Q_FLAG(Modes)
58
59 /** Mode of transport for this section. */
60 KPUBLICTRANSPORT_PROPERTY(Mode, mode, setMode)
61
62 /** Planned departure time. */
63 KPUBLICTRANSPORT_PROPERTY(QDateTime, scheduledDepartureTime, setScheduledDepartureTime)
64 /** Actual departure time, if available.
65 * Set to invalid to indicate real-time data is not available.
66 */
67 KPUBLICTRANSPORT_PROPERTY(QDateTime, expectedDepartureTime, setExpectedDepartureTime)
68 /** @c true if this has real-time data. */
69 Q_PROPERTY(bool hasExpectedDepartureTime READ hasExpectedDepartureTime STORED false)
70 /** Difference to schedule in minutes. */
71 Q_PROPERTY(int departureDelay READ departureDelay STORED false)
72
73 /** Planned arrival time. */
74 KPUBLICTRANSPORT_PROPERTY(QDateTime, scheduledArrivalTime, setScheduledArrivalTime)
75 /** Actual arrival time, if available.
76 * Set to invalid to indicate real-time data is not available.
77 */
78 KPUBLICTRANSPORT_PROPERTY(QDateTime, expectedArrivalTime, setExpectedArrivalTime)
79 /** @c true if this has real-time data. */
80 Q_PROPERTY(bool hasExpectedArrivalTime READ hasExpectedArrivalTime STORED false)
81 /** Difference to schedule in minutes. */
82 Q_PROPERTY(int arrivalDelay READ arrivalDelay STORED false)
83
84 /** Duration of the section in seconds. */
85 Q_PROPERTY(int duration READ duration STORED false)
86 /** Distance of the section in meter. */
87 KPUBLICTRANSPORT_PROPERTY(int, distance, setDistance)
88
89 /** Departure location of this segment. */
90 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Location, from, setFrom)
91 /** Arrival location of this segment. */
92 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Location, to, setTo)
93 /** Route to take on this segment. */
94 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Route, route, setRoute)
95
96 /** Planned departure platform. */
97 KPUBLICTRANSPORT_PROPERTY(QString, scheduledDeparturePlatform, setScheduledDeparturePlatform)
98 /** Actual departure platform, in case real-time information are available. */
99 KPUBLICTRANSPORT_PROPERTY(QString, expectedDeparturePlatform, setExpectedDeparturePlatform)
100 /** @c true if real-time platform information are available. */
102 /** @c true if we have real-time platform information and the platform changed. */
103 Q_PROPERTY(bool departurePlatformChanged READ departurePlatformChanged STORED false)
104
105 /** Planned arrival platform. */
106 KPUBLICTRANSPORT_PROPERTY(QString, scheduledArrivalPlatform, setScheduledArrivalPlatform)
107 /** Actual arrival platform, in case real-time information are available. */
108 KPUBLICTRANSPORT_PROPERTY(QString, expectedArrivalPlatform, setExpectedArrivalPlatform)
109 /** @c true if real-time platform information are available. */
111 /** @c true if we have real-time platform information and the platform changed. */
112 Q_PROPERTY(bool arrivalPlatformChanged READ arrivalPlatformChanged STORED false)
113
114 /** Disruption effect on this section, if any. */
115 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Disruption::Effect, disruptionEffect, setDisruptionEffect)
116 /** General human-readable notes on this service, e.g. details about a disruption. */
117 KPUBLICTRANSPORT_PROPERTY(QStringList, notes, setNotes)
118
119 /** Intermediate stops for consumption by QML. */
120 Q_PROPERTY(QVariantList intermediateStops READ intermediateStopsVariant)
121
122 /** All departure information represented as Stopover object. */
123 Q_PROPERTY(KPublicTransport::Stopover departure READ departure STORED false)
124 /** All arrival information represented as Stopover object. */
125 Q_PROPERTY(KPublicTransport::Stopover arrival READ arrival STORED false)
126
127 /** CO₂ emission during this journey section, in gram.
128 * In case the backend doesn't provide this value, it is estimated based on the
129 * distance travelled during this section and the mode of transport, based on
130 * average emission values from https://en.wikipedia.org/wiki/Environmental_impact_of_transport
131 * This value can be 0 (e.g. in case of walk or wait sections), or -1 if no
132 * information is available.
133 */
134 KPUBLICTRANSPORT_PROPERTY(int, co2Emission, setCo2Emission)
135
136 /** Vehicle load information for this journey section.
137 * Contains LoadInfo objects for consumption by QML.
138 */
139 Q_PROPERTY(QList<KPublicTransport::LoadInfo> loadInformation READ loadInformationList WRITE setLoadInformationList STORED false)
140
141 /** Information about a rental vehicle, for sections using one. */
142 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::RentalVehicle, rentalVehicle, setRentalVehicle)
143
144 /** Movement path for this journey section.
145 * This can be navigation instructions for individual transport modes and transfers,
146 * or the path a public transport vehicle takes.
147 */
148 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Path, path, setPath)
149
150 /** Vehicle coach layout information at departure. */
151 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Vehicle, departureVehicleLayout, setDepartureVehicleLayout)
152 /** Platform layout information at departure. */
153 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Platform, departurePlatformLayout, setDeparturePlatformLayout)
154 /** Vehicle coach layout information at arrival.
155 * Note that this does not necessarily need to be the same as departureVehicleLayout, as e.g. trains
156 * can be split up or merged along the way.
157 */
158 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Vehicle, arrivalVehicleLayout, setArrivalVehicleLayout)
159 /** Platform layout information at arrival. */
160 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Platform, arrivalPlatformLayout, setArrivalPlatformLayout)
161
162 /** Individual transport details for sections using your own vehicle. */
163 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::IndividualTransport, individualTransport, setIndividualTransport)
164
165 /** Features of the vehicle used on this section.
166 * This is identical to departureVehicleLayout.features and provided for convenience
167 * for cases where no more detailed vehicle information are available.
168 */
169 Q_PROPERTY(std::vector<KPublicTransport::Feature> features READ features)
170
171 /** The best available icon to represent this journey section.
172 * Can be a qrc: or file: URL or an XDG icon name.
173 */
174 Q_PROPERTY(QString iconName READ iconName STORED false)
175
176 /** Label shortly describing this transport for display. */
177 Q_PROPERTY(QString label READ label STORED false)
178
179 /** Maximum occpancy over all classes. */
180 Q_PROPERTY(KPublicTransport::Load::Category maximumOccupancy READ maximumOccupancy STORED false)
181
182public:
183 [[nodiscard]] bool hasExpectedDepartureTime() const;
184 [[nodiscard]] int departureDelay() const;
185 [[nodiscard]] bool hasExpectedArrivalTime() const;
186 [[nodiscard]] int arrivalDelay() const;
187
188 [[nodiscard]] int duration() const;
189
190 [[nodiscard]] bool hasExpectedDeparturePlatform() const;
191 [[nodiscard]] bool departurePlatformChanged() const;
192 [[nodiscard]] bool hasExpectedArrivalPlatform() const;
193 [[nodiscard]] bool arrivalPlatformChanged() const;
194
195 /** Adds a note. This will check for duplicates and normalize the notes. */
196 void addNote(const QString &note);
197 void addNotes(const QStringList &notes);
198
199 /** Intermediate stop-overs along this journey section.
200 * This does not include the departure and arrival stops, and might be empty on backends not providing this information.
201 */
202 [[nodiscard]] const std::vector<Stopover>& intermediateStops() const;
203 /** Moves the intermediate stops out of this object. */
204 std::vector<Stopover>&& takeIntermediateStops();
205 /** Set the intermediate stops. */
206 void setIntermediateStops(std::vector<Stopover> &&stops);
207
208 /** Returns the departure stopover of this journey section.
209 * This is the same information as accessible by individual properties,
210 * so this is mainly useful if you have to interface with code expecting a Stopover object.
211 */
212 [[nodiscard]] Stopover departure() const;
213 /**
214 * Sets all departure properties from a given Stopover.
215 * This effects location and time, but doesn't modify intermediate stops or paths.
216 */
217 void setDeparture(const Stopover &departure);
218
219 /** Returns the arrival stopover of this journey section.
220 * This is the same information as accessible by individual properties,
221 * so this is mainly useful if you have to interface with code expecting a Stopover object.
222 */
223 [[nodiscard]] Stopover arrival() const;
224 /**
225 * Sets all arrival properties from a given Stopover.
226 * This effects location and time, but doesn't modify intermediate stops or paths.
227 */
228 void setArrival(const Stopover &arrival);
229
230 /** Vehicle load information for this journey section, if available. */
231 [[nodiscard]] const std::vector<LoadInfo>& loadInformation() const;
232 /** Moves the load information out of this object for modification. */
233 std::vector<LoadInfo>&& takeLoadInformation();
234 /** Set the vehicle load information for this journey section. */
235 void setLoadInformation(std::vector<LoadInfo>&& loadInfo);
236
237 /** Augment line meta data.
238 * @param download if set to @p true, trigger the download of locally missing assets.
239 */
240 void applyMetaData(bool download);
241
242 /** Checks if two instances refer to the same journey section (which does not necessarily mean they are exactly equal). */
243 [[nodiscard]] static bool isSame(const JourneySection &lhs, const JourneySection &rhs);
244
245 /** Merge two instances.
246 * This assumes isSame(lhs, rhs) and tries to preserve the most detailed information.
247 */
248 [[nodiscard]] static JourneySection merge(const JourneySection &lhs, const JourneySection &rhs);
249
250 /** Serializes one journey section to JSON. */
251 [[nodiscard]] static QJsonObject toJson(const JourneySection &section);
252 /** Serializes a vector of journey sections to JSON. */
253 [[nodiscard]] static QJsonArray toJson(const std::vector<JourneySection> &sections);
254 /** Deserialize an object from JSON. */
255 [[nodiscard]] static JourneySection fromJson(const QJsonObject &obj);
256 /** Deserialize a vector of journey sections from JSON. */
257 [[nodiscard]] static std::vector<JourneySection> fromJson(const QJsonArray &array);
258
259 /** Vehicle features.
260 * This is identical to departureVehicleLayout.features and provided for convenience
261 * for cases where no more detailed vehicle information are available.
262 */
263 [[nodiscard]] const std::vector<KPublicTransport::Feature>& features() const;
264 [[nodiscard]] std::vector<KPublicTransport::Feature>&& takeFeatures();
265 void setFeatures(std::vector<KPublicTransport::Feature> &&features);
266
267 [[nodiscard]] QString iconName() const;
268
269 /** Icon representing the journey section mode @p mode.
270 * Can be a qrc: or file: URL or an XDG icon name.
271 */
272 Q_INVOKABLE [[nodiscard]] static QString modeIconName(KPublicTransport::JourneySection::Mode mode);
273
274 [[nodiscard]] QString label() const;
275 [[nodiscard]] Load::Category maximumOccupancy() const;
276
277 /** Backend-specific journey section identifiers. */
278 [[nodiscard]] QString identifier(QAnyStringView identifierType) const;
279 [[nodiscard]] bool hasIdentifier(QAnyStringView identifierType) const;
280 void setIdentifier(const QString &identifierType, const QString &id);
281 /** Returns @c true if there is any identifier set at all.
282 * This is usually a prerequisite for efficient trip queries.
283 */
284 [[nodiscard]] bool hasIdentifiers() const;
285
286 /** Retrieve stopover at index @p idx. */
287 [[nodiscard]] Stopover stopover(qsizetype idx) const;
288 /** Set the stopover at index @p idx.
289 * If @p idx is not a valid index nothing is done.
290 */
291 void setStopovver(qsizetype idx, const Stopover &stop);
292
293 /** Returns the index of @p stop in this journey section.
294 * @returns -1 if @p stop isn't found.
295 */
296 [[nodiscard]] qsizetype indexOfStopover(const Stopover &stop) const;
297
298 /** Returns the sub-journey starting from index @p begin until
299 * @p end (inclusive).
300 *
301 * Both @p begin and @p end have to be valid indices and @p end has to
302 * be strictly larger than @p begin, otherwise an invalid journey section
303 * is returned.
304 */
305 [[nodiscard]] JourneySection subsection(qsizetype begin, qsizetype end) const;
306
307private:
308 [[nodiscard]] Q_DECL_HIDDEN QVariantList intermediateStopsVariant() const;
309 [[nodiscard]] Q_DECL_HIDDEN QList<LoadInfo> loadInformationList() const;
310 Q_DECL_HIDDEN void setLoadInformationList(const QList<LoadInfo> &loadInfo);
311};
312
313Q_DECLARE_OPERATORS_FOR_FLAGS(JourneySection::Modes)
314
315class JourneyPrivate;
316
317/** A journey plan. */
318class KPUBLICTRANSPORT_EXPORT Journey
319{
320 KPUBLICTRANSPORT_GADGET(Journey)
321 /** Journey sections for consumption by QML. */
322 Q_PROPERTY(QList<KPublicTransport::JourneySection> sections READ sectionsList WRITE setSectionsList)
323 /** Departure time of the journey, according to schedule. */
325 /** @c true if this has real-time data. */
326 Q_PROPERTY(bool hasExpectedDepartureTime READ hasExpectedDepartureTime STORED false)
327 /** Actual departure time, if available.
328 * Set to invalid to indicate real-time data is not available.
329 */
331 /** Difference to schedule in minutes. */
332 Q_PROPERTY(int departureDelay READ departureDelay STORED false)
333
334 /** Arrival time of the journey, according to schedule. */
336 /** @c true if this has real-time data. */
337 Q_PROPERTY(bool hasExpectedArrivalTime READ hasExpectedArrivalTime STORED false)
338 /** Actual arrival time, if available.
339 * Set to invalid to indicate real-time data is not available.
340 */
342 /** Difference to schedule in minutes. */
343 Q_PROPERTY(int arrivalDelay READ arrivalDelay STORED false)
344
345 /** Duration of the entire journey in seconds. */
346 Q_PROPERTY(int duration READ duration STORED false)
347 /** Number of changes on this journey. */
348 Q_PROPERTY(int numberOfChanges READ numberOfChanges STORED false)
349 /** Worst disruption effect of any of the journey sections. */
350 Q_PROPERTY(KPublicTransport::Disruption::Effect disruptionEffect READ disruptionEffect STORED false)
351
352 /** Total travelled distance of the entire journey in meter.
353 * That is, the sum of the distances of all sections.
354 */
355 Q_PROPERTY(int distance READ distance STORED false)
356 /** Total CO2 emissions for the entire journey in gram.
357 * That is, the sum of the emissions of all sections.
358 */
359 Q_PROPERTY(int co2Emission READ co2Emission STORED false)
360
361 /** Maximum occpancy in all journey sections, over all classes. */
362 Q_PROPERTY(KPublicTransport::Load::Category maximumOccupancy READ maximumOccupancy STORED false)
363
364public:
365 /** The journey sections. */
366 [[nodiscard]] const std::vector<JourneySection>& sections() const;
367 /** Moves the journey sections out of this object. */
368 [[nodiscard]] std::vector<JourneySection>&& takeSections();
369 /** Sets the journey sections. */
370 void setSections(std::vector<JourneySection> &&sections);
371
372 [[nodiscard]] QDateTime scheduledDepartureTime() const;
373 [[nodiscard]] bool hasExpectedDepartureTime() const;
374 [[nodiscard]] QDateTime expectedDepartureTime() const;
375 [[nodiscard]] int departureDelay() const;
376
377 [[nodiscard]] QDateTime scheduledArrivalTime() const;
378 [[nodiscard]] bool hasExpectedArrivalTime() const;
379 [[nodiscard]] QDateTime expectedArrivalTime() const;
380 [[nodiscard]] int arrivalDelay() const;
381
382 [[nodiscard]] int duration() const;
383 [[nodiscard]] int numberOfChanges() const;
384 [[nodiscard]] Disruption::Effect disruptionEffect() const;
385
386 [[nodiscard]] int distance() const;
387 [[nodiscard]] int co2Emission() const;
388 [[nodiscard]] Load::Category maximumOccupancy() const;
389
390 /** Augment line meta data.
391 * @param download if set to @p true, trigger the download of locally missing assets.
392 */
393 void applyMetaData(bool download);
394
395 /** Checks if two instances refer to the same journey (which does not necessarily mean they are exactly equal). */
396 [[nodiscard]] static bool isSame(const Journey &lhs, const Journey &rhs);
397
398 /** Merge two instances.
399 * This assumes isSame(lhs, rhs) and tries to preserve the most detailed information.
400 */
401 [[nodiscard]] static Journey merge(const Journey &lhs, const Journey &rhs);
402
403 /** Serializes one journey object to JSON. */
404 [[nodiscard]] static QJsonObject toJson(const Journey &journey);
405 /** Serializes a vector of journey objects to JSON. */
406 [[nodiscard]] static QJsonArray toJson(const std::vector<Journey> &journeys);
407 /** Deserialize an object from JSON. */
408 [[nodiscard]] static Journey fromJson(const QJsonObject &obj);
409 /** Deserialize a list of journey from JSON. */
410 [[nodiscard]] static std::vector<Journey> fromJson(const QJsonArray &array);
411
412private:
413 [[nodiscard]] Q_DECL_HIDDEN QList<JourneySection> sectionsList() const;
414 Q_DECL_HIDDEN void setSectionsList(const QList<JourneySection> &sections);
415};
416
417}
418
419Q_DECLARE_METATYPE(KPublicTransport::JourneySection)
420Q_DECLARE_METATYPE(KPublicTransport::Journey)
421
422#endif // KPUBLICTRANSPORT_JOURNEY_H
An amenity, facility or other relevant property of a vehicle (train, bus, etc), vehicle part (e....
Definition feature.h:20
A segment of a journey plan.
Definition journey.h:39
KPublicTransport::Path path
Movement path for this journey section.
Definition journey.h:148
void applyMetaData(bool download)
Augment line meta data.
Definition journey.cpp:673
bool arrivalPlatformChanged
true if we have real-time platform information and the platform changed.
Definition journey.h:112
QString scheduledDeparturePlatform
Planned departure platform.
Definition journey.h:97
static JourneySection merge(const JourneySection &lhs, const JourneySection &rhs)
Merge two instances.
Definition journey.cpp:738
Stopover stopover(qsizetype idx) const
Retrieve stopover at index idx.
Definition journey.cpp:565
qsizetype indexOfStopover(const Stopover &stop) const
Returns the index of stop in this journey section.
Definition journey.cpp:596
KPublicTransport::Load::Category maximumOccupancy
Maximum occpancy over all classes.
Definition journey.h:180
void setDeparture(const Stopover &departure)
Sets all departure properties from a given Stopover.
Definition journey.cpp:282
static bool isSame(const JourneySection &lhs, const JourneySection &rhs)
Checks if two instances refer to the same journey section (which does not necessarily mean they are e...
Definition journey.cpp:688
void setLoadInformation(std::vector< LoadInfo > &&loadInfo)
Set the vehicle load information for this journey section.
Definition journey.cpp:436
KPublicTransport::Location from
Departure location of this segment.
Definition journey.h:90
QDateTime expectedArrivalTime
Actual arrival time, if available.
Definition journey.h:78
QString expectedArrivalPlatform
Actual arrival platform, in case real-time information are available.
Definition journey.h:108
QString iconName
The best available icon to represent this journey section.
Definition journey.h:174
QList< KPublicTransport::LoadInfo > loadInformation
Vehicle load information for this journey section.
Definition journey.h:139
int departureDelay
Difference to schedule in minutes.
Definition journey.h:71
JourneySection subsection(qsizetype begin, qsizetype end) const
Returns the sub-journey starting from index begin until end (inclusive).
Definition journey.cpp:610
void setIntermediateStops(std::vector< Stopover > &&stops)
Set the intermediate stops.
Definition journey.cpp:252
QString label
Label shortly describing this transport for display.
Definition journey.h:177
static Q_INVOKABLE QString modeIconName(KPublicTransport::JourneySection::Mode mode)
Icon representing the journey section mode mode.
Definition journey.cpp:493
KPublicTransport::Platform arrivalPlatformLayout
Platform layout information at arrival.
Definition journey.h:160
int co2Emission
CO₂ emission during this journey section, in gram.
Definition journey.h:134
KPublicTransport::RentalVehicle rentalVehicle
Information about a rental vehicle, for sections using one.
Definition journey.h:142
bool hasIdentifiers() const
Returns true if there is any identifier set at all.
Definition journey.cpp:560
QString identifier(QAnyStringView identifierType) const
Backend-specific journey section identifiers.
Definition journey.cpp:544
QStringList notes
General human-readable notes on this service, e.g.
Definition journey.h:117
void setArrival(const Stopover &arrival)
Sets all arrival properties from a given Stopover.
Definition journey.cpp:311
static QJsonObject toJson(const JourneySection &section)
Serializes one journey section to JSON.
Definition journey.cpp:792
QDateTime scheduledDepartureTime
Planned departure time.
Definition journey.h:63
bool hasExpectedArrivalPlatform
true if real-time platform information are available.
Definition journey.h:110
@ RentedVehicle
free floating or dock-based rental bike service, electric scooters, car sharing services,...
Definition journey.h:52
@ IndividualTransport
using your own vehicle (bike, car, etc).
Definition journey.h:53
KPublicTransport::Route route
Route to take on this segment.
Definition journey.h:94
KPublicTransport::Disruption::Effect disruptionEffect
Disruption effect on this section, if any.
Definition journey.h:115
KPublicTransport::Stopover departure
All departure information represented as Stopover object.
Definition journey.h:123
KPublicTransport::Vehicle arrivalVehicleLayout
Vehicle coach layout information at arrival.
Definition journey.h:158
QVariantList intermediateStops
Intermediate stops for consumption by QML.
Definition journey.h:120
KPublicTransport::Platform departurePlatformLayout
Platform layout information at departure.
Definition journey.h:153
void setStopovver(qsizetype idx, const Stopover &stop)
Set the stopover at index idx.
Definition journey.cpp:580
int arrivalDelay
Difference to schedule in minutes.
Definition journey.h:82
KPublicTransport::Location to
Arrival location of this segment.
Definition journey.h:92
std::vector< Stopover > && takeIntermediateStops()
Moves the intermediate stops out of this object.
Definition journey.cpp:246
bool hasExpectedDeparturePlatform
true if real-time platform information are available.
Definition journey.h:101
QString scheduledArrivalPlatform
Planned arrival platform.
Definition journey.h:106
bool hasExpectedDepartureTime
true if this has real-time data.
Definition journey.h:69
bool hasExpectedArrivalTime
true if this has real-time data.
Definition journey.h:80
QString expectedDeparturePlatform
Actual departure platform, in case real-time information are available.
Definition journey.h:99
static JourneySection fromJson(const QJsonObject &obj)
Deserialize an object from JSON.
Definition journey.cpp:862
std::vector< LoadInfo > && takeLoadInformation()
Moves the load information out of this object for modification.
Definition journey.cpp:430
KPublicTransport::Vehicle departureVehicleLayout
Vehicle coach layout information at departure.
Definition journey.h:151
std::vector< KPublicTransport::Feature > features
Features of the vehicle used on this section.
Definition journey.h:169
void addNote(const QString &note)
Adds a note.
Definition journey.cpp:224
int duration
Duration of the section in seconds.
Definition journey.h:85
Mode mode
Mode of transport for this section.
Definition journey.h:60
QDateTime scheduledArrivalTime
Planned arrival time.
Definition journey.h:74
KPublicTransport::IndividualTransport individualTransport
Individual transport details for sections using your own vehicle.
Definition journey.h:163
bool departurePlatformChanged
true if we have real-time platform information and the platform changed.
Definition journey.h:103
QDateTime expectedDepartureTime
Actual departure time, if available.
Definition journey.h:67
KPublicTransport::Stopover arrival
All arrival information represented as Stopover object.
Definition journey.h:125
int distance
Distance of the section in meter.
Definition journey.h:87
A journey plan.
Definition journey.h:319
void applyMetaData(bool download)
Augment line meta data.
Definition journey.cpp:1004
KPublicTransport::Disruption::Effect disruptionEffect
Worst disruption effect of any of the journey sections.
Definition journey.h:350
static Journey fromJson(const QJsonObject &obj)
Deserialize an object from JSON.
Definition journey.cpp:1092
QDateTime expectedDepartureTime
Actual departure time, if available.
Definition journey.h:330
QDateTime scheduledDepartureTime
Departure time of the journey, according to schedule.
Definition journey.h:324
static bool isSame(const Journey &lhs, const Journey &rhs)
Checks if two instances refer to the same journey (which does not necessarily mean they are exactly e...
Definition journey.cpp:1018
QDateTime expectedArrivalTime
Actual arrival time, if available.
Definition journey.h:341
int departureDelay
Difference to schedule in minutes.
Definition journey.h:332
int numberOfChanges
Number of changes on this journey.
Definition journey.h:348
void setSections(std::vector< JourneySection > &&sections)
Sets the journey sections.
Definition journey.cpp:901
KPublicTransport::Load::Category maximumOccupancy
Maximum occpancy in all journey sections, over all classes.
Definition journey.h:362
QList< KPublicTransport::JourneySection > sections
Journey sections for consumption by QML.
Definition journey.h:322
static QJsonObject toJson(const Journey &journey)
Serializes one journey object to JSON.
Definition journey.cpp:1080
bool hasExpectedDepartureTime
true if this has real-time data.
Definition journey.h:326
int duration
Duration of the entire journey in seconds.
Definition journey.h:346
QDateTime scheduledArrivalTime
Arrival time of the journey, according to schedule.
Definition journey.h:335
int distance
Total travelled distance of the entire journey in meter.
Definition journey.h:355
int arrivalDelay
Difference to schedule in minutes.
Definition journey.h:343
int co2Emission
Total CO2 emissions for the entire journey in gram.
Definition journey.h:359
std::vector< JourneySection > && takeSections()
Moves the journey sections out of this object.
Definition journey.cpp:895
static Journey merge(const Journey &lhs, const Journey &rhs)
Merge two instances.
Definition journey.cpp:1050
bool hasExpectedArrivalTime
true if this has real-time data.
Definition journey.h:337
Vehicle load information.
Definition load.h:38
A path followed by any kind of location change.
Definition path.h:113
Information about the layout of a station platform.
Definition platform.h:45
An individual rental vehicle used on a JourneySection, ie.
A route of a public transport line.
Definition line.h:148
Information about an arrival and/or departure of a vehicle at a stop area.
Definition stopover.h:26
Information about the vehicle used on a journey.
Definition vehicle.h:159
void stop(Ekos::AlignState mode)
Disruption information for a Departure or a JourneySection.
Definition disruption.h:21
Vehicle load categories.
Definition load.h:16
Query operations and data types for accessing realtime public transport information from online servi...
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:47:40 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.