diff --git a/routing/index_road_graph.cpp b/routing/index_road_graph.cpp index ab5d45b81d..557810a66f 100644 --- a/routing/index_road_graph.cpp +++ b/routing/index_road_graph.cpp @@ -12,8 +12,8 @@ IndexRoadGraph::IndexRoadGraph(MwmSet::MwmId const & mwmId, Index const & index, for (size_t i = 0; i < junctions.size(); ++i) { Junction const & junction = junctions[i]; - m_endToSegment[junction] = segments[i]; - m_beginToSegment[junction] = segments[i + 1]; + m_endToSegment[junction].push_back(segments[i]); + m_beginToSegment[junction].push_back(segments[i + 1]); } } @@ -64,7 +64,13 @@ void IndexRoadGraph::GetEdges(Junction const & junction, bool isOutgoing, TEdgeV edges.clear(); vector segmentEdges; - m_starter.GetEdgesList(GetSegment(junction, isOutgoing), isOutgoing, segmentEdges); + vector tmpEdges; + for (Segment const & segment : GetSegments(junction, isOutgoing)) + { + tmpEdges.clear(); + m_starter.GetEdgesList(segment, isOutgoing, tmpEdges); + segmentEdges.insert(segmentEdges.end(), tmpEdges.begin(), tmpEdges.end()); + } for (SegmentEdge const & segmentEdge : segmentEdges) { @@ -84,7 +90,8 @@ Junction IndexRoadGraph::GetJunction(Segment const & segment, bool front) const return Junction(m_starter.GetPoint(segment, front), feature::kDefaultAltitudeMeters); } -const Segment & IndexRoadGraph::GetSegment(Junction const & junction, bool isOutgoing) const +vector const & IndexRoadGraph::GetSegments(Junction const & junction, + bool isOutgoing) const { auto const & junctionToSegment = isOutgoing ? m_endToSegment : m_beginToSegment; diff --git a/routing/index_road_graph.hpp b/routing/index_road_graph.hpp index 2d731c6c99..c6f4ba7ca6 100644 --- a/routing/index_road_graph.hpp +++ b/routing/index_road_graph.hpp @@ -29,13 +29,13 @@ public: private: void GetEdges(Junction const & junction, bool isOutgoing, TEdgeVector & edges) const; Junction GetJunction(Segment const & segment, bool front) const; - const Segment & GetSegment(Junction const & junction, bool isOutgoing) const; + vector const & GetSegments(Junction const & junction, bool isOutgoing) const; MwmSet::MwmId const & m_mwmId; Index const & m_index; double const m_maxSpeedKMPH; IndexGraphStarter & m_starter; - map m_beginToSegment; - map m_endToSegment; + map> m_beginToSegment; + map> m_endToSegment; }; } // namespace routing diff --git a/routing/segment.hpp b/routing/segment.hpp index f3a9006f33..e723998bdd 100644 --- a/routing/segment.hpp +++ b/routing/segment.hpp @@ -73,8 +73,8 @@ public: private: // Target is vertex going to for outgoing edges, vertex going from for ingoing edges. - Segment const m_target; - double const m_weight; + Segment m_target; + double m_weight; }; inline string DebugPrint(Segment const & segment)