Beispiel #1
0
        public override string WhereRule()
        {
            string baseErr = base.WhereRule();

            if (IsDecomposedBy.Count() > 0 && Representation != null)
            {
                baseErr +=
                    "WR1 Stair: Either the stair is not decomposed into its flights and landings (the stair can have independent geometry), or the geometry shall not be given at Stair directly.\n";
            }
            return(baseErr);
        }
        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);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        ///   Adds Building to the IsDecomposedBy Collection.
        /// </summary>
        public void AddBuilding(IfcBuilding building)
        {
            var decomposition = IsDecomposedBy.FirstOrDefault();

            if (decomposition == null) //none defined create the relationship
            {
                var relSub = Model.Instances.New <IfcRelAggregates>();
                relSub.RelatingObject = this;
                relSub.RelatedObjects.Add(building);
            }
            else
            {
                decomposition.RelatedObjects.Add(building);
            }
        }
Beispiel #4
0
        /// <summary>
        ///   Adds specified IfcSpatialStructureElement to the decomposition of this spatial structure element.
        /// </summary>
        /// <param name = "child">Child spatial structure element.</param>
        public void AddToSpatialDecomposition(IfcSpatialStructureElement child)
        {
            var ifcRelDecomposes = IsDecomposedBy.FirstOrDefault();

            if (ifcRelDecomposes == null) //none defined create the relationship
            {
                var relSub = Model.Instances.New <IfcRelAggregates>();
                relSub.RelatingObject = this;
                relSub.RelatedObjects.Add(child);
            }
            else
            {
                ifcRelDecomposes.RelatedObjects.Add(child);
            }
        }
Beispiel #5
0
        public override string WhereRule()
        {
            string baseErr = base.WhereRule();

            if (IsDecomposedBy.Count() == 0 || (IsDecomposedBy.Count() == 1 && Representation == null))
            {
                return(baseErr);
            }
            else
            {
                return
                    (baseErr +=
                         "WR1 Roof: Either the roof is not decomposed into its roof slabs (the roof can have independent geometry), or the geometry shall not be given at IfcRoof directly.\n");
            }
        }
Beispiel #6
0
        public Tuple <DateTime, DateTime> ComputeAndSetScheduledStartFinishTimes()
        {
            DateTime scheduledStart = DateTime.MaxValue, scheduledFinish = DateTime.MinValue;
            List <IfcWorkControl> subControls = IsDecomposedBy.SelectMany(x => x.RelatedObjects).OfType <IfcWorkControl>().ToList();

            subControls.AddRange(IsNestedBy.SelectMany(x => x.RelatedObjects).OfType <IfcWorkControl>());
            foreach (IfcWorkControl workControl in subControls)
            {
                Tuple <DateTime, DateTime> startFinish = workControl.ComputeAndSetScheduledStartFinishTimes();
                if (startFinish.Item1 != DateTime.MinValue && startFinish.Item1 < scheduledStart)
                {
                    scheduledStart = startFinish.Item1;
                }
                if (startFinish.Item2 > scheduledFinish)
                {
                    scheduledFinish = startFinish.Item2;
                }
            }
            foreach (IfcTask task in Controls.SelectMany(x => x.RelatedObjects).OfType <IfcTask>())
            {
                Tuple <DateTime, DateTime> startFinish = task.computeScheduleStartFinish();
                if (startFinish.Item1 != DateTime.MinValue && startFinish.Item1 < scheduledStart)
                {
                    scheduledStart = startFinish.Item1;
                }
                if (startFinish.Item2 > scheduledFinish)
                {
                    scheduledFinish = startFinish.Item2;
                }
            }
            if (mDatabase.Release > ReleaseVersion.IFC2x3)
            {
                mStartTime  = scheduledStart;
                mFinishTime = scheduledFinish;
            }
            else
            {
                if (scheduledStart > DateTime.MinValue)
                {
                    mSSStartTime = new IfcDateAndTime(mDatabase, scheduledStart);
                }
                if (scheduledFinish > DateTime.MinValue)
                {
                    mSSFinishTime = new IfcDateAndTime(mDatabase, scheduledFinish);
                }
            }
            return(new Tuple <DateTime, DateTime>(scheduledStart, scheduledFinish));
        }