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

Method PrepareRouteArrows

libs/drape_frontend/route_renderer.cpp:243–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243void 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
281void RouteRenderer::CacheRouteArrows(ScreenBase const & screen, dp::DrapeID subrouteId,
282 std::vector<ArrowBorders> && arrowBorders,

Callers 2

AcceptMessageMethod · 0.80
PrepareSceneMethod · 0.80

Calls 6

InterpolateByZoomFunction · 0.85
ASSERTFunction · 0.85
CalculateArrowBordersFunction · 0.85
resetMethod · 0.45
clearMethod · 0.45
GetScaleMethod · 0.45

Tested by

no test coverage detected