MCPcopy Create free account
hub / github.com/comaps/comaps / IsJoint

Function IsJoint

libs/routing/directions_engine_helpers.cpp:59–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59bool IsJoint(IRoadGraph::EdgeListT const & ingoingEdges, IRoadGraph::EdgeListT const & outgoingEdges,
60 Edge const & ingoingRouteEdge, Edge const & outgoingRouteEdge)
61{
62 // When feature id is changed at a junction this junction should be considered as a joint.
63 //
64 // If a feature id is not changed at a junction but the junction has some ingoing or outgoing
65 // edges with different feature ids, the junction should be considered as a joint.
66 //
67 // If a feature id is not changed at a junction and all ingoing and outgoing edges of the junction
68 // has the same feature id, the junction still may be considered as a joint. It happens in case of
69 // self intersected features. For example:
70 // *--Seg3--*
71 // | |
72 // Seg4 Seg2
73 // | |
74 // *--Seg0--*--Seg1--*
75 // The common point of segments 0, 1 and 4 should be considered as a joint.
76
77 if (ingoingRouteEdge.GetFeatureId() != outgoingRouteEdge.GetFeatureId())
78 return true;
79
80 FeatureID const & featureId = ingoingRouteEdge.GetFeatureId();
81 uint32_t const segOut = outgoingRouteEdge.GetSegId();
82 for (Edge const & e : ingoingEdges)
83 if (e.GetFeatureId() != featureId || abs(static_cast<int32_t>(segOut - e.GetSegId())) != 1)
84 return true;
85
86 uint32_t const segIn = ingoingRouteEdge.GetSegId();
87 for (Edge const & e : outgoingEdges)
88 {
89 // It's necessary to compare segments for cases when |featureId| is a loop.
90 if (e.GetFeatureId() != featureId || abs(static_cast<int32_t>(segIn - e.GetSegId())) != 1)
91 return true;
92 }
93 return false;
94}
95} // namespace routing

Callers 3

IsJointOrEndMethod · 0.85
FindFirstJointsMethod · 0.85

Calls 2

GetSegIdMethod · 0.80
GetFeatureIdMethod · 0.45

Tested by

no test coverage detected