MCPcopy Create free account
hub / github.com/comaps/comaps / GetCompletionPercent

Method GetCompletionPercent

libs/routing/routing_session.cpp:503–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

501}
502
503double RoutingSession::GetCompletionPercent() const
504{
505 CHECK_THREAD_CHECKER(m_threadChecker, ());
506 ASSERT(m_route, ());
507
508 double const denominator = m_passedDistanceOnRouteMeters + m_route->GetTotalDistanceMeters();
509 if (!m_route->IsValid() || denominator == 0.0)
510 return 0;
511
512 double const percent =
513 100.0 * (m_passedDistanceOnRouteMeters + m_route->GetCurrentDistanceFromBeginMeters()) / denominator;
514 if (percent - m_lastCompletionPercent > kCompletionPercentAccuracy)
515 m_lastCompletionPercent = percent;
516 return percent;
517}
518
519void RoutingSession::PassCheckpoints()
520{

Callers 1

UNIT_CLASS_TESTFunction · 0.80

Calls 4

ASSERTFunction · 0.85
IsValidMethod · 0.45

Tested by 1

UNIT_CLASS_TESTFunction · 0.64