mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 12:47:50 -06:00
Don't be lazy, use fully qualified Slic3r::Polygon/ExPolygon/Point/Line names
This commit is contained in:
parent
24e0b568b5
commit
5d18657ac5
4 changed files with 61 additions and 61 deletions
|
@ -293,37 +293,37 @@ extern bool remove_sticks(ExPolygon &poly);
|
||||||
#include <boost/polygon/polygon.hpp>
|
#include <boost/polygon/polygon.hpp>
|
||||||
namespace boost { namespace polygon {
|
namespace boost { namespace polygon {
|
||||||
template <>
|
template <>
|
||||||
struct polygon_traits<ExPolygon> {
|
struct polygon_traits<Slic3r::ExPolygon> {
|
||||||
typedef coord_t coordinate_type;
|
typedef coord_t coordinate_type;
|
||||||
typedef Points::const_iterator iterator_type;
|
typedef Slic3r::Points::const_iterator iterator_type;
|
||||||
typedef Point point_type;
|
typedef Slic3r::Point point_type;
|
||||||
|
|
||||||
// Get the begin iterator
|
// Get the begin iterator
|
||||||
static inline iterator_type begin_points(const ExPolygon& t) {
|
static inline iterator_type begin_points(const Slic3r::ExPolygon& t) {
|
||||||
return t.contour.points.begin();
|
return t.contour.points.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the end iterator
|
// Get the end iterator
|
||||||
static inline iterator_type end_points(const ExPolygon& t) {
|
static inline iterator_type end_points(const Slic3r::ExPolygon& t) {
|
||||||
return t.contour.points.end();
|
return t.contour.points.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the number of sides of the polygon
|
// Get the number of sides of the polygon
|
||||||
static inline std::size_t size(const ExPolygon& t) {
|
static inline std::size_t size(const Slic3r::ExPolygon& t) {
|
||||||
return t.contour.points.size();
|
return t.contour.points.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the winding direction of the polygon
|
// Get the winding direction of the polygon
|
||||||
static inline winding_direction winding(const ExPolygon& t) {
|
static inline winding_direction winding(const Slic3r::ExPolygon& t) {
|
||||||
return unknown_winding;
|
return unknown_winding;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct polygon_mutable_traits<ExPolygon> {
|
struct polygon_mutable_traits<Slic3r::ExPolygon> {
|
||||||
//expects stl style iterators
|
//expects stl style iterators
|
||||||
template <typename iT>
|
template <typename iT>
|
||||||
static inline ExPolygon& set_points(ExPolygon& expolygon, iT input_begin, iT input_end) {
|
static inline Slic3r::ExPolygon& set_points(Slic3r::ExPolygon& expolygon, iT input_begin, iT input_end) {
|
||||||
expolygon.contour.points.assign(input_begin, input_end);
|
expolygon.contour.points.assign(input_begin, input_end);
|
||||||
// skip last point since Boost will set last point = first point
|
// skip last point since Boost will set last point = first point
|
||||||
expolygon.contour.points.pop_back();
|
expolygon.contour.points.pop_back();
|
||||||
|
@ -333,27 +333,27 @@ namespace boost { namespace polygon {
|
||||||
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct geometry_concept<ExPolygon> { typedef polygon_with_holes_concept type; };
|
struct geometry_concept<Slic3r::ExPolygon> { typedef polygon_with_holes_concept type; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct polygon_with_holes_traits<ExPolygon> {
|
struct polygon_with_holes_traits<Slic3r::ExPolygon> {
|
||||||
typedef Polygons::const_iterator iterator_holes_type;
|
typedef Slic3r::Polygons::const_iterator iterator_holes_type;
|
||||||
typedef Polygon hole_type;
|
typedef Slic3r::Polygon hole_type;
|
||||||
static inline iterator_holes_type begin_holes(const ExPolygon& t) {
|
static inline iterator_holes_type begin_holes(const Slic3r::ExPolygon& t) {
|
||||||
return t.holes.begin();
|
return t.holes.begin();
|
||||||
}
|
}
|
||||||
static inline iterator_holes_type end_holes(const ExPolygon& t) {
|
static inline iterator_holes_type end_holes(const Slic3r::ExPolygon& t) {
|
||||||
return t.holes.end();
|
return t.holes.end();
|
||||||
}
|
}
|
||||||
static inline unsigned int size_holes(const ExPolygon& t) {
|
static inline unsigned int size_holes(const Slic3r::ExPolygon& t) {
|
||||||
return (int)t.holes.size();
|
return (int)t.holes.size();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct polygon_with_holes_mutable_traits<ExPolygon> {
|
struct polygon_with_holes_mutable_traits<Slic3r::ExPolygon> {
|
||||||
template <typename iT>
|
template <typename iT>
|
||||||
static inline ExPolygon& set_holes(ExPolygon& t, iT inputBegin, iT inputEnd) {
|
static inline Slic3r::ExPolygon& set_holes(Slic3r::ExPolygon& t, iT inputBegin, iT inputEnd) {
|
||||||
t.holes.assign(inputBegin, inputEnd);
|
t.holes.assign(inputBegin, inputEnd);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -361,32 +361,32 @@ namespace boost { namespace polygon {
|
||||||
|
|
||||||
//first we register CPolygonSet as a polygon set
|
//first we register CPolygonSet as a polygon set
|
||||||
template <>
|
template <>
|
||||||
struct geometry_concept<ExPolygons> { typedef polygon_set_concept type; };
|
struct geometry_concept<Slic3r::ExPolygons> { typedef polygon_set_concept type; };
|
||||||
|
|
||||||
//next we map to the concept through traits
|
//next we map to the concept through traits
|
||||||
template <>
|
template <>
|
||||||
struct polygon_set_traits<ExPolygons> {
|
struct polygon_set_traits<Slic3r::ExPolygons> {
|
||||||
typedef coord_t coordinate_type;
|
typedef coord_t coordinate_type;
|
||||||
typedef ExPolygons::const_iterator iterator_type;
|
typedef Slic3r::ExPolygons::const_iterator iterator_type;
|
||||||
typedef ExPolygons operator_arg_type;
|
typedef Slic3r::ExPolygons operator_arg_type;
|
||||||
|
|
||||||
static inline iterator_type begin(const ExPolygons& polygon_set) {
|
static inline iterator_type begin(const Slic3r::ExPolygons& polygon_set) {
|
||||||
return polygon_set.begin();
|
return polygon_set.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline iterator_type end(const ExPolygons& polygon_set) {
|
static inline iterator_type end(const Slic3r::ExPolygons& polygon_set) {
|
||||||
return polygon_set.end();
|
return polygon_set.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
//don't worry about these, just return false from them
|
//don't worry about these, just return false from them
|
||||||
static inline bool clean(const ExPolygons& polygon_set) { return false; }
|
static inline bool clean(const Slic3r::ExPolygons& polygon_set) { return false; }
|
||||||
static inline bool sorted(const ExPolygons& polygon_set) { return false; }
|
static inline bool sorted(const Slic3r::ExPolygons& polygon_set) { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct polygon_set_mutable_traits<ExPolygons> {
|
struct polygon_set_mutable_traits<Slic3r::ExPolygons> {
|
||||||
template <typename input_iterator_type>
|
template <typename input_iterator_type>
|
||||||
static inline void set(ExPolygons& expolygons, input_iterator_type input_begin, input_iterator_type input_end) {
|
static inline void set(Slic3r::ExPolygons& expolygons, input_iterator_type input_begin, input_iterator_type input_end) {
|
||||||
expolygons.assign(input_begin, input_end);
|
expolygons.assign(input_begin, input_end);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -76,20 +76,20 @@ class Linef3
|
||||||
void scale(double factor);
|
void scale(double factor);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace Slic3r
|
||||||
|
|
||||||
// start Boost
|
// start Boost
|
||||||
#include <boost/polygon/polygon.hpp>
|
#include <boost/polygon/polygon.hpp>
|
||||||
namespace boost { namespace polygon {
|
namespace boost { namespace polygon {
|
||||||
template <>
|
template <>
|
||||||
struct geometry_concept<Line> { typedef segment_concept type; };
|
struct geometry_concept<Slic3r::Line> { typedef segment_concept type; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct segment_traits<Line> {
|
struct segment_traits<Slic3r::Line> {
|
||||||
typedef coord_t coordinate_type;
|
typedef coord_t coordinate_type;
|
||||||
typedef Point point_type;
|
typedef Slic3r::Point point_type;
|
||||||
|
|
||||||
static inline point_type get(const Line& line, direction_1d dir) {
|
static inline point_type get(const Slic3r::Line& line, direction_1d dir) {
|
||||||
return dir.to_int() ? line.b : line.a;
|
return dir.to_int() ? line.b : line.a;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -131,7 +131,7 @@ class Pointf3 : public Pointf
|
||||||
Vectorf3 vector_to(const Pointf3 &point) const;
|
Vectorf3 vector_to(const Pointf3 &point) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace Slic3r
|
||||||
|
|
||||||
// start Boost
|
// start Boost
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
|
@ -155,28 +155,28 @@ namespace boost { namespace polygon {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct geometry_concept<Point> { typedef point_concept type; };
|
struct geometry_concept<Slic3r::Point> { typedef point_concept type; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct point_traits<Point> {
|
struct point_traits<Slic3r::Point> {
|
||||||
typedef coord_t coordinate_type;
|
typedef coord_t coordinate_type;
|
||||||
|
|
||||||
static inline coordinate_type get(const Point& point, orientation_2d orient) {
|
static inline coordinate_type get(const Slic3r::Point& point, orientation_2d orient) {
|
||||||
return (orient == HORIZONTAL) ? point.x : point.y;
|
return (orient == HORIZONTAL) ? point.x : point.y;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct point_mutable_traits<Point> {
|
struct point_mutable_traits<Slic3r::Point> {
|
||||||
typedef coord_t coordinate_type;
|
typedef coord_t coordinate_type;
|
||||||
static inline void set(Point& point, orientation_2d orient, coord_t value) {
|
static inline void set(Slic3r::Point& point, orientation_2d orient, coord_t value) {
|
||||||
if (orient == HORIZONTAL)
|
if (orient == HORIZONTAL)
|
||||||
point.x = value;
|
point.x = value;
|
||||||
else
|
else
|
||||||
point.y = value;
|
point.y = value;
|
||||||
}
|
}
|
||||||
static inline Point construct(coord_t x_value, coord_t y_value) {
|
static inline Slic3r::Point construct(coord_t x_value, coord_t y_value) {
|
||||||
Point retval;
|
Slic3r::Point retval;
|
||||||
retval.x = x_value;
|
retval.x = x_value;
|
||||||
retval.y = y_value;
|
retval.y = y_value;
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -142,40 +142,40 @@ inline Polylines to_polylines(Polygons &&polys)
|
||||||
#include <boost/polygon/polygon.hpp>
|
#include <boost/polygon/polygon.hpp>
|
||||||
namespace boost { namespace polygon {
|
namespace boost { namespace polygon {
|
||||||
template <>
|
template <>
|
||||||
struct geometry_concept<Polygon>{ typedef polygon_concept type; };
|
struct geometry_concept<Slic3r::Polygon>{ typedef polygon_concept type; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct polygon_traits<Polygon> {
|
struct polygon_traits<Slic3r::Polygon> {
|
||||||
typedef coord_t coordinate_type;
|
typedef coord_t coordinate_type;
|
||||||
typedef Points::const_iterator iterator_type;
|
typedef Slic3r::Points::const_iterator iterator_type;
|
||||||
typedef Point point_type;
|
typedef Slic3r::Point point_type;
|
||||||
|
|
||||||
// Get the begin iterator
|
// Get the begin iterator
|
||||||
static inline iterator_type begin_points(const Polygon& t) {
|
static inline iterator_type begin_points(const Slic3r::Polygon& t) {
|
||||||
return t.points.begin();
|
return t.points.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the end iterator
|
// Get the end iterator
|
||||||
static inline iterator_type end_points(const Polygon& t) {
|
static inline iterator_type end_points(const Slic3r::Polygon& t) {
|
||||||
return t.points.end();
|
return t.points.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the number of sides of the polygon
|
// Get the number of sides of the polygon
|
||||||
static inline std::size_t size(const Polygon& t) {
|
static inline std::size_t size(const Slic3r::Polygon& t) {
|
||||||
return t.points.size();
|
return t.points.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the winding direction of the polygon
|
// Get the winding direction of the polygon
|
||||||
static inline winding_direction winding(const Polygon& t) {
|
static inline winding_direction winding(const Slic3r::Polygon& t) {
|
||||||
return unknown_winding;
|
return unknown_winding;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct polygon_mutable_traits<Polygon> {
|
struct polygon_mutable_traits<Slic3r::Polygon> {
|
||||||
// expects stl style iterators
|
// expects stl style iterators
|
||||||
template <typename iT>
|
template <typename iT>
|
||||||
static inline Polygon& set_points(Polygon& polygon, iT input_begin, iT input_end) {
|
static inline Slic3r::Polygon& set_points(Slic3r::Polygon& polygon, iT input_begin, iT input_end) {
|
||||||
polygon.points.clear();
|
polygon.points.clear();
|
||||||
while (input_begin != input_end) {
|
while (input_begin != input_end) {
|
||||||
polygon.points.push_back(Point());
|
polygon.points.push_back(Point());
|
||||||
|
@ -189,32 +189,32 @@ namespace boost { namespace polygon {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct geometry_concept<Polygons> { typedef polygon_set_concept type; };
|
struct geometry_concept<Slic3r::Polygons> { typedef polygon_set_concept type; };
|
||||||
|
|
||||||
//next we map to the concept through traits
|
//next we map to the concept through traits
|
||||||
template <>
|
template <>
|
||||||
struct polygon_set_traits<Polygons> {
|
struct polygon_set_traits<Slic3r::Polygons> {
|
||||||
typedef coord_t coordinate_type;
|
typedef coord_t coordinate_type;
|
||||||
typedef Polygons::const_iterator iterator_type;
|
typedef Slic3r::Polygons::const_iterator iterator_type;
|
||||||
typedef Polygons operator_arg_type;
|
typedef Slic3r::Polygons operator_arg_type;
|
||||||
|
|
||||||
static inline iterator_type begin(const Polygons& polygon_set) {
|
static inline iterator_type begin(const Slic3r::Polygons& polygon_set) {
|
||||||
return polygon_set.begin();
|
return polygon_set.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline iterator_type end(const Polygons& polygon_set) {
|
static inline iterator_type end(const Slic3r::Polygons& polygon_set) {
|
||||||
return polygon_set.end();
|
return polygon_set.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
//don't worry about these, just return false from them
|
//don't worry about these, just return false from them
|
||||||
static inline bool clean(const Polygons& polygon_set) { return false; }
|
static inline bool clean(const Slic3r::Polygons& polygon_set) { return false; }
|
||||||
static inline bool sorted(const Polygons& polygon_set) { return false; }
|
static inline bool sorted(const Slic3r::Polygons& polygon_set) { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct polygon_set_mutable_traits<Polygons> {
|
struct polygon_set_mutable_traits<Slic3r::Polygons> {
|
||||||
template <typename input_iterator_type>
|
template <typename input_iterator_type>
|
||||||
static inline void set(Polygons& polygons, input_iterator_type input_begin, input_iterator_type input_end) {
|
static inline void set(Slic3r::Polygons& polygons, input_iterator_type input_begin, input_iterator_type input_end) {
|
||||||
polygons.assign(input_begin, input_end);
|
polygons.assign(input_begin, input_end);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue