コード例 #1
0
        override protected void Process(IFCAnyHandle item)
        {
            base.Process(item);

            // We will not fail if the transform is not given, but instead assume it to be the identity.
            IFCAnyHandle mappingTarget = IFCImportHandleUtil.GetRequiredInstanceAttribute(item, "MappingTarget", false);

            if (mappingTarget != null)
            {
                MappingTarget = IFCCartesianTransformOperator.ProcessIFCCartesianTransformOperator(mappingTarget);
            }
            else
            {
                MappingTarget = IFCCartesianTransformOperator.ProcessIFCCartesianTransformOperator();
            }

            IFCAnyHandle mappingSource = IFCImportHandleUtil.GetRequiredInstanceAttribute(item, "MappingSource", false);

            if (mappingSource == null)
            {
                return;
            }

            MappingSource = IFCRepresentationMap.ProcessIFCRepresentationMap(mappingSource);
        }
コード例 #2
0
        /// <summary>
        /// Processes IfcTypeObject attributes.
        /// </summary>
        /// <param name="ifcTypeProduct">The IfcTypeProduct handle.</param>
        protected override void Process(IFCAnyHandle ifcTypeProduct)
        {
            base.Process(ifcTypeProduct);

            Tag = IFCAnyHandleUtil.GetStringAttribute(ifcTypeProduct, "Tag");

            IList <IFCAnyHandle> representationMapsHandle = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcTypeProduct, "RepresentationMaps");

            if (representationMapsHandle != null && representationMapsHandle.Count > 0)
            {
                foreach (IFCAnyHandle representationMapHandle in representationMapsHandle)
                {
                    IFCRepresentationMap representationMap = IFCRepresentationMap.ProcessIFCRepresentationMap(representationMapHandle);
                    if (representationMap != null)
                    {
                        RepresentationMaps.Add(representationMap);

                        // Traditionally we would create a "dummy" DirectShapeType for each IfcRepresentationMap.  In the case where the IfcRepresentationMap is not used by another other IfcTypeProduct,
                        // we would like to stop creating the "dummy" DirectShapeType and store the geometry in the DirectShapeType associated with the IfcTypeProduct.  However, IfcRepresentationMap
                        // does not have an INVERSE relationship to its IfcTypeProduct(s), at least in IFC2x3.
                        // As such, we keep track of the IfcRepresentationMaps that have the relationship described above for future correspondence.
                        RegisterRepresentationMapWithTypeProject(representationMap, this);
                    }
                }
            }
        }
コード例 #3
0
        override protected void Process(IFCAnyHandle item)
        {
            base.Process(item);

            // We will not fail if the transform is not given, but instead assume it to be the identity.
            IFCAnyHandle mappingTarget = IFCImportHandleUtil.GetRequiredInstanceAttribute(item, "MappingTarget", false);
            if (mappingTarget != null)
                MappingTarget = IFCCartesianTransformOperator.ProcessIFCCartesianTransformOperator(mappingTarget);
            else
                MappingTarget = IFCCartesianTransformOperator.ProcessIFCCartesianTransformOperator();

            IFCAnyHandle mappingSource = IFCImportHandleUtil.GetRequiredInstanceAttribute(item, "MappingSource", false);
            if (mappingSource == null)
                return;
                
            MappingSource = IFCRepresentationMap.ProcessIFCRepresentationMap(mappingSource);
        }
コード例 #4
0
        private void RegisterRepresentationMapWithTypeProject(IFCRepresentationMap representationMap, IFCTypeProduct typeProduct)
        {
            if (representationMap == null || typeProduct == null)
            {
                return;
            }

            // Note that if the representation map is already in the RepMapToTypeProduct map, we null out the entry, but keep it.
            // That prevents future attempts to register the representation map.
            if (Importer.TheCache.RepMapToTypeProduct.ContainsKey(representationMap.Id))
            {
                Importer.TheCache.RepMapToTypeProduct[representationMap.Id] = null;
            }
            else
            {
                Importer.TheCache.RepMapToTypeProduct[representationMap.Id] = typeProduct;
            }
        }
コード例 #5
0
ファイル: IFCTypeProduct.cs プロジェクト: zfcJerry/revit-ifc
        private void RegisterRepresentationMapWithTypeProject(IFCRepresentationMap representationMap, IFCTypeProduct typeProduct)
        {
            if (representationMap == null || representationMap.MappedRepresentation == null || typeProduct == null)
            {
                return;
            }

            // Note that if the representation map is already in the RepMapToTypeProduct map, or we have already found
            // a representation of the same type, then we null out the entry, but keep it.
            // That prevents future attempts to register the representation map.
            if (Importer.TheCache.RepMapToTypeProduct.ContainsKey(representationMap.Id))
            {
                Importer.TheCache.RepMapToTypeProduct[representationMap.Id] = null;
                return;
            }

            string repType = representationMap.MappedRepresentation.Type;

            if (repType == null)
            {
                repType = string.Empty;
            }

            ISet <string> typeProductLabels = null;

            if (Importer.TheCache.TypeProductToRepLabel.TryGetValue(typeProduct.Id, out typeProductLabels) &&
                typeProductLabels != null && typeProductLabels.Contains(repType))
            {
                // We expect a TypeProduct to only have one Representation of each type.  In the case
                // that we find a 2nd representation of the same type, we will refuse to add it.
                Importer.TheCache.RepMapToTypeProduct[representationMap.Id] = null;
                return;
            }

            if (typeProductLabels == null)
            {
                Importer.TheCache.TypeProductToRepLabel[typeProduct.Id] = new HashSet <string>();
            }

            Importer.TheCache.RepMapToTypeProduct[representationMap.Id] = typeProduct;
            Importer.TheCache.TypeProductToRepLabel[typeProduct.Id].Add(repType);
        }