@@ -714,16 +714,16 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
714
714
{
715
715
++node_based_edge_counter;
716
716
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);
727
727
728
728
// check if this edge is part of a restriction via-way
729
729
const auto is_restriction_via_edge =
@@ -746,12 +746,12 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
746
746
continue ;
747
747
748
748
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 (),
751
751
[edge = outgoing_edge.edge ](const auto &road) {
752
752
return road.eid == edge;
753
753
});
754
- OSRM_ASSERT (turn != intersection_view .end (),
754
+ OSRM_ASSERT (turn != connected_roads .end (),
755
755
m_coordinates[intersection_node]);
756
756
757
757
std::vector<ExtractionTurnLeg> road_legs_on_the_right;
@@ -760,6 +760,37 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
760
760
auto get_connected_road_info = [&](const auto &connected_edge) {
761
761
const auto &edge_data =
762
762
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
+
763
794
return ExtractionTurnLeg (
764
795
edge_data.flags .restricted ,
765
796
edge_data.flags .road_classification .IsMotorwayClass (),
@@ -772,54 +803,52 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
772
803
edge_data.duration ) *
773
804
36 ,
774
805
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);
779
808
};
780
809
781
810
// all connected roads on the right of a u turn
782
811
const auto is_uturn = guidance::getTurnDirection (turn->angle ) ==
783
812
guidance::DirectionModifier::UTurn;
784
813
if (is_uturn)
785
814
{
786
- if (turn != intersection_view .begin ())
815
+ if (turn != connected_roads .begin ())
787
816
{
788
- std::transform (intersection_view .begin () + 1 ,
817
+ std::transform (connected_roads .begin () + 1 ,
789
818
turn,
790
819
std::back_inserter (road_legs_on_the_right),
791
820
get_connected_road_info);
792
821
}
793
822
794
823
std::transform (turn + 1 ,
795
- intersection_view .end (),
824
+ connected_roads .end (),
796
825
std::back_inserter (road_legs_on_the_right),
797
826
get_connected_road_info);
798
827
}
799
828
else
800
829
{
801
- if (intersection_view .begin () != turn)
830
+ if (connected_roads .begin () != turn)
802
831
{
803
- std::transform (intersection_view .begin () + 1 ,
832
+ std::transform (connected_roads .begin () + 1 ,
804
833
turn,
805
834
std::back_inserter (road_legs_on_the_right),
806
835
get_connected_road_info);
807
836
}
808
837
std::transform (turn + 1 ,
809
- intersection_view .end (),
838
+ connected_roads .end (),
810
839
std::back_inserter (road_legs_on_the_left),
811
840
get_connected_road_info);
812
841
}
813
842
814
- if (is_uturn && turn != intersection_view .begin ())
843
+ if (is_uturn && turn != connected_roads .begin ())
815
844
{
816
845
util::Log (logWARNING)
817
846
<< " Turn is a u turn but not turning to the first connected "
818
847
" edge of the intersection. Node ID: "
819
848
<< intersection_node << " , OSM link: "
820
849
<< toOSMLink (m_coordinates[intersection_node]);
821
850
}
822
- else if (turn == intersection_view .begin () && !is_uturn)
851
+ else if (turn == connected_roads .begin () && !is_uturn)
823
852
{
824
853
util::Log (logWARNING)
825
854
<< " Turn is a u turn but not classified as a u turn. Node ID: "
0 commit comments