Esempio n. 1
0
 public IfcZone(IfcSpatialElement e, string name, List <IfcSpace> spaces) : base(e, name)
 {
     if (spaces != null && spaces.Count > 0)
     {
         new IfcRelAssignsToGroup(spaces, this);
     }
 }
Esempio n. 2
0
 private void init(IfcSpatialElement container)
 {
     if (container != null)
     {
         container.AddAggregated(this);
     }
 }
Esempio n. 3
0
 internal IfcZone(IfcSpatialElement e, string name, string longname, List <IfcSpace> spaces) : base(e, name)
 {
     if (spaces != null)
     {
         mIsGroupedBy[0].mRelatedObjects.AddRange(spaces.ConvertAll(x => x.mIndex));
     }
 }
Esempio n. 4
0
 public IfcGrid(IfcSpatialElement host, IfcAxis2Placement3D placement, List <IfcGridAxis> uAxes, List <IfcGridAxis> vAxes)
     : base(new IfcLocalPlacement(host.ObjectPlacement, placement), getRepresentation(uAxes, vAxes, null))
 {
     host.addGrid(this);
     UAxes.AddRange(uAxes);
     VAxes.AddRange(vAxes);
 }
Esempio n. 5
0
		internal void IsolateObject(string filename)
		{
			DatabaseIfc db = new DatabaseIfc(mDatabase);
			IfcSpatialElement spatial = this as IfcSpatialElement;
			IfcElementAssembly eas = this as IfcElementAssembly;
			if (spatial != null || eas != null)
				db.Factory.Duplicate(this, true);
			else
				db.Factory.Duplicate(this);
			db.WriteFile(filename);
		}
Esempio n. 6
0
 public IfcGrid(IfcSpatialElement host, IfcAxis2Placement3D placement, List <IfcGridAxis> uAxes, List <IfcGridAxis> vAxes)
     : base(new IfcLocalPlacement(host.Placement, placement), getRepresentation(uAxes, vAxes, null))
 {
     host.addGrid(this);
     if (uAxes != null)
     {
         mUAxes = uAxes.ConvertAll(x => x.mIndex);
     }
     if (vAxes != null)
     {
         mVAxes = vAxes.ConvertAll(x => x.mIndex);
     }
 }
Esempio n. 7
0
        private void validateWorker(List <IConceptRoot> conceptRoots, List <IfcPropertySetTemplate> propertySetTemplates, ref Dictionary <IfcRoot, List <ValidationResult> > results)
        {
            List <ValidationResult> validationResults = new List <ValidationResult>();

            foreach (var propertySetTemplate in propertySetTemplates)
            {
                List <ValidationResult> templateResults = validatePropertySetTemplate(propertySetTemplate);
                if (templateResults != null)
                {
                    validationResults.AddRange(templateResults);
                }
            }

            foreach (var conceptRoot in conceptRoots)
            {
                List <ValidationResult> rootResults = conceptRoot.Validate(this);
                if (rootResults != null)
                {
                    validationResults.AddRange(rootResults);
                }
            }

            if (validationResults.Count > 0)
            {
                results[this] = validationResults;
            }

            foreach (var od in IsDecomposedBy.SelectMany(x => x.RelatedObjects))
            {
                od.validateWorker(conceptRoots, propertySetTemplates, ref results);
            }

            foreach (var od in IsNestedBy.SelectMany(x => x.RelatedObjects))
            {
                od.validateWorker(conceptRoots, propertySetTemplates, ref results);
            }

            IfcSpatialElement spatialElement = this as IfcSpatialElement;

            if (spatialElement != null)
            {
                foreach (var relatedElement in spatialElement.ContainsElements.SelectMany(x => x.RelatedElements))
                {
                    relatedElement.validateWorker(conceptRoots, propertySetTemplates, ref results);
                }
                foreach (var relatingSystem in spatialElement.ServicedBySystems.Select(x => x.RelatingSystem))
                {
                    relatingSystem.validateWorker(conceptRoots, propertySetTemplates, ref results);
                }
            }
        }
Esempio n. 8
0
        public IfcGeotechnicalStratum(IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation)
            : base(host.Database)
        {
            IfcSpatialElement spatialElement = host as IfcSpatialElement;

            if (spatialElement != null)
            {
                spatialElement.AddElement(this);
            }
            else
            {
                host.AddNested(this);
            }
            ObjectPlacement = placement;
            Representation  = representation;
        }
Esempio n. 9
0
        internal void IsolateObject(string filename)
        {
            DatabaseIfc        db      = new DatabaseIfc(mDatabase);
            IfcSpatialElement  spatial = this as IfcSpatialElement;
            IfcElementAssembly eas     = this as IfcElementAssembly;

            db.Factory.Duplicate(this, true);
            IfcSite site = db.Project.RootElement as IfcSite;

            if (site != null)
            {
                IfcProductRepresentation pr = site.Representation;
                if (pr != null)
                {
                    site.Representation = null;
                    pr.Destruct(true);
                }
            }
            db.WriteFile(filename);
        }
Esempio n. 10
0
 public IfcGroup(IfcSpatialElement spatial, string name) : base(spatial.Database)
 {
     Name = name;
     if (!(this is IfcZone))
     {
         if (spatial.mDatabase.Release <= ReleaseVersion.IFC4X3_RC1)
         {
             IfcSystem system = this as IfcSystem;
             if (system != null)
             {
                 new IfcRelServicesBuildings(system, spatial)
                 {
                     Name = name
                 };
             }
         }
         else
         {
             spatial.ReferenceElement(this);
         }
     }
 }
Esempio n. 11
0
 internal override void ParseXml(XmlElement xml)
 {
     base.ParseXml(xml);
     foreach (XmlNode child in xml.ChildNodes)
     {
         string name = child.Name;
         if (string.Compare(name, "RelatingSystem") == 0)
         {
             RelatingSystem = mDatabase.ParseXml <IfcSystem>(child as XmlElement);
         }
         else if (string.Compare(name, "RelatedBuildings") == 0)
         {
             foreach (XmlNode cn in child.ChildNodes)
             {
                 IfcSpatialElement s = mDatabase.ParseXml <IfcSpatialElement>(cn as XmlElement);
                 if (s != null)
                 {
                     addRelated(s);
                 }
             }
         }
     }
 }
Esempio n. 12
0
		static int CountStories(IfcSpatialElement element)
		{
			if (element == null)
				return 0;
			int result = 0;
			List<IfcRelAggregates> aggregates = element.IsDecomposedBy;
			foreach(IfcRelAggregates rag in aggregates)
			{
				List<IfcObjectDefinition> objects = rag.RelatedObjects;
				foreach(IfcObjectDefinition obj in objects)
				{
					IfcBuildingStorey storey = obj as IfcBuildingStorey;
					if (storey != null)
						result++;
					else
					{
						IfcSpatialElement se = obj as IfcSpatialElement;
						if (se != null)
							result += CountStories(se);
					}
				}
			}
			return result;
		}
Esempio n. 13
0
		protected IfcSpatialElement(IfcSpatialElement host, string name) : this(host.mDatabase)
		{ 
			Name = name;
			IfcBuilding building = this as IfcBuilding;
			if(building != null)
				host.addBuilding(building);
			else
			{
				building = host as IfcBuilding;
				IfcBuildingStorey bs = this as IfcBuildingStorey;
				if (building != null && bs != null)
					building.addStorey(bs);
				else
				{
					IfcSpace space = this as IfcSpace;
					if (space != null)
						host.addSpace(space);
					else
						host.AddAggregated(this);
				}
			}
		}
Esempio n. 14
0
		protected static void parseFields(IfcSpatialElement s, List<string> arrFields, ref int ipos) { IfcProduct.parseFields(s, arrFields, ref ipos); s.mLongName = arrFields[ipos++].Replace("'", ""); }
Esempio n. 15
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;
		}
Esempio n. 16
0
 public IfcBuildingSystem(IfcSpatialElement bldg, string name, IfcBuildingSystemTypeEnum type) : base(bldg, name)
 {
     mPredefinedType = type;
 }
Esempio n. 17
0
 public IfcGrid(IfcSpatialElement host, IfcAxis2Placement3D placement, List<IfcGridAxis> uAxes, List<IfcGridAxis> vAxes, List<IfcGridAxis> wAxes)
     : this(host,placement, uAxes,vAxes)
 {
     WAxes = wAxes;
 }
Esempio n. 18
0
 public IfcGrid(IfcSpatialElement host, IfcAxis2Placement3D placement, List <IfcGridAxis> uAxes, List <IfcGridAxis> vAxes, List <IfcGridAxis> wAxes)
     : this(host, placement, uAxes, vAxes)
 {
     WAxes.AddRange(wAxes);
 }
Esempio n. 19
0
 protected static void parseFields(IfcExternalSpatialStructureElement s, List <string> arrFields, ref int ipos)
 {
     IfcSpatialElement.parseFields(s, arrFields, ref ipos);
 }
Esempio n. 20
0
		internal IfcBuildingSystem(IfcSpatialElement bldg, string name,  IfcBuildingSystemTypeEnum type) : base(bldg, name) { mPredefinedType = type; }
Esempio n. 21
0
		internal IfcZone(IfcSpatialElement e, string name, string longname, List<IfcSpace> spaces) : base(e, name)
		{
			if (spaces != null)
				mIsGroupedBy[0].mRelatedObjects.AddRange(spaces.ConvertAll(x => x.mIndex));
		}
Esempio n. 22
0
		internal IfcSystem(IfcSpatialElement e, string name) : base(e.mDatabase, name) { mServicesBuildings = new IfcRelServicesBuildings(this, e) { Name = name };  }
Esempio n. 23
0
		internal IfcDistributionSystem(IfcSpatialElement bldg, string name, IfcDistributionSystemEnum type) : base(bldg, name) { mPredefinedType = type; }
Esempio n. 24
0
		internal IfcDistributionCircuit(IfcSpatialElement bldg, string name,IfcDistributionSystemEnum type) : base(bldg, name, type) { }
Esempio n. 25
0
 public IfcGrid(IfcSpatialElement host, IfcAxis2Placement3D placement, List <IfcGridAxis> uAxes, List <IfcGridAxis> vAxes, List <IfcGridAxis> wAxes)
     : this(host, placement, uAxes, vAxes)
 {
     wAxes.ForEach(x => AddWAxis(x));
 }
Esempio n. 26
0
        private List<int> mWAxes = new List<int>(); // : OPTIONAL LIST [1:?] OF UNIQUE IfcGridAxis;

        #endregion Fields

        #region Constructors

        public IfcGrid(IfcSpatialElement host, IfcAxis2Placement3D placement, List<IfcGridAxis> uAxes, List<IfcGridAxis> vAxes)
            : base(new IfcLocalPlacement(host.Placement, placement), getRepresentation(uAxes,vAxes, null))
        {
            host.addGrid(this);
            if(uAxes != null)
                mUAxes = uAxes.ConvertAll(x=>x.mIndex);
            if (vAxes != null)
                mVAxes = vAxes.ConvertAll(x => x.mIndex);
        }
Esempio n. 27
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;
        }
Esempio n. 28
0
		internal IfcRelContainedInSpatialStructure(IfcSpatialElement e) : base(e.mDatabase)
		{
			string containerName = "";
			if (e as IfcBuilding != null)
				containerName = "Building";
			else if (e as IfcBuildingStorey != null)
				containerName = "BuildingStorey";
			else if (e as IfcExternalSpatialElement != null)
				containerName = "ExternalSpatialElement";
			else if (e as IfcSite != null)
				containerName = "Site";
			else if (e as IfcSpace != null)
				containerName = "Space";
			Name = containerName;
			Description = containerName + " Container for Elements";
			mRelatingStructure = e.mIndex;
			e.mContainsElements.Add(this);
		}
Esempio n. 29
0
		protected IfcSpatialElement(IfcSpatialElement e) : base(e) { mLongName = e.mLongName; }
Esempio n. 30
0
		internal IfcRelServicesBuildings(IfcSystem sys, IfcSpatialElement se)
			: base(sys.mDatabase) { mRelatingSystem = sys.mIndex; mRelatedBuildings.Add(se.mIndex); se.mServicedBySystems.Add(this); }
Esempio n. 31
0
		internal IfcStructuralAnalysisModel(IfcSpatialElement bldg, string name, IfcAnalysisModelTypeEnum type) : base(bldg, name) { mPredefinedType = type; }
Esempio n. 32
0
		public IfcAnnotation(IfcSpatialElement host) : base(host.Database) { host.AddElement(this); }