mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 11:43:53 +00:00
#1153 work on embedding svgfill in ifcopenshell wrapper
This commit is contained in:
@@ -53,12 +53,12 @@ IF (WIN32 AND NOT PYTHON_DEBUG_LIBRARIES)
|
||||
ENDIF()
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(IfcPython.i PROPERTIES CPLUSPLUS ON)
|
||||
SWIG_ADD_MODULE(ifcopenshell_wrapper python IfcPython.i)
|
||||
swig_add_library(ifcopenshell_wrapper LANGUAGE python SOURCES IfcPython.i)
|
||||
if("$ENV{LDFLAGS}" MATCHES ".undefined.suppress")
|
||||
# On osx there is some state in the python dylib. With `-Wl,undefined,suppress` we can ignore the missing symbols at compile time.
|
||||
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES})
|
||||
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} libsvgfill)
|
||||
else()
|
||||
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper ${IFCOPENSHELL_LIBRARIES} ${PYTHON_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES})
|
||||
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper ${IFCOPENSHELL_LIBRARIES} ${PYTHON_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} libsvgfill)
|
||||
endif()
|
||||
if ((NOT WIN32) AND BUILD_SHARED_LIBS)
|
||||
SET_INSTALL_RPATHS(${SWIG_MODULE_ifcopenshell_wrapper_REAL_NAME} "${IFCDIRS};${OCC_LIBRARY_DIR}")
|
||||
|
||||
@@ -502,3 +502,42 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
||||
return IfcGeom::tesselate(schema_name, shp, d);
|
||||
}
|
||||
%}
|
||||
|
||||
%ignore svgfill::svg_to_line_segments;
|
||||
%ignore svgfill::line_segments_to_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>>>;
|
||||
%template(svg_point) std::array<double, 2>;
|
||||
%template(line_segment) std::array<svgfill::point_2, 2>;
|
||||
%template(svg_polygons) std::vector<svgfill::polygon_2>;
|
||||
%template(svg_groups_of_polygons) std::vector<std::vector<svgfill::polygon_2>>;
|
||||
%template(svg_loop) std::vector<std::array<double, 2>>;
|
||||
%template(svg_loops) std::vector<std::vector<std::array<double, 2>>>;
|
||||
|
||||
%naturalvar svgfill::polygon_2::boundary;
|
||||
%naturalvar svgfill::polygon_2::inner_boundaries;
|
||||
%naturalvar svgfill::polygon_2::point_inside;
|
||||
|
||||
%include "../svgfill/src/svgfill.h"
|
||||
|
||||
%inline %{
|
||||
std::vector<std::vector<svgfill::line_segment_2>> svg_to_line_segments(const std::string& data, const boost::optional<std::string>& class_name) {
|
||||
std::vector<std::vector<svgfill::line_segment_2>> r;
|
||||
if (svgfill::svg_to_line_segments(data, class_name, r)) {
|
||||
return r;
|
||||
} else {
|
||||
throw std::runtime_error("Failed to read SVG");
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::vector<svgfill::polygon_2>> line_segments_to_polygons(svgfill::solver s, double eps, const std::vector<std::vector<svgfill::line_segment_2>>& segments) {
|
||||
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 to read SVG");
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
%}
|
||||
|
||||
%include "std_array.i"
|
||||
%include "std_vector.i"
|
||||
%include "std_string.i"
|
||||
%include "exception.i"
|
||||
|
||||
@@ -111,6 +112,8 @@
|
||||
#include "../ifcparse/IfcSchema.h"
|
||||
#include "../ifcparse/utils.h"
|
||||
|
||||
#include "../svgfill/src/svgfill.h"
|
||||
|
||||
#include <BRepTools_ShapeSet.hxx>
|
||||
%}
|
||||
|
||||
@@ -155,6 +158,8 @@
|
||||
#include "../ifcparse/IfcSchema.h"
|
||||
#include "../ifcparse/utils.h"
|
||||
|
||||
#include "../svgfill/src/svgfill.h"
|
||||
|
||||
#include <BRepTools_ShapeSet.hxx>
|
||||
%}
|
||||
|
||||
|
||||
Submodule
+1
Submodule src/svgfill added at 77f2329351
Reference in New Issue
Block a user