| 57 | } |
| 58 | |
| 59 | bool 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 |
no test coverage detected