\returns true when - the route leads from one big road to another one; - and the other possible turns lead to small roads; Returns false otherwise. \param turnCandidates is all possible ways out from a junction. \param turnInfo is information about ingoing and outgoing segments of the route.
| 30 | /// \param turnCandidates is all possible ways out from a junction. |
| 31 | /// \param turnInfo is information about ingoing and outgoing segments of the route. |
| 32 | bool CanDiscardTurnByHighwayClass(std::vector<TurnCandidate> const & turnCandidates, TurnInfo const & turnInfo, |
| 33 | NumMwmIds const & numMwmIds) |
| 34 | { |
| 35 | HighwayClass outgoingRouteRoadClass = turnInfo.m_outgoing->m_highwayClass; |
| 36 | HighwayClass ingoingRouteRoadClass = turnInfo.m_ingoing->m_highwayClass; |
| 37 | |
| 38 | HighwayClass maxRouteRoadClass = |
| 39 | static_cast<HighwayClass>(max(static_cast<int>(ingoingRouteRoadClass), static_cast<int>(outgoingRouteRoadClass))); |
| 40 | |
| 41 | // The turn should be kept if there's no any information about feature id of outgoing segment |
| 42 | // just to be on the safe side. It may happen in case of outgoing segment is a finish segment. |
| 43 | Segment firstOutgoingSegment; |
| 44 | if (!turnInfo.m_outgoing->m_segmentRange.GetFirstSegment(numMwmIds, firstOutgoingSegment)) |
| 45 | return false; |
| 46 | |
| 47 | for (auto const & t : turnCandidates) |
| 48 | { |
| 49 | // Let's consider all outgoing segments except for route outgoing segment. |
| 50 | if (t.m_segment == firstOutgoingSegment) |
| 51 | continue; |
| 52 | |
| 53 | HighwayClass candidateRoadClass = t.m_highwayClass; |
| 54 | |
| 55 | // If route's road is significantly larger than candidate's road, the candidate can be ignored. |
| 56 | if (CalcDiffRoadClasses(maxRouteRoadClass, candidateRoadClass) <= kMinHighwayClassDiff) |
| 57 | continue; |
| 58 | |
| 59 | // If route's road is significantly larger than candidate's service road, the candidate can be ignored. |
| 60 | if (CalcDiffRoadClasses(maxRouteRoadClass, candidateRoadClass) <= kMinHighwayClassDiffForService && |
| 61 | (candidateRoadClass == HighwayClass::Service || candidateRoadClass == HighwayClass::ServiceMinor)) |
| 62 | continue; |
| 63 | |
| 64 | return false; |
| 65 | } |
| 66 | |
| 67 | return true; |
| 68 | } |
| 69 | |
| 70 | m2::PointD GetPointForTurn(IRoutingResult const & result, size_t outgoingSegmentIndex, NumMwmIds const & numMwmIds, |
| 71 | size_t const maxPointsCount, double const maxDistMeters, bool const forward) |
no test coverage detected