Commit 554bdac7 authored by Volker Krause's avatar Volker Krause
Browse files

Add journey section path support for OTP as well

parent 24371f64
......@@ -6,6 +6,7 @@
#include "opentripplannerparser.h"
#include "gtfs/hvt.h"
#include "geo/polylinedecoder_p.h"
#include <KPublicTransport/Journey>
#include <KPublicTransport/RentalVehicle>
......@@ -440,6 +441,20 @@ JourneySection OpenTripPlannerParser::parseJourneySection(const QJsonObject &obj
}
section.setIntermediateStops(std::move(stops));
const auto geometryObj = obj.value(QLatin1String("legGeometry")).toObject();
if (!geometryObj.empty()) {
QPolygonF poly;
poly.reserve(geometryObj.value(QLatin1String("length")).toInt());
const auto points = geometryObj.value(QLatin1String("points")).toString().toUtf8();
PolylineDecoder<2> decoder(points.constData());
decoder.readPolygon(poly);
PathSection pathSec;
pathSec.setPath(std::move(poly));
Path path;
path.setSections({std::move(pathSec)});
section.setPath(std::move(path));
}
return section;
}
......
......@@ -101,6 +101,10 @@ query journeys(
scheduledArrivalTime: arrivalTime
scheduledDepartureTime: departureTime
}
legGeometry {
length
points
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment