protected IfcElement(DatabaseIfc db, IfcElement e, bool downStream) : base(db, e,downStream)
{
mTag = e.mTag;
#warning todo finish inverse
foreach (IfcRelVoidsElement ve in e.mHasOpenings)
{
IfcRelVoidsElement dve = db.Factory.Duplicate(ve) as IfcRelVoidsElement;
dve.RelatingBuildingElement = this;
}
foreach(IfcRelConnectsElements ce in e.mConnectedTo)
{
IfcElement element = ce.RelatingElement;
if(db.Factory.mDuplicateMapping.ContainsKey(element.mIndex))
{
IfcRelConnectsElements rce = db.Factory.Duplicate(ce) as IfcRelConnectsElements;
rce.RelatedElement = this;
rce.RelatingElement = db[db.Factory.mDuplicateMapping[element.mIndex]] as IfcElement;
}
}
foreach (IfcRelConnectsElements ce in e.mConnectedFrom)
{
IfcElement element = ce.RelatedElement;
if (db.Factory.mDuplicateMapping.ContainsKey(element.mIndex))
{
IfcRelConnectsElements rce = db.Factory.Duplicate(ce) as IfcRelConnectsElements;
rce.RelatingElement = this;
rce.RelatedElement = db[db.Factory.mDuplicateMapping[element.mIndex]] as IfcElement;
}
}
foreach(IfcRelVoidsElement ve in e.mHasOpenings)
{
IfcRelVoidsElement rv = db.Factory.Duplicate(ve) as IfcRelVoidsElement;
rv.RelatingBuildingElement = this;
}
if (e.mContainedInStructure != null)
(db.Factory.Duplicate(e.mContainedInStructure, false) as IfcRelContainedInSpatialStructure).add(this);
foreach (IfcRelConnectsStructuralActivity rcss in e.mAssignedStructuralActivity)
{
IfcRelConnectsStructuralActivity rc = db.Factory.Duplicate(rcss) as IfcRelConnectsStructuralActivity;
rc.RelatingElement = this;
}
foreach (IfcRelConnectsStructuralElement rcse in e.mHasStructuralMember)
{
IfcRelConnectsStructuralElement rc = db.Factory.Duplicate(rcse) as IfcRelConnectsStructuralElement;
rc.RelatingElement = this;
}
}
protected IfcElement(IfcObjectDefinition host, IfcObjectPlacement p, IfcProductRepresentation r) : base(host, p, r) { }