Пример #1
0
 public SpatialViewModel(IfcSpatialStructureElement spatialStructure, IXbimViewModel parent)
 {
     xbimModel = spatialStructure.ModelOf as XbimModel;
     this.spatialStructureLabel = Math.Abs(spatialStructure.EntityLabel);
     CreatingParent = parent;
     IEnumerable subs = this.Children; //call this once to preload first level of hierarchy   
 }
        //public ContainedElementsViewModel(IfcSpatialStructureElement container)
        //{
        //    xbimModel = container.ModelOf as XbimModel;
        //    IEnumerable subs = this.Children; //call this once to preload first level of hierarchy          
        //}

        public ContainedElementsViewModel(IfcSpatialStructureElement spatialElem, Type type, IXbimViewModel parent)
        {
            this.spatialContainerLabel = spatialElem.EntityLabel;
            this.type = type;
            this.xbimModel = (XbimModel) spatialElem.ModelOf;
            this.CreatingParent = parent;
        }
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
            case 3:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 4:
                _relatedElements.InternalAdd((IfcProduct)value.EntityVal);
                return;

            case 5:
                _relatingStructure = (IfcSpatialStructureElement)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
        public override void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
            case 3:
                base.IfcParse(propIndex, value);
                break;

            case 4:
                _relatedElements.Add((IfcProduct)value.EntityVal);
                break;

            case 5:
                _relatingStructure = (IfcSpatialStructureElement)value.EntityVal;
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
Пример #5
0
        private IEnumerable<IfcProduct> GetProductsInSpatStruct(IfcSpatialStructureElement spatialStruct)
        {
            //contained in spatial structure
            IEnumerable<IfcRelContainedInSpatialStructure> prodRels =
                _model.Instances.Where<IfcRelContainedInSpatialStructure>(r => r.RelatingStructure == spatialStruct);
            foreach (var rel in prodRels)
            {
                foreach (var prod in rel.RelatedElements)
                {
                    yield return prod;
                }
            }

            //referenced in spatial structure
            IEnumerable<IfcRelReferencedInSpatialStructure> prodRefs =
                _model.Instances.Where<IfcRelReferencedInSpatialStructure>(r => r.RelatingStructure == spatialStruct);
            foreach (var rel in prodRefs)
            {
                foreach (var prod in rel.RelatedElements)
                {
                    yield return prod;
                }
            }
        }
 internal XbimSpatialStructureElement(XbimDocument document, IfcSpatialStructureElement element)
 {
     if (document == null) throw new ArgumentNullException("XbimSpatialStructureElement constructor can not have null arguments.");
     _document = document;
     _spatialElement = element;
 }
Пример #7
0
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
         case 1:
         case 2:
         case 3:
         case 4:
             base.IfcParse(propIndex, value);
             break;
         case 5:
             _SpaceProgramIdentifier = value.StringVal;
             break;
         case 6:
             _MaxRequiredArea = value.RealVal;
             break;
         case 7:
             _MinRequiredArea = value.RealVal;
             break;
         case 8:
             _RequestedLocation = (IfcSpatialStructureElement)value.EntityVal;
             break;
         case 9:
             _StandardRequiredArea = value.RealVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
 /// <summary>
 ///   Adds specified IfcSpatialStructureElement to the decomposition of this spatial structure element.
 /// </summary>
 /// <param name = "se"></param>
 /// <param name = "child">Child spatial structure element.</param>
 public static void AddToSpatialDecomposition(this IfcSpatialStructureElement se,
                                              IfcSpatialStructureElement child)
 {
     IEnumerable<IfcRelDecomposes> decomposition = se.IsDecomposedBy;
     if (decomposition.Count() == 0) //none defined create the relationship
     {
         IfcRelAggregates relSub = se.ModelOf.Instances.New<IfcRelAggregates>();
         relSub.RelatingObject = se;
         relSub.RelatedObjects.Add(child);
     }
     else
     {
         decomposition.First().RelatedObjects.Add(child);
     }
 }
Пример #9
0
 //transformation function to convert/cast IFC2x3 data to appear as IFC4
 private static IIfcSpatialElement RelatedBuildingsToIfc4(IfcSpatialStructureElement member)
 {
     return(member);
 }
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
         case 1:
         case 2:
         case 3:
             base.IfcParse(propIndex, value);
             break;
         case 4:
             _relatedElements.Add((IfcProduct) value.EntityVal);
             break;
         case 5:
             _relatingStructure = (IfcSpatialStructureElement) value.EntityVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
Пример #11
0
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
             base.IfcParse(propIndex, value);
             break;
         case 10:
             _moveFrom = (IfcSpatialStructureElement)value.EntityVal;
             break;
         case 11:
             _moveTo = (IfcSpatialStructureElement)value.EntityVal;
             break;
         case 12:
             if (_punchList == null) //optional so set here
             {
                 _punchList = new XbimListUnique<IfcText>(this);
             }
             _punchList.Add((IfcText)value.StringVal);
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
         case 1:
         case 2:
         case 3:
             base.IfcParse(propIndex, value);
             break;
         case 4:
             _DailyInteraction = value.NumberVal;
             break;
         case 5:
             _ImportanceRating = value.RealVal;
             break;
         case 6:
             _LocationOfInteraction = (IfcSpatialStructureElement)value.EntityVal;
             break;
         case 7:
             _RelatedSpaceProgram = (IfcSpaceProgram)value.EntityVal;
             break;
         case 8:
             _RelatingSpaceProgram = (IfcSpaceProgram)value.EntityVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }