| curSegLenMeters | | | | passedSegMeters | | ----------*-----------------*------------*----> x | | | LastPoint CurrentPoint NextPoint | fromLastPassedPointToEndSec ----------*-----------------*------------*----> t | | | toLastPointSec currentTime toNextPointSec CurrentTime is c
| 132 | // |
| 133 | // CurrentTime is calculated using equal proportions for distance and time at any segment. |
| 134 | double Route::GetCurrentTimeFromBeginSec() const |
| 135 | { |
| 136 | if (!IsValid()) |
| 137 | return 0.0; |
| 138 | |
| 139 | auto const & curIter = m_poly.GetCurrentIter(); |
| 140 | CHECK_LESS(curIter.m_ind, m_routeSegments.size(), ()); |
| 141 | |
| 142 | double const toLastPointSec = |
| 143 | (curIter.m_ind == 0) ? 0.0 : m_routeSegments[curIter.m_ind - 1].GetTimeFromBeginningSec(); |
| 144 | double const toNextPointSec = m_routeSegments[curIter.m_ind].GetTimeFromBeginningSec(); |
| 145 | |
| 146 | double const curSegLenMeters = GetSegLenMeters(curIter.m_ind); |
| 147 | |
| 148 | if (curSegLenMeters < 1.0) |
| 149 | return toLastPointSec; |
| 150 | |
| 151 | double const passedSegMeters = m_poly.GetDistFromCurPointToRoutePointMeters(); |
| 152 | |
| 153 | return toLastPointSec + passedSegMeters / curSegLenMeters * (toNextPointSec - toLastPointSec); |
| 154 | } |
| 155 | |
| 156 | double Route::GetCurrentTimeToSegmentSec(size_t segIdx) const |
| 157 | { |
nothing calls this directly
no test coverage detected