| 307 | } |
| 308 | |
| 309 | bool Route::GetNextTurn(double & distanceToTurnMeters, TurnItem & nextTurn) const |
| 310 | { |
| 311 | TurnItem curTurn; |
| 312 | // Note. |m_poly.GetCurrentIter().m_ind| is a zero based index of last passed point at |m_poly|. |
| 313 | size_t const curIdx = m_poly.GetCurrentIter().m_ind; |
| 314 | // Note. First param of GetClosestTurnAfterIdx() is a segment index at |m_routeSegments|. |
| 315 | // |curIdx| is an index of last passed point at |m_poly|. |
| 316 | // |curIdx| + 1 is an index of next point. |
| 317 | // |curIdx| + 1 - 1 is an index of segment to start look for the closest turn. |
| 318 | GetClosestTurnAfterIdx(curIdx, curTurn); |
| 319 | CHECK_LESS(curIdx, curTurn.m_index, ()); |
| 320 | if (curTurn.IsTurnReachedYourDestination()) |
| 321 | { |
| 322 | nextTurn = TurnItem(); |
| 323 | return false; |
| 324 | } |
| 325 | |
| 326 | // Note. |curTurn.m_index| is an index of the point of |curTurn| at polyline |m_poly|. |
| 327 | // |curTurn.m_index| + 1 is an index of the next point after |curTurn|. |
| 328 | // |curTurn.m_index| + 1 - 1 is an index of the segment next to the |curTurn| segment. |
| 329 | CHECK_LESS(curTurn.m_index, m_routeSegments.size(), ()); |
| 330 | GetClosestTurnAfterIdx(curTurn.m_index, nextTurn); |
| 331 | CHECK_LESS(curTurn.m_index, nextTurn.m_index, ()); |
| 332 | distanceToTurnMeters = m_poly.GetDistanceM(m_poly.GetCurrentIter(), m_poly.GetIterToIndex(nextTurn.m_index)); |
| 333 | return true; |
| 334 | } |
| 335 | |
| 336 | bool Route::GetNextTurns(vector<TurnItemDist> & turns) const |
| 337 | { |