protected override Space Mapping(IfcSpatialStructureElement ifcSpatialElement, Space target)
        {
            var helper = ((IfcToCOBieLiteUkExchanger)Exchanger).Helper;

            target.ExternalEntity = helper.ExternalEntityName(ifcSpatialElement);
            target.ExternalId     = helper.ExternalEntityIdentity(ifcSpatialElement);
            target.ExternalSystem = helper.ExternalSystemName(ifcSpatialElement);
            target.Name           = ifcSpatialElement.Name;
            target.Categories     = helper.GetCategories(ifcSpatialElement);
            target.Description    = ifcSpatialElement.LongName;
            if (string.IsNullOrWhiteSpace(target.Description))
            {
                target.Description = ifcSpatialElement.Description;
            }
            target.CreatedBy    = helper.GetCreatedBy(ifcSpatialElement);
            target.CreatedOn    = helper.GetCreatedOn(ifcSpatialElement);
            target.RoomTag      = helper.GetCoBieAttribute <StringAttributeValue>("SpaceSignageName", ifcSpatialElement).Value;
            target.UsableHeight = helper.GetCoBieAttribute <DecimalAttributeValue>("SpaceUsableHeightValue", ifcSpatialElement).Value;
            target.GrossArea    = helper.GetCoBieAttribute <DecimalAttributeValue>("SpaceGrossAreaValue", ifcSpatialElement).Value;
            target.NetArea      = helper.GetCoBieAttribute <DecimalAttributeValue>("SpaceNetAreaValue", ifcSpatialElement).Value;

            //Attributes
            target.Attributes = helper.GetAttributes(ifcSpatialElement);

            //TODO:
            //Space Issues
            //Space Documents
            return(target);
        }
コード例 #2
0
        public bool Contains(IfcProduct first, IfcProduct second)
        {
            //this type of relation is always recursive
            if (first == second)
            {
                return(true);
            }

            //check the case of spatial strucure element (specific relations)
            IfcSpatialStructureElement spatStruct = first as IfcSpatialStructureElement;
            IEnumerable <IfcProduct>   prods      = null;

            if (spatStruct != null)
            {
                prods = GetProductsInSpatStruct(spatStruct);
                foreach (var prod in prods)
                {
                    if (Contains(prod, second))
                    {
                        return(true);
                    }
                }
            }
            prods = GetProductsInProduct(first);
            foreach (var prod in prods)
            {
                if (Contains(prod, second))
                {
                    return(true);
                }
            }

            //if we don't know
            return(false);
        }
コード例 #3
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);
                }
            }
        }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 10:
                _moveFrom = (IfcSpatialStructureElement)(value.EntityVal);
                return;

            case 11:
                _moveTo = (IfcSpatialStructureElement)(value.EntityVal);
                return;

            case 12:
                _punchList.InternalAdd(value.StringVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
コード例 #6
0
        //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;
        }
コード例 #7
0
 public IfcMove(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcLabel?__ObjectType, IfcIdentifier __TaskId, IfcLabel?__Status, IfcLabel?__WorkMethod, Boolean __IsMilestone, Int64?__Priority, IfcSpatialStructureElement __MoveFrom, IfcSpatialStructureElement __MoveTo, IfcText[] __PunchList)
     : base(__GlobalId, __OwnerHistory, __Name, __Description, __ObjectType, __TaskId, __Status, __WorkMethod, __IsMilestone, __Priority)
 {
     this._MoveFrom  = __MoveFrom;
     this._MoveTo    = __MoveTo;
     this._PunchList = new List <IfcText>(__PunchList);
 }
コード例 #8
0
 public SpatialViewModel(IfcSpatialStructureElement spatialStructure, IXbimViewModel parent)
 {
     xbimModel = spatialStructure.ModelOf as XbimModel;
     this.spatialStructureLabel = spatialStructure.EntityLabel;
     CreatingParent             = parent;
     // IEnumerable subs = this.Children; //call this once to preload first level of hierarchy
 }
コード例 #9
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;
            }
        }
コード例 #10
0
        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:
                _dailyInteraction = value.NumberVal;
                return;

            case 5:
                _importanceRating = value.RealVal;
                return;

            case 6:
                _locationOfInteraction = (IfcSpatialStructureElement)(value.EntityVal);
                return;

            case 7:
                _relatedSpaceProgram = (IfcSpaceProgram)(value.EntityVal);
                return;

            case 8:
                _relatingSpaceProgram = (IfcSpaceProgram)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
コード例 #11
0
 public static void AddPrductIntoSpatial(IfcStore m, IfcSpatialStructureElement spatial, IfcProduct p, string txt)
 {
     using (var txn = m.BeginTransaction(txt))
     {
         spatial.AddElement(p);
         txn.Commit();
     }
 }
コード例 #12
0
        /// <summary>
        ///   Returns  the first spatial structural element that this decomposes
        /// </summary>
        /// <param name = "se"></param>
        /// <returns></returns>
        public static IfcSpatialStructureElement GetContainingStructuralElement(this IfcSpatialStructureElement se)
        {
            IModel model = se.ModelOf;
            IEnumerable <IfcRelContainedInSpatialStructure> rels =
                model.Instances.Where <IfcRelContainedInSpatialStructure>(r => r.RelatedElements.Contains(se));

            return(rels.Select(r => r.RelatingStructure).FirstOrDefault());
            // return  se).Instances.Where<RelContainedInSpatialStructure>(r => r.RelatedElements.Contains(se)).Select(r=>r.RelatingStructure).FirstOrDefault(.ModelOf;
        }
コード例 #13
0
 public IfcRelInteractionRequirements(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcCountMeasure?__DailyInteraction, IfcNormalisedRatioMeasure?__ImportanceRating, IfcSpatialStructureElement __LocationOfInteraction, IfcSpaceProgram __RelatedSpaceProgram, IfcSpaceProgram __RelatingSpaceProgram)
     : base(__GlobalId, __OwnerHistory, __Name, __Description)
 {
     this._DailyInteraction      = __DailyInteraction;
     this._ImportanceRating      = __ImportanceRating;
     this._LocationOfInteraction = __LocationOfInteraction;
     this._RelatedSpaceProgram   = __RelatedSpaceProgram;
     this._RelatingSpaceProgram  = __RelatingSpaceProgram;
 }
コード例 #14
0
ファイル: IfcSpaceProgram.cs プロジェクト: sta1216/IfcDoc
 public IfcSpaceProgram(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcLabel?__ObjectType, IfcIdentifier __SpaceProgramIdentifier, IfcAreaMeasure?__MaxRequiredArea, IfcAreaMeasure?__MinRequiredArea, IfcSpatialStructureElement __RequestedLocation, IfcAreaMeasure __StandardRequiredArea)
     : base(__GlobalId, __OwnerHistory, __Name, __Description, __ObjectType)
 {
     this._SpaceProgramIdentifier = __SpaceProgramIdentifier;
     this._MaxRequiredArea        = __MaxRequiredArea;
     this._MinRequiredArea        = __MinRequiredArea;
     this._RequestedLocation      = __RequestedLocation;
     this._StandardRequiredArea   = __StandardRequiredArea;
 }
コード例 #15
0
        private void DecomposeSpatialStructure(IfcSpatialStructureElement ifcSpatialStructuralElement,
                                               HashSet <IfcSpatialStructureElement> allSpatialStructuralElements)
        {
            List <IfcSpatialStructureElement> spatialElements;

            if (_spatialDecomposition.TryGetValue(ifcSpatialStructuralElement, out spatialElements))
            {
                foreach (var spatialElement in spatialElements)
                {
                    allSpatialStructuralElements.Add(spatialElement);
                    DecomposeSpatialStructure(spatialElement, allSpatialStructuralElements);
                }
            }
        }
コード例 #16
0
        /// <summary>
        /// Adds the space to the space map if the storey name plus the space name is not unique returns false
        /// </summary>
        /// <param name="space"></param>
        /// <returns></returns>
        public bool AddToSpaceMap(IfcSpatialStructureElement space)
        {
            if (!space.Name.HasValue)
            {
                return(false);
            }
            string key = space.Name;

            if (_spaceLookup.ContainsKey(key))
            {
                return(false);
            }
            _spaceLookup.Add(key, space);
            return(true);
        }
コード例 #17
0
        /// <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.Model.Instances.New <IfcRelAggregates>();
                relSub.RelatingObject = se;
                relSub.RelatedObjects.Add(child);
            }
            else
            {
                decomposition.First().RelatedObjects.Add(child);
            }
        }
コード例 #18
0
        /// <summary>
        ///   Adds the element to the set of elements which are contained in this spatialstructure
        /// </summary>
        /// <param name = "se"></param>
        /// <param name = "prod"></param>
        public static void AddElement(this IfcSpatialStructureElement se, IfcProduct prod)
        {
            if (prod == null)
            {
                return;
            }

            IEnumerable <IfcRelContainedInSpatialStructure> relatedElements = se.ContainsElements;

            if (relatedElements.Count() == 0) //none defined create the relationship
            {
                IfcRelContainedInSpatialStructure relSe =
                    se.Model.Instances.New <IfcRelContainedInSpatialStructure>();
                relSe.RelatingStructure = se;
                relSe.RelatedElements.Add(prod);
            }
            else
            {
                relatedElements.First().RelatedElements.Add(prod);
            }
        }
コード例 #19
0
        public void SampleSpatialStructure(IfcSpatialStructureElement structIfc, Action <List <string> > collectionSampler)
        {
            SampleChildren(structIfc, collectionSampler);
            if (structIfc.ContainsElements == null)
            {
                return;
            }

            List <string> collection = new List <string> {
                structIfc.GetType().Name
            };

            foreach (IfcRelContainedInSpatialStructure rel in structIfc.ContainsElements)
            {
                foreach (var prod in rel.RelatedElements)
                {
                    collection.Add(prod.GetType().Name);
                }
            }

            collectionSampler.Invoke(collection);
        }
コード例 #20
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;
            }
        }
コード例 #21
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 5:
                _spaceProgramIdentifier = value.StringVal;
                return;

            case 6:
                _maxRequiredArea = value.RealVal;
                return;

            case 7:
                _minRequiredArea = value.RealVal;
                return;

            case 8:
                _requestedLocation = (IfcSpatialStructureElement)(value.EntityVal);
                return;

            case 9:
                _standardRequiredArea = value.RealVal;
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
コード例 #22
0
        public static IfcRelContainedInSpatialStructure NewIfc2x3Contains(this IModel s, IfcSpatialStructureElement spatialElement)
        {
            var relation = spatialElement.ContainsElements.FirstOrDefault();

            if (null == relation)
            {
                relation = s.Instances.New <IfcRelContainedInSpatialStructure>();
            }

            relation.RelatingStructure = spatialElement;
            return(relation);
        }
コード例 #23
0
 /// <summary>
 ///   Returns all the elements that decomposes this
 /// </summary>
 /// <param name = "se"></param>
 /// <returns></returns>
 public static IEnumerable <IfcProduct> GetContainedElements(this IfcSpatialStructureElement se)
 {
     return
         (se.ModelOf.Instances.Where <IfcRelContainedInSpatialStructure>(
              r => r.RelatingStructure == se).SelectMany(subrel => subrel.RelatedElements));
 }
コード例 #24
0
 protected XPreviewContainer(IfcSpatialStructureElement ifcEntity)
     : base(ifcEntity)
 {
     Elements   = new List <XPreviewElement>();
     Containers = new List <XPreviewContainer>();
 }
コード例 #25
0
        protected override Floor Mapping(IfcSpatialStructureElement ifcSpatialStructureElement, Floor target)
        {
            var helper = ((IfcToCOBieLiteUkExchanger)Exchanger).Helper;

            target.ExternalEntity = helper.ExternalEntityName(ifcSpatialStructureElement);
            target.ExternalId     = helper.ExternalEntityIdentity(ifcSpatialStructureElement);
            target.ExternalSystem = helper.ExternalSystemName(ifcSpatialStructureElement);
            target.Name           = ifcSpatialStructureElement.Name;

            //Attributes
            target.Attributes = helper.GetAttributes(ifcSpatialStructureElement);
            if (target.Categories == null)
            {
                target.Categories = new List <Category>();
            }


            IEnumerable <IfcSpatialStructureElement> spaces = null;
            var site         = ifcSpatialStructureElement as IfcSite;
            var building     = ifcSpatialStructureElement as IfcBuilding;
            var storey       = ifcSpatialStructureElement as IfcBuildingStorey;
            var spaceElement = ifcSpatialStructureElement as IfcSpace;

            if (site != null)
            {
                target.Categories.Add(new Category()
                {
                    Code = "Site"
                });
                //upgrade code below to use extension method GetSpaces()

                if (site.IsDecomposedBy != null)
                {
                    var decomp = site.IsDecomposedBy;
                    var objs   = decomp.SelectMany(s => s.RelatedObjects);
                    spaces = objs.OfType <IfcSpace>();
                }
            }
            else if (building != null)
            {
                target.Categories.Add(new Category()
                {
                    Code = "Building"
                });
                spaces = building.GetSpaces();
            }
            else if (storey != null)
            {
                target.Categories.Add(new Category()
                {
                    Code = "Floor"
                });
                if (storey.Elevation.HasValue)
                {
                    target.Elevation = storey.Elevation.Value;
                }
                spaces = storey.GetSpaces();
            }
            else if (spaceElement != null)
            {
                target.Categories.Add(new Category()
                {
                    Code = "Space"
                });
                spaces = spaceElement.GetSpaces();
            }


            target.Description = ifcSpatialStructureElement.Description;
            target.CreatedBy   = helper.GetCreatedBy(ifcSpatialStructureElement);
            target.CreatedOn   = helper.GetCreatedOn(ifcSpatialStructureElement);
            //set the fall backs


            target.Height = helper.GetCoBieAttribute <DecimalAttributeValue>("FloorHeightValue", ifcSpatialStructureElement).Value;


            var ifcSpatialStructureElements = spaces as IList <IfcSpatialStructureElement> ?? spaces.ToList();

            ifcSpatialStructureElements.Add(ifcSpatialStructureElement);

            target.Spaces = new List <Space>(ifcSpatialStructureElements.Count);
            var spaceMappings = Exchanger.GetOrCreateMappings <MappingIfcSpatialStructureElementToSpace>();

            for (var i = 0; i < ifcSpatialStructureElements.Count; i++)
            {
                var space = new Space();
                space = spaceMappings.AddMapping(ifcSpatialStructureElements[i], space);
                target.Spaces.Add(space);
            }


            //Attributes
            target.Attributes = helper.GetAttributes(ifcSpatialStructureElement);

            //TODO:
            //Space Issues
            //Space Documents
            return(target);
        }