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
0f0d6e9c
Commit
0f0d6e9c
authored
Oct 19, 2021
by
Volker Krause
Browse files
Support location queries for rental bike stations with Navitia
parent
4937b22a
Changes
1
Show whitespace changes
Inline
Side-by-side
src/lib/backends/navitiabackend.cpp
View file @
0f0d6e9c
...
...
@@ -97,6 +97,7 @@ bool NavitiaBackend::queryJourney(const JourneyRequest &req, JourneyReply *reply
// TODO: disable reply parts we don't care about
query
.
addQueryItem
(
QStringLiteral
(
"disable_geojson"
),
req
.
includePaths
()
?
QStringLiteral
(
"false"
)
:
QStringLiteral
(
"true"
));
query
.
addQueryItem
(
QStringLiteral
(
"depth"
),
QStringLiteral
(
"0"
));
// ### also has no effect?
query
.
addQueryItem
(
QStringLiteral
(
"add_poi_infos[]"
),
QStringLiteral
(
"bss_stands"
));
url
.
setQuery
(
query
);
}
url
.
setScheme
(
QStringLiteral
(
"https"
));
// force https in any case
...
...
@@ -197,7 +198,7 @@ bool NavitiaBackend::queryStopover(const StopoverRequest &req, StopoverReply *re
bool
NavitiaBackend
::
queryLocation
(
const
LocationRequest
&
req
,
LocationReply
*
reply
,
QNetworkAccessManager
*
nam
)
const
{
if
((
req
.
types
()
&
Location
::
Stop
)
==
0
)
{
if
((
req
.
types
()
&
(
Location
::
Stop
|
Location
::
RentedVehicleStation
)
)
==
0
)
{
return
false
;
}
...
...
@@ -208,8 +209,15 @@ bool NavitiaBackend::queryLocation(const LocationRequest &req, LocationReply *re
QUrlQuery
query
;
query
.
addQueryItem
(
QStringLiteral
(
"disable_geojson"
),
QStringLiteral
(
"true"
));
query
.
addQueryItem
(
QStringLiteral
(
"depth"
),
QStringLiteral
(
"1"
));
// 1 so administrative region elements are included
query
.
addQueryItem
(
QStringLiteral
(
"type[]"
),
QStringLiteral
(
"stop_area"
));
query
.
addQueryItem
(
QStringLiteral
(
"count"
),
QString
::
number
(
std
::
max
(
1
,
req
.
maximumResults
())));
if
(
req
.
types
()
&
Location
::
Stop
)
{
query
.
addQueryItem
(
QStringLiteral
(
"type[]"
),
QStringLiteral
(
"stop_area"
));
}
if
(
req
.
types
()
&
Location
::
RentedVehicleStation
)
{
query
.
addQueryItem
(
QStringLiteral
(
"type[]"
),
QStringLiteral
(
"poi"
));
query
.
addQueryItem
(
QStringLiteral
(
"add_poi_infos[]"
),
QStringLiteral
(
"bss_stands"
));
query
.
addQueryItem
(
QStringLiteral
(
"filter"
),
QStringLiteral
(
"poi_type.id=poi_type:amenity:bicycle_rental"
));
}
if
(
req
.
hasCoordinate
())
{
url
.
setPath
(
...
...
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