| 403 | } |
| 404 | |
| 405 | void RoutingSession::GetRouteFollowingInfo(FollowingInfo & info) const |
| 406 | { |
| 407 | CHECK_THREAD_CHECKER(m_threadChecker, ()); |
| 408 | |
| 409 | ASSERT(m_route, ()); |
| 410 | |
| 411 | if (!m_route->IsValid()) |
| 412 | { |
| 413 | // Nothing should be displayed on the screen about turns if these lines are executed. |
| 414 | info = FollowingInfo(); |
| 415 | info.m_routingSessionState = m_state; |
| 416 | info.m_indexOfNextStop = -1; // Invalid next stop index. |
| 417 | return; |
| 418 | } |
| 419 | |
| 420 | if (!IsNavigable()) |
| 421 | { |
| 422 | info = FollowingInfo(); |
| 423 | info.m_distToTarget = platform::Distance::CreateFormatted(m_route->GetTotalDistanceMeters()); |
| 424 | info.m_time = static_cast<int>(std::max(kMinimumETASec, m_route->GetCurrentTimeToEndSec())); |
| 425 | info.m_routingSessionState = m_state; |
| 426 | info.m_indexOfNextStop = -1; // Invalid next stop index. |
| 427 | return; |
| 428 | } |
| 429 | |
| 430 | info.m_distToTarget = platform::Distance::CreateFormatted(m_route->GetCurrentDistanceToEndMeters()); |
| 431 | |
| 432 | double distanceToTurnMeters = 0.; |
| 433 | turns::TurnItem turn; |
| 434 | m_route->GetNearestTurn(distanceToTurnMeters, turn); |
| 435 | info.m_distToTurn = platform::Distance::CreateFormatted(distanceToTurnMeters); |
| 436 | info.m_turn = turn.m_turn; |
| 437 | |
| 438 | info.m_speedLimitMps = GetCurrentSpeedLimit(); |
| 439 | |
| 440 | // The turn after the next one. |
| 441 | if (m_routingSettings.m_showTurnAfterNext) |
| 442 | info.m_nextTurn = m_turnNotificationsMgr.GetSecondTurnNotification(); |
| 443 | else |
| 444 | info.m_nextTurn = routing::turns::CarDirection::None; |
| 445 | |
| 446 | info.m_exitNum = turn.m_exitNum; |
| 447 | info.m_time = static_cast<int>(std::max(kMinimumETASec, m_route->GetCurrentTimeToEndSec())); |
| 448 | RouteSegment::RoadNameInfo currentRoadNameInfo, nextRoadNameInfo, nextNextRoadNameInfo; |
| 449 | m_route->GetCurrentStreetName(currentRoadNameInfo); |
| 450 | GetFullRoadName(currentRoadNameInfo, info.m_currentStreetName); |
| 451 | m_route->GetNextTurnStreetName(nextRoadNameInfo); |
| 452 | GetFullRoadName(nextRoadNameInfo, info.m_nextStreetName); |
| 453 | m_route->GetNextNextTurnStreetName(nextNextRoadNameInfo); |
| 454 | GetFullRoadName(nextNextRoadNameInfo, info.m_nextNextStreetName); |
| 455 | |
| 456 | info.m_completionPercent = GetCompletionPercent(); |
| 457 | |
| 458 | // Lane information. |
| 459 | info.m_lanes.clear(); |
| 460 | if (distanceToTurnMeters < kShowLanesMinDistInMeters || m_route->GetCurrentTimeToNearestTurnSec() < 60.0) |
| 461 | info.m_lanes = turn.m_lanes; |
| 462 |
no test coverage detected