| 241 | } |
| 242 | |
| 243 | void RouteRenderer::PrepareRouteArrows(ScreenBase const & screen, PrepareRouteArrowsCallback const & prepareCallback) |
| 244 | { |
| 245 | for (auto & subrouteInfo : m_subroutes) |
| 246 | { |
| 247 | // Interpolate values by zoom level. |
| 248 | double zoom = 0.0; |
| 249 | float halfWidth = 0.0; |
| 250 | InterpolateByZoom(subrouteInfo.m_subroute, screen, halfWidth, zoom); |
| 251 | subrouteInfo.m_baseHalfWidth = halfWidth; |
| 252 | |
| 253 | if (zoom < kArrowAppearingZoomLevel) |
| 254 | { |
| 255 | subrouteInfo.m_arrowsData.reset(); |
| 256 | subrouteInfo.m_arrowBorders.clear(); |
| 257 | continue; |
| 258 | } |
| 259 | |
| 260 | // Calculate arrow borders. |
| 261 | double dist = kInvalidDistance; |
| 262 | if (m_followingEnabled) |
| 263 | dist = m_distanceFromBegin - subrouteInfo.m_subroute->m_baseDistance; |
| 264 | |
| 265 | // We run asynchronous task to calculate new positions of route arrows. |
| 266 | auto const subrouteId = subrouteInfo.m_subrouteId; |
| 267 | auto const screenRect = screen.ClipRect(); |
| 268 | auto const screenScale = screen.GetScale(); |
| 269 | auto const subrouteLength = subrouteInfo.m_length; |
| 270 | auto subroute = subrouteInfo.m_subroute; |
| 271 | dp::DrapeRoutine::RunSequential([subrouteId, screenRect, screenScale, halfWidth, subroute = std::move(subroute), |
| 272 | subrouteLength, dist, prepareCallback]() |
| 273 | { |
| 274 | ASSERT(prepareCallback != nullptr, ()); |
| 275 | prepareCallback(subrouteId, |
| 276 | CalculateArrowBorders(screenRect, screenScale, halfWidth, subroute, subrouteLength, dist)); |
| 277 | }); |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | void RouteRenderer::CacheRouteArrows(ScreenBase const & screen, dp::DrapeID subrouteId, |
| 282 | std::vector<ArrowBorders> && arrowBorders, |
no test coverage detected