mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-02 04:59:52 +00:00
Update wrapper for svgfill::arrange_polygons()
This commit is contained in:
@@ -1121,6 +1121,8 @@ ifcopenshell::geometry::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type
|
|||||||
%ignore prefiltered_hlr;
|
%ignore prefiltered_hlr;
|
||||||
%ignore svgfill::svg_to_line_segments;
|
%ignore svgfill::svg_to_line_segments;
|
||||||
%ignore svgfill::line_segments_to_polygons;
|
%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_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>>>;
|
%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;
|
std::vector<std::vector<svgfill::polygon_2>> r;
|
||||||
if (svgfill::line_segments_to_polygons(s, eps, segments, r)) {
|
if (svgfill::line_segments_to_polygons(s, eps, segments, r)) {
|
||||||
return 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 {
|
} else {
|
||||||
throw std::runtime_error("Failed to read SVG");
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|||||||
Reference in New Issue
Block a user