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

Method EraseIfDeadEnd

libs/routing/index_router.cpp:1159–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1157}
1158
1159void 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
1181bool IndexRouter::PointsOnEdgesSnapping::IsFencedOff(m2::PointD const & point, EdgeProjectionT const & edgeProjection,

Callers

nothing calls this directly

Calls 7

EraseIfFunction · 0.85
CalcMinSquaredDistanceFunction · 0.85
IsDeadEndCachedFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected