7#include "journeyutil_p.h"
8#include "stopoverutil_p.h"
11#include <KPublicTransport/Journey>
12#include <KPublicTransport/Stopover>
21 for (
const auto §ion : jny.
sections()) {
22 if (section.mode() == JourneySection::PublicTransport) {
23 return section.scheduledDepartureTime();
30bool JourneyUtil::firstTransportDepartureLessThan(
const Journey &lhs,
const Journey &rhs)
32 return firstTransportDeparture(lhs) < firstTransportDeparture(rhs);
35bool JourneyUtil::firstTransportDepartureEqual(
const Journey &lhs,
const Journey &rhs)
37 return firstTransportDeparture(lhs) == firstTransportDeparture(rhs);
43 for (
auto &sec : sections) {
44 sec.setScheduledDepartureTime(TimeUtil::applyTimeZone(sec.scheduledDepartureTime(), tz));
45 sec.setExpectedDepartureTime(TimeUtil::applyTimeZone(sec.expectedDepartureTime(), tz));
46 sec.setScheduledArrivalTime(TimeUtil::applyTimeZone(sec.scheduledArrivalTime(), tz));
47 sec.setExpectedArrivalTime(TimeUtil::applyTimeZone(sec.expectedArrivalTime(), tz));
49 auto stops = sec.takeIntermediateStops();
50 for (
auto &
stop : stops) {
51 StopoverUtil::applyTimeZone(
stop, tz);
53 sec.setIntermediateStops(std::move(stops));
58void JourneyUtil::propagateTimeZones(
Journey &jny)
61 for (
auto &sec : sections) {
62 if (
const auto tz = sec.from().timeZone(); tz.
isValid()) {
63 sec.setScheduledDepartureTime(TimeUtil::applyTimeZone(sec.scheduledDepartureTime(), tz));
64 sec.setExpectedDepartureTime(TimeUtil::applyTimeZone(sec.expectedDepartureTime(), tz));
66 if (
const auto tz = sec.to().timeZone(); tz.
isValid()) {
67 sec.setScheduledArrivalTime(TimeUtil::applyTimeZone(sec.scheduledArrivalTime(), tz));
68 sec.setExpectedArrivalTime(TimeUtil::applyTimeZone(sec.expectedArrivalTime(), tz));
71 auto stops = sec.takeIntermediateStops();
72 for (
auto &
stop : stops) {
73 StopoverUtil::propagateTimeZone(
stop);
75 sec.setIntermediateStops(std::move(stops));
QDateTime scheduledDepartureTime
Departure time of the journey, according to schedule.
QVariantList sections
Journey sections for consumption by QML.
void setSections(std::vector< JourneySection > &§ions)
Sets the journey sections.
std::vector< JourneySection > && takeSections()
Moves the journey sections out of this object.
void stop(Ekos::AlignState mode)
Query operations and data types for accessing realtime public transport information from online servi...
bool isValid() const const