Update wrapper for svgfill::arrange_polygons()

This commit is contained in:
Thomas Krijnen
2024-11-06 09:15:59 +01:00
parent 262fca95e3
commit 585821d763
+20
View File
@@ -1121,6 +1121,8 @@ ifcopenshell::geometry::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type
%ignore prefiltered_hlr;
%ignore svgfill::svg_to_line_segments;
%ignore svgfill::line_segments_to_polygons;
%ignore svgfill::svg_to_polygons;
%ignore svgfill::arrange_polygons;
%template(svg_line_segments) std::vector<std::array<svgfill::point_2, 2>>;
%template(svg_groups_of_line_segments) std::vector<std::vector<std::array<svgfill::point_2, 2>>>;
@@ -1228,8 +1230,26 @@ ifcopenshell::geometry::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type
std::vector<std::vector<svgfill::polygon_2>> r;
if (svgfill::line_segments_to_polygons(s, eps, segments, r)) {
return r;
} else {
throw std::runtime_error("Failed process line segments");
}
}
std::vector<svgfill::polygon_2> svg_to_polygons(const std::string& data, const boost::optional<std::string>& class_name) {
std::vector<svgfill::polygon_2> r;
if (svgfill::svg_to_polygons(data, class_name, r)) {
return r;
} else {
throw std::runtime_error("Failed to read SVG");
}
}
std::vector<svgfill::polygon_2> arrange_polygons(const std::vector<svgfill::polygon_2>& polygons) {
std::vector<svgfill::polygon_2> r;
if (svgfill::arrange_polygons(polygons, r)) {
return r;
} else {
throw std::runtime_error("Failed to arrange polygons");
}
}
%}