Commit 8e492b81 authored by Volker Krause's avatar Volker Krause
Browse files

Adapt location GraphQL queries for OTP2

Also properly mark carpool pickup/dropoff locations, so those can be
filtered out if only public transport stops are desired.
parent 84bbb431
......@@ -95,6 +95,13 @@ bool OpenTripPlannerParser::parseLocationFragment(const QJsonObject &obj, Locati
return loc.rentalVehicleStation().network().isValid() || loc.rentalVehicle().network().isValid();
}
const auto mode = obj.value(QLatin1String("vehicleMode")).toString();
if (mode == QLatin1String("CARPOOL")) {
loc.setType(Location::CarpoolPickupDropoff);
} else if (!mode.isEmpty() && loc.type() == Location::Place) {
loc.setType(Location::Stop);
}
return true;
}
......
......@@ -19,5 +19,7 @@
<file>entur/stationByName.graphql</file>
<file>otp2/journey.graphql</file>
<file>otp2/stationByCoordinate.graphql</file>
<file>otp2/stationByName.graphql</file>
</qresource>
</RCC>
# SPDX-FileCopyrightText: 2020-2021 Volker Krause <vkrause@kde.org>
# SPDX-License-Identifier: CC0-1.0
query stopsByCoordinate(
$lat: Float!,
$lon: Float!,
$radius: Int!,
$maxResults: Int!,
$placeType: [FilterPlaceType]!
) {
stopsByRadius: nearest(
lat: $lat,
lon: $lon,
maxDistance: $radius,
maxResults: $maxResults,
filterByPlaceTypes: $placeType
) {
edges {
node {
stop: place { ...on Stop {
id: gtfsId
name
lat
lon
vehicleMode
parentStation {
id: gtfsId
name
lat
lon
}
}}
bikeRentalStation: place { ...on BikeRentalStation {
id
name
lat
lon
networks,
bikesAvailable,
spacesAvailable
}}
}
}
}
}
# SPDX-FileCopyrightText: 2020-2021 Volker Krause <vkrause@kde.org>
# SPDX-License-Identifier: CC0-1.0
query stationsByName($name: String!) {
stations: stops(name: $name) {
id: gtfsId
name
lat
lon
vehicleMode
parentStation {
id: gtfsId
name
lat
lon
}
}
}
......@@ -37,6 +37,7 @@ public:
RentedVehicleStation = 2, ///< a pick-up/drop-off point for dock-based rental bike/scooter systems
RentedVehicle = 4, ///< a free-floating rental bike/scooter
Equipment = 8, ///< elevator/escalator
CarpoolPickupDropoff = 16, ///< a pickup or dropoff location for a carpool trip
};
Q_ENUM(Type)
Q_DECLARE_FLAGS(Types, Type)
......
......@@ -103,6 +103,8 @@ Kirigami.ApplicationWindow {
default:
return '? ' + location.name;
}
case Location.CarpoolPickupDropoff:
return '🚘 ' + location.name;
case Location.Place: return location.name;
}
}
......
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