Surface / Surface Collection - optimization routines for filtering,

routines for visualization.
This commit is contained in:
bubnikv 2016-09-26 12:42:44 +02:00
parent a506030082
commit 4a13efd081
5 changed files with 204 additions and 4 deletions

View file

@ -6,7 +6,7 @@
namespace Slic3r {
enum SurfaceType { stTop, stBottom, stBottomBridge, stInternal, stInternalSolid, stInternalBridge, stInternalVoid };
enum SurfaceType { stTop, stBottom, stBottomBridge, stInternal, stInternalSolid, stInternalBridge, stInternalVoid, stPerimeter };
class Surface
{
@ -34,10 +34,43 @@ class Surface
typedef std::vector<Surface> Surfaces;
typedef std::vector<Surface*> SurfacesPtr;
inline Polygons to_polygons(const SurfacesPtr &src)
{
Polygons polygons;
for (SurfacesPtr::const_iterator it = src.begin(); it != src.end(); ++it) {
polygons.push_back((*it)->expolygon.contour);
for (Polygons::const_iterator ith = (*it)->expolygon.holes.begin(); ith != (*it)->expolygon.holes.end(); ++ith) {
polygons.push_back(*ith);
}
}
return polygons;
}
#if SLIC3R_CPPVER > 11
inline Polygons to_polygons(SurfacesPtr &&src)
{
Polygons polygons;
for (ExPolygons::const_iterator it = src.begin(); it != src.end(); ++it) {
polygons.push_back(std::move((*it)->expolygon.contour));
for (Polygons::const_iterator ith = (*it)->expolygon.holes.begin(); ith != (*it)->expolygon.holes.end(); ++ith) {
polygons.push_back(std::move(*ith));
}
}
return polygons;
}
#endif
extern BoundingBox get_extents(const Surface &surface);
extern BoundingBox get_extents(const Surfaces &surfaces);
extern BoundingBox get_extents(const SurfacesPtr &surfaces);
class SVG;
extern const char* surface_type_to_color_name(const SurfaceType surface_type);
extern void export_surface_type_legend_to_svg(SVG &svg, const Point &pos);
extern Point export_surface_type_legend_to_svg_box_size();
extern bool export_to_svg(const char *path, const Surfaces &surfaces, const float transparency = 1.f);
}
#endif