| 18 | } // namespace |
| 19 | |
| 20 | void 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 | |
| 46 | bool impl::SetRecommendedLaneWays(CarDirection const carDirection, LanesInfo & lanesInfo) |
| 47 | { |