From fd3ef6508bf86e99019669a348595c9f9588fee3 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 18 Oct 2023 09:46:29 +0200 Subject: [PATCH] In-code changes for ADD2 --- cmake/CMakeLists.txt | 2 +- src/ifcparse/IfcHierarchyHelper.cpp | 8 ++++++++ src/ifcparse/IfcHierarchyHelper.h | 25 +++++++++++++++++++++++++ src/ifcparse/IfcSIPrefix.cpp | 9 +++++++++ src/ifcparse/IfcSchema.cpp | 9 +++++++++ 5 files changed, 52 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 19cd00c528..1fc7b4b3e9 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -705,7 +705,7 @@ if(NOT SCHEMA_VERSIONS) # super arbitrarily try to keep size down at least a little bit set(SCHEMA_VERSIONS "2x3" "4") else() - set(SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3_tc1" "4x3_add1") + set(SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3_tc1" "4x3_add1" "4x3_add2") endif() endif() diff --git a/src/ifcparse/IfcHierarchyHelper.cpp b/src/ifcparse/IfcHierarchyHelper.cpp index 9dc18b09e9..179d003159 100644 --- a/src/ifcparse/IfcHierarchyHelper.cpp +++ b/src/ifcparse/IfcHierarchyHelper.cpp @@ -641,6 +641,14 @@ Ifc4x3_add1::IfcStyledItem* create_styled_item(Ifc4x3_add1::IfcRepresentationIte } #endif +#ifdef HAS_SCHEMA_4x3_add2 +Ifc4x3_add2::IfcStyledItem* create_styled_item(Ifc4x3_add2::IfcRepresentationItem* item, Ifc4x3_add2::IfcPresentationStyle* style) { + boost::shared_ptr> styles(new aggregate_of()); + styles->push(style); + return new Ifc4x3_add2::IfcStyledItem(item, styles, boost::none); +} +#endif + template void setSurfaceColour_2x3(IfcHierarchyHelper& file, typename Schema::IfcRepresentation* rep, typename Schema::IfcPresentationStyleAssignment* style_assignment) { typename Schema::IfcRepresentationItem::list::ptr items = rep->Items(); diff --git a/src/ifcparse/IfcHierarchyHelper.h b/src/ifcparse/IfcHierarchyHelper.h index eb2b36ac06..9472769212 100644 --- a/src/ifcparse/IfcHierarchyHelper.h +++ b/src/ifcparse/IfcHierarchyHelper.h @@ -65,6 +65,9 @@ #ifdef HAS_SCHEMA_4x3_add1 #include "Ifc4x3_add1.h" #endif +#ifdef HAS_SCHEMA_4x3_add2 +#include "Ifc4x3_add2.h" +#endif #include "IfcFile.h" #include "IfcGlobalId.h" @@ -313,6 +316,28 @@ void set_children_of_relation(Ifc4x3_add1::IfcRelAggregates* t, aggregate_of_ins } #endif +#ifdef HAS_SCHEMA_4x3_add2 +Ifc4x3_add2::IfcObjectDefinition* get_parent_of_relation(Ifc4x3_add2::IfcRelContainedInSpatialStructure* t) { + return t->RelatingStructure(); +} + +aggregate_of_instance::ptr get_children_of_relation(Ifc4x3_add2::IfcRelContainedInSpatialStructure* t) { + return t->RelatedElements()->generalize(); +} + +aggregate_of_instance::ptr get_children_of_relation(Ifc4x3_add2::IfcRelAggregates* t) { + return t->RelatedObjects()->generalize(); +} + +void set_children_of_relation(Ifc4x3_add2::IfcRelContainedInSpatialStructure* t, aggregate_of_instance::ptr& cs) { + t->setRelatedElements(cs->as()); +} + +void set_children_of_relation(Ifc4x3_add2::IfcRelAggregates* t, aggregate_of_instance::ptr& cs) { + t->setRelatedObjects(cs->as()); +} +#endif + IfcUtil::IfcBaseClass* get_parent_of_relation(IfcUtil::IfcBaseClass* t) { return *t->data().getArgument( t->declaration().as_entity()->attribute_index("RelatingObject")); diff --git a/src/ifcparse/IfcSIPrefix.cpp b/src/ifcparse/IfcSIPrefix.cpp index d2dc91cb9d..3f80a054de 100644 --- a/src/ifcparse/IfcSIPrefix.cpp +++ b/src/ifcparse/IfcSIPrefix.cpp @@ -52,6 +52,9 @@ #ifdef HAS_SCHEMA_4x3_add1 #include "Ifc4x3_add1.h" #endif +#ifdef HAS_SCHEMA_4x3_add2 +#include "Ifc4x3_add2.h" +#endif double IfcParse::IfcSIPrefixToValue(const std::string& v) { if (v == "EXA") { @@ -151,6 +154,9 @@ template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc4x3::IfcNam #ifdef HAS_SCHEMA_4x3_add1 template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc4x3_add1::IfcNamedUnit* named_unit); #endif +#ifdef HAS_SCHEMA_4x3_add2 +template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc4x3_add2::IfcNamedUnit* named_unit); +#endif #else @@ -187,5 +193,8 @@ template double IFC_PARSE_API IfcParse::get_SI_equivalent(typename I #ifdef HAS_SCHEMA_4x3_add1 template double IFC_PARSE_API IfcParse::get_SI_equivalent(typename Ifc4x3_add1::IfcNamedUnit* named_unit); #endif +#ifdef HAS_SCHEMA_4x3_add2 +template double IFC_PARSE_API IfcParse::get_SI_equivalent(typename Ifc4x3_add2::IfcNamedUnit* named_unit); +#endif #endif diff --git a/src/ifcparse/IfcSchema.cpp b/src/ifcparse/IfcSchema.cpp index 3f63203ed4..ad22761c54 100644 --- a/src/ifcparse/IfcSchema.cpp +++ b/src/ifcparse/IfcSchema.cpp @@ -54,6 +54,9 @@ #ifdef HAS_SCHEMA_4x3_add1 #include "Ifc4x3_add1.h" #endif +#ifdef HAS_SCHEMA_4x3_add2 +#include "Ifc4x3_add2.h" +#endif #include @@ -194,6 +197,9 @@ const IfcParse::schema_definition* IfcParse::schema_by_name(const std::string& n #ifdef HAS_SCHEMA_4x3_add1 Ifc4x3_add1::get_schema(); #endif +#ifdef HAS_SCHEMA_4x3_add2 + Ifc4x3_add2::get_schema(); +#endif std::map::const_iterator it = schemas.find(boost::to_upper_copy(name)); if (it == schemas.end()) { @@ -252,6 +258,9 @@ void IfcParse::clear_schemas() { #ifdef HAS_SCHEMA_4x3_add1 Ifc4x3_add1::clear_schema(); #endif +#ifdef HAS_SCHEMA_4x3_add2 + Ifc4x3_add2::clear_schema(); +#endif // clear any remaining registered schemas // we pop schemas until map is empty, because map iteration is invalidated after each erasure