#1897 handle nesting in get_decomposing_entity_impl()

This commit is contained in:
Thomas Krijnen
2021-11-26 14:15:51 +01:00
parent d7b27c0620
commit c5e6c3e2c7
+23 -3
View File
@@ -142,13 +142,13 @@ IfcSchema::IfcObjectDefinition* get_decomposing_entity_impl(IfcSchema::IfcProduc
if (!parent) { \ if (!parent) { \
aggregate_of_instance::ptr parents = product->data().getInverse((&IfcSchema::IfcRelAggregates::Class()), -1); \ aggregate_of_instance::ptr parents = product->data().getInverse((&IfcSchema::IfcRelAggregates::Class()), -1); \
parents->push(product->data().getInverse((&IfcSchema::IfcRelNests::Class()), -1)); \ parents->push(product->data().getInverse((&IfcSchema::IfcRelNests::Class()), -1)); \
for (aggregate_of_instance::it it = parents->begin(); it != parents->end(); ++it) { \ for (aggregate_of_instance::it it = parents->begin(); it != parents->end(); ++it) { \
IfcSchema::IfcRelDecomposes* decompose = (IfcSchema::IfcRelDecomposes*)*it; \ IfcSchema::IfcRelDecomposes* decompose = (*it)->as<IfcSchema::IfcRelDecomposes>(); \
IfcUtil::IfcBaseEntity* ifc_objectdef; \ IfcUtil::IfcBaseEntity* ifc_objectdef; \
\ \
ifc_objectdef = get_RelatingObject(decompose); \ ifc_objectdef = get_RelatingObject(decompose); \
\ \
if (product == ifc_objectdef) continue; \ if (!ifc_objectdef || product == ifc_objectdef) continue; \
parent = ifc_objectdef->as<IfcSchema::IfcObjectDefinition>(); \ parent = ifc_objectdef->as<IfcSchema::IfcObjectDefinition>(); \
} \ } \
} \ } \
@@ -170,6 +170,10 @@ namespace {
if (aggr != nullptr) { if (aggr != nullptr) {
return aggr->RelatingObject(); return aggr->RelatingObject();
} }
Ifc4::IfcRelNests* nest = decompose->as<Ifc4::IfcRelNests>();
if (nest != nullptr) {
return nest->RelatingObject();
}
return nullptr; return nullptr;
} }
CREATE_GET_DECOMPOSING_ENTITY(Ifc4); CREATE_GET_DECOMPOSING_ENTITY(Ifc4);
@@ -181,6 +185,10 @@ namespace {
if (aggr != nullptr) { if (aggr != nullptr) {
return aggr->RelatingObject(); return aggr->RelatingObject();
} }
Ifc4x1::IfcRelNests* nest = decompose->as<Ifc4x1::IfcRelNests>();
if (nest != nullptr) {
return nest->RelatingObject();
}
return nullptr; return nullptr;
} }
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x1); CREATE_GET_DECOMPOSING_ENTITY(Ifc4x1);
@@ -192,6 +200,10 @@ namespace {
if (aggr != nullptr) { if (aggr != nullptr) {
return aggr->RelatingObject(); return aggr->RelatingObject();
} }
Ifc4x2::IfcRelNests* nest = decompose->as<Ifc4x2::IfcRelNests>();
if (nest != nullptr) {
return nest->RelatingObject();
}
return nullptr; return nullptr;
} }
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x2); CREATE_GET_DECOMPOSING_ENTITY(Ifc4x2);
@@ -203,6 +215,10 @@ namespace {
if (aggr != nullptr) { if (aggr != nullptr) {
return aggr->RelatingObject(); return aggr->RelatingObject();
} }
Ifc4x3_rc1::IfcRelNests* nest = decompose->as<Ifc4x3_rc1::IfcRelNests>();
if (nest != nullptr) {
return nest->RelatingObject();
}
return nullptr; return nullptr;
} }
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x3_rc1); CREATE_GET_DECOMPOSING_ENTITY(Ifc4x3_rc1);
@@ -214,6 +230,10 @@ namespace {
if (aggr != nullptr) { if (aggr != nullptr) {
return aggr->RelatingObject(); return aggr->RelatingObject();
} }
Ifc4x3_rc2::IfcRelNests* nest = decompose->as<Ifc4x3_rc2::IfcRelNests>();
if (nest != nullptr) {
return nest->RelatingObject();
}
return nullptr; return nullptr;
} }
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x3_rc2); CREATE_GET_DECOMPOSING_ENTITY(Ifc4x3_rc2);