diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2021-01-29 13:48:11 +0300 |
---|---|---|
committer | Olga Khlopkova <mesozoic.drones@gmail.com> | 2021-01-29 14:42:57 +0300 |
commit | 83dded092c7b5f5282ad925b9b2370e65be27d2b (patch) | |
tree | 00cfabae287746dc55f9fe421d01d285b6ad4130 | |
parent | 3a87d80002341f279cf34d120a7aa2f837108a82 (diff) |
[transit] Improve get stop times for trip speed.
-rw-r--r-- | transit/world_feed/world_feed.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/transit/world_feed/world_feed.cpp b/transit/world_feed/world_feed.cpp index b46f1925a6..65f86e12d0 100644 --- a/transit/world_feed/world_feed.cpp +++ b/transit/world_feed/world_feed.cpp @@ -671,10 +671,21 @@ bool WorldFeed::FillLinesAndShapes() std::sort(shape.second.begin(), shape.second.end(), base::LessBy(>fs::ShapePoint::shape_pt_sequence)); } + auto const getShape = [&shapes](gtfs::Id const & gtfsShapeId) -> gtfs::Shape const & { return shapes[gtfsShapeId]; }; + std::unordered_map<gtfs::Id, gtfs::StopTimes> stopTimes; + for (const auto & stop_time : m_feed.get_stop_times()) + stopTimes[stop_time.trip_id].emplace_back(stop_time); + + for (auto & stop_time : stopTimes) + { + std::sort(stop_time.second.begin(), stop_time.second.end(), + base::LessBy(>fs::StopTime::stop_sequence)); + } + for (const auto & trip : m_feed.get_trips()) { // We skip routes filtered on the route preparation stage. @@ -690,7 +701,7 @@ bool WorldFeed::FillLinesAndShapes() std::string stopIds; - for (auto const & stopTime : m_feed.get_stop_times_for_trip(trip.trip_id)) + for (auto const & stopTime : stopTimes[trip.trip_id]) stopIds += stopTime.stop_id + kDelimiter; std::string const & lineHash = BuildHash(routeHash, trip.shape_id, stopIds); |