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>
|
||||
namespace boost { namespace polygon {
|
||||
template <>
|
||||
struct polygon_traits<ExPolygon> {
|
||||
struct polygon_traits<Slic3r::ExPolygon> {
|
||||
typedef coord_t coordinate_type;
|
||||
typedef Points::const_iterator iterator_type;
|
||||
typedef Point point_type;
|
||||
typedef Slic3r::Points::const_iterator iterator_type;
|
||||
typedef Slic3r::Point point_type;
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct polygon_mutable_traits<ExPolygon> {
|
||||
struct polygon_mutable_traits<Slic3r::ExPolygon> {
|
||||
//expects stl style iterators
|
||||
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);
|
||||
// skip last point since Boost will set last point = first point
|
||||
expolygon.contour.points.pop_back();
|
||||
|
@ -333,27 +333,27 @@ namespace boost { namespace polygon {
|
|||
|
||||
|
||||
template <>
|
||||
struct geometry_concept<ExPolygon> { typedef polygon_with_holes_concept type; };
|
||||
struct geometry_concept<Slic3r::ExPolygon> { typedef polygon_with_holes_concept type; };
|
||||
|
||||
template <>
|
||||
struct polygon_with_holes_traits<ExPolygon> {
|
||||
typedef Polygons::const_iterator iterator_holes_type;
|
||||
typedef Polygon hole_type;
|
||||
static inline iterator_holes_type begin_holes(const ExPolygon& t) {
|
||||
struct polygon_with_holes_traits<Slic3r::ExPolygon> {
|
||||
typedef Slic3r::Polygons::const_iterator iterator_holes_type;
|
||||
typedef Slic3r::Polygon hole_type;
|
||||
static inline iterator_holes_type begin_holes(const Slic3r::ExPolygon& t) {
|
||||
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();
|
||||
}
|
||||
static inline unsigned int size_holes(const ExPolygon& t) {
|
||||
static inline unsigned int size_holes(const Slic3r::ExPolygon& t) {
|
||||
return (int)t.holes.size();
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct polygon_with_holes_mutable_traits<ExPolygon> {
|
||||
struct polygon_with_holes_mutable_traits<Slic3r::ExPolygon> {
|
||||
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);
|
||||
return t;
|
||||
}
|
||||
|
@ -361,32 +361,32 @@ namespace boost { namespace polygon {
|
|||
|
||||
//first we register CPolygonSet as a polygon set
|
||||
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
|
||||
template <>
|
||||
struct polygon_set_traits<ExPolygons> {
|
||||
struct polygon_set_traits<Slic3r::ExPolygons> {
|
||||
typedef coord_t coordinate_type;
|
||||
typedef ExPolygons::const_iterator iterator_type;
|
||||
typedef ExPolygons operator_arg_type;
|
||||
typedef Slic3r::ExPolygons::const_iterator iterator_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();
|
||||
}
|
||||
|
||||
static inline iterator_type end(const ExPolygons& polygon_set) {
|
||||
static inline iterator_type end(const Slic3r::ExPolygons& polygon_set) {
|
||||
return polygon_set.end();
|
||||
}
|
||||
|
||||
//don't worry about these, just return false from them
|
||||
static inline bool clean(const ExPolygons& polygon_set) { return false; }
|
||||
static inline bool sorted(const ExPolygons& polygon_set) { return false; }
|
||||
static inline bool clean(const Slic3r::ExPolygons& polygon_set) { return false; }
|
||||
static inline bool sorted(const Slic3r::ExPolygons& polygon_set) { return false; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct polygon_set_mutable_traits<ExPolygons> {
|
||||
struct polygon_set_mutable_traits<Slic3r::ExPolygons> {
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -76,20 +76,20 @@ class Linef3
|
|||
void scale(double factor);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Slic3r
|
||||
|
||||
// start Boost
|
||||
#include <boost/polygon/polygon.hpp>
|
||||
namespace boost { namespace polygon {
|
||||
template <>
|
||||
struct geometry_concept<Line> { typedef segment_concept type; };
|
||||
struct geometry_concept<Slic3r::Line> { typedef segment_concept type; };
|
||||
|
||||
template <>
|
||||
struct segment_traits<Line> {
|
||||
struct segment_traits<Slic3r::Line> {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -131,7 +131,7 @@ class Pointf3 : public Pointf
|
|||
Vectorf3 vector_to(const Pointf3 &point) const;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Slic3r
|
||||
|
||||
// start Boost
|
||||
#include <boost/version.hpp>
|
||||
|
@ -155,28 +155,28 @@ namespace boost { namespace polygon {
|
|||
#endif
|
||||
|
||||
template <>
|
||||
struct geometry_concept<Point> { typedef point_concept type; };
|
||||
struct geometry_concept<Slic3r::Point> { typedef point_concept type; };
|
||||
|
||||
template <>
|
||||
struct point_traits<Point> {
|
||||
struct point_traits<Slic3r::Point> {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct point_mutable_traits<Point> {
|
||||
struct point_mutable_traits<Slic3r::Point> {
|
||||
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)
|
||||
point.x = value;
|
||||
else
|
||||
point.y = value;
|
||||
}
|
||||
static inline Point construct(coord_t x_value, coord_t y_value) {
|
||||
Point retval;
|
||||
static inline Slic3r::Point construct(coord_t x_value, coord_t y_value) {
|
||||
Slic3r::Point retval;
|
||||
retval.x = x_value;
|
||||
retval.y = y_value;
|
||||
return retval;
|
||||
|
|
|
@ -142,40 +142,40 @@ inline Polylines to_polylines(Polygons &&polys)
|
|||
#include <boost/polygon/polygon.hpp>
|
||||
namespace boost { namespace polygon {
|
||||
template <>
|
||||
struct geometry_concept<Polygon>{ typedef polygon_concept type; };
|
||||
struct geometry_concept<Slic3r::Polygon>{ typedef polygon_concept type; };
|
||||
|
||||
template <>
|
||||
struct polygon_traits<Polygon> {
|
||||
struct polygon_traits<Slic3r::Polygon> {
|
||||
typedef coord_t coordinate_type;
|
||||
typedef Points::const_iterator iterator_type;
|
||||
typedef Point point_type;
|
||||
typedef Slic3r::Points::const_iterator iterator_type;
|
||||
typedef Slic3r::Point point_type;
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct polygon_mutable_traits<Polygon> {
|
||||
struct polygon_mutable_traits<Slic3r::Polygon> {
|
||||
// expects stl style iterators
|
||||
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();
|
||||
while (input_begin != input_end) {
|
||||
polygon.points.push_back(Point());
|
||||
|
@ -189,32 +189,32 @@ namespace boost { namespace polygon {
|
|||
};
|
||||
|
||||
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
|
||||
template <>
|
||||
struct polygon_set_traits<Polygons> {
|
||||
struct polygon_set_traits<Slic3r::Polygons> {
|
||||
typedef coord_t coordinate_type;
|
||||
typedef Polygons::const_iterator iterator_type;
|
||||
typedef Polygons operator_arg_type;
|
||||
typedef Slic3r::Polygons::const_iterator iterator_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();
|
||||
}
|
||||
|
||||
static inline iterator_type end(const Polygons& polygon_set) {
|
||||
static inline iterator_type end(const Slic3r::Polygons& polygon_set) {
|
||||
return polygon_set.end();
|
||||
}
|
||||
|
||||
//don't worry about these, just return false from them
|
||||
static inline bool clean(const Polygons& polygon_set) { return false; }
|
||||
static inline bool sorted(const Polygons& polygon_set) { return false; }
|
||||
static inline bool clean(const Slic3r::Polygons& polygon_set) { return false; }
|
||||
static inline bool sorted(const Slic3r::Polygons& polygon_set) { return false; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct polygon_set_mutable_traits<Polygons> {
|
||||
struct polygon_set_mutable_traits<Slic3r::Polygons> {
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue