Some reduction of unnecessary conversions when calling ClipperUtils.

This commit is contained in:
Vojtech Bubnik 2021-09-13 15:13:05 +02:00
parent 60b5e0d0d5
commit cab71073a1
11 changed files with 29 additions and 24 deletions

View file

@ -18,11 +18,6 @@ using ConstPolygonPtrs = std::vector<const Polygon*>;
class Polygon : public MultiPoint
{
public:
explicit operator Polygons() const { Polygons pp; pp.push_back(*this); return pp; }
explicit operator Polyline() const { return this->split_at_first_point(); }
Point& operator[](Points::size_type idx) { return this->points[idx]; }
const Point& operator[](Points::size_type idx) const { return this->points[idx]; }
Polygon() = default;
virtual ~Polygon() = default;
explicit Polygon(const Points &points) : MultiPoint(points) {}
@ -39,6 +34,9 @@ public:
Polygon& operator=(const Polygon &other) { points = other.points; return *this; }
Polygon& operator=(Polygon &&other) { points = std::move(other.points); return *this; }
Point& operator[](Points::size_type idx) { return this->points[idx]; }
const Point& operator[](Points::size_type idx) const { return this->points[idx]; }
// last point == first point for polygons
const Point& last_point() const override { return this->points.front(); }