diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index dc903d0a6f..adb50a2845 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -1405,7 +1405,7 @@ void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool st express::base quantity; std::vector objects; - std::shared_ptr previous_geometry_pointer; + std::shared_ptr previous_geometry_pointer; for (;; ++num_created) { bool has_more = true; diff --git a/src/ifcgeom/conversion_result.cpp b/src/ifcgeom/conversion_result.cpp index d215d6fcd9..b2cf5b2f6a 100644 --- a/src/ifcgeom/conversion_result.cpp +++ b/src/ifcgeom/conversion_result.cpp @@ -1,9 +1,9 @@ #include "conversion_result.h" #include "representation.h" -ifcopenshell::geom::Representation::triangulation* ifcopenshell::geom::conversion_result_shape::Triangulate(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger) const +ifcopenshell::geom::triangulation* ifcopenshell::geom::conversion_result_shape::Triangulate(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger) const { - auto t = ifcopenshell::geom::Representation::triangulation::empty(settings); + auto t = ifcopenshell::geom::triangulation::empty(settings); static ifcopenshell::geom::taxonomy::matrix4 iden; Triangulate(settings, iden, t, -1, -1, logger); return t; diff --git a/src/ifcgeom/conversion_result.h b/src/ifcgeom/conversion_result.h index 6cf1e62f98..c777959ceb 100644 --- a/src/ifcgeom/conversion_result.h +++ b/src/ifcgeom/conversion_result.h @@ -82,9 +82,7 @@ namespace std { namespace ifcopenshell::geom { - namespace Representation { - class IFC_GEOM_API triangulation; - } + class IFC_GEOM_API triangulation; #ifndef SWIG template @@ -509,8 +507,8 @@ namespace ifcopenshell::geom { #else virtual std::string_view backend_id() const = 0; #endif - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const = 0; - ifcopenshell::geom::Representation::triangulation* Triangulate(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const = 0; + ifcopenshell::geom::triangulation* Triangulate(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const = 0; virtual int surface_genus() const = 0; diff --git a/src/ifcgeom/converter.cpp b/src/ifcgeom/converter.cpp index a27af67597..1fe74a9252 100644 --- a/src/ifcgeom/converter.cpp +++ b/src/ifcgeom/converter.cpp @@ -44,7 +44,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for representation_id_builder << representation_node->instance.id(); - ifcopenshell::geom::Representation::brep* shape; + ifcopenshell::geom::brep* shape; std::vector shapes; if (!kernel_->convert(representation_node, shapes)) { @@ -254,7 +254,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for } } - shape = new ifcopenshell::geom::Representation::brep(settings_, product_type, representation_id_builder.str(), shapes); + shape = new ifcopenshell::geom::brep(settings_, product_type, representation_id_builder.str(), shapes); std::string context_string = ""; @@ -280,7 +280,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for guid, context_string, place, - std::shared_ptr(shape), + std::shared_ptr(shape), product ); diff --git a/src/ifcgeom/converter.h b/src/ifcgeom/converter.h index 1adbafbff7..e2567ae25e 100644 --- a/src/ifcgeom/converter.h +++ b/src/ifcgeom/converter.h @@ -16,7 +16,7 @@ namespace ifcopenshell { namespace geom { class IFC_GEOM_API converter { public: - typedef std::shared_ptr brep_ptr; + typedef std::shared_ptr brep_ptr; private: ifcopenshell::geom::abstract_mapping* mapping_; std::unique_ptr kernel_; diff --git a/src/ifcgeom/element.h b/src/ifcgeom/element.h index a56ed8ed56..327c08e5cc 100644 --- a/src/ifcgeom/element.h +++ b/src/ifcgeom/element.h @@ -160,12 +160,12 @@ namespace ifcopenshell::geom { class brep_element : public element { private: - std::shared_ptr _geometry; + std::shared_ptr _geometry; public: - const std::shared_ptr& geometry_pointer() const { return _geometry; } - const ifcopenshell::geom::Representation::brep& geometry() const { return *_geometry; } + const std::shared_ptr& geometry_pointer() const { return _geometry; } + const ifcopenshell::geom::brep& geometry() const { return *_geometry; } brep_element(int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid, - const std::string& context, const ifcopenshell::geom::taxonomy::matrix4::ptr& trsf, const std::shared_ptr& geometry, + const std::string& context, const ifcopenshell::geom::taxonomy::matrix4::ptr& trsf, const std::shared_ptr& geometry, const express::entity& product) : element(geometry->settings(), id, parent_id, name, type, guid, context, trsf, product) , _geometry(geometry) @@ -182,15 +182,15 @@ namespace ifcopenshell::geom { class triangulation_element : public element { private: - std::shared_ptr< ifcopenshell::geom::Representation::triangulation > _geometry; + std::shared_ptr< ifcopenshell::geom::triangulation > _geometry; public: - const ifcopenshell::geom::Representation::triangulation& geometry() const { return *_geometry; } - const std::shared_ptr< ifcopenshell::geom::Representation::triangulation>& geometry_pointer() const { return _geometry; } + const ifcopenshell::geom::triangulation& geometry() const { return *_geometry; } + const std::shared_ptr< ifcopenshell::geom::triangulation>& geometry_pointer() const { return _geometry; } triangulation_element(const ifcopenshell::geom::brep_element& shape_model) : element(shape_model) - , _geometry(std::make_shared(shape_model.geometry())) + , _geometry(std::make_shared(shape_model.geometry())) {} - triangulation_element(const ifcopenshell::geom::element& source, const std::shared_ptr& geometry) + triangulation_element(const ifcopenshell::geom::element& source, const std::shared_ptr& geometry) : element(source) , _geometry(geometry) {} @@ -202,12 +202,12 @@ namespace ifcopenshell::geom { class serialized_element : public element { private: - std::shared_ptr _geometry; + std::shared_ptr _geometry; public: - const ifcopenshell::geom::Representation::serialization& geometry() const { return *_geometry; } + const ifcopenshell::geom::serialization& geometry() const { return *_geometry; } serialized_element(const brep_element& shape_model) : element(shape_model) - , _geometry(std::make_shared(shape_model.geometry())) + , _geometry(std::make_shared(shape_model.geometry())) {} serialized_element(const serialized_element& other) = default; private: diff --git a/src/ifcgeom/iterator.cpp b/src/ifcgeom/iterator.cpp index aeeadf1820..b3f385c4cf 100644 --- a/src/ifcgeom/iterator.cpp +++ b/src/ifcgeom/iterator.cpp @@ -303,7 +303,7 @@ void ifcopenshell::geom::iterator::compute_bounds(bool with_geometry) do { auto geom_object = get(); const ifcopenshell::geom::triangulation_element* o = static_cast(geom_object.get()); - const ifcopenshell::geom::Representation::triangulation& mesh = o->geometry(); + const ifcopenshell::geom::triangulation& mesh = o->geometry(); auto mat = o->transformation().data()->ccomponents(); Eigen::Vector4d vec, transformed; diff --git a/src/ifcgeom/iterator.h b/src/ifcgeom/iterator.h index 953d12a64f..623c4d0124 100644 --- a/src/ifcgeom/iterator.h +++ b/src/ifcgeom/iterator.h @@ -22,7 +22,7 @@ * Geometrical data in an IFC file consists of shapes (IfcShapeRepresentation) * * and instances (SUBTYPE OF IfcBuildingElement e.g. IfcWindow). * * * - * ifcopenshell::geom::Representation::triangulation is a class that represents a * + * ifcopenshell::geom::triangulation is a class that represents a * * triangulated IfcShapeRepresentation. * * Triangulation.verts is a 1 dimensional vector of float defining the * * cartesian coordinates of the vertices of the triangulated shape in the * diff --git a/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp b/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp index d2b31c5695..4e8616f653 100644 --- a/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp +++ b/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp @@ -364,7 +364,7 @@ void ifcopenshell::geom::cgal_shape::to_nef() const { } #endif -void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger) const { +void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger) const { if (is_point() || is_wire()) { return; } @@ -1035,7 +1035,7 @@ bool ifcopenshell::geom::cgal_shape::surface_area_along_direction(double tol, co #ifndef IFOPSH_SIMPLE_KERNEL -void ifcopenshell::geom::cgal_shape_half_space_decomposition::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger) const { +void ifcopenshell::geom::cgal_shape_half_space_decomposition::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger) const { throw std::runtime_error("Not implemented"); } diff --git a/src/ifcgeom/kernels/cgal/cgal_conversion_result.h b/src/ifcgeom/kernels/cgal/cgal_conversion_result.h index d523236617..802f76c7b9 100644 --- a/src/ifcgeom/kernels/cgal/cgal_conversion_result.h +++ b/src/ifcgeom/kernels/cgal/cgal_conversion_result.h @@ -226,7 +226,7 @@ namespace ifcopenshell { namespace geom { const cgal_point& point() const { return std::get(*shape_); } const cgal_wire& wire() const { return std::get(*shape_); } - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual ifcopenshell::geom::conversion_result_shape* clone() const { @@ -319,7 +319,7 @@ namespace ifcopenshell { namespace geom { #endif } - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual int surface_genus() const; diff --git a/src/ifcgeom/kernels/manifold/manifold_conversion_result.cpp b/src/ifcgeom/kernels/manifold/manifold_conversion_result.cpp index 37c75f642e..90dfb6ca05 100644 --- a/src/ifcgeom/kernels/manifold/manifold_conversion_result.cpp +++ b/src/ifcgeom/kernels/manifold/manifold_conversion_result.cpp @@ -215,7 +215,7 @@ std::optional ifcopenshell::geom::manifold_shape::as_manifol return manifold::Manifold::BatchBoolean(solids, manifold::OpType::Add); } -void ifcopenshell::geom::manifold_shape::Triangulate(ifcopenshell::geom::settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger&) const { +void ifcopenshell::geom::manifold_shape::Triangulate(ifcopenshell::geom::settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger&) const { for (const auto& part : parts_) { auto mesh = transform_mesh(part.mesh, place); std::vector indices(mesh.NumVert()); diff --git a/src/ifcgeom/kernels/manifold/manifold_conversion_result.h b/src/ifcgeom/kernels/manifold/manifold_conversion_result.h index 5e6ab07af3..67ea711d2c 100644 --- a/src/ifcgeom/kernels/manifold/manifold_conversion_result.h +++ b/src/ifcgeom/kernels/manifold/manifold_conversion_result.h @@ -40,7 +40,7 @@ public: std::optional as_manifold() const; virtual std::string_view backend_id() const { return "manifold"; } - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual int surface_genus() const; diff --git a/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.cpp b/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.cpp index 8402456a96..484af4648f 100644 --- a/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.cpp +++ b/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.cpp @@ -68,7 +68,7 @@ ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::open_cascade_sh return new open_cascade_shape(shape_); } -void ifcopenshell::geom::open_cascade_shape::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger) const { +void ifcopenshell::geom::open_cascade_shape::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger) const { // @todo remove duplication with open_cascade_kernel::convert(const taxonomy::matrix4::ptr matrix, gp_GTrsf& trsf); // above can be static? @@ -257,7 +257,7 @@ void ifcopenshell::geom::open_cascade_shape::Triangulate(ifcopenshell::geom::set } if (!t->normals().empty() && settings.get().get()) { - t->uvs_ref() = ifcopenshell::geom::Representation::triangulation::box_project_uvs(t->verts(), t->normals()); + t->uvs_ref() = ifcopenshell::geom::triangulation::box_project_uvs(t->verts(), t->normals()); } if (num_faces == 0) { diff --git a/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.h b/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.h index 8e60189e4d..64623891f1 100644 --- a/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.h +++ b/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.h @@ -49,7 +49,7 @@ namespace ifcopenshell { operator const TopoDS_Shape& (); virtual std::string_view backend_id() const; - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual ifcopenshell::geom::conversion_result_shape* clone() const; diff --git a/src/ifcgeom/kernels/opencascade/opencascade_kernel.cpp b/src/ifcgeom/kernels/opencascade/opencascade_kernel.cpp index 517eae631d..1a58c23a40 100644 --- a/src/ifcgeom/kernels/opencascade/opencascade_kernel.cpp +++ b/src/ifcgeom/kernels/opencascade/opencascade_kernel.cpp @@ -374,7 +374,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // // representation_id_builder << representation->data().id(); // -// ifcopenshell::geom::Representation::brep* shape; +// ifcopenshell::geom::brep* shape; // std::vector shapes, shapes2; // // if (!convert_shapes(representation, shapes)) { @@ -524,16 +524,16 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // trsf = gp_Trsf(); // representation_id_builder << "-world-coords"; // } -// shape = new ifcopenshell::geom::Representation::brep(element_settings, representation_id_builder.str(), opened_shapes); +// shape = new ifcopenshell::geom::brep(element_settings, representation_id_builder.str(), opened_shapes); // } else if (settings.get(IteratorSettings::USE_WORLD_COORDS)) { // for (std::vector::iterator it = shapes.begin(); it != shapes.end(); ++it) { // it->prepend(trsf); // } // trsf = gp_Trsf(); // representation_id_builder << "-world-coords"; -// shape = new ifcopenshell::geom::Representation::brep(element_settings, representation_id_builder.str(), shapes); +// shape = new ifcopenshell::geom::brep(element_settings, representation_id_builder.str(), shapes); // } else { -// shape = new ifcopenshell::geom::Representation::brep(element_settings, representation_id_builder.str(), shapes); +// shape = new ifcopenshell::geom::brep(element_settings, representation_id_builder.str(), shapes); // } // // std::string context_string = ""; @@ -551,7 +551,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // guid, // context_string, // trsf, -// std::shared_ptr(shape), +// std::shared_ptr(shape), // product // ); // diff --git a/src/ifcgeom/kernels/passthrough/passthrough_conversion_result.cpp b/src/ifcgeom/kernels/passthrough/passthrough_conversion_result.cpp index 1e3e3efd45..afb2c53ef2 100644 --- a/src/ifcgeom/kernels/passthrough/passthrough_conversion_result.cpp +++ b/src/ifcgeom/kernels/passthrough/passthrough_conversion_result.cpp @@ -286,7 +286,7 @@ ifcopenshell::geom::passthrough_shape::passthrough_shape(const std::vector&& parts) : parts_(normalize_parts(parts)) {} -void ifcopenshell::geom::passthrough_shape::Triangulate(ifcopenshell::geom::settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger&) const { +void ifcopenshell::geom::passthrough_shape::Triangulate(ifcopenshell::geom::settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger&) const { auto mesh = build_mesh(parts_, &place); std::vector indices(mesh.vertices.size()); for (size_t i = 0; i < mesh.vertices.size(); ++i) { diff --git a/src/ifcgeom/kernels/passthrough/passthrough_conversion_result.h b/src/ifcgeom/kernels/passthrough/passthrough_conversion_result.h index 37044b9fe9..c2dd7d1360 100644 --- a/src/ifcgeom/kernels/passthrough/passthrough_conversion_result.h +++ b/src/ifcgeom/kernels/passthrough/passthrough_conversion_result.h @@ -24,7 +24,7 @@ public: const std::vector& parts() const { return parts_; } virtual std::string_view backend_id() const { return "passthrough"; } - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual int surface_genus() const; diff --git a/src/ifcgeom/representation.cpp b/src/ifcgeom/representation.cpp index bb3689ee60..265aa708b8 100644 --- a/src/ifcgeom/representation.cpp +++ b/src/ifcgeom/representation.cpp @@ -19,7 +19,7 @@ #include "representation.h" -ifcopenshell::geom::Representation::serialization::serialization(const brep& brep) +ifcopenshell::geom::serialization::serialization(const brep& brep) : representation(brep.settings(), brep.entity(), brep.id()) { for (auto it = brep.begin(); it != brep.end(); ++it) { @@ -53,7 +53,7 @@ ifcopenshell::geom::Representation::serialization::serialization(const brep& bre delete comp; } -ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::Representation::brep::as_compound(bool force_meters) const { +ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::brep::as_compound(bool force_meters) const { conversion_result_shape* accum = nullptr; for (auto it = begin(); it != end(); ++it) { @@ -75,7 +75,7 @@ ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::Representation: return accum; } -bool ifcopenshell::geom::Representation::brep::calculate_surface_area(double& area) const { +bool ifcopenshell::geom::brep::calculate_surface_area(double& area) const { std::unique_ptr s(as_compound()); if (!s) { area = 0.; @@ -85,7 +85,7 @@ bool ifcopenshell::geom::Representation::brep::calculate_surface_area(double& ar return true; } -bool ifcopenshell::geom::Representation::brep::calculate_volume(double& volume) const { +bool ifcopenshell::geom::brep::calculate_volume(double& volume) const { std::unique_ptr s(as_compound()); if (!s) { volume = 0.; @@ -95,7 +95,7 @@ bool ifcopenshell::geom::Representation::brep::calculate_volume(double& volume) return true; } -bool ifcopenshell::geom::Representation::brep::calculate_projected_surface_area(const ifcopenshell::geom::taxonomy::matrix4::ptr& place, double& along_x, double& along_y, double& along_z) const { +bool ifcopenshell::geom::brep::calculate_projected_surface_area(const ifcopenshell::geom::taxonomy::matrix4::ptr& place, double& along_x, double& along_y, double& along_z) const { along_x = along_y = along_z = 0.; for (std::vector::const_iterator it = begin(); it != end(); ++it) { @@ -116,7 +116,7 @@ bool ifcopenshell::geom::Representation::brep::calculate_projected_surface_area( return true; } -ifcopenshell::geom::Representation::triangulation::triangulation(const brep& shape_model) +ifcopenshell::geom::triangulation::triangulation(const brep& shape_model) : representation(shape_model.settings(), shape_model.entity(), shape_model.id()) , weld_offset_(0) { @@ -154,7 +154,7 @@ ifcopenshell::geom::Representation::triangulation::triangulation(const brep& sha /// Generates UVs for a single mesh using box projection. /// @todo Very simple impl. Assumes that input vertices and normals match 1:1. -std::vector ifcopenshell::geom::Representation::triangulation::box_project_uvs(const std::vector& vertices, const std::vector& normals) +std::vector ifcopenshell::geom::triangulation::box_project_uvs(const std::vector& vertices, const std::vector& normals) { std::vector uvs; uvs.resize(vertices.size() / 3 * 2); @@ -182,7 +182,7 @@ std::vector ifcopenshell::geom::Representation::triangulation::box_proje return uvs; } -int ifcopenshell::geom::Representation::triangulation::addVertex(int item_id, int material_index, double pX, double pY, double pZ) { +int ifcopenshell::geom::triangulation::addVertex(int item_id, int material_index, double pX, double pY, double pZ) { const bool convert = settings().get().get(); auto unit_magnitude = settings().get().get(); const double X = convert ? (pX /unit_magnitude) : pX; @@ -205,12 +205,12 @@ int ifcopenshell::geom::Representation::triangulation::addVertex(int item_id, in return i; } -void ifcopenshell::geom::Representation::triangulation::registerEdgeCount(int n1, int n2, std::map, int>& edgecount) { +void ifcopenshell::geom::triangulation::registerEdgeCount(int n1, int n2, std::map, int>& edgecount) { const edge e = edge((std::min)(n1, n2), (std::max)(n1, n2)); edgecount[e] ++; } -const ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::Representation::brep::item(int i) const { +const ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::brep::item(int i) const { if (i >= 0 && i < shapes_.size()) { return shapes_[i].Shape()->moved(shapes_[i].Placement()); } else { @@ -218,7 +218,7 @@ const ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::Represent } } -int ifcopenshell::geom::Representation::brep::item_id(int i) const { +int ifcopenshell::geom::brep::item_id(int i) const { if (i >= 0 && i < shapes_.size()) { return shapes_[i].ItemId(); } else { diff --git a/src/ifcgeom/representation.h b/src/ifcgeom/representation.h index f0caae7c5a..d32d400777 100644 --- a/src/ifcgeom/representation.h +++ b/src/ifcgeom/representation.h @@ -27,8 +27,6 @@ namespace ifcopenshell::geom { - namespace Representation { - class IFC_GEOM_API representation { representation(const representation&); //N/A representation& operator =(const representation&); //N/A @@ -235,7 +233,6 @@ namespace ifcopenshell::geom { triangulation& operator=(const triangulation&); }; - } } #endif diff --git a/src/ifcwrap/IfcGeomWrapper.i b/src/ifcwrap/IfcGeomWrapper.i index c8142f3668..8cc9b81ff9 100644 --- a/src/ifcwrap/IfcGeomWrapper.i +++ b/src/ifcwrap/IfcGeomWrapper.i @@ -21,7 +21,7 @@ // Keep the established Python API names while the underlying C++ types use // snake_case. -%rename("BRep") ifcopenshell::geom::Representation::brep; +%rename("BRep") ifcopenshell::geom::brep; %rename("BRepElement") ifcopenshell::geom::brep_element; %rename("ConversionResult") ifcopenshell::geom::conversion_result; %rename("ConversionResultShape") ifcopenshell::geom::conversion_result_shape; @@ -29,12 +29,12 @@ %rename("GeometrySerializer") ifcopenshell::geom::geometry_serializer; %rename("Iterator") ifcopenshell::geom::iterator; %rename("OpaqueNumber") ifcopenshell::geom::opaque_number; -%rename("Representation") ifcopenshell::geom::Representation::representation; -%rename("Serialization") ifcopenshell::geom::Representation::serialization; +%rename("Representation") ifcopenshell::geom::representation; +%rename("Serialization") ifcopenshell::geom::serialization; %rename("SerializedElement") ifcopenshell::geom::serialized_element; %rename("Settings") ifcopenshell::geom::settings; %rename("Transformation") ifcopenshell::geom::transformation; -%rename("Triangulation") ifcopenshell::geom::Representation::triangulation; +%rename("Triangulation") ifcopenshell::geom::triangulation; %rename("TriangulationElement") ifcopenshell::geom::triangulation_element; %rename("WriteOnlyGeometrySerializer") ifcopenshell::geom::write_only_geometry_serializer; @@ -125,8 +125,8 @@ $result = SWIG_NewPointerObj(SWIG_as_voidptr($1.release()), SWIGTYPE_p_ifcopenshell__geom__brep_element, SWIG_POINTER_OWN); } -%newobject ifcopenshell::geom::Representation::brep::item; -%newobject ifcopenshell::geom::Representation::brep::as_compound; +%newobject ifcopenshell::geom::brep::item; +%newobject ifcopenshell::geom::brep::as_compound; %newobject ifcopenshell::geom::conversion_result_shape::halfspaces; %newobject ifcopenshell::geom::conversion_result_shape::box; @@ -687,10 +687,10 @@ struct shape_rtti : public boost::static_visitor return SWIG_Py_Void(); } } - PyObject* operator()(ifcopenshell::geom::Representation::representation* representation) const { - ifcopenshell::geom::Representation::serialization* serialized_representation = dynamic_cast(representation); - ifcopenshell::geom::Representation::triangulation* triangulated_representation = dynamic_cast(representation); - ifcopenshell::geom::Representation::brep* brep_representation = dynamic_cast(representation); + PyObject* operator()(ifcopenshell::geom::representation* representation) const { + ifcopenshell::geom::serialization* serialized_representation = dynamic_cast(representation); + ifcopenshell::geom::triangulation* triangulated_representation = dynamic_cast(representation); + ifcopenshell::geom::brep* brep_representation = dynamic_cast(representation); if (serialized_representation) { return SWIG_NewPointerObj(SWIG_as_voidptr(serialized_representation), SWIGTYPE_p_ifcopenshell__geom__Representation__serialization, SWIG_POINTER_OWN); } else if (triangulated_representation) { @@ -708,9 +708,9 @@ struct shape_rtti : public boost::static_visitor %} // Note that these elements ARE to be owned by SWIG/Python -%typemap(out) std::variant { +%typemap(out) std::variant { // See which type is set and return appropriate - $result = std::visit(shape_rtti(), (std::variant) $1); + $result = std::visit(shape_rtti(), (std::variant) $1); } %newobject construct_iterator; @@ -782,7 +782,7 @@ struct shape_rtti : public boost::static_visitor } %} -%extend ifcopenshell::geom::Representation::triangulation { +%extend ifcopenshell::geom::triangulation { std::pair faces_buffer() const { return vector_to_buffer(self->faces()); @@ -869,14 +869,14 @@ struct shape_rtti : public boost::static_visitor %} }; -%extend ifcopenshell::geom::Representation::representation { +%extend ifcopenshell::geom::representation { %pythoncode %{ # Hide the getters with read-only property implementations id = property(id) %} }; -%extend ifcopenshell::geom::Representation::serialization { +%extend ifcopenshell::geom::serialization { %pythoncode %{ # Hide the getters with read-only property implementations brep_data = property(brep_data) @@ -983,7 +983,7 @@ struct shape_rtti : public boost::static_visitor return oss.str(); } - static std::variant helper_fn_create_shape(logger& logger, const std::string& geometry_library, ifcopenshell::geom::settings& settings, const express::base& instance, const express::base& representation = express::base()) { + static std::variant helper_fn_create_shape(logger& logger, const std::string& geometry_library, ifcopenshell::geom::settings& settings, const express::base& instance, const express::base& representation = express::base()) { ifcopenshell::file* file = instance.file(); ifcopenshell::geom::converter kernel(ifcopenshell::geom::kernels::construct(file, geometry_library, settings), file, settings, logger); @@ -1045,12 +1045,12 @@ struct shape_rtti : public boost::static_visitor throw ifcopenshell::exception("Failed to process shape. Instance: " + oss.str()); } - ifcopenshell::geom::Representation::brep brep(kernel.settings(), instance.declaration().name(), to_locale_invariant_string(instance.id()), shapes); + ifcopenshell::geom::brep brep(kernel.settings(), instance.declaration().name(), to_locale_invariant_string(instance.id()), shapes); try { if (settings.get().get() == ifcopenshell::geom::settings::SERIALIZED) { - return new ifcopenshell::geom::Representation::serialization(brep); + return new ifcopenshell::geom::serialization(brep); } else if (settings.get().get() == ifcopenshell::geom::settings::TRIANGULATED) { - return new ifcopenshell::geom::Representation::triangulation(brep); + return new ifcopenshell::geom::triangulation(brep); } } catch (...) { throw ifcopenshell::exception("error during shape serialization"); @@ -1060,7 +1060,7 @@ struct shape_rtti : public boost::static_visitor throw ifcopenshell::exception("Invalid additional representation specified"); } } - return std::variant(); + return std::variant(); } %} @@ -1099,12 +1099,12 @@ ifcopenshell::geom::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type_inf %} %inline %{ - static std::variant create_shape(ifcopenshell::geom::settings& settings, const express::base& instance, const express::base& representation, const char* const geometry_library="opencascade", ifcopenshell::logger* logger = nullptr) { + static std::variant create_shape(ifcopenshell::geom::settings& settings, const express::base& instance, const express::base& representation, const char* const geometry_library="opencascade", ifcopenshell::logger* logger = nullptr) { return helper_fn_create_shape(ifcopenshell::logger_or_root(logger), geometry_library, settings, instance, representation); } // Manual definition of overload without representation argument - static std::variant create_shape(ifcopenshell::geom::settings& settings, const express::base& instance, const char* const geometry_library="opencascade", ifcopenshell::logger* logger = nullptr) { + static std::variant create_shape(ifcopenshell::geom::settings& settings, const express::base& instance, const char* const geometry_library="opencascade", ifcopenshell::logger* logger = nullptr) { return create_shape(settings, instance, express::base(), geometry_library, logger); } %} @@ -1168,7 +1168,7 @@ ifcopenshell::geom::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type_inf %extend ifcopenshell::geom::conversion_result_shape { std::string serialize_obj() { ifcopenshell::geom::settings settings; - std::unique_ptr triangulation($self->Triangulate(settings)); + std::unique_ptr triangulation($self->Triangulate(settings)); std::ostringstream result; for (auto it = triangulation->verts().begin(); it != triangulation->verts().end();) { diff --git a/src/serializers/collada_serializer.cpp b/src/serializers/collada_serializer.cpp index 27e6efa359..5223fa35bb 100644 --- a/src/serializers/collada_serializer.cpp +++ b/src/serializers/collada_serializer.cpp @@ -386,7 +386,7 @@ void collada_serializer::collada_exporter::startDocument(const std::string& unit void collada_serializer::collada_exporter::write(const ifcopenshell::geom::triangulation_element* o) { - const ifcopenshell::geom::Representation::triangulation& mesh = o->geometry(); + const ifcopenshell::geom::triangulation& mesh = o->geometry(); BOOST_FOREACH(const ifcopenshell::geom::taxonomy::style::ptr& material, mesh.materials()) { materials.add(material); } diff --git a/src/serializers/usd_serializer.cpp b/src/serializers/usd_serializer.cpp index f02632c940..b49c7bcfaa 100644 --- a/src/serializers/usd_serializer.cpp +++ b/src/serializers/usd_serializer.cpp @@ -203,7 +203,7 @@ void usd_serializer::write(const ifcopenshell::geom::triangulation_element* o) { } pxr::UsdGeomXform usd_mesh_container = writeNode(o); // writeNode(o); auto usd_mesh = pxr::UsdGeomMesh::Define(stage_, pxr::SdfPath(usd_mesh_container.GetPath().GetString() + "/" + o->context())); - const ifcopenshell::geom::Representation::triangulation& mesh = o->geometry(); + const ifcopenshell::geom::triangulation& mesh = o->geometry(); const auto verts = mesh.verts(); const auto faces = mesh.faces(); const auto material_ids = mesh.material_ids(); diff --git a/src/serializers/wavefront_obj_serializer.cpp b/src/serializers/wavefront_obj_serializer.cpp index bf891f5d9f..1c11c7a04b 100644 --- a/src/serializers/wavefront_obj_serializer.cpp +++ b/src/serializers/wavefront_obj_serializer.cpp @@ -92,7 +92,7 @@ void wavefront_obj_serializer::write(const ifcopenshell::geom::triangulation_ele obj_stream.stream << "s 1" << "\n"; const bool isyup = settings().get().get(); - const ifcopenshell::geom::Representation::triangulation& mesh = o->geometry(); + const ifcopenshell::geom::triangulation& mesh = o->geometry(); size_t vcount = mesh.verts().size() / 3; size_t ncount = mesh.normals().size() / 3;