| 1157 | } |
| 1158 | |
| 1159 | void IndexRouter::PointsOnEdgesSnapping::EraseIfDeadEnd(m2::PointD const & checkpoint, vector<RoadInfoT> & roads, |
| 1160 | std::set<Segment> & deadEnds) const |
| 1161 | { |
| 1162 | // |deadEnds| cache is necessary to minimize number of calls a time consumption IsDeadEnd() method. |
| 1163 | base::EraseIf(roads, [&](RoadInfoT const & fullRoadInfo) |
| 1164 | { |
| 1165 | auto const & junctions = fullRoadInfo.m_roadInfo.m_junctions; |
| 1166 | CHECK_GREATER_OR_EQUAL(junctions.size(), 2, ()); |
| 1167 | auto const squaredDistAndIndex = m2::CalcMinSquaredDistance(junctions.begin(), junctions.end(), checkpoint); |
| 1168 | |
| 1169 | // Note. Checking if an edge goes to a dead end is a time consumption process. |
| 1170 | // So the number of checked edges should be minimized as possible. |
| 1171 | // Below a heuristic is used. If the closest to |checkpoint| segment of a feature |
| 1172 | // in forward direction is a dead end all segments of the feature is considered as dead ends. |
| 1173 | auto const segment = GetSegmentByEdge(Edge::MakeReal(fullRoadInfo.m_featureId, true /* forward */, |
| 1174 | squaredDistAndIndex.second, junctions[0], junctions[1])); |
| 1175 | return (IsDeadEndCached(segment, true /* isOutgoing */, false /* useRoutingOptions */, m_graph, deadEnds) && |
| 1176 | m_deadEnds[0].count(segment) == 0); |
| 1177 | }); |
| 1178 | } |
| 1179 | |
| 1180 | // static |
| 1181 | bool IndexRouter::PointsOnEdgesSnapping::IsFencedOff(m2::PointD const & point, EdgeProjectionT const & edgeProjection, |
nothing calls this directly
no test coverage detected