| 107 | NumMwmIds const & numMwmIds, RoutingSettings const & vehicleSettings, TurnItem & turn); |
| 108 | |
| 109 | size_t CarDirectionsEngine::GetTurnDirection(IRoutingResult const & result, size_t const outgoingSegmentIndex, |
| 110 | NumMwmIds const & numMwmIds, RoutingSettings const & vehicleSettings, |
| 111 | TurnItem & turnItem) |
| 112 | { |
| 113 | if (outgoingSegmentIndex == result.GetSegments().size()) |
| 114 | { |
| 115 | turnItem.m_turn = CarDirection::ReachedYourDestination; |
| 116 | return 0; |
| 117 | } |
| 118 | |
| 119 | // This is for jump from initial point to start of the route. No direction is given. |
| 120 | /// @todo Sometimes results of GetPossibleTurns are empty, sometimes are invalid. |
| 121 | /// The best will be to fix GetPossibleTurns(). It will allow us to use following approach. |
| 122 | /// E.g. Google Maps until you reach the destination will guide you to go to the left or to the right of the first |
| 123 | /// road. |
| 124 | if (outgoingSegmentIndex == 2) // The same as turnItem.m_index == 2. |
| 125 | return 0; |
| 126 | |
| 127 | size_t skipTurnSegments = CheckUTurnOnRoute(result, outgoingSegmentIndex, numMwmIds, vehicleSettings, turnItem); |
| 128 | |
| 129 | if (turnItem.m_turn == CarDirection::None) |
| 130 | GetTurnDirectionBasic(result, outgoingSegmentIndex, numMwmIds, vehicleSettings, turnItem); |
| 131 | |
| 132 | // Lane information. |
| 133 | if (turnItem.m_turn != CarDirection::None) |
| 134 | { |
| 135 | auto const & loadedSegments = result.GetSegments(); |
| 136 | auto const & ingoingSegment = loadedSegments[outgoingSegmentIndex - 1]; |
| 137 | turnItem.m_lanes = ingoingSegment.m_lanes; |
| 138 | } |
| 139 | |
| 140 | return skipTurnSegments; |
| 141 | } |
| 142 | |
| 143 | /*! |
| 144 | * \brief Calculates a turn instruction if the ingoing edge or (and) the outgoing edge belongs to a |
nothing calls this directly
no test coverage detected