mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 13:36:25 +00:00
Last minute refactoring
This commit is contained in:
@@ -38,7 +38,7 @@ if ( it != cache.T.end() ) { e = it->second; return true; }
|
||||
*/
|
||||
|
||||
#ifdef IFOPSH_SIMPLE_KERNEL
|
||||
#define CgalKernel SimpleCgalKernel
|
||||
#define cgal_kernel SimpleCgalKernel
|
||||
#define create_cube create_cube_simple
|
||||
#define create_polyhedron create_polyhedron_simple
|
||||
#endif
|
||||
@@ -56,22 +56,22 @@ if ( it != cache.T.end() ) { e = it->second; return true; }
|
||||
#include <cmath>
|
||||
|
||||
namespace ifcopenshell {
|
||||
namespace geometry {
|
||||
namespace geom {
|
||||
namespace utils {
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<Kernel_> create_cube(double d);
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<Kernel_> create_cube(const Kernel_::Point_3& lower, const Kernel_::Point_3& upper);
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<Kernel_> create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders = false, logger& logger = ::logger::root());
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_cube(double d);
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_cube(const kernel_::Point_3& lower, const kernel_::Point_3& upper);
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders = false, logger& logger = ::logger::root());
|
||||
|
||||
#ifndef IFOPSH_SIMPLE_KERNEL
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<Kernel_> create_polyhedron(const CGAL::Nef_polyhedron_3<Kernel_> &nef_polyhedron, logger& logger = ::logger::root());
|
||||
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<Kernel_> create_nef_polyhedron(std::list<cgal_face_t> &face_list, logger& logger = ::logger::root());
|
||||
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<Kernel_> create_nef_polyhedron(CGAL::Polyhedron_3<Kernel_> &polyhedron, logger& logger = ::logger::root());
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_polyhedron(const CGAL::Nef_polyhedron_3<kernel_> &nef_polyhedron, logger& logger = ::logger::root());
|
||||
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<kernel_> create_nef_polyhedron(std::list<cgal_face_t> &face_list, logger& logger = ::logger::root());
|
||||
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<kernel_> create_nef_polyhedron(CGAL::Polyhedron_3<kernel_> &polyhedron, logger& logger = ::logger::root());
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace kernels {
|
||||
|
||||
class IFC_GEOMLIBRARY_API CgalKernel : public AbstractKernel {
|
||||
class IFC_GEOMLIBRARY_API cgal_kernel : public abstract_kernel {
|
||||
private:
|
||||
#ifndef IFOPSH_SIMPLE_KERNEL
|
||||
enum boolean_operand_preprocess {
|
||||
@@ -82,23 +82,23 @@ namespace ifcopenshell {
|
||||
PP_NONE
|
||||
};
|
||||
|
||||
bool preprocess_boolean_operand(const express::Base& log_reference, const std::list<cgal_shape_t>& first_operands, const std::list<CGAL::Nef_polyhedron_3<Kernel_>>& first_operands_nef, const std::list<Kernel_::Plane_3>& all_operand_planes, const cgal_shape_t& shape_const, CGAL::Nef_polyhedron_3<Kernel_>& result, boolean_operand_preprocess proc);
|
||||
bool preprocess_boolean_operand(const express::base& log_reference, const std::list<cgal_shape_t>& first_operands, const std::list<CGAL::Nef_polyhedron_3<kernel_>>& first_operands_nef, const std::list<kernel_::Plane_3>& all_operand_planes, const cgal_shape_t& shape_const, CGAL::Nef_polyhedron_3<kernel_>& result, boolean_operand_preprocess proc);
|
||||
|
||||
bool thin_solid(const CGAL::Nef_polyhedron_3<Kernel_>& a, CGAL::Nef_polyhedron_3<Kernel_>& result);
|
||||
bool thin_solid(const CGAL::Nef_polyhedron_3<kernel_>& a, CGAL::Nef_polyhedron_3<kernel_>& result);
|
||||
|
||||
CGAL::Nef_polyhedron_3<Kernel_> create_precision_cube_() const {
|
||||
CGAL::Nef_polyhedron_3<kernel_> create_precision_cube_() const {
|
||||
auto cc = utils::create_cube(settings_.get<settings::Precision>().get());
|
||||
return CGAL::Nef_polyhedron_3<Kernel_>(cc);
|
||||
return CGAL::Nef_polyhedron_3<kernel_>(cc);
|
||||
}
|
||||
#endif
|
||||
public:
|
||||
|
||||
CgalKernel(const Settings& settings, ::logger& logger = ::logger::root())
|
||||
: AbstractKernel("cgal", settings, logger)
|
||||
cgal_kernel(const ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root())
|
||||
: abstract_kernel("cgal", settings, logger)
|
||||
{}
|
||||
|
||||
virtual AbstractKernel* clone(::logger& logger) const {
|
||||
return new CgalKernel(settings(), logger);
|
||||
virtual abstract_kernel* clone(::logger& logger) const {
|
||||
return new cgal_kernel(settings(), logger);
|
||||
}
|
||||
|
||||
virtual bool supports_boolean_operations() const {
|
||||
@@ -116,19 +116,19 @@ namespace ifcopenshell {
|
||||
bool convert(const taxonomy::shell::ptr, cgal_shape_t&);
|
||||
|
||||
bool process_extrusion(const cgal_face_t& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_shape_t& shape);
|
||||
bool process_as_2d_polygon(const taxonomy::boolean_result::ptr br, std::list<CGAL::Polygon_2<Kernel_>>& loops, double& z0, double& z1);
|
||||
bool process_as_2d_polygon(const std::list<std::list<std::pair<express::Base, cgal_shape_t>>>& operands, std::list<CGAL::Polygon_2<Kernel_>>& loops, double& z0, double& z1);
|
||||
bool process_as_2d_polygon(const taxonomy::boolean_result::ptr br, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1);
|
||||
bool process_as_2d_polygon(const std::list<std::list<std::pair<express::base, cgal_shape_t>>>& operands, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1);
|
||||
|
||||
virtual bool convert_impl(const taxonomy::shell::ptr, IfcGeom::ConversionResults&);
|
||||
virtual bool convert_impl(const taxonomy::extrusion::ptr, IfcGeom::ConversionResults&);
|
||||
virtual bool convert_impl(const taxonomy::boolean_result::ptr, IfcGeom::ConversionResults&);
|
||||
virtual bool convert_impl(const taxonomy::solid::ptr, IfcGeom::ConversionResults&);
|
||||
virtual bool convert_impl(const taxonomy::shell::ptr, ifcopenshell::geom::conversion_results&);
|
||||
virtual bool convert_impl(const taxonomy::extrusion::ptr, ifcopenshell::geom::conversion_results&);
|
||||
virtual bool convert_impl(const taxonomy::boolean_result::ptr, ifcopenshell::geom::conversion_results&);
|
||||
virtual bool convert_impl(const taxonomy::solid::ptr, ifcopenshell::geom::conversion_results&);
|
||||
|
||||
virtual bool convert_openings(const express::Base& entity, const std::vector<std::pair<taxonomy::ptr, ifcopenshell::geometry::taxonomy::matrix4>>& openings,
|
||||
const IfcGeom::ConversionResults& entity_shapes, const ifcopenshell::geometry::taxonomy::matrix4& entity_trsf, IfcGeom::ConversionResults& cut_shapes);
|
||||
virtual bool convert_openings(const express::base& entity, const std::vector<std::pair<taxonomy::ptr, ifcopenshell::geom::taxonomy::matrix4>>& openings,
|
||||
const ifcopenshell::geom::conversion_results& entity_shapes, const ifcopenshell::geom::taxonomy::matrix4& entity_trsf, ifcopenshell::geom::conversion_results& cut_shapes);
|
||||
|
||||
#ifndef IFOPSH_SIMPLE_KERNEL
|
||||
CGAL::Nef_polyhedron_3<Kernel_> precision_cube() const { return create_precision_cube_(); }
|
||||
CGAL::Nef_polyhedron_3<kernel_> precision_cube() const { return create_precision_cube_(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user