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

Function SelectRecommendedLanes

libs/routing/lanes/lanes_recommendation.cpp:20–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18} // namespace
19
20void SelectRecommendedLanes(std::vector<RouteSegment> & routeSegments)
21{
22 for (auto & segment : routeSegments)
23 {
24 auto & t = segment.GetTurn();
25 if (t.IsTurnNone() || t.m_lanes.empty())
26 continue;
27 auto & lanesInfo = segment.GetTurnLanes();
28 // Check if there are elements in lanesInfo that correspond with the turn exactly.
29 // If so, fix up all the elements in lanesInfo that correspond with the turn.
30 if (impl::SetRecommendedLaneWays(t.m_turn, lanesInfo))
31 continue;
32 // If not, check if there are elements in lanesInfo that correspond with the turn
33 // approximately. If so, fix up all those elements.
34 if (impl::SetRecommendedLaneWaysApproximately(t.m_turn, lanesInfo))
35 continue;
36 // If not, check if there is an unrestricted lane that could correspond to the
37 // turn. If so, fix up that lane.
38 if (impl::SetUnrestrictedLaneAsRecommended(t.m_turn, lanesInfo))
39 continue;
40 // Otherwise, we don't have lane recommendations for the user, so we don't
41 // want to send the lane data any further.
42 segment.ClearTurnLanes();
43 }
44}
45
46bool impl::SetRecommendedLaneWays(CarDirection const carDirection, LanesInfo & lanesInfo)
47{

Callers 2

FixupCarTurnsFunction · 0.85
UNIT_TESTFunction · 0.85

Calls 3

IsTurnNoneMethod · 0.80
ClearTurnLanesMethod · 0.80
emptyMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.68