Наследование: GeometryGym.Ifc.IfcRelDecomposes
Пример #1
0
 protected IfcObjectDefinition(IfcObjectDefinition basis) : base(basis)
 {
     mHasAssignments  = basis.mHasAssignments;
     mNests           = basis.mNests;
     mIsNestedBy      = basis.mIsNestedBy;
     mHasContext      = basis.mHasContext;
     mIsDecomposedBy  = basis.mIsDecomposedBy;
     mDecomposes      = basis.mDecomposes;
     mHasAssociations = basis.mHasAssociations;
 }
Пример #2
0
 public void AddAggregated(IfcObjectDefinition o)
 {
     if (mDecomposes == null)
     {
         mDecomposes = new IfcRelAggregates(this, o);
     }
     else
     {
         mDecomposes.addObject(o);
     }
 }
Пример #3
0
 internal override void ParseXml(XmlElement xml)
 {
     base.ParseXml(xml);
     foreach (XmlNode child in xml.ChildNodes)
     {
         string name = child.Name;
         if (string.Compare(name, "HasAssignments") == 0)
         {
             foreach (XmlNode node in child.ChildNodes)
             {
                 IfcRelAssigns ra = mDatabase.ParseXml <IfcRelAssigns>(node as XmlElement);
                 if (ra != null)
                 {
                     ra.AddRelated(this);
                 }
             }
         }
         else if (string.Compare(name, "IsNestedBy") == 0)
         {
             foreach (XmlNode node in child.ChildNodes)
             {
                 IfcRelNests rn = mDatabase.ParseXml <IfcRelNests>(node as XmlElement);
                 if (rn != null)
                 {
                     rn.RelatingObject = this;
                 }
             }
         }
         else if (string.Compare(name, "IsDecomposedBy") == 0)
         {
             foreach (XmlNode node in child.ChildNodes)
             {
                 IfcRelAggregates ra = mDatabase.ParseXml <IfcRelAggregates>(node as XmlElement);
                 if (ra != null)
                 {
                     ra.RelatingObject = this;
                 }
             }
         }
         else if (string.Compare(name, "HasAssociations") == 0)
         {
             foreach (XmlNode node in child.ChildNodes)
             {
                 IfcRelAssociates ra = mDatabase.ParseXml <IfcRelAssociates>(node as XmlElement);
                 if (ra != null)
                 {
                     ra.addAssociation(this);
                 }
             }
         }
     }
 }
Пример #4
0
            internal GlobalIdChangeManager(BaseClassIfc obj)
            {
                mObject = obj;
                IfcObjectDefinition objectDefinition = obj as IfcObjectDefinition;

                if (objectDefinition != null)
                {
                    mIsDefinedBy.AddRange(objectDefinition.mIsDefinedBy);
                    foreach (IfcRelDefinesByProperties rdp in mIsDefinedBy)
                    {
                        rdp.RelatedObjects.Remove(objectDefinition);
                    }

                    mDecomposes = objectDefinition.mDecomposes;
                    if (mDecomposes != null)
                    {
                        mDecomposes.RelatedObjects.Remove(objectDefinition);
                    }
                    mNests = objectDefinition.mNests;
                    if (mNests != null)
                    {
                        mNests.RelatedObjects.Remove(objectDefinition);
                    }

                    IfcObject o = mObject as IfcObject;
                    if (o != null)
                    {
                        IfcProduct product = objectDefinition as IfcProduct;
                        if (product != null)
                        {
                            mContainedIn = product.mContainedInStructure;
                            if (mContainedIn != null)
                            {
                                mContainedIn.RelatedElements.Remove(product);
                            }
                        }
                    }
                }
            }
Пример #5
0
        protected void ReplaceDatabase(BaseClassIfc revised)
        {
            IfcRoot thisRoot = this as IfcRoot, revisedRoot = revised as IfcRoot;

            if (thisRoot != null && revisedRoot != null)
            {
                revisedRoot.GlobalId     = thisRoot.GlobalId;
                revisedRoot.OwnerHistory = thisRoot.OwnerHistory;
                revisedRoot.Name         = thisRoot.Name;
                revisedRoot.Description  = thisRoot.Description;
                IfcObjectDefinition thisObjectDefinition = this as IfcObjectDefinition, revisedObjectDefinition = revised as IfcObjectDefinition;
                if (thisObjectDefinition != null && revisedObjectDefinition != null)
                {
                    foreach (IfcRelAggregates rel in thisObjectDefinition.IsDecomposedBy.ToList())
                    {
                        rel.RelatingObject = revisedObjectDefinition;
                    }
                    foreach (IfcRelNests rel in thisObjectDefinition.IsNestedBy.ToList())
                    {
                        rel.RelatingObject = revisedObjectDefinition;
                    }

                    IfcRelAggregates relAggregates = thisObjectDefinition.Decomposes;
                    if (relAggregates != null)
                    {
                        relAggregates.RelatedObjects.Remove(thisObjectDefinition);
                        relAggregates.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcRelNests relNests = thisObjectDefinition.Nests;
                    if (relNests != null)
                    {
                        relNests.RelatedObjects.Remove(thisObjectDefinition);
                        relNests.RelatedObjects.Add(thisObjectDefinition);
                    }

                    foreach (IfcRelDefinesByProperties relDefinesByProperties in thisObjectDefinition.mIsDefinedBy.ToList())
                    {
                        relDefinesByProperties.RelatedObjects.Remove(thisObjectDefinition);
                        relDefinesByProperties.RelatedObjects.Add(revisedObjectDefinition);
                    }

                    foreach (IfcRelAssigns assigns in thisObjectDefinition.HasAssignments.ToList())
                    {
                        assigns.RelatedObjects.Remove(thisObjectDefinition);
                        assigns.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcRelDeclares relDeclares = thisObjectDefinition.HasContext;
                    if (relDeclares != null)
                    {
                        relDeclares.RelatedDefinitions.Remove(thisObjectDefinition);
                        relDeclares.RelatedDefinitions.Add(revisedObjectDefinition);
                    }
                    foreach (IfcRelAssociates associates in thisObjectDefinition.HasAssociations.ToList())
                    {
                        associates.RelatedObjects.Remove(thisObjectDefinition);
                        associates.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcObject thisObject = this as IfcObject, revisedObject = revised as IfcObject;
                    if (thisObject != null && revisedObject != null)
                    {
                        if (!string.IsNullOrEmpty(thisObject.ObjectType))
                        {
                            revisedObject.ObjectType = thisObject.ObjectType;
                        }

                        if (thisObject.mIsTypedBy != null)
                        {
                            thisObject.mIsTypedBy.mRelatedObjects.Remove(thisObject);
                        }
                        IfcProduct thisProduct = this as IfcProduct, revisedProduct = revised as IfcProduct;
                        if (thisProduct != null && revisedProduct != null)
                        {
                            IfcRelContainedInSpatialStructure containedInSpatialStructure = thisProduct.mContainedInStructure;
                            if (containedInSpatialStructure != null)
                            {
                                containedInSpatialStructure.RelatedElements.Remove(thisProduct);
                                containedInSpatialStructure.RelatedElements.Add(revisedProduct);
                            }
                            IfcElement thisElement = this as IfcElement, revisedElement = revised as IfcElement;
                            if (thisElement != null && revisedElement != null)
                            {
                                revisedElement.Tag = thisElement.Tag;
                                List <IfcRelVoidsElement> voids = thisElement.HasOpenings.ToList();
                                foreach (var relVoids in voids)
                                {
                                    relVoids.RelatingBuildingElement = revisedElement;
                                }
                            }
                            IfcSpatialElement thisSpatial = this as IfcSpatialElement, revisedSpatial = revised as IfcSpatialElement;
                            if (thisSpatial != null && revisedSpatial != null)
                            {
                                foreach (IfcRelContainedInSpatialStructure contained in thisSpatial.ContainsElements.ToList())
                                {
                                    contained.RelatingStructure = revisedSpatial;
                                }
                            }
                            else if (revisedSpatial != null && thisElement != null)
                            {
                                if (containedInSpatialStructure != null)
                                {
                                    containedInSpatialStructure.RelatedElements.Remove(revisedProduct);
                                    containedInSpatialStructure.RelatingStructure.AddAggregated(revisedProduct);
                                }
                                List <IfcProduct> subProducts = thisObjectDefinition.IsDecomposedBy.SelectMany(x => x.RelatedObjects).OfType <IfcProduct>().ToList();
                                if (subProducts.Count > 0)
                                {
                                    new IfcRelContainedInSpatialStructure(subProducts, revisedSpatial);
                                }
                                foreach (IfcRelAssociatesMaterial associates in revisedSpatial.HasAssociations.OfType <IfcRelAssociatesMaterial>().ToList())
                                {
                                    associates.RelatedObjects.Remove(revisedSpatial);
                                }

                                IfcFacilityPart facilityPart = revisedSpatial as IfcFacilityPart;
                                if (facilityPart != null)
                                {
                                    IfcFacility facility = revisedSpatial.FindHost <IfcFacility>();
                                    if (facility != null)
                                    {
                                        facility.AddAggregated(revisedSpatial);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        IfcTypeObject thisTypeObject = this as IfcTypeObject, revisedTypeObject = revised as IfcTypeObject;
                        if (thisTypeObject != null && revisedTypeObject != null)
                        {
                            IfcTypeProduct thisTypeProduct = this as IfcTypeProduct, revisedTypeProduct = revised as IfcTypeProduct;
                            if (thisTypeProduct != null && revisedTypeProduct != null)
                            {
                                revisedTypeProduct.Tag = thisTypeProduct.Tag;
                                IfcElementType thisElementType = this as IfcElementType, revisedElementType = revised as IfcElementType;
                                if (thisElementType != null && revisedElementType != null)
                                {
                                    revisedElementType.ElementType = thisElementType.ElementType;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                IfcRepresentationItem representationItem = this as IfcRepresentationItem, revisedItem = revised as IfcRepresentationItem;
                if (representationItem != null && revisedItem != null)
                {
                    IfcStyledItem styledItem = representationItem.StyledByItem;
                    if (styledItem != null)
                    {
                        styledItem.Item = revisedItem;
                    }

                    foreach (IfcShapeModel shapeModel in representationItem.Represents.ToList())
                    {
                        shapeModel.Items.Remove(representationItem);
                        shapeModel.Items.Add(revisedItem);
                    }
                    IfcPresentationLayerAssignment layerAssignment = representationItem.mLayerAssignment;
                    if (layerAssignment != null)
                    {
                        layerAssignment.AssignedItems.Remove(representationItem);
                        layerAssignment.AssignedItems.Add(revisedItem);
                    }
                }
            }
            mDatabase[revised.mStepId] = null;
            revised.mStepId            = StepId;
            mDatabase[StepId]          = revised;
        }
Пример #6
0
		internal static void parseFields(IfcRelAggregates a, List<string> arrFields, ref int ipos) { IfcRelDecomposes.parseFields(a, arrFields, ref ipos); a.mRelatingObject = ParserSTEP.ParseLink(arrFields[ipos++]); a.mRelatedObjects = ParserSTEP.SplitListLinks(arrFields[ipos++]); }
Пример #7
0
		internal static IfcRelAggregates Parse(string strDef) { IfcRelAggregates a = new IfcRelAggregates(); int ipos = 0; parseFields(a, ParserSTEP.SplitLineFields(strDef), ref ipos); return a; }
Пример #8
0
		internal IfcRelAggregates(IfcRelAggregates a) : base(a) { mRelatingObject = a.mRelatingObject; mRelatedObjects = new List<int>(a.mRelatedObjects.ToArray()); }
Пример #9
0
		public IfcProject(IfcSite site, string name, IfcUnitAssignment.Length length) : this(site.mDatabase, name, length) { IfcRelAggregates ra = new IfcRelAggregates(site.mDatabase, "Project", "Site", this, site); }
Пример #10
0
		public IfcProject(IfcBuilding building, string name, IfcUnitAssignment.Length length) : this(building.mDatabase, name, length) { IfcRelAggregates ra = new IfcRelAggregates(building.mDatabase, "Project", "Building", this, building); }
Пример #11
0
		public virtual bool AddElement(IfcElement s)
		{
			for (int icounter = 0; icounter < mIsDecomposedBy.Count; icounter++)
			{
				IfcRelAggregates a = mIsDecomposedBy[icounter] as IfcRelAggregates;
				if (a.Description.EndsWith("Elements", true, System.Globalization.CultureInfo.CurrentCulture))
				{
					a.addObject(s);
					return true;
				}
			}
			IfcRelAggregates ra = new IfcRelAggregates(mDatabase, KeyWord.Substring(3), "Element", this);
			ra.addObject(s);
			return true;
		}
Пример #12
0
		private void init(IfcSpatialElement container)
		{
			IfcRelAggregates ra = new IfcRelAggregates(mDatabase, "Building", "Building Storie", this);
			if (container != null) 
				container.addBuilding(this);
			//mBuildingAddress = new IfcPostalAddress(mModel, IfcAddressTypeEnum.NOTDEFINED).mIndex;
		}
Пример #13
0
		public void AddAggregated(IfcObjectDefinition o) { if (mDecomposes == null) mDecomposes = new IfcRelAggregates(this, o); else mDecomposes.addObject(o); }
Пример #14
0
		internal bool addBuilding(IfcBuilding s)
		{
			for (int icounter = 0; icounter < mIsDecomposedBy.Count; icounter++)
			{
				IfcRelAggregates rd = mIsDecomposedBy[icounter];
				if (rd.Description.EndsWith("Buildings", true, System.Globalization.CultureInfo.CurrentCulture))
				{
					rd.addObject(s);
					return true;
				}
				if (rd.mRelatedObjects.Count > 0)
				{
					IfcBuilding b = mDatabase.mIfcObjects[rd.mRelatedObjects[0]] as IfcBuilding;
					if (b != null)
					{
						rd.addObject(s);
						return true;
					}
				}
			}
			IfcRelAggregates ra = new IfcRelAggregates(mDatabase, KeyWord, "Building", this, s);
			return true;
		}
Пример #15
0
		protected bool addStorey(IfcBuildingStorey s)
		{
			for (int icounter = 0; icounter < mIsDecomposedBy.Count; icounter++)
			{
				IfcRelAggregates rd = mIsDecomposedBy[icounter];
				if (rd.Description.EndsWith("Stories", true, System.Globalization.CultureInfo.CurrentCulture))
					return rd.addObject(s);
			}
			IfcRelAggregates ra = new IfcRelAggregates(mDatabase, "Building", "Storie", this, s);
			return true;
		}
Пример #16
0
		internal bool addSpace(IfcSpace s)
		{
			for (int icounter = 0; icounter < mIsDecomposedBy.Count; icounter++)
			{
				IfcRelAggregates rd = mIsDecomposedBy[icounter];
				if (rd.Description.EndsWith("Spaces", true, System.Globalization.CultureInfo.CurrentCulture))
					return rd.addObject(s);
			}
			IfcRelAggregates ra = new IfcRelAggregates(mDatabase, KeyWord, "Space", this, s);
			return true;
		}