diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index 3c12cefde6..373ecf9399 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -920,7 +920,7 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } - IfcGeom::Iterator tmp_context_iterator(settings, ifc_file, filter_funcs, num_threads); + IfcGeom::Iterator tmp_context_iterator(settings, ifc_file, filter_funcs, num_threads); time_t start, end; time(&start); @@ -961,7 +961,7 @@ int main(int argc, char** argv) { Logger::Notice(msg.str()); } - IfcGeom::Iterator context_iterator(settings, ifc_file, filter_funcs, num_threads); + IfcGeom::Iterator context_iterator(settings, ifc_file, filter_funcs, num_threads); if (!context_iterator.initialize()) { /// @todo It would be nice to know and print separate error prints for a case where we found no entities /// and for a case we found no entities that satisfy our filtering criteria. @@ -1074,15 +1074,15 @@ int main(int argc, char** argv) { do { - IfcGeom::Element *geom_object = context_iterator.get(); + IfcGeom::Element* geom_object = context_iterator.get(); if (is_tesselated) { - serializer->write(static_cast*>(geom_object)); + serializer->write(static_cast(geom_object)); } else { - serializer->write(static_cast*>(geom_object)); + serializer->write(static_cast(geom_object)); } if (!no_progress) { @@ -1485,7 +1485,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std settings.set(IfcGeom::IteratorSettings::CONVERT_BACK_UNITS, true); settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true); - IfcGeom::Iterator context_iterator(settings, &f); + IfcGeom::Iterator context_iterator(settings, &f); if (!context_iterator.initialize()) { return; @@ -1526,7 +1526,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std if (num_created) { has_more = context_iterator.next(); } - IfcGeom::BRepElement* geom_object = nullptr; + IfcGeom::BRepElement* geom_object = nullptr; if (has_more) { geom_object = context_iterator.get_native(); } diff --git a/src/ifcgeom/IfcGeom.h b/src/ifcgeom/IfcGeom.h index a02036a9b7..c34ec5dd2d 100644 --- a/src/ifcgeom/IfcGeom.h +++ b/src/ifcgeom/IfcGeom.h @@ -434,13 +434,11 @@ public: std::pair initializeUnits(IfcSchema::IfcUnitAssignment*); - template - IfcGeom::BRepElement* create_brep_for_representation_and_product( + IfcGeom::BRepElement* create_brep_for_representation_and_product( const IteratorSettings&, IfcSchema::IfcRepresentation*, IfcSchema::IfcProduct*); - template - IfcGeom::BRepElement* create_brep_for_processed_representation( - const IteratorSettings&, IfcSchema::IfcRepresentation*, IfcSchema::IfcProduct*, IfcGeom::BRepElement*); + IfcGeom::BRepElement* create_brep_for_processed_representation( + const IteratorSettings&, IfcSchema::IfcRepresentation*, IfcSchema::IfcProduct*, IfcGeom::BRepElement*); const IfcSchema::IfcMaterial* get_single_material_association(const IfcSchema::IfcProduct*); IfcSchema::IfcRepresentation* representation_mapped_to(const IfcSchema::IfcRepresentation* representation); @@ -543,11 +541,11 @@ public: virtual void setValue(GeomValue var, double value); virtual double getValue(GeomValue var) const; - virtual IfcGeom::BRepElement* convert( + virtual IfcGeom::BRepElement* convert( const IteratorSettings& settings, IfcUtil::IfcBaseClass* representation, IfcUtil::IfcBaseClass* product) { - return create_brep_for_representation_and_product(settings, (IfcSchema::IfcRepresentation*) representation, (IfcSchema::IfcProduct*) product); + return create_brep_for_representation_and_product(settings, (IfcSchema::IfcRepresentation*) representation, (IfcSchema::IfcProduct*) product); } virtual IfcRepresentationShapeItems convert(IfcUtil::IfcBaseClass* item) { diff --git a/src/ifcgeom/IfcGeomElement.h b/src/ifcgeom/IfcGeomElement.h index ad0efa7139..c9829d8ef3 100644 --- a/src/ifcgeom/IfcGeomElement.h +++ b/src/ifcgeom/IfcGeomElement.h @@ -32,10 +32,9 @@ namespace IfcGeom { - template class Matrix { private: - std::vector

_data; + std::vector _data; public: Matrix(const ElementSettings& settings, const gp_Trsf& trsf) { // Convert the gp_Trsf into a 4x3 Matrix @@ -49,19 +48,18 @@ namespace IfcGeom { const double matrix_value = i == 4 && settings.get(IteratorSettings::CONVERT_BACK_UNITS) ? trsf_value / settings.unit_magnitude() : trsf_value; - _data.push_back(static_cast

(matrix_value)); + _data.push_back(static_cast(matrix_value)); } } } - const std::vector

& data() const { return _data; } + const std::vector& data() const { return _data; } }; - template class Transformation { private: ElementSettings settings_; gp_Trsf trsf_; - Matrix

matrix_; + Matrix matrix_; public: Transformation(const ElementSettings& settings, const gp_Trsf& trsf) : settings_(settings) @@ -69,7 +67,7 @@ namespace IfcGeom { , matrix_(settings, trsf) {} const gp_Trsf& data() const { return trsf_; } - const Matrix

& matrix() const { return matrix_; } + const Matrix& matrix() const { return matrix_; } Transformation inverted() const { return Transformation(settings_, trsf_.Inverted()); @@ -80,7 +78,6 @@ namespace IfcGeom { } }; - template class Element { private: int _id; @@ -90,17 +87,17 @@ namespace IfcGeom { std::string _guid; std::string _context; std::string _unique_id; - Transformation _transformation; + Transformation _transformation; IfcUtil::IfcBaseEntity* product_; - std::vector*> _parents; + std::vector _parents; public: - friend bool operator == (const Element & element1, const Element & element2) { + friend bool operator == (const Element& element1, const Element& element2) { return element1.id() == element2.id(); } // Use the id to compare, or the elevation is the elements are IfcBuildingStoreys and the elevation is set - friend bool operator < (const Element & element1, const Element & element2) { + friend bool operator < (const Element& element1, const Element& element2) { if (element1.type() == "IfcBuildingStorey" && element2.type() == "IfcBuildingStorey") { size_t attr_index = element1.product()->declaration().attribute_index("Elevation"); Argument* elev_attr1 = element1.product()->data().getArgument(attr_index); @@ -124,10 +121,10 @@ namespace IfcGeom { const std::string& guid() const { return _guid; } const std::string& context() const { return _context; } const std::string& unique_id() const { return _unique_id; } - const Transformation& transformation() const { return _transformation; } + const Transformation& transformation() const { return _transformation; } IfcUtil::IfcBaseEntity* product() const { return product_; } - const std::vector*> parents() const { return _parents; } - void SetParents(std::vector*> newparents) { _parents = newparents; } + const std::vector parents() const { return _parents; } + void SetParents(std::vector newparents) { _parents = newparents; } Element(const ElementSettings& settings, int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid, const std::string& context, const gp_Trsf& trsf, IfcUtil::IfcBaseEntity* product) @@ -159,17 +156,16 @@ namespace IfcGeom { virtual ~Element() {} }; - template - class BRepElement : public Element { + class BRepElement : public Element { private: - boost::shared_ptr _geometry; + boost::shared_ptr _geometry; public: - const boost::shared_ptr& geometry_pointer() const { return _geometry; } - const Representation::BRep& geometry() const { return *_geometry; } + const boost::shared_ptr& geometry_pointer() const { return _geometry; } + const IfcGeom::Representation::BRep& geometry() const { return *_geometry; } BRepElement(int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid, - const std::string& context, const gp_Trsf& trsf, const boost::shared_ptr& geometry, + const std::string& context, const gp_Trsf& trsf, const boost::shared_ptr& geometry, IfcUtil::IfcBaseEntity* product) - : Element(geometry->settings() ,id, parent_id, name, type, guid, context, trsf, product) + : Element(geometry->settings() ,id, parent_id, name, type, guid, context, trsf, product) , _geometry(geometry) {} @@ -184,19 +180,18 @@ namespace IfcGeom { BRepElement& operator=(const BRepElement& other); }; - template - class TriangulationElement : public Element { + class TriangulationElement : public Element { private: - boost::shared_ptr< Representation::Triangulation

> _geometry; + boost::shared_ptr< IfcGeom::Representation::Triangulation > _geometry; public: - const Representation::Triangulation

& geometry() const { return *_geometry; } - const boost::shared_ptr< Representation::Triangulation

>& geometry_pointer() const { return _geometry; } - TriangulationElement(const BRepElement& shape_model) - : Element(shape_model) - , _geometry(boost::shared_ptr >(new Representation::Triangulation

(shape_model.geometry()))) + const IfcGeom::Representation::Triangulation& geometry() const { return *_geometry; } + const boost::shared_ptr< IfcGeom::Representation::Triangulation>& geometry_pointer() const { return _geometry; } + TriangulationElement(const IfcGeom::BRepElement& shape_model) + : Element(shape_model) + , _geometry(boost::shared_ptr(new IfcGeom::Representation::Triangulation(shape_model.geometry()))) {} - TriangulationElement(const Element& element, const boost::shared_ptr >& geometry) - : Element(element) + TriangulationElement(const IfcGeom::Element& element, const boost::shared_ptr& geometry) + : Element(element) , _geometry(geometry) {} private: @@ -204,15 +199,14 @@ namespace IfcGeom { TriangulationElement& operator=(const TriangulationElement& other); }; - template - class SerializedElement : public Element { + class SerializedElement : public Element { private: - Representation::Serialization* _geometry; + IfcGeom::Representation::Serialization* _geometry; public: - const Representation::Serialization& geometry() const { return *_geometry; } - SerializedElement(const BRepElement& shape_model) - : Element(shape_model) - , _geometry(new Representation::Serialization(shape_model.geometry())) + const IfcGeom::Representation::Serialization& geometry() const { return *_geometry; } + SerializedElement(const BRepElement& shape_model) + : Element(shape_model) + , _geometry(new IfcGeom::Representation::Serialization(shape_model.geometry())) {} virtual ~SerializedElement() { delete _geometry; diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index e3a5a592dd..799cd2f4cd 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -1828,8 +1828,7 @@ const IfcSchema::IfcMaterial* IfcGeom::Kernel::get_single_material_association(c return single_material; } -template -IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and_product( +IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and_product( const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product) { std::stringstream representation_id_builder; @@ -2020,7 +2019,7 @@ IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and context_string = representation->ContextOfItems()->ContextType(); } - auto elem = new BRepElement( + auto elem = new BRepElement( product->data().id(), parent_id, name, @@ -2187,10 +2186,9 @@ IfcSchema::IfcProduct::list::ptr IfcGeom::Kernel::products_represented_by(const return products; } -template -IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_processed_representation( +IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_processed_representation( const IteratorSettings& /*settings*/, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product, - IfcGeom::BRepElement* brep) + IfcGeom::BRepElement* brep) { int parent_id = -1; try { @@ -2223,7 +2221,7 @@ IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_processed_represen const std::string product_type = product->declaration().name(); - return new BRepElement( + return new BRepElement( product->data().id(), parent_id, name, @@ -2236,20 +2234,6 @@ IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_processed_represen ); } -template IFC_GEOM_API IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and_product( - const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product); -template IFC_GEOM_API IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and_product( - const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product); -template IFC_GEOM_API IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and_product( - const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product); - -template IFC_GEOM_API IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_processed_representation( - const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product, IfcGeom::BRepElement* brep); -template IFC_GEOM_API IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_processed_representation( - const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product, IfcGeom::BRepElement* brep); -template IFC_GEOM_API IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_processed_representation( - const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product, IfcGeom::BRepElement* brep); - std::pair IfcGeom::Kernel::initializeUnits(IfcSchema::IfcUnitAssignment* unit_assignment) { // Set default units, set length to meters, angles to undefined setValue(IfcGeom::Kernel::GV_LENGTH_UNIT, 1.0); diff --git a/src/ifcgeom/IfcGeomIteratorImplementation.cpp b/src/ifcgeom/IfcGeomIteratorImplementation.cpp index 1206f0fd5f..b7e80bff65 100644 --- a/src/ifcgeom/IfcGeomIteratorImplementation.cpp +++ b/src/ifcgeom/IfcGeomIteratorImplementation.cpp @@ -1,32 +1,20 @@ #include "IfcGeomIteratorImplementation.h" #include "../ifcgeom_schema_agnostic/IteratorImplementation.h" -namespace IfcGeom { - template class MAKE_TYPE_NAME(IteratorImplementation_); - template class MAKE_TYPE_NAME(IteratorImplementation_); - template class MAKE_TYPE_NAME(IteratorImplementation_); -} - #define MAKE_INIT_FN__(a, b) init_ ## a ## b #define MAKE_INIT_FN_(a, b) MAKE_INIT_FN__(a, b) #define MAKE_INIT_FN(t) MAKE_INIT_FN_(t, IfcSchema) namespace { - template struct MAKE_TYPE_NAME(factory_t) { - IfcGeom::IteratorImplementation* operator()(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector& filters, int num_threads) const { - return new IfcGeom::MAKE_TYPE_NAME(IteratorImplementation_)(settings, file, filters, num_threads); + IfcGeom::IteratorImplementation* operator()(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector& filters, int num_threads) const { + return new IfcGeom::MAKE_TYPE_NAME(IteratorImplementation_)(settings, file, filters, num_threads); } }; } -template -void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation* mapping) { +void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation* mapping) { static const std::string schema_name = STRINGIFY(IfcSchema); - MAKE_TYPE_NAME(factory_t) factory; + MAKE_TYPE_NAME(factory_t) factory; mapping->bind(schema_name, factory); } - -template void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation*); -template void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation*); -template void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation*); diff --git a/src/ifcgeom/IfcGeomIteratorImplementation.h b/src/ifcgeom/IfcGeomIteratorImplementation.h index 99010b218f..831b974fad 100644 --- a/src/ifcgeom/IfcGeomIteratorImplementation.h +++ b/src/ifcgeom/IfcGeomIteratorImplementation.h @@ -100,24 +100,22 @@ #endif namespace { - template struct geometry_conversion_task { int index; IfcSchema::IfcRepresentation *representation; IfcSchema::IfcProduct::list::ptr products; - std::vector*> breps; - std::vector*> elements; + std::vector breps; + std::vector elements; }; - template - IfcGeom::Element* process_based_on_settings( + IfcGeom::Element* process_based_on_settings( const IfcGeom::IteratorSettings& settings, - IfcGeom::BRepElement* elem, - IfcGeom::TriangulationElement* previous=nullptr) + IfcGeom::BRepElement* elem, + IfcGeom::TriangulationElement* previous=nullptr) { if (settings.get(IfcGeom::IteratorSettings::USE_BREP_DATA)) { try { - return new IfcGeom::SerializedElement(*elem); + return new IfcGeom::SerializedElement(*elem); } catch (...) { Logger::Message(Logger::LOG_ERROR, "Getting a serialized element from model failed."); return nullptr; @@ -125,9 +123,9 @@ namespace { } else if (!settings.get(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION)) { try { if (!previous) { - return new IfcGeom::TriangulationElement(*elem); + return new IfcGeom::TriangulationElement(*elem); } else { - return new IfcGeom::TriangulationElement(*elem, previous->geometry_pointer()); + return new IfcGeom::TriangulationElement(*elem, previous->geometry_pointer()); } } catch (...) { Logger::Message(Logger::LOG_ERROR, "Getting a triangulation element from model failed."); @@ -138,15 +136,14 @@ namespace { } } - template void create_element( IfcGeom::MAKE_TYPE_NAME(Kernel)* kernel, const IfcGeom::IteratorSettings& settings, - geometry_conversion_task* rep) + geometry_conversion_task* rep) { IfcSchema::IfcRepresentation *representation = rep->representation; IfcSchema::IfcProduct *product = *rep->products->begin(); - auto brep = kernel->create_brep_for_representation_and_product(settings, representation, product); + auto brep = kernel->create_brep_for_representation_and_product(settings, representation, product); if (!brep) { return; } @@ -160,9 +157,9 @@ namespace { rep->elements = { elem }; for (auto it = rep->products->begin() + 1; it != rep->products->end(); ++it) { - auto brep2 = kernel->create_brep_for_processed_representation(settings, representation, *it, brep); + auto brep2 = kernel->create_brep_for_processed_representation(settings, representation, *it, brep); if (brep2) { - auto elem2 = process_based_on_settings(settings, brep2, dynamic_cast*>(elem)); + auto elem2 = process_based_on_settings(settings, brep2, dynamic_cast(elem)); if (elem2) { rep->breps.push_back(brep2); rep->elements.push_back(elem2); @@ -174,16 +171,15 @@ namespace { namespace IfcGeom { - template - class MAKE_TYPE_NAME(IteratorImplementation_) : public IteratorImplementation { + class MAKE_TYPE_NAME(IteratorImplementation_) : public IteratorImplementation { private: std::atomic progress_; - std::vector> tasks_; - std::vector*> all_processed_elements_; - std::vector*> all_processed_native_elements_; - typename std::vector*>::const_iterator task_result_iterator_; - typename std::vector*>::const_iterator native_task_result_iterator_; + std::vector tasks_; + std::vector all_processed_elements_; + std::vector all_processed_native_elements_; + typename std::vector::const_iterator task_result_iterator_; + typename std::vector::const_iterator native_task_result_iterator_; MAKE_TYPE_NAME(IteratorImplementation_)(const MAKE_TYPE_NAME(IteratorImplementation_)&); // N/I MAKE_TYPE_NAME(IteratorImplementation_)& operator=(const MAKE_TYPE_NAME(IteratorImplementation_)&); // N/I @@ -201,9 +197,9 @@ namespace IfcGeom { IfcSchema::IfcRepresentation::list::it representation_iterator; // The object is fetched beforehand to be sure that get() returns a valid element - TriangulationElement* current_triangulation; - BRepElement* current_shape_model; - SerializedElement* current_serialization; + TriangulationElement* current_triangulation; + BRepElement* current_shape_model; + SerializedElement* current_serialization; // A container and iterator for IfcBuildingElements for the current IfcRepresentation referenced by *representation_iterator IfcSchema::IfcProduct::list::ptr ifcproducts; @@ -243,8 +239,6 @@ namespace IfcGeom { /// @todo public/private sections all over the place: move all public to the beginning of the class public: - typedef P Precision; - typedef PP PlacementPrecision; boost::optional initialization_outcome_; @@ -402,7 +396,7 @@ namespace IfcGeom { if (ifcproducts.get() != previous) { previous = ifcproducts.get(); if (ifcproducts->size()) { - geometry_conversion_task t; + geometry_conversion_task t; t.index = i++; t.representation = *representation_iterator; t.products = ifcproducts; @@ -467,7 +461,7 @@ namespace IfcGeom { } // for } // while - std::future fu = std::async(std::launch::async, create_element, K, std::ref(settings), &rep); + std::future fu = std::async(std::launch::async, create_element, K, std::ref(settings), &rep); threadpool.emplace_back(std::move(fu)); } @@ -506,15 +500,15 @@ namespace IfcGeom { if (with_geometry) { size_t num_created = 0; do { - IfcGeom::Element* geom_object = get(); - const IfcGeom::TriangulationElement* o = static_cast*>(geom_object); - const IfcGeom::Representation::Triangulation

& mesh = o->geometry(); + IfcGeom::Element* geom_object = get(); + const IfcGeom::TriangulationElement* o = static_cast(geom_object); + const IfcGeom::Representation::Triangulation& mesh = o->geometry(); const gp_XYZ& pos = o->transformation().data().TranslationPart(); - for (typename std::vector

::const_iterator it = mesh.verts().begin(); it != mesh.verts().end();) { - const P x = *(it++); - const P y = *(it++); - const P z = *(it++); + for (typename std::vector::const_iterator it = mesh.verts().begin(); it != mesh.verts().end();) { + const double& x = *(it++); + const double& y = *(it++); + const double& z = *(it++); bounds_min_.SetX(std::min(bounds_min_.X(), pos.X() + x)); bounds_min_.SetY(std::min(bounds_min_.Y(), pos.Y() + y)); @@ -729,7 +723,7 @@ namespace IfcGeom { } } - BRepElement* create_shape_model_for_next_entity() { + BRepElement* create_shape_model_for_next_entity() { for (;;) { auto rp = get_next_task(); if (!rp) { @@ -740,9 +734,9 @@ namespace IfcGeom { Logger::SetProduct(product); - BRepElement* element; + BRepElement* element; if (ifcproduct_iterator == ifcproducts->begin() || !geometry_reuse_ok_for_current_representation_) { - element = kernel.create_brep_for_representation_and_product(settings, representation, product); + element = kernel.create_brep_for_representation_and_product(settings, representation, product); } else { element = kernel.create_brep_for_processed_representation(settings, representation, product, current_shape_model); } @@ -806,10 +800,10 @@ namespace IfcGeom { } /// Gets the representation of the current geometrical entity. - Element* get() + Element* get() { // TODO: Test settings and throw - Element* ret = 0; + Element* ret = 0; if (num_threads_ != 1) { ret = *task_result_iterator_; @@ -828,12 +822,12 @@ namespace IfcGeom { { // We are going to build a vector with the element parents. // First, create the parent vector - std::vector*> parents; + std::vector parents; // if the element has a parent if (ret->parent_id() != -1) { - const IfcGeom::Element* parent_object = NULL; + const IfcGeom::Element* parent_object = NULL; bool hasParent = true; // get the parent @@ -873,7 +867,7 @@ namespace IfcGeom { } /// Gets the native (Open Cascade) representation of the current geometrical entity. - BRepElement* get_native() + BRepElement* get_native() { // TODO: Test settings and throw if (num_threads_ != 1) { @@ -883,7 +877,7 @@ namespace IfcGeom { } } - const Element* get_object(int id) { + const Element* get_object(int id) { gp_Trsf trsf; int parent_id = -1; std::string instance_type, product_name, product_guid; @@ -935,14 +929,14 @@ namespace IfcGeom { ElementSettings element_settings(settings, unit_magnitude, instance_type); - Element* ifc_object = new Element(element_settings, id, parent_id, product_name, instance_type, product_guid, "", trsf, ifc_product); + Element* ifc_object = new Element(element_settings, id, parent_id, product_name, instance_type, product_guid, "", trsf, ifc_product); return ifc_object; } IfcUtil::IfcBaseClass* create() { - IfcGeom::BRepElement* next_shape_model = 0; - IfcGeom::SerializedElement* next_serialization = 0; - IfcGeom::TriangulationElement* next_triangulation = 0; + IfcGeom::BRepElement* next_shape_model = 0; + IfcGeom::SerializedElement* next_serialization = 0; + IfcGeom::TriangulationElement* next_triangulation = 0; try { next_shape_model = create_shape_model_for_next_entity(); @@ -961,16 +955,16 @@ namespace IfcGeom { if (next_shape_model) { if (settings.get(IteratorSettings::USE_BREP_DATA)) { try { - next_serialization = new SerializedElement(*next_shape_model); + next_serialization = new SerializedElement(*next_shape_model); } catch (...) { Logger::Message(Logger::LOG_ERROR, "Getting a serialized element from model failed."); } } else if (!settings.get(IteratorSettings::DISABLE_TRIANGULATION)) { try { if (ifcproduct_iterator == ifcproducts->begin() || !geometry_reuse_ok_for_current_representation_) { - next_triangulation = new TriangulationElement(*next_shape_model); + next_triangulation = new TriangulationElement(*next_shape_model); } else { - next_triangulation = new TriangulationElement(*next_shape_model, current_triangulation->geometry_pointer()); + next_triangulation = new TriangulationElement(*next_shape_model, current_triangulation->geometry_pointer()); } } catch (...) { Logger::Message(Logger::LOG_ERROR, "Getting a triangulation element from model failed."); diff --git a/src/ifcgeom/IfcGeomRepresentation.h b/src/ifcgeom/IfcGeomRepresentation.h index 7e81c0f15f..93dd1fae4f 100644 --- a/src/ifcgeom/IfcGeomRepresentation.h +++ b/src/ifcgeom/IfcGeomRepresentation.h @@ -101,22 +101,21 @@ namespace IfcGeom { Serialization& operator=(const Serialization&); }; - template class Triangulation : public Representation { private: // A nested pair of floats and a material index to be able to store an XYZ coordinate in a map. // TODO: Make this a std::tuple when compilers add support for that. - typedef typename std::pair > Coordinate; + typedef typename std::pair > Coordinate; typedef typename std::pair VertexKey; typedef std::map VertexKeyMap; typedef std::pair Edge; std::string id_; - std::vector

_verts; + std::vector _verts; std::vector _faces; std::vector _edges; - std::vector

_normals; - std::vector

uvs_; + std::vector _normals; + std::vector uvs_; std::vector _material_ids; std::vector _materials; size_t weld_offset_; @@ -124,11 +123,11 @@ namespace IfcGeom { public: const std::string& id() const { return id_; } - const std::vector

& verts() const { return _verts; } + const std::vector& verts() const { return _verts; } const std::vector& faces() const { return _faces; } const std::vector& edges() const { return _edges; } - const std::vector

& normals() const { return _normals; } - const std::vector

& uvs() const { return uvs_; } + const std::vector& normals() const { return _normals; } + const std::vector& uvs() const { return uvs_; } const std::vector& material_ids() const { return _material_ids; } const std::vector& materials() const { return _materials; } @@ -232,9 +231,9 @@ namespace IfcGeom { } // TODO: Do the same for conical surfaces, but they are rare in IFC. } - _normals.push_back(static_cast

(normal.X())); - _normals.push_back(static_cast

(normal.Y())); - _normals.push_back(static_cast

(normal.Z())); + _normals.push_back(normal.X()); + _normals.push_back(normal.Y()); + _normals.push_back(normal.Z()); } } @@ -336,9 +335,9 @@ namespace IfcGeom { segments.push_back(std::make_pair(right, current)); } - for (auto& s : segments) { - _edges.push_back(s.first); - _edges.push_back(s.second); + for (auto& sgmt : segments) { + _edges.push_back(sgmt.first); + _edges.push_back(sgmt.second); _material_ids.push_back(surface_style_id); } @@ -354,16 +353,16 @@ namespace IfcGeom { /// Generates UVs for a single mesh using box projection. /// @todo Very simple impl. Assumes that input vertices and normals match 1:1. - static std::vector

box_project_uvs(const std::vector

&vertices, const std::vector

&normals) + static std::vector box_project_uvs(const std::vector &vertices, const std::vector &normals) { - std::vector

uvs; + std::vector uvs; uvs.resize(vertices.size() / 3 * 2); for (size_t uv_idx = 0, v_idx = 0; uv_idx < uvs.size() && v_idx < vertices.size() && v_idx < normals.size(); uv_idx += 2, v_idx += 3) { - P n_x = normals[v_idx], n_y = normals[v_idx + 1], n_z = normals[v_idx + 2]; - P v_x = vertices[v_idx], v_y = vertices[v_idx + 1], v_z = vertices[v_idx + 2]; + double n_x = normals[v_idx], n_y = normals[v_idx + 1], n_z = normals[v_idx + 2]; + double v_x = vertices[v_idx], v_y = vertices[v_idx + 1], v_z = vertices[v_idx + 2]; if (std::abs(n_x) > std::abs(n_y) && std::abs(n_x) > std::abs(n_z)) { uvs[uv_idx] = v_z; @@ -386,15 +385,15 @@ namespace IfcGeom { // Welds vertices that belong to different faces int addVertex(int material_index, const gp_XYZ& p) { const bool convert = settings().get(IteratorSettings::CONVERT_BACK_UNITS); - const P X = static_cast

(convert ? (p.X() / settings().unit_magnitude()) : p.X()); - const P Y = static_cast

(convert ? (p.Y() / settings().unit_magnitude()) : p.Y()); - const P Z = static_cast

(convert ? (p.Z() / settings().unit_magnitude()) : p.Z()); + const double X = convert ? (p.X() / settings().unit_magnitude()) : p.X(); + const double Y = convert ? (p.Y() / settings().unit_magnitude()) : p.Y(); + const double Z = convert ? (p.Z() / settings().unit_magnitude()) : p.Z(); int i = (int) _verts.size() / 3; if (settings().get(IteratorSettings::WELD_VERTICES)) { const VertexKey key = std::make_pair(material_index, std::make_pair(X, std::make_pair(Y, Z))); typename VertexKeyMap::const_iterator it = welds.find(key); if ( it != welds.end() ) return it->second; - i = (int) welds.size() + weld_offset_; + i = (int) (welds.size() + weld_offset_); welds[key] = i; } _verts.push_back(X); diff --git a/src/ifcgeom/IfcGeomTree.h b/src/ifcgeom/IfcGeomTree.h index 7d8c175c2e..08039ba590 100644 --- a/src/ifcgeom/IfcGeomTree.h +++ b/src/ifcgeom/IfcGeomTree.h @@ -287,7 +287,7 @@ namespace IfcGeom { add_file(f, settings); } - tree(IfcGeom::Iterator& it) { + tree(IfcGeom::Iterator& it) { add_file(it); } @@ -297,15 +297,15 @@ namespace IfcGeom { settings_.set(IfcGeom::IteratorSettings::USE_WORLD_COORDS, true); settings_.set(IfcGeom::IteratorSettings::SEW_SHELLS, true); - IfcGeom::Iterator it(settings_, &f); + IfcGeom::Iterator it(settings_, &f); add_file(it); } - void add_file(IfcGeom::Iterator& it) { + void add_file(IfcGeom::Iterator& it) { if (it.initialize()) { do { - IfcGeom::BRepElement* elem = (IfcGeom::BRepElement*)it.get(); + IfcGeom::BRepElement* elem = (IfcGeom::BRepElement*)it.get(); auto compound = elem->geometry().as_compound(); compound.Move(elem->transformation().data()); add((IfcUtil::IfcBaseEntity*)it.file()->instance_by_id(elem->id()), compound); diff --git a/src/ifcgeom_schema_agnostic/IfcGeomIterator.h b/src/ifcgeom_schema_agnostic/IfcGeomIterator.h index 3d86660cd8..db35d45156 100644 --- a/src/ifcgeom_schema_agnostic/IfcGeomIterator.h +++ b/src/ifcgeom_schema_agnostic/IfcGeomIterator.h @@ -70,7 +70,6 @@ namespace IfcGeom { - template class Iterator { private: Iterator(const Iterator&); // N/I @@ -80,7 +79,7 @@ namespace IfcGeom { IfcGeom::IteratorSettings settings_; std::vector filters_; - IteratorImplementation* implementation_; + IteratorImplementation* implementation_; public: Iterator(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, int num_threads = 1) @@ -88,20 +87,20 @@ namespace IfcGeom { , settings_(settings) { try { - implementation_ = iterator_implementations().construct(file_->schema()->name(), settings, file, filters_, num_threads); + implementation_ = iterator_implementations().construct(file_->schema()->name(), settings, file, filters_, num_threads); } catch (const std::exception& e) { Logger::Error(e); implementation_ = nullptr; } } - Iterator(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector& filters, size_t num_threads = 1) + Iterator(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector& filters, int num_threads = 1) : file_(file) , settings_(settings) , filters_(filters) { try { - implementation_ = iterator_implementations().construct(file_->schema()->name(), settings, file, filters_, num_threads); + implementation_ = iterator_implementations().construct(file_->schema()->name(), settings, file, filters_, num_threads); } catch (const std::exception& e) { Logger::Error(e); implementation_ = nullptr; @@ -131,11 +130,11 @@ namespace IfcGeom { IfcUtil::IfcBaseClass* next() const { return implementation_->next(); } - Element* get() { return implementation_->get(); } + Element* get() { return implementation_->get(); } - BRepElement* get_native() { return implementation_->get_native(); } + BRepElement* get_native() { return implementation_->get_native(); } - const Element* get_object(int id) { return implementation_->get_object(id); } + const Element* get_object(int id) { return implementation_->get_object(id); } IfcUtil::IfcBaseClass* create() { return implementation_->create(); } }; diff --git a/src/ifcgeom_schema_agnostic/IteratorImplementation.cpp b/src/ifcgeom_schema_agnostic/IteratorImplementation.cpp index a664db0378..2ab16b8e78 100644 --- a/src/ifcgeom_schema_agnostic/IteratorImplementation.cpp +++ b/src/ifcgeom_schema_agnostic/IteratorImplementation.cpp @@ -2,48 +2,36 @@ #include -template -IteratorFactoryImplementation& iterator_implementations() { - static IteratorFactoryImplementation impl; +IteratorFactoryImplementation& iterator_implementations() { + static IteratorFactoryImplementation impl; return impl; } -template IteratorFactoryImplementation& iterator_implementations(); -template IteratorFactoryImplementation& iterator_implementations(); -template IteratorFactoryImplementation& iterator_implementations(); - #ifdef HAS_SCHEMA_2x3 -template -extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation*); +extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation*); #endif #ifdef HAS_SCHEMA_4 -template -extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation*); +extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation*); #endif #ifdef HAS_SCHEMA_4x1 -template -extern void init_IteratorImplementation_Ifc4x1(IteratorFactoryImplementation*); +extern void init_IteratorImplementation_Ifc4x1(IteratorFactoryImplementation*); #endif #ifdef HAS_SCHEMA_4x2 -template -extern void init_IteratorImplementation_Ifc4x2(IteratorFactoryImplementation*); +extern void init_IteratorImplementation_Ifc4x2(IteratorFactoryImplementation*); #endif #ifdef HAS_SCHEMA_4x3_rc1 -template -extern void init_IteratorImplementation_Ifc4x3_rc1(IteratorFactoryImplementation*); +extern void init_IteratorImplementation_Ifc4x3_rc1(IteratorFactoryImplementation*); #endif #ifdef HAS_SCHEMA_4x3_rc2 -template -extern void init_IteratorImplementation_Ifc4x3_rc2(IteratorFactoryImplementation*); +extern void init_IteratorImplementation_Ifc4x3_rc2(IteratorFactoryImplementation*); #endif -template -IteratorFactoryImplementation::IteratorFactoryImplementation() { +IteratorFactoryImplementation::IteratorFactoryImplementation() { #ifdef HAS_SCHEMA_2x3 init_IteratorImplementation_Ifc2x3(this); #endif @@ -64,24 +52,17 @@ IteratorFactoryImplementation::IteratorFactoryImplementation() { #endif } -template -void IteratorFactoryImplementation::bind(const std::string& schema_name, typename get_factory_type::type fn) { +void IteratorFactoryImplementation::bind(const std::string& schema_name, iterator_fn fn) { const std::string schema_name_lower = boost::to_lower_copy(schema_name); this->insert(std::make_pair(schema_name_lower, fn)); } -template -IfcGeom::IteratorImplementation* IteratorFactoryImplementation::construct(const std::string& schema_name, const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector& filters, int num_threads) { +IfcGeom::IteratorImplementation* IteratorFactoryImplementation::construct(const std::string& schema_name, const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector& filters, int num_threads) { const std::string schema_name_lower = boost::to_lower_copy(schema_name); - typename std::map::type>::const_iterator it; + typename std::map::const_iterator it; it = this->find(schema_name_lower); if (it == this->end()) { throw IfcParse::IfcException("No geometry iterator registered for " + schema_name); } return it->second(settings, file, filters, num_threads); } - - -template class IteratorFactoryImplementation; -template class IteratorFactoryImplementation; -template class IteratorFactoryImplementation; diff --git a/src/ifcgeom_schema_agnostic/IteratorImplementation.h b/src/ifcgeom_schema_agnostic/IteratorImplementation.h index 34badca50e..8a0681bbb7 100644 --- a/src/ifcgeom_schema_agnostic/IteratorImplementation.h +++ b/src/ifcgeom_schema_agnostic/IteratorImplementation.h @@ -13,52 +13,26 @@ #include namespace IfcGeom { - template class IteratorImplementation; - template class Element; - template class BRepElement; } -typedef boost::function4*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector&, int> iterator_float_float_fn; -typedef boost::function4*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector&, int> iterator_float_double_fn; -typedef boost::function4*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector&, int> iterator_double_double_fn; +typedef boost::function4&, int> iterator_fn; -template -struct get_factory_type {}; - -template <> -struct get_factory_type { - typedef iterator_float_float_fn type; -}; - -template <> -struct get_factory_type { - typedef iterator_float_double_fn type; -}; - -template <> -struct get_factory_type { - typedef iterator_double_double_fn type; -}; - -template -class IteratorFactoryImplementation : public std::map::type> { +class IteratorFactoryImplementation : public std::map { public: IteratorFactoryImplementation(); - void bind(const std::string& schema_name, typename get_factory_type::type fn); - IfcGeom::IteratorImplementation* construct(const std::string& schema_name, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector&, int); + void bind(const std::string& schema_name, iterator_fn fn); + IfcGeom::IteratorImplementation* construct(const std::string& schema_name, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector&, int); }; -template -IteratorFactoryImplementation& iterator_implementations(); +IteratorFactoryImplementation& iterator_implementations(); namespace IfcGeom { - template class IteratorImplementation { public: virtual bool initialize() = 0; @@ -70,9 +44,9 @@ namespace IfcGeom { virtual double getUnitMagnitude() const = 0; virtual IfcParse::IfcFile* file() const = 0; virtual IfcUtil::IfcBaseClass* next() = 0; - virtual Element* get() = 0; - virtual BRepElement* get_native() = 0; - virtual const Element* get_object(int id) = 0; + virtual Element* get() = 0; + virtual BRepElement* get_native() = 0; + virtual const Element* get_object(int id) = 0; virtual IfcUtil::IfcBaseClass* create() = 0; }; diff --git a/src/ifcgeom_schema_agnostic/Kernel.h b/src/ifcgeom_schema_agnostic/Kernel.h index fa8b1ffdd2..6d2b478f98 100644 --- a/src/ifcgeom_schema_agnostic/Kernel.h +++ b/src/ifcgeom_schema_agnostic/Kernel.h @@ -36,7 +36,6 @@ namespace IfcGeom { - template class BRepElement; class Kernel { @@ -91,7 +90,7 @@ namespace IfcGeom { return implementation_->getValue(var); } - virtual BRepElement* convert( + virtual BRepElement* convert( const IteratorSettings& settings, IfcUtil::IfcBaseClass* representation, IfcUtil::IfcBaseClass* product) { diff --git a/src/serializers/ColladaSerializer.cpp b/src/serializers/ColladaSerializer.cpp index e47e7effb4..5a8f362e15 100644 --- a/src/serializers/ColladaSerializer.cpp +++ b/src/serializers/ColladaSerializer.cpp @@ -179,7 +179,7 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::close() { void ColladaSerializer::ColladaExporter::ColladaScene::add( const std::string& node_id, const std::string& node_name, const std::string& geom_name, - const std::vector& material_ids, const IfcGeom::Transformation& transformation) + const std::vector& material_ids, const IfcGeom::Transformation& transformation) { if (!scene_opened) { openVisualScene(scene_id); @@ -194,13 +194,13 @@ void ColladaSerializer::ColladaExporter::ColladaScene::add( // The matrix attribute of an entity is basically a 4x3 representation of its ObjectPlacement. // Note that this placement is absolute, ie it is multiplied with all parent placements. - IfcGeom::Transformation* relative_trsf = 0; - const IfcGeom::Transformation* transformation_towrite = &transformation; + IfcGeom::Transformation* relative_trsf = 0; + const IfcGeom::Transformation* transformation_towrite = &transformation; // If this is not the first parent, get the relative placement if (parentNodes.size() > 0) { - relative_trsf = new IfcGeom::Transformation(matrixStack.top().multiplied(transformation)); + relative_trsf = new IfcGeom::Transformation(matrixStack.top().multiplied(transformation)); transformation_towrite = relative_trsf; } @@ -231,22 +231,22 @@ void ColladaSerializer::ColladaExporter::ColladaScene::add( node.end(); } -void ColladaSerializer::ColladaExporter::ColladaScene::addParent(const IfcGeom::Element& parent){ +void ColladaSerializer::ColladaExporter::ColladaScene::addParent(const IfcGeom::Element& parent){ //we open the visual scene tag if it's not. if (!scene_opened) { openVisualScene(scene_id); scene_opened = true; } - const IfcGeom::Transformation& parent_trsf = parent.transformation(); + const IfcGeom::Transformation& parent_trsf = parent.transformation(); - IfcGeom::Transformation* relative_trsf = 0; - const IfcGeom::Transformation* transformation_towrite = &parent_trsf; + IfcGeom::Transformation* relative_trsf = 0; + const IfcGeom::Transformation* transformation_towrite = &parent_trsf; // If this is not the first parent, get the relative placement if (parentNodes.size() > 0) { - relative_trsf = new IfcGeom::Transformation(matrixStack.top().multiplied(parent_trsf)); + relative_trsf = new IfcGeom::Transformation(matrixStack.top().multiplied(parent_trsf)); transformation_towrite = relative_trsf; } @@ -390,9 +390,9 @@ void ColladaSerializer::ColladaExporter::startDocument(const std::string& unit_n asset.add(); } -void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationElement* o) +void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationElement* o) { - const IfcGeom::Representation::Triangulation& mesh = o->geometry(); + const IfcGeom::Representation::Triangulation& mesh = o->geometry(); std::string name = serializer->object_id(o); collada_id(name); @@ -451,7 +451,7 @@ std::string ColladaSerializer::differentiateSlabTypes(const IfcUtil::IfcBaseEnti return result; } -std::string ColladaSerializer::object_id(const IfcGeom::Element* o) /*override*/ +std::string ColladaSerializer::object_id(const IfcGeom::Element* o) /*override*/ { if (settings_.get(SerializerSettings::USE_ELEMENT_TYPES)) { const std::string slabSuffix = (o->product() && o->product()->declaration().name() == "IfcSlab") @@ -544,7 +544,7 @@ void ColladaSerializer::writeHeader() { exporter.startDocument(unit_name, unit_magnitude); } -void ColladaSerializer::write(const IfcGeom::TriangulationElement* o) { +void ColladaSerializer::write(const IfcGeom::TriangulationElement* o) { exporter.write(o); } diff --git a/src/serializers/ColladaSerializer.h b/src/serializers/ColladaSerializer.h index e0c73f3059..6c1433a8f2 100644 --- a/src/serializers/ColladaSerializer.h +++ b/src/serializers/ColladaSerializer.h @@ -88,7 +88,7 @@ private: const std::string scene_id; bool scene_opened; std::stack parentNodes; - std::stack > matrixStack; + std::stack matrixStack; public: ColladaScene(const std::string& scene_id, COLLADASW::StreamWriter& stream, ColladaSerializer *_serializer) : COLLADASW::LibraryVisualScenes(&stream) @@ -97,8 +97,8 @@ private: , serializer(_serializer) {} void add(const std::string& node_id, const std::string& node_name, const std::string& geom_name, - const std::vector& material_ids, const IfcGeom::Transformation& matrix); - void addParent(const IfcGeom::Element& parent); + const std::vector& material_ids, const IfcGeom::Transformation& matrix); + void addParent(const IfcGeom::Element& parent); void closeParent(); COLLADASW::Node* GetDirectParent(); void write(); @@ -158,7 +158,7 @@ private: public: std::string unique_id, representation_id, type; - IfcGeom::Transformation transformation; + IfcGeom::Transformation transformation; std::vector vertices; std::vector normals; std::vector faces; @@ -167,9 +167,9 @@ private: std::vector materials; std::vector material_references; std::vector uvs; - std::vector*> parents_; + std::vector parents_; - DeferredObject(const std::string& unique_id, const std::string& representation_id, const std::string& type, const IfcGeom::Transformation& transformation, + DeferredObject(const std::string& unique_id, const std::string& representation_id, const std::string& type, const IfcGeom::Transformation& transformation, const std::vector& vertices, const std::vector& normals, const std::vector& faces, const std::vector& edges, const std::vector& material_ids, const std::vector& materials, const std::vector& material_references, const std::vector& uvs) @@ -187,8 +187,8 @@ private: , uvs(uvs) {} - std::vector*>& parents() { return parents_; } - const std::vector*>& parents() const { return parents_; } + std::vector& parents() { return parents_; } + const std::vector& parents() const { return parents_; } }; COLLADABU::NativeString filename; COLLADASW::StreamWriter stream; @@ -211,7 +211,7 @@ private: std::vector deferreds; virtual ~ColladaExporter() {} void startDocument(const std::string& unit_name, float unit_magnitude); - void write(const IfcGeom::TriangulationElement* o); + void write(const IfcGeom::TriangulationElement* o); void endDocument(); }; ColladaExporter exporter; @@ -229,8 +229,8 @@ public: } bool ready(); void writeHeader(); - void write(const IfcGeom::TriangulationElement* o); - void write(const IfcGeom::BRepElement* /*o*/) {} + void write(const IfcGeom::TriangulationElement* o); + void write(const IfcGeom::BRepElement* /*o*/) {} void finalize(); bool isTesselated() const { return true; } void setUnitNameAndMagnitude(const std::string& name, float magnitude) { @@ -239,7 +239,7 @@ public: } void setFile(IfcParse::IfcFile*) {} - std::string object_id(const IfcGeom::Element* o) /*override*/; + std::string object_id(const IfcGeom::Element* o) /*override*/; private: static std::string differentiateSlabTypes(const IfcUtil::IfcBaseEntity* slab); diff --git a/src/serializers/GeometrySerializer.h b/src/serializers/GeometrySerializer.h index f6a675e2a1..3e04c8c4f8 100644 --- a/src/serializers/GeometrySerializer.h +++ b/src/serializers/GeometrySerializer.h @@ -70,15 +70,15 @@ public: virtual ~GeometrySerializer() {} virtual bool isTesselated() const = 0; - virtual void write(const IfcGeom::TriangulationElement* o) = 0; - virtual void write(const IfcGeom::BRepElement* o) = 0; + virtual void write(const IfcGeom::TriangulationElement* o) = 0; + virtual void write(const IfcGeom::BRepElement* o) = 0; virtual void setUnitNameAndMagnitude(const std::string& name, float magnitude) = 0; const SerializerSettings& settings() const { return settings_; } SerializerSettings& settings() { return settings_; } /// Returns ID for the object depending on the used setting. - virtual std::string object_id(const IfcGeom::Element* o) + virtual std::string object_id(const IfcGeom::Element* o) { if (settings_.get(SerializerSettings::USE_ELEMENT_GUIDS)) return o->guid(); if (settings_.get(SerializerSettings::USE_ELEMENT_NAMES)) return o->name(); diff --git a/src/serializers/GltfSerializer.cpp b/src/serializers/GltfSerializer.cpp index 80396fb449..8a6374d9e5 100644 --- a/src/serializers/GltfSerializer.cpp +++ b/src/serializers/GltfSerializer.cpp @@ -157,7 +157,7 @@ size_t write_accessor(json& j, std::ofstream& ofs, It begin, It end) { return j["accessors"].size() - 1; } -void GltfSerializer::write(const IfcGeom::TriangulationElement* o) { +void GltfSerializer::write(const IfcGeom::TriangulationElement* o) { if (o->geometry().material_ids().empty()) { return; } diff --git a/src/serializers/GltfSerializer.h b/src/serializers/GltfSerializer.h index 5621c8b764..102e2d1543 100644 --- a/src/serializers/GltfSerializer.h +++ b/src/serializers/GltfSerializer.h @@ -42,8 +42,8 @@ public: virtual ~GltfSerializer(); bool ready(); void writeHeader(); - void write(const IfcGeom::TriangulationElement* o); - void write(const IfcGeom::BRepElement* /*o*/) {} + void write(const IfcGeom::TriangulationElement* o); + void write(const IfcGeom::BRepElement* /*o*/) {} void finalize(); bool isTesselated() const { return true; } void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {} diff --git a/src/serializers/HdfSerializer.cpp b/src/serializers/HdfSerializer.cpp index fe64c5a60a..bf534ce055 100644 --- a/src/serializers/HdfSerializer.cpp +++ b/src/serializers/HdfSerializer.cpp @@ -54,7 +54,7 @@ void HdfSerializer::writeHeader() { } -void HdfSerializer::write(const IfcGeom::BRepElement* o) { +void HdfSerializer::write(const IfcGeom::BRepElement* o) { std::string guid = o->guid(); @@ -72,8 +72,8 @@ void HdfSerializer::write(const IfcGeom::BRepElement* o) { const IfcGeom::Representation::Serialization serialization(brepmesh); std::string brep_data = serialization.brep_data(); - const IfcGeom::TriangulationElementtriangular_element(*o); - const IfcGeom::Representation::Triangulation& mesh = triangular_element.geometry(); + const IfcGeom::TriangulationElement triangular_element(*o); + const IfcGeom::Representation::Triangulation& mesh = triangular_element.geometry(); const int vcount = (int)mesh.verts().size() / 3; const int fcount = (int)mesh.faces().size() / 3; const bool isyup = settings().get(SerializerSettings::USE_Y_UP); diff --git a/src/serializers/HdfSerializer.h b/src/serializers/HdfSerializer.h index e2b042b5ff..9e1570adc3 100644 --- a/src/serializers/HdfSerializer.h +++ b/src/serializers/HdfSerializer.h @@ -46,8 +46,8 @@ public: virtual ~HdfSerializer() {} bool ready(); void writeHeader(); - void write(const IfcGeom::BRepElement* o); - void write(const IfcGeom::TriangulationElement* /*o*/) {} + void write(const IfcGeom::BRepElement* o); + void write(const IfcGeom::TriangulationElement* /*o*/) {} void finalize() {} bool isTesselated() const { return false; } void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {} diff --git a/src/serializers/OpenCascadeBasedSerializer.cpp b/src/serializers/OpenCascadeBasedSerializer.cpp index 62597e239e..1a36b7535a 100644 --- a/src/serializers/OpenCascadeBasedSerializer.cpp +++ b/src/serializers/OpenCascadeBasedSerializer.cpp @@ -36,7 +36,7 @@ bool OpenCascadeBasedSerializer::ready() { return succeeded; } -void OpenCascadeBasedSerializer::write(const IfcGeom::BRepElement* o) { +void OpenCascadeBasedSerializer::write(const IfcGeom::BRepElement* o) { TopoDS_Shape compound = o->geometry().as_compound(); gp_Trsf trsf = o->transformation().data(); const IfcGeom::ElementSettings& settings = o->geometry().settings(); diff --git a/src/serializers/OpenCascadeBasedSerializer.h b/src/serializers/OpenCascadeBasedSerializer.h index 156a40fa66..6c07c2be04 100644 --- a/src/serializers/OpenCascadeBasedSerializer.h +++ b/src/serializers/OpenCascadeBasedSerializer.h @@ -39,8 +39,8 @@ public: void writeHeader() {} bool ready(); virtual void writeShape(const std::string& name, const TopoDS_Shape& shape) = 0; - void write(const IfcGeom::TriangulationElement* /*o*/) {} - void write(const IfcGeom::BRepElement* o); + void write(const IfcGeom::TriangulationElement* /*o*/) {} + void write(const IfcGeom::BRepElement* o); bool isTesselated() const { return false; } void setFile(IfcParse::IfcFile*) {} }; diff --git a/src/serializers/SvgSerializer.cpp b/src/serializers/SvgSerializer.cpp index 5188a4c5b3..c674e82c9d 100644 --- a/src/serializers/SvgSerializer.cpp +++ b/src/serializers/SvgSerializer.cpp @@ -339,7 +339,7 @@ SvgSerializer::path_object& SvgSerializer::start_path(const gp_Pln& pln, const s } namespace { - boost::optional> storey_elevation_from_element(const IfcGeom::BRepElement* o) { + boost::optional> storey_elevation_from_element(const IfcGeom::BRepElement* o) { for (const auto& p : o->parents()) { if (p->type() == "IfcBuildingStorey") { try { @@ -503,7 +503,7 @@ namespace { } } -void SvgSerializer::write(const IfcGeom::BRepElement* brep_obj) { +void SvgSerializer::write(const IfcGeom::BRepElement* brep_obj) { boost::optional object_type; if (!brep_obj->product()->get("ObjectType")->isNull()) { @@ -2052,7 +2052,7 @@ return oss.str(); } } -std::string SvgSerializer::nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element* elem) { +std::string SvgSerializer::nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element* elem) { auto n = elem->name(); IfcUtil::escape_xml(n); @@ -2178,7 +2178,7 @@ namespace { std::string SvgSerializer::writeMetadata(const drawing_meta& m) { gp_Trsf trsf; trsf.SetTransformation(m.pln_3d.Position(), gp::XOY()); - auto m43 = IfcGeom::Matrix(IfcGeom::ElementSettings(IfcGeom::IteratorSettings(), 1., ""), trsf).data(); + auto m43 = IfcGeom::Matrix(IfcGeom::ElementSettings(IfcGeom::IteratorSettings(), 1., ""), trsf).data(); std::array, 4> m4 = {{ {{ (double)m43[0], (double)m43[3], (double)m43[6], (double)m43[9] }}, {{ (double)m43[1], (double)m43[4], (double)m43[7], (double)m43[10] }}, diff --git a/src/serializers/SvgSerializer.h b/src/serializers/SvgSerializer.h index 255b471377..978be7d371 100644 --- a/src/serializers/SvgSerializer.h +++ b/src/serializers/SvgSerializer.h @@ -215,8 +215,8 @@ public: void writeHeader(); void doWriteHeader(); bool ready(); - void write(const IfcGeom::TriangulationElement* /*o*/) {} - void write(const IfcGeom::BRepElement* o); + void write(const IfcGeom::TriangulationElement* /*o*/) {} + void write(const IfcGeom::BRepElement* o); void write(path_object& p, const TopoDS_Wire& wire, boost::optional> dash_array=boost::none); void write(const geometry_data& data); path_object& start_path(const gp_Pln& p, IfcUtil::IfcBaseEntity* storey, const std::string& id); @@ -279,10 +279,10 @@ public: void setDrawingCenter(double x, double y) { center_x_ = x; center_y_ = y; } - std::string nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element* elem); + std::string nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element* elem); std::string nameElement(const IfcUtil::IfcBaseEntity* elem); std::string idElement(const IfcUtil::IfcBaseEntity* elem); - std::string object_id(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element* o) { + std::string object_id(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element* o) { if (storey) { return idElement(storey) + "-" + GeometrySerializer::object_id(o); } else { diff --git a/src/serializers/WavefrontObjSerializer.cpp b/src/serializers/WavefrontObjSerializer.cpp index e849a3e7c7..ef5b26b571 100644 --- a/src/serializers/WavefrontObjSerializer.cpp +++ b/src/serializers/WavefrontObjSerializer.cpp @@ -84,7 +84,7 @@ void WaveFrontOBJSerializer::writeMaterial(const IfcGeom::Material& style) } } -void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement* o) +void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement* o) { obj_stream << "g " << object_id(o) << "\n"; obj_stream << "s 1" << "\n"; diff --git a/src/serializers/WavefrontObjSerializer.h b/src/serializers/WavefrontObjSerializer.h index 6b5e2e0d1f..00244abf95 100644 --- a/src/serializers/WavefrontObjSerializer.h +++ b/src/serializers/WavefrontObjSerializer.h @@ -40,8 +40,8 @@ public: bool ready(); void writeHeader(); void writeMaterial(const IfcGeom::Material& style); - void write(const IfcGeom::TriangulationElement* o); - void write(const IfcGeom::BRepElement* /*o*/) {} + void write(const IfcGeom::TriangulationElement* o); + void write(const IfcGeom::BRepElement* /*o*/) {} void finalize() {} bool isTesselated() const { return true; } void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}