mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
Fix addRelatedObject, fix by Cadline St2
This commit is contained in:
@@ -78,8 +78,8 @@ public:
|
|||||||
double xx=1.0, double xy=0.0, double xz=0.0);
|
double xx=1.0, double xy=0.0, double xz=0.0);
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void addRelatedObject(IfcSchema::IfcObjectDefinition* related_object,
|
void addRelatedObject(IfcSchema::IfcObjectDefinition* relating_object,
|
||||||
IfcSchema::IfcObjectDefinition* relating_object, IfcSchema::IfcOwnerHistory* owner_hist = 0)
|
IfcSchema::IfcObjectDefinition* related_object, IfcSchema::IfcOwnerHistory* owner_hist = 0)
|
||||||
{
|
{
|
||||||
typename T::list::ptr li = entitiesByType<T>();
|
typename T::list::ptr li = entitiesByType<T>();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
@@ -100,9 +100,9 @@ public:
|
|||||||
if (! owner_hist) {
|
if (! owner_hist) {
|
||||||
owner_hist = addOwnerHistory();
|
owner_hist = addOwnerHistory();
|
||||||
}
|
}
|
||||||
IfcSchema::IfcObjectDefinition::list::ptr relating_objects (new IfcTemplatedEntityList<IfcSchema::IfcObjectDefinition>());
|
IfcSchema::IfcObjectDefinition::list::ptr related_objects (new IfcTemplatedEntityList<IfcSchema::IfcObjectDefinition>());
|
||||||
relating_objects->push(relating_object);
|
related_objects->push(related_object);
|
||||||
T* t = new T(IfcParse::IfcGlobalId(), owner_hist, boost::none, boost::none, related_object, relating_objects);
|
T* t = new T(IfcParse::IfcGlobalId(), owner_hist, boost::none, boost::none, relating_object, related_objects);
|
||||||
addEntity(t);
|
addEntity(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,14 +174,14 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void IfcHierarchyHelper::addRelatedObject <IfcSchema::IfcRelContainedInSpatialStructure> (IfcSchema::IfcObjectDefinition* related_object,
|
inline void IfcHierarchyHelper::addRelatedObject <IfcSchema::IfcRelContainedInSpatialStructure> (IfcSchema::IfcObjectDefinition* relating_structure,
|
||||||
IfcSchema::IfcObjectDefinition* relating_object, IfcSchema::IfcOwnerHistory* owner_hist)
|
IfcSchema::IfcObjectDefinition* related_object, IfcSchema::IfcOwnerHistory* owner_hist)
|
||||||
{
|
{
|
||||||
IfcSchema::IfcRelContainedInSpatialStructure::list::ptr li = entitiesByType<IfcSchema::IfcRelContainedInSpatialStructure>();
|
IfcSchema::IfcRelContainedInSpatialStructure::list::ptr li = entitiesByType<IfcSchema::IfcRelContainedInSpatialStructure>();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (IfcSchema::IfcRelContainedInSpatialStructure::list::it i = li->begin(); i != li->end(); ++i) {
|
for (IfcSchema::IfcRelContainedInSpatialStructure::list::it i = li->begin(); i != li->end(); ++i) {
|
||||||
IfcSchema::IfcRelContainedInSpatialStructure* rel = *i;
|
IfcSchema::IfcRelContainedInSpatialStructure* rel = *i;
|
||||||
if (rel->RelatingStructure() == relating_object) {
|
if (rel->RelatingStructure() == relating_structure) {
|
||||||
IfcSchema::IfcProduct::list::ptr products = rel->RelatedElements();
|
IfcSchema::IfcProduct::list::ptr products = rel->RelatedElements();
|
||||||
products->push((IfcSchema::IfcProduct*)related_object);
|
products->push((IfcSchema::IfcProduct*)related_object);
|
||||||
rel->setRelatedElements(products);
|
rel->setRelatedElements(products);
|
||||||
@@ -196,10 +196,10 @@ inline void IfcHierarchyHelper::addRelatedObject <IfcSchema::IfcRelContainedInSp
|
|||||||
if (! owner_hist) {
|
if (! owner_hist) {
|
||||||
owner_hist = addOwnerHistory();
|
owner_hist = addOwnerHistory();
|
||||||
}
|
}
|
||||||
IfcSchema::IfcProduct::list::ptr relating_objects (new IfcTemplatedEntityList<IfcSchema::IfcProduct>());
|
IfcSchema::IfcProduct::list::ptr related_objects (new IfcTemplatedEntityList<IfcSchema::IfcProduct>());
|
||||||
relating_objects->push((IfcSchema::IfcProduct*)relating_object);
|
related_objects->push((IfcSchema::IfcProduct*)related_object);
|
||||||
IfcSchema::IfcRelContainedInSpatialStructure* t = new IfcSchema::IfcRelContainedInSpatialStructure(IfcParse::IfcGlobalId(), owner_hist,
|
IfcSchema::IfcRelContainedInSpatialStructure* t = new IfcSchema::IfcRelContainedInSpatialStructure(IfcParse::IfcGlobalId(), owner_hist,
|
||||||
boost::none, boost::none, relating_objects, (IfcSchema::IfcSpatialStructureElement*)related_object);
|
boost::none, boost::none, related_objects, (IfcSchema::IfcSpatialStructureElement*)relating_structure);
|
||||||
|
|
||||||
addEntity(t);
|
addEntity(t);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user