| 492 | } |
| 493 | |
| 494 | void 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 | |
| 521 | void CacheUserLines(ref_ptr<dp::GraphicsContext> context, TileKey const & tileKey, ref_ptr<dp::TextureManager> textures, |
| 522 | kml::TrackIdCollection const & linesId, UserLinesRenderCollection const & renderParams, |
no test coverage detected