Commit 4e112b1a authored by Volker Krause's avatar Volker Krause
Browse files

Parse information about rental bike stations in Navitia responses

parent 0f0d6e9c
Pipeline #89887 passed with stage
in 1 minute and 26 seconds
......@@ -10,6 +10,7 @@
#include <KPublicTransport/Attribution>
#include <KPublicTransport/Journey>
#include <KPublicTransport/Line>
#include <KPublicTransport/RentalVehicle>
#include <KPublicTransport/Stopover>
#include <QColor>
......@@ -113,6 +114,21 @@ static Location parseLocation(const QJsonObject &obj)
}
}
const auto poi_type = obj.value(QLatin1String("poi_type")).toObject().value(QLatin1String("id")).toString();
if (poi_type == QLatin1String("poi_type:amenity:bicycle_rental")) {
RentalVehicleNetwork network;
network.setName(obj.value(QLatin1String("properties")).toObject().value(QLatin1String("network")).toString());
RentalVehicleStation station;
station.setNetwork(network);
const auto standsObj = obj.value(QLatin1String("stands")).toObject();
station.setAvailableVehicles(standsObj.value(QLatin1String("available_bikes")).toInt(-1));
station.setCapacity(standsObj.value(QLatin1String("total_stands")).toInt(-1));
loc.setType(Location::RentedVehicleStation);
loc.setData(station);
}
return loc;
}
......
Supports Markdown
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