| 908 | } |
| 909 | |
| 910 | void ApplyLineFeatureGeometry::ProcessLineRules(Stylist::LineRulesT const & lineRules) |
| 911 | { |
| 912 | ASSERT(!lineRules.empty(), ()); |
| 913 | ASSERT(HasGeometry(), ()); |
| 914 | |
| 915 | if (!ftypes::IsIsolineChecker::Instance()(m_f)) |
| 916 | { |
| 917 | // A line crossing the tile several times will be split in several parts. |
| 918 | // TODO(pastk) : use feature's pre-calculated limitRect when possible. |
| 919 | m_clippedSplines = m2::ClipSplineByRect(m_tileRect, m_spline); |
| 920 | } |
| 921 | else |
| 922 | { |
| 923 | // Isolines smoothing. |
| 924 | ASSERT_EQUAL(lineRules.size(), 1, ()); |
| 925 | m2::GuidePointsForSmooth guidePointsForSmooth; |
| 926 | std::vector<std::vector<m2::PointD>> clippedPaths; |
| 927 | auto extTileRect = m_tileRect; |
| 928 | extTileRect.Inflate(m_tileRect.SizeX() * 0.3, m_tileRect.SizeY() * 0.3); |
| 929 | m2::ClipPathByRectBeforeSmooth(extTileRect, m_spline->GetPath(), guidePointsForSmooth, clippedPaths); |
| 930 | |
| 931 | if (clippedPaths.empty()) |
| 932 | return; |
| 933 | |
| 934 | m2::SmoothPaths(guidePointsForSmooth, 4 /* newPointsPerSegmentCount */, m2::kCentripetalAlpha, clippedPaths); |
| 935 | |
| 936 | ASSERT(m_clippedSplines.empty(), ()); |
| 937 | std::function<void(m2::SharedSpline &&)> inserter = base::MakeBackInsertFunctor(m_clippedSplines); |
| 938 | for (auto & path : clippedPaths) |
| 939 | m2::ClipPathByRect(m_tileRect, std::move(path), inserter); |
| 940 | } |
| 941 | |
| 942 | if (m_clippedSplines.empty()) |
| 943 | return; |
| 944 | |
| 945 | for (LineRuleProto const * r : lineRules) |
| 946 | ProcessRule(*r); |
| 947 | |
| 948 | #ifdef LINES_GENERATION_CALC_FILTERED_POINTS |
| 949 | LinesStat::Get().InsertLine(m_f.GetID(), m_tileKey.m_zoomLevel, m_readCount, static_cast<int>(m_spline->GetSize())); |
| 950 | #endif |
| 951 | } |
| 952 | |
| 953 | void ApplyLineFeatureGeometry::ProcessRule(LineRuleProto const & lineRule) |
| 954 | { |
no test coverage detected