From 25948a608ad52184a5e68790a5cbe0842f0a6de0 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 21 Nov 2022 09:43:13 +0100 Subject: [PATCH] Missing parse updates after 4e0a19e --- src/ifcparse/IfcHierarchyHelper.cpp | 35 +++++++++++++++++++++++++++++ src/ifcparse/IfcHierarchyHelper.h | 35 +++++++++++++++++++++++++++++ src/ifcparse/IfcSIPrefix.cpp | 12 ++++++++-- src/ifcparse/IfcSchema.cpp | 6 +++++ 4 files changed, 86 insertions(+), 2 deletions(-) diff --git a/src/ifcparse/IfcHierarchyHelper.cpp b/src/ifcparse/IfcHierarchyHelper.cpp index b0109ac7ce..6661a3bb60 100644 --- a/src/ifcparse/IfcHierarchyHelper.cpp +++ b/src/ifcparse/IfcHierarchyHelper.cpp @@ -568,6 +568,14 @@ Ifc4x3::IfcStyledItem* create_styled_item(Ifc4x3::IfcRepresentationItem* item, I } #endif +#ifdef HAS_SCHEMA_4x3_add1 +Ifc4x3_add1::IfcStyledItem* create_styled_item(Ifc4x3_add1::IfcRepresentationItem* item, Ifc4x3_add1::IfcPresentationStyle* style) { + boost::shared_ptr> styles(new aggregate_of()); + styles->push(style); + return new Ifc4x3_add1::IfcStyledItem(item, styles, boost::none); +} +#endif + template void setSurfaceColour_2x3(IfcHierarchyHelper& file, typename Schema::IfcRepresentation* rep, typename Schema::IfcPresentationStyleAssignment* style_assignment) { @@ -835,6 +843,33 @@ void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3::IfcRepresentatio } #endif +#ifdef HAS_SCHEMA_4x3_add1 +Ifc4x3_add1::IfcPresentationStyle* addStyleAssignment(IfcHierarchyHelper& file, double r, double g, double b, double a) +{ + return addStyleAssignment_4x3(file, r, g, b, a); +} + +Ifc4x3_add1::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add1::IfcProductRepresentation* shape, double r, double g, double b, double a) +{ + return setSurfaceColour_4x3(file, shape, r, g, b, a); +} + +Ifc4x3_add1::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add1::IfcRepresentation* shape, double r, double g, double b, double a) +{ + return setSurfaceColour_4x3(file, shape, r, g, b, a); +} + +void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add1::IfcProductRepresentation* shape, Ifc4x3_add1::IfcPresentationStyle* style) +{ + setSurfaceColour_4x3(file, shape, style); +} + +void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add1::IfcRepresentation* shape, Ifc4x3_add1::IfcPresentationStyle* style) +{ + setSurfaceColour_4x3(file, shape, style); +} +#endif + template typename Schema::IfcProductDefinitionShape* IfcHierarchyHelper::addMappedItem( typename Schema::IfcShapeRepresentation* rep, diff --git a/src/ifcparse/IfcHierarchyHelper.h b/src/ifcparse/IfcHierarchyHelper.h index 84e29d842a..10a5ae2ca9 100644 --- a/src/ifcparse/IfcHierarchyHelper.h +++ b/src/ifcparse/IfcHierarchyHelper.h @@ -59,6 +59,9 @@ #ifdef HAS_SCHEMA_4x3 #include "../ifcparse/Ifc4x3.h" #endif +#ifdef HAS_SCHEMA_4x3_add1 +#include "../ifcparse/Ifc4x3_add1.h" +#endif #include "../ifcparse/IfcFile.h" #include "../ifcparse/IfcWrite.h" @@ -263,6 +266,29 @@ namespace { } #endif +#ifdef HAS_SCHEMA_4x3_add1 + Ifc4x3_add1::IfcObjectDefinition* get_parent_of_relation(Ifc4x3_add1::IfcRelContainedInSpatialStructure* t) { + return t->RelatingStructure(); + } + + aggregate_of_instance::ptr get_children_of_relation(Ifc4x3_add1::IfcRelContainedInSpatialStructure* t) { + return t->RelatedElements()->generalize(); + } + + aggregate_of_instance::ptr get_children_of_relation(Ifc4x3_add1::IfcRelAggregates* t) { + return t->RelatedObjects()->generalize(); + } + + void set_children_of_relation(Ifc4x3_add1::IfcRelContainedInSpatialStructure* t, aggregate_of_instance::ptr& cs) { + t->setRelatedElements(cs->as()); + } + + void set_children_of_relation(Ifc4x3_add1::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") @@ -497,6 +523,15 @@ IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3::If IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3::IfcRepresentation* shape, Ifc4x3::IfcPresentationStyle* style); #endif +#ifdef HAS_SCHEMA_4x3_add1 +IFC_PARSE_API Ifc4x3_add1::IfcPresentationStyle* addStyleAssignment(IfcHierarchyHelper& file, double r, double g, double b, double a = 1.0); +IFC_PARSE_API Ifc4x3_add1::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add1::IfcProductRepresentation* shape, double r, double g, double b, double a = 1.0); +IFC_PARSE_API Ifc4x3_add1::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add1::IfcRepresentation* shape, double r, double g, double b, double a = 1.0); +IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add1::IfcProductRepresentation* shape, Ifc4x3_add1::IfcPresentationStyle* style); +IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add1::IfcRepresentation* shape, Ifc4x3_add1::IfcPresentationStyle* style); +#endif + + /* template <> inline void IfcHierarchyHelper::addRelatedObject (typename Schema::IfcObjectDefinition* relating_structure, diff --git a/src/ifcparse/IfcSIPrefix.cpp b/src/ifcparse/IfcSIPrefix.cpp index 4d53ec99ac..1a2c0cbb00 100644 --- a/src/ifcparse/IfcSIPrefix.cpp +++ b/src/ifcparse/IfcSIPrefix.cpp @@ -46,6 +46,9 @@ #ifdef HAS_SCHEMA_4x3 #include "../ifcparse/Ifc4x3.h" #endif +#ifdef HAS_SCHEMA_4x3_add1 +#include "../ifcparse/Ifc4x3_add1.h" +#endif double IfcParse::IfcSIPrefixToValue(const std::string& v) { if ( v == "EXA" ) return 1.e18; @@ -104,7 +107,6 @@ template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc2x3::IfcNam template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc4::IfcNamedUnit* named_unit); #endif #ifdef HAS_SCHEMA_4x1 - template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc4x1::IfcNamedUnit* named_unit); #endif #ifdef HAS_SCHEMA_4x2 @@ -123,7 +125,10 @@ template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc4x3_rc3 template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc4x3_rc4::IfcNamedUnit* named_unit); #endif #ifdef HAS_SCHEMA_4x3 -template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc4x3_rc4::IfcNamedUnit* named_unit); +template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc4x3::IfcNamedUnit* named_unit); +#endif +#ifdef HAS_SCHEMA_4x3_add1 +template double IFC_PARSE_API IfcParse::get_SI_equivalent(Ifc4x3_add1::IfcNamedUnit* named_unit); #endif #else @@ -155,5 +160,8 @@ template double IFC_PARSE_API IfcParse::get_SI_equivalent(typename I #ifdef HAS_SCHEMA_4x3 template double IFC_PARSE_API IfcParse::get_SI_equivalent(typename Ifc4x3::IfcNamedUnit* named_unit); #endif +#ifdef HAS_SCHEMA_4x3_add1 +template double IFC_PARSE_API IfcParse::get_SI_equivalent(typename Ifc4x3_add1::IfcNamedUnit* named_unit); +#endif #endif diff --git a/src/ifcparse/IfcSchema.cpp b/src/ifcparse/IfcSchema.cpp index 7d547e3014..2f20fcb1b5 100644 --- a/src/ifcparse/IfcSchema.cpp +++ b/src/ifcparse/IfcSchema.cpp @@ -118,6 +118,9 @@ void IfcParse::register_schema(schema_definition* s) { #ifdef HAS_SCHEMA_4x3 #include "../ifcparse/Ifc4x3.h" #endif +#ifdef HAS_SCHEMA_4x3_add1 +#include "../ifcparse/Ifc4x3_add1.h" +#endif const IfcParse::schema_definition* IfcParse::schema_by_name(const std::string& name) { // TODO: initialize automatically somehow @@ -148,6 +151,9 @@ const IfcParse::schema_definition* IfcParse::schema_by_name(const std::string& n #ifdef HAS_SCHEMA_4x3 Ifc4x3::get_schema(); #endif +#ifdef HAS_SCHEMA_4x3_add1 + Ifc4x3_add1::get_schema(); +#endif std::map::const_iterator it = schemas.find(boost::to_upper_copy(name)); if (it == schemas.end()) {