@@ -714,16 +714,16 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
714714 {
715715 ++node_based_edge_counter;
716716
717- const auto intersection_view =
718- convertToIntersectionView (m_node_based_graph,
719- m_edge_based_node_container ,
720- unconditional_node_restriction_map ,
721- m_barrier_nodes ,
722- edge_geometries ,
723- turn_lanes_data,
724- incoming_edge,
725- outgoing_edges ,
726- merged_edge_ids);
717+ const auto connected_roads =
718+ extractor::intersection::getConnectedRoadsForEdgeGeometries (
719+ m_node_based_graph ,
720+ m_edge_based_node_container ,
721+ unconditional_node_restriction_map ,
722+ m_barrier_nodes ,
723+ turn_lanes_data,
724+ incoming_edge,
725+ edge_geometries ,
726+ merged_edge_ids);
727727
728728 // check if this edge is part of a restriction via-way
729729 const auto is_restriction_via_edge =
@@ -746,12 +746,12 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
746746 continue ;
747747
748748 const auto turn =
749- std::find_if (intersection_view .begin (),
750- intersection_view .end (),
749+ std::find_if (connected_roads .begin (),
750+ connected_roads .end (),
751751 [edge = outgoing_edge.edge ](const auto &road) {
752752 return road.eid == edge;
753753 });
754- OSRM_ASSERT (turn != intersection_view .end (),
754+ OSRM_ASSERT (turn != connected_roads .end (),
755755 m_coordinates[intersection_node]);
756756
757757 std::vector<ExtractionTurnLeg> road_legs_on_the_right;
@@ -760,6 +760,37 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
760760 auto get_connected_road_info = [&](const auto &connected_edge) {
761761 const auto &edge_data =
762762 m_node_based_graph.GetEdgeData (connected_edge.eid );
763+
764+ bool is_incoming, is_outgoing;
765+ if (edge_data.reversed )
766+ {
767+ // If getConnectedRoads adds reversed edge it means
768+ // this edge is incoming-only
769+ is_incoming = true ;
770+ is_outgoing = false ;
771+ }
772+ else
773+ {
774+ // It does not add incoming edge if there is outgoing so we
775+ // should find it ourselves
776+ is_incoming = false ;
777+ auto reversed_edge = m_node_based_graph.FindEdge (
778+ m_node_based_graph.GetTarget (connected_edge.eid ),
779+ intersection_node);
780+ if (reversed_edge != SPECIAL_EDGEID)
781+ {
782+ const auto &reversed_edge_data =
783+ m_node_based_graph.GetEdgeData (reversed_edge);
784+
785+ if (!reversed_edge_data.reversed )
786+ {
787+ is_incoming = true ;
788+ }
789+ }
790+
791+ is_outgoing = true ;
792+ }
793+
763794 return ExtractionTurnLeg (
764795 edge_data.flags .restricted ,
765796 edge_data.flags .road_classification .IsMotorwayClass (),
@@ -772,54 +803,52 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
772803 edge_data.duration ) *
773804 36 ,
774805 edge_data.flags .road_classification .GetPriority (),
775- !connected_edge.entry_allowed ||
776- (edge_data.flags .forward &&
777- edge_data.flags .backward ), // is incoming
778- connected_edge.entry_allowed );
806+ is_incoming,
807+ is_outgoing);
779808 };
780809
781810 // all connected roads on the right of a u turn
782811 const auto is_uturn = guidance::getTurnDirection (turn->angle ) ==
783812 guidance::DirectionModifier::UTurn;
784813 if (is_uturn)
785814 {
786- if (turn != intersection_view .begin ())
815+ if (turn != connected_roads .begin ())
787816 {
788- std::transform (intersection_view .begin () + 1 ,
817+ std::transform (connected_roads .begin () + 1 ,
789818 turn,
790819 std::back_inserter (road_legs_on_the_right),
791820 get_connected_road_info);
792821 }
793822
794823 std::transform (turn + 1 ,
795- intersection_view .end (),
824+ connected_roads .end (),
796825 std::back_inserter (road_legs_on_the_right),
797826 get_connected_road_info);
798827 }
799828 else
800829 {
801- if (intersection_view .begin () != turn)
830+ if (connected_roads .begin () != turn)
802831 {
803- std::transform (intersection_view .begin () + 1 ,
832+ std::transform (connected_roads .begin () + 1 ,
804833 turn,
805834 std::back_inserter (road_legs_on_the_right),
806835 get_connected_road_info);
807836 }
808837 std::transform (turn + 1 ,
809- intersection_view .end (),
838+ connected_roads .end (),
810839 std::back_inserter (road_legs_on_the_left),
811840 get_connected_road_info);
812841 }
813842
814- if (is_uturn && turn != intersection_view .begin ())
843+ if (is_uturn && turn != connected_roads .begin ())
815844 {
816845 util::Log (logWARNING)
817846 << " Turn is a u turn but not turning to the first connected "
818847 " edge of the intersection. Node ID: "
819848 << intersection_node << " , OSM link: "
820849 << toOSMLink (m_coordinates[intersection_node]);
821850 }
822- else if (turn == intersection_view .begin () && !is_uturn)
851+ else if (turn == connected_roads .begin () && !is_uturn)
823852 {
824853 util::Log (logWARNING)
825854 << " Turn is a u turn but not classified as a u turn. Node ID: "
0 commit comments