From 89be7a17600c6e65f1cc40566d64ec066aae1c94 Mon Sep 17 00:00:00 2001 From: Patrick Brosi Date: Sun, 3 Feb 2019 14:14:31 +0100 Subject: [PATCH] handle station entrances (should only occur in erroneous feeds) --- src/pfaedle/router/Misc.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/pfaedle/router/Misc.h b/src/pfaedle/router/Misc.h index 4380128..c477b09 100644 --- a/src/pfaedle/router/Misc.h +++ b/src/pfaedle/router/Misc.h @@ -11,8 +11,8 @@ #include #include "ad/cppgtfs/gtfs/Feed.h" #include "ad/cppgtfs/gtfs/Route.h" -#include "pfaedle/trgraph/Graph.h" #include "pfaedle/gtfs/Feed.h" +#include "pfaedle/trgraph/Graph.h" #include "util/Nullable.h" using ad::cppgtfs::gtfs::Route; @@ -166,7 +166,18 @@ inline pfaedle::router::FeedStops writeMotStops(const pfaedle::gtfs::Feed* feed, for (auto t : feed->getTrips()) { if (!tid.empty() && t.getId() != tid) continue; if (mots.count(t.getRoute()->getType())) { - for (auto st : t.getStopTimes()) ret[st.getStop()] = 0; + for (auto st : t.getStopTimes()) { + // if the station has type STATION_ENTRANCE, use the parent + // station for routing. Normally, this should not occur, as + // this is not allowed in stop_times.txt + if (st.getStop()->getLocationType() == + ad::cppgtfs::gtfs::flat::Stop::STATION_ENTRANCE && + st.getStop()->getParentStation()) { + ret[st.getStop()->getParentStation()] = 0; + } else { + ret[st.getStop()] = 0; + } + } } } return ret;