Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KPublicTransport
Commits
554bdac7
Commit
554bdac7
authored
Feb 12, 2021
by
Volker Krause
Browse files
Add journey section path support for OTP as well
parent
24371f64
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/backends/opentripplannerparser.cpp
View file @
554bdac7
...
...
@@ -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
;
}
...
...
src/lib/backends/otp/journey.graphql
View file @
554bdac7
...
...
@@ -101,6 +101,10 @@ query journeys(
scheduledArrivalTime
:
arrivalTime
scheduledDepartureTime
:
departureTime
}
legGeometry
{
length
points
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment