Ejemplo n.º 1
0
        override protected void Process(IFCAnyHandle item)
        {
            base.Process(item);

            LayerAssignment = IFCPresentationLayerAssignment.GetTheLayerAssignment(item);

            // IFC2x has a different representation for styled items which we don't support.
            ICollection <IFCAnyHandle> styledByItems = null;

            if (Importer.TheCache.StyledByItems.TryGetValue(item, out styledByItems))
            {
                if (styledByItems != null && styledByItems.Count > 0)
                {
                    // We can only handle one styled item, but we allow the possiblity that there are duplicates.  Do a top-level check.
                    foreach (IFCAnyHandle styledByItem in styledByItems)
                    {
                        if (!IFCAnyHandleUtil.IsSubTypeOf(styledByItem, IFCEntityType.IfcStyledItem))
                        {
                            Importer.TheLog.LogUnexpectedTypeError(styledByItem, IFCEntityType.IfcStyledItem, false);
                            StyledByItem = null;
                            break;
                        }
                        else
                        {
                            if (StyledByItem == null)
                            {
                                StyledByItem = IFCStyledItem.ProcessIFCStyledItem(styledByItem);
                            }
                            else
                            {
                                IFCStyledItem compStyledByItem = IFCStyledItem.ProcessIFCStyledItem(styledByItem);
                                if (!StyledByItem.IsEquivalentTo(compStyledByItem))
                                {
                                    Importer.TheLog.LogWarning(Id, "Multiple inconsistent styled items found for this item; using first one.", false);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
        override protected void Process(IFCAnyHandle item)
        {
            base.Process(item);

            LayerAssignment = IFCPresentationLayerAssignment.GetTheLayerAssignment(item, false);

            List <IFCAnyHandle> styledByItems = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(item, "StyledByItem");

            if (styledByItems != null && styledByItems.Count > 0)
            {
                // We can only handle one styled item, but we allow the possiblity that there are duplicates.  Do a top-level check.
                foreach (IFCAnyHandle styledByItem in styledByItems)
                {
                    if (!IFCAnyHandleUtil.IsSubTypeOf(styledByItem, IFCEntityType.IfcStyledItem))
                    {
                        Importer.TheLog.LogUnexpectedTypeError(styledByItem, IFCEntityType.IfcStyledItem, false);
                        StyledByItem = null;
                        break;
                    }
                    else
                    {
                        if (StyledByItem == null)
                        {
                            StyledByItem = IFCStyledItem.ProcessIFCStyledItem(styledByItem);
                        }
                        else
                        {
                            IFCStyledItem compStyledByItem = IFCStyledItem.ProcessIFCStyledItem(styledByItem);
                            if (!StyledByItem.IsEquivalentTo(compStyledByItem))
                            {
                                Importer.TheLog.LogWarning(Id, "Multiple inconsistent styled items found for this item; using first one.", false);
                                break;
                            }
                        }
                    }
                }
            }
        }