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

Function ProcessSplineSegmentRects

libs/drape_frontend/user_mark_shapes.cpp:494–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494void ProcessSplineSegmentRects(m2::SharedSpline const & spline, double maxSegmentLength,
495 std::function<bool(m2::RectD const & segmentRect)> const & func)
496{
497 double const splineFullLength = spline->GetLength();
498 double length = 0;
499 while (length < splineFullLength)
500 {
501 m2::RectD splineRect;
502
503 auto const itBegin = spline->GetPoint(length);
504 auto itEnd = spline->GetPoint(length + maxSegmentLength);
505 if (itEnd.BeginAgain())
506 {
507 double const lastSegmentLength = spline->GetLastLength();
508 itEnd = spline->GetPoint(splineFullLength - lastSegmentLength / 2.0);
509 splineRect.Add(spline->GetPath().back());
510 }
511
512 spline->ForEachNode(itBegin, itEnd, [&splineRect](m2::PointD const & pt) { splineRect.Add(pt); });
513
514 length += maxSegmentLength;
515
516 if (!func(splineRect))
517 return;
518 }
519}
520
521void CacheUserLines(ref_ptr<dp::GraphicsContext> context, TileKey const & tileKey, ref_ptr<dp::TextureManager> textures,
522 kml::TrackIdCollection const & linesId, UserLinesRenderCollection const & renderParams,

Callers 1

UpdateIndexMethod · 0.85

Calls 8

BeginAgainMethod · 0.80
GetLastLengthMethod · 0.80
backMethod · 0.80
GetLengthMethod · 0.45
GetPointMethod · 0.45
AddMethod · 0.45
GetPathMethod · 0.45
ForEachNodeMethod · 0.45

Tested by

no test coverage detected