| 196 | } |
| 197 | |
| 198 | std::vector<m2::SharedSpline> ClipSplineByRect(m2::RectD const & rect, m2::SharedSpline const & spline) |
| 199 | { |
| 200 | switch (GetRectCase(rect, spline->GetPath())) |
| 201 | { |
| 202 | case RectCase::Inside: return {spline}; |
| 203 | case RectCase::Outside: return {}; |
| 204 | case RectCase::Intersect: |
| 205 | { |
| 206 | std::vector<m2::SharedSpline> res; |
| 207 | res.reserve(2); // keep previous behavior, but not sure that its actually needed |
| 208 | ClipPathByRectImpl(rect, spline->GetPath(), base::MakeBackInsertFunctor(res)); |
| 209 | return res; |
| 210 | } |
| 211 | } |
| 212 | CHECK(false, ("Unreachable")); |
| 213 | return {}; |
| 214 | } |
| 215 | |
| 216 | void ClipPathByRect(m2::RectD const & rect, std::vector<m2::PointD> && path, |
| 217 | std::function<void(m2::SharedSpline &&)> const & fn) |