diff --git a/src/ifcgeom/IfcGeom.h b/src/ifcgeom/IfcGeom.h index bf8550bfd8..579b2b0985 100644 --- a/src/ifcgeom/IfcGeom.h +++ b/src/ifcgeom/IfcGeom.h @@ -221,13 +221,13 @@ public: static IfcSchema::IfcObjectDefinition* get_decomposing_entity(IfcSchema::IfcProduct*); - template - IfcGeom::BRepElement

* create_brep_for_representation_and_product( + template + 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

*); + template + 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); @@ -304,7 +304,7 @@ public: 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 b05e00db1f..561ceb6566 100644 --- a/src/ifcgeom/IfcGeomElement.h +++ b/src/ifcgeom/IfcGeomElement.h @@ -79,7 +79,7 @@ namespace IfcGeom { } }; - template + template class Element { private: int _id; @@ -89,17 +89,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); @@ -123,10 +123,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) @@ -158,8 +158,8 @@ namespace IfcGeom { virtual ~Element() {} }; - template - class BRepElement : public Element

{ + template + class BRepElement : public Element { private: boost::shared_ptr _geometry; public: @@ -168,7 +168,7 @@ namespace IfcGeom { 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, 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) {} private: @@ -176,19 +176,19 @@ namespace IfcGeom { BRepElement& operator=(const BRepElement& other); }; - template - class TriangulationElement : public Element

{ + template + class TriangulationElement : public Element { private: boost::shared_ptr< 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) + TriangulationElement(const BRepElement& shape_model) + : Element(shape_model) , _geometry(boost::shared_ptr >(new Representation::Triangulation

(shape_model.geometry()))) {} - TriangulationElement(const Element

& element, const boost::shared_ptr >& geometry) - : Element

(element) + TriangulationElement(const Element& element, const boost::shared_ptr >& geometry) + : Element(element) , _geometry(geometry) {} private: @@ -196,14 +196,14 @@ namespace IfcGeom { TriangulationElement& operator=(const TriangulationElement& other); }; - template - class SerializedElement : public Element

{ + template + class SerializedElement : public Element { private: Representation::Serialization* _geometry; public: const Representation::Serialization& geometry() const { return *_geometry; } - SerializedElement(const BRepElement

& shape_model) - : Element

(shape_model) + SerializedElement(const BRepElement& shape_model) + : Element(shape_model) , _geometry(new Representation::Serialization(shape_model.geometry())) {} virtual ~SerializedElement() { diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index a7d9d8c487..7c1e3c62ec 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -1242,8 +1242,8 @@ const IfcSchema::IfcMaterial* IfcGeom::Kernel::get_single_material_association(c return single_material; } -template -IfcGeom::BRepElement

* IfcGeom::Kernel::create_brep_for_representation_and_product( +template +IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and_product( const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product) { std::stringstream representation_id_builder; @@ -1392,7 +1392,7 @@ IfcGeom::BRepElement

* IfcGeom::Kernel::create_brep_for_representation_and_pro context_string = representation->ContextOfItems()->ContextType(); } - return new BRepElement

( + return new BRepElement( product->data().id(), parent_id, name, @@ -1470,10 +1470,10 @@ IfcSchema::IfcProduct::list::ptr IfcGeom::Kernel::products_represented_by(const return products; } -template -IfcGeom::BRepElement

* IfcGeom::Kernel::create_brep_for_processed_representation( +template +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 { @@ -1506,7 +1506,7 @@ IfcGeom::BRepElement

* IfcGeom::Kernel::create_brep_for_processed_representati const std::string product_type = product->declaration().name(); - return new BRepElement

( + return new BRepElement( product->data().id(), parent_id, name, @@ -1574,15 +1574,19 @@ IfcSchema::IfcObjectDefinition* IfcGeom::Kernel::get_decomposing_entity(IfcSchem return parent; } -template IFC_GEOM_API IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and_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( +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); +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 diff --git a/src/ifcgeom/IfcGeomIteratorImplementation.cpp b/src/ifcgeom/IfcGeomIteratorImplementation.cpp index 8313f5ce43..fe29773c65 100644 --- a/src/ifcgeom/IfcGeomIteratorImplementation.cpp +++ b/src/ifcgeom/IfcGeomIteratorImplementation.cpp @@ -2,8 +2,9 @@ #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_); + template class MAKE_TYPE_NAME(IteratorImplementation_); + template class MAKE_TYPE_NAME(IteratorImplementation_); } #define MAKE_INIT_FN__(a, b) init_ ## a ## b @@ -11,20 +12,21 @@ namespace IfcGeom { #define MAKE_INIT_FN(t) MAKE_INIT_FN_(t, IfcSchema) namespace { - template + template struct factory_t { - IfcGeom::IteratorImplementation

* operator()(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file) const { - return new IfcGeom::MAKE_TYPE_NAME(IteratorImplementation_)

(settings, file); + IfcGeom::IteratorImplementation* operator()(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file) const { + return new IfcGeom::MAKE_TYPE_NAME(IteratorImplementation_)(settings, file); } }; } -template -void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation

* mapping) { +template +void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation* mapping) { static const std::string schema_name = STRINGIFY(IfcSchema); - factory_t

factory; + 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*); +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 33092b63c7..76bdad017c 100644 --- a/src/ifcgeom/IfcGeomIteratorImplementation.h +++ b/src/ifcgeom/IfcGeomIteratorImplementation.h @@ -94,8 +94,8 @@ namespace IfcGeom { - template - class MAKE_TYPE_NAME(IteratorImplementation_) : public IteratorImplementation

{ + template + class MAKE_TYPE_NAME(IteratorImplementation_) : public IteratorImplementation { private: MAKE_TYPE_NAME(IteratorImplementation_)(const MAKE_TYPE_NAME(IteratorImplementation_)&); // N/I @@ -111,9 +111,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; @@ -154,6 +154,7 @@ 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; MAKE_TYPE_NAME(IteratorImplementation_)(const IteratorSettings& settings, IfcParse::IfcFile* file, std::vector& filters) : settings(settings) @@ -399,7 +400,7 @@ namespace IfcGeom { return associated_single_materials.size() == 1; } - BRepElement

* create_shape_model_for_next_entity() { + BRepElement* create_shape_model_for_next_entity() { for (;;) { IfcSchema::IfcRepresentation* representation; @@ -468,9 +469,9 @@ namespace IfcGeom { IfcSchema::IfcProduct* product = *ifcproduct_iterator; 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); } @@ -524,10 +525,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 (current_triangulation) { ret = current_triangulation; } else if (current_serialization) { ret = current_serialization; } else if (current_shape_model) { ret = current_shape_model; } @@ -537,12 +538,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 @@ -582,13 +583,13 @@ namespace IfcGeom { } /// Gets the native (Open Cascade) representation of the current geometrical entity. - BRepElement

* get_native() + BRepElement* get_native() { // TODO: Test settings and throw return current_shape_model; } - 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; @@ -640,14 +641,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(); @@ -666,16 +667,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_schema_agnostic/IfcGeomIterator.h b/src/ifcgeom_schema_agnostic/IfcGeomIterator.h index b4b5c3bc7f..56769d6acd 100644 --- a/src/ifcgeom_schema_agnostic/IfcGeomIterator.h +++ b/src/ifcgeom_schema_agnostic/IfcGeomIterator.h @@ -70,7 +70,7 @@ namespace IfcGeom { - template + template class Iterator { private: Iterator(const Iterator&); // N/I @@ -78,14 +78,14 @@ namespace IfcGeom { IfcParse::IfcFile* file_; IfcGeom::IteratorSettings settings_; - IteratorImplementation

* implementation_; + IteratorImplementation* implementation_; public: Iterator(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file) : file_(file) , settings_(settings) { - implementation_ = iterator_implementations

().construct(file_->schema()->name(), settings, file); + implementation_ = iterator_implementations().construct(file_->schema()->name(), settings, file); } bool initialize() { @@ -102,11 +102,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 df747fb8e9..daccfb4a44 100644 --- a/src/ifcgeom_schema_agnostic/IteratorImplementation.cpp +++ b/src/ifcgeom_schema_agnostic/IteratorImplementation.cpp @@ -2,37 +2,38 @@ #include -template -IteratorFactoryImplementation

& iterator_implementations() { - static IteratorFactoryImplementation

impl; +template +IteratorFactoryImplementation& iterator_implementations() { + static IteratorFactoryImplementation impl; return impl; } -template IteratorFactoryImplementation& iterator_implementations(); -template IteratorFactoryImplementation& iterator_implementations(); +template IteratorFactoryImplementation& iterator_implementations(); +template IteratorFactoryImplementation& iterator_implementations(); +template IteratorFactoryImplementation& iterator_implementations(); -template -extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation

*); +template +extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation*); -template -extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation

*); +template +extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation*); -template -IteratorFactoryImplementation

::IteratorFactoryImplementation() { +template +IteratorFactoryImplementation::IteratorFactoryImplementation() { init_IteratorImplementation_Ifc2x3(this); init_IteratorImplementation_Ifc4(this); } -template -void IteratorFactoryImplementation

::bind(const std::string& schema_name, typename get_factory_type

::type fn) { +template +void IteratorFactoryImplementation::bind(const std::string& schema_name, typename get_factory_type::type 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) { +template +IfcGeom::IteratorImplementation* IteratorFactoryImplementation::construct(const std::string& schema_name, const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file) { const std::string schema_name_lower = boost::to_lower_copy(schema_name); - typename std::map::type>::const_iterator it; + typename std::map::type>::const_iterator it; it = this->find(schema_name_lower); if (it == this->end()) { throw IfcParse::IfcException("No geometry iterator registered for " + schema_name); @@ -41,5 +42,6 @@ IfcGeom::IteratorImplementation

* IteratorFactoryImplementation

::construct( } -template class IteratorFactoryImplementation; -template class IteratorFactoryImplementation; +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 ddcac38439..a6caf78a57 100644 --- a/src/ifcgeom_schema_agnostic/IteratorImplementation.h +++ b/src/ifcgeom_schema_agnostic/IteratorImplementation.h @@ -10,46 +10,52 @@ #include namespace IfcGeom { - template + template class IteratorImplementation; - template + template class Element; - template + template class BRepElement; } -typedef boost::function2*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*> iterator_float_fn; -typedef boost::function2*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*> iterator_double_fn; +typedef boost::function2*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*> iterator_float_float_fn; +typedef boost::function2*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*> iterator_float_double_fn; +typedef boost::function2*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*> iterator_double_double_fn; -template +template struct get_factory_type {}; template <> -struct get_factory_type { - typedef iterator_float_fn type; +struct get_factory_type { + typedef iterator_float_float_fn type; }; template <> -struct get_factory_type { - typedef iterator_double_fn type; +struct get_factory_type { + typedef iterator_float_double_fn type; }; -template -class IteratorFactoryImplementation : public std::map::type> { +template <> +struct get_factory_type { + typedef iterator_double_double_fn type; +}; + +template +class IteratorFactoryImplementation : public std::map::type> { 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*); + 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*); }; -template -IteratorFactoryImplementation

& iterator_implementations(); +template +IteratorFactoryImplementation& iterator_implementations(); namespace IfcGeom { - template + template class IteratorImplementation { public: virtual bool initialize() = 0; @@ -58,9 +64,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 8a1755d4fd..ae6bc65bf7 100644 --- a/src/ifcgeom_schema_agnostic/Kernel.h +++ b/src/ifcgeom_schema_agnostic/Kernel.h @@ -24,7 +24,7 @@ namespace { namespace IfcGeom { - template + template class BRepElement; class Kernel { @@ -78,7 +78,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/ifcgeomserver/IfcGeomServer.cpp b/src/ifcgeomserver/IfcGeomServer.cpp index 18b4a26163..dde9b6efa7 100644 --- a/src/ifcgeomserver/IfcGeomServer.cpp +++ b/src/ifcgeomserver/IfcGeomServer.cpp @@ -155,7 +155,7 @@ protected: } public: const std::string& string() { return str; } - Hello() : Command(HELLO), str("IfcOpenShell-" IFCOPENSHELL_VERSION "-2") {} + Hello() : Command(HELLO), str("IfcOpenShell-" IFCOPENSHELL_VERSION "-0") {} }; class More : public Command { @@ -224,7 +224,7 @@ public: class Entity : public Command { private: - const IfcGeom::TriangulationElement* geom; + const IfcGeom::TriangulationElement* geom; bool append_line_data; EntityExtension* eext_; protected: @@ -235,14 +235,14 @@ protected: swrite(s, geom->name()); swrite(s, geom->type()); swrite(s, geom->parent_id()); - const std::vector& m = geom->transformation().matrix().data(); - const float matrix_array[16] = { + const std::vector& m = geom->transformation().matrix().data(); + const double matrix_array[16] = { m[0], m[3], m[6], m[ 9], m[1], m[4], m[7], m[10], m[2], m[5], m[8], m[11], 0, 0, 0, 1 }; - swrite(s, std::string((char*)matrix_array, 16 * sizeof(float))); + swrite(s, std::string((char*)matrix_array, 16 * sizeof(double))); // The first bit of the string is always the instance name of the representation. const std::string& representation_id = geom->geometry().id(); @@ -310,7 +310,7 @@ protected: } } public: - Entity(const IfcGeom::TriangulationElement* geom, EntityExtension* eext = 0) : Command(ENTITY), geom(geom), append_line_data(false), eext_(eext) {}; + Entity(const IfcGeom::TriangulationElement* geom, EntityExtension* eext = 0) : Command(ENTITY), geom(geom), append_line_data(false), eext_(eext) {}; }; class Next : public Command { @@ -370,9 +370,9 @@ static const double MAX_WALKABLE_SURFACE_ANGLE_DEGREES = 15.; class QuantityWriter : public EntityExtension { private: - const IfcGeom::BRepElement* elem_; + const IfcGeom::BRepElement* elem_; public: - QuantityWriter(const IfcGeom::BRepElement* elem) : + QuantityWriter(const IfcGeom::BRepElement* elem) : elem_(elem) {} void write_contents(std::ostream& s) { @@ -471,7 +471,7 @@ int main () { double deflection = 1.e-3; bool has_more = false; - IfcGeom::Iterator* iterator = 0; + IfcGeom::Iterator* iterator = 0; IfcParse::IfcFile* file = 0; std::vector< std::pair > setting_pairs; @@ -501,7 +501,7 @@ int main () { settings.set_deflection_tolerance(deflection); file = new IfcParse::IfcFile(data, (int)len); - iterator = new IfcGeom::Iterator(settings, file); + iterator = new IfcGeom::Iterator(settings, file); has_more = iterator->initialize(); More(has_more).write(std::cout); @@ -513,7 +513,7 @@ int main () { exit_code = 1; break; } - const IfcGeom::TriangulationElement* geom = static_cast*>(iterator->get()); + const IfcGeom::TriangulationElement* geom = static_cast*>(iterator->get()); QuantityWriter eext(iterator->get_native()); Entity(geom, &eext).write(std::cout); continue;