internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "LayerAssignments") == 0) { List <IfcPresentationLayerAssignment> repItems = new List <IfcPresentationLayerAssignment>(child.ChildNodes.Count); foreach (XmlNode cn in child.ChildNodes) { IfcPresentationLayerAssignment a = mDatabase.ParseXml <IfcPresentationLayerAssignment>(cn as XmlElement); if (a != null) { a.AssignedItems.Add(this); } } } else if (string.Compare(name, "StyledByItem") == 0) { foreach (XmlNode node in child.ChildNodes) { IfcStyledItem styled = mDatabase.ParseXml <IfcStyledItem>(node as XmlElement); if (styled != null) { styled.Item = this; } } } } }
protected void ReplaceDatabase(BaseClassIfc revised) { IfcRoot thisRoot = this as IfcRoot, revisedRoot = revised as IfcRoot; if (thisRoot != null && revisedRoot != null) { revisedRoot.GlobalId = thisRoot.GlobalId; revisedRoot.OwnerHistory = thisRoot.OwnerHistory; revisedRoot.Name = thisRoot.Name; revisedRoot.Description = thisRoot.Description; IfcObjectDefinition thisObjectDefinition = this as IfcObjectDefinition, revisedObjectDefinition = revised as IfcObjectDefinition; if (thisObjectDefinition != null && revisedObjectDefinition != null) { foreach (IfcRelAggregates rel in thisObjectDefinition.IsDecomposedBy.ToList()) { rel.RelatingObject = revisedObjectDefinition; } foreach (IfcRelNests rel in thisObjectDefinition.IsNestedBy.ToList()) { rel.RelatingObject = revisedObjectDefinition; } IfcRelAggregates relAggregates = thisObjectDefinition.Decomposes; if (relAggregates != null) { relAggregates.RelatedObjects.Remove(thisObjectDefinition); relAggregates.RelatedObjects.Add(revisedObjectDefinition); } IfcRelNests relNests = thisObjectDefinition.Nests; if (relNests != null) { relNests.RelatedObjects.Remove(thisObjectDefinition); relNests.RelatedObjects.Add(thisObjectDefinition); } foreach (IfcRelDefinesByProperties relDefinesByProperties in thisObjectDefinition.mIsDefinedBy.ToList()) { relDefinesByProperties.RelatedObjects.Remove(thisObjectDefinition); relDefinesByProperties.RelatedObjects.Add(revisedObjectDefinition); } foreach (IfcRelAssigns assigns in thisObjectDefinition.HasAssignments.ToList()) { assigns.RelatedObjects.Remove(thisObjectDefinition); assigns.RelatedObjects.Add(revisedObjectDefinition); } IfcRelDeclares relDeclares = thisObjectDefinition.HasContext; if (relDeclares != null) { relDeclares.RelatedDefinitions.Remove(thisObjectDefinition); relDeclares.RelatedDefinitions.Add(revisedObjectDefinition); } foreach (IfcRelAssociates associates in thisObjectDefinition.HasAssociations.ToList()) { associates.RelatedObjects.Remove(thisObjectDefinition); associates.RelatedObjects.Add(revisedObjectDefinition); } IfcObject thisObject = this as IfcObject, revisedObject = revised as IfcObject; if (thisObject != null && revisedObject != null) { if (!string.IsNullOrEmpty(thisObject.ObjectType)) { revisedObject.ObjectType = thisObject.ObjectType; } if (thisObject.mIsTypedBy != null) { thisObject.mIsTypedBy.mRelatedObjects.Remove(thisObject); } IfcProduct thisProduct = this as IfcProduct, revisedProduct = revised as IfcProduct; if (thisProduct != null && revisedProduct != null) { IfcRelContainedInSpatialStructure containedInSpatialStructure = thisProduct.mContainedInStructure; if (containedInSpatialStructure != null) { containedInSpatialStructure.RelatedElements.Remove(thisProduct); containedInSpatialStructure.RelatedElements.Add(revisedProduct); } IfcElement thisElement = this as IfcElement, revisedElement = revised as IfcElement; if (thisElement != null && revisedElement != null) { revisedElement.Tag = thisElement.Tag; List <IfcRelVoidsElement> voids = thisElement.HasOpenings.ToList(); foreach (var relVoids in voids) { relVoids.RelatingBuildingElement = revisedElement; } } IfcSpatialElement thisSpatial = this as IfcSpatialElement, revisedSpatial = revised as IfcSpatialElement; if (thisSpatial != null && revisedSpatial != null) { foreach (IfcRelContainedInSpatialStructure contained in thisSpatial.ContainsElements.ToList()) { contained.RelatingStructure = revisedSpatial; } } else if (revisedSpatial != null && thisElement != null) { if (containedInSpatialStructure != null) { containedInSpatialStructure.RelatedElements.Remove(revisedProduct); containedInSpatialStructure.RelatingStructure.AddAggregated(revisedProduct); } List <IfcProduct> subProducts = thisObjectDefinition.IsDecomposedBy.SelectMany(x => x.RelatedObjects).OfType <IfcProduct>().ToList(); if (subProducts.Count > 0) { new IfcRelContainedInSpatialStructure(subProducts, revisedSpatial); } foreach (IfcRelAssociatesMaterial associates in revisedSpatial.HasAssociations.OfType <IfcRelAssociatesMaterial>().ToList()) { associates.RelatedObjects.Remove(revisedSpatial); } IfcFacilityPart facilityPart = revisedSpatial as IfcFacilityPart; if (facilityPart != null) { IfcFacility facility = revisedSpatial.FindHost <IfcFacility>(); if (facility != null) { facility.AddAggregated(revisedSpatial); } } } } } else { IfcTypeObject thisTypeObject = this as IfcTypeObject, revisedTypeObject = revised as IfcTypeObject; if (thisTypeObject != null && revisedTypeObject != null) { IfcTypeProduct thisTypeProduct = this as IfcTypeProduct, revisedTypeProduct = revised as IfcTypeProduct; if (thisTypeProduct != null && revisedTypeProduct != null) { revisedTypeProduct.Tag = thisTypeProduct.Tag; IfcElementType thisElementType = this as IfcElementType, revisedElementType = revised as IfcElementType; if (thisElementType != null && revisedElementType != null) { revisedElementType.ElementType = thisElementType.ElementType; } } } } } } else { IfcRepresentationItem representationItem = this as IfcRepresentationItem, revisedItem = revised as IfcRepresentationItem; if (representationItem != null && revisedItem != null) { IfcStyledItem styledItem = representationItem.StyledByItem; if (styledItem != null) { styledItem.Item = revisedItem; } foreach (IfcShapeModel shapeModel in representationItem.Represents.ToList()) { shapeModel.Items.Remove(representationItem); shapeModel.Items.Add(revisedItem); } IfcPresentationLayerAssignment layerAssignment = representationItem.mLayerAssignment; if (layerAssignment != null) { layerAssignment.AssignedItems.Remove(representationItem); layerAssignment.AssignedItems.Add(revisedItem); } } } mDatabase[revised.mStepId] = null; revised.mStepId = StepId; mDatabase[StepId] = revised; }
protected void ReplaceDatabase(BaseClassIfc revised) { IfcRoot thisRoot = this as IfcRoot, revisedRoot = revised as IfcRoot; if (thisRoot != null && revisedRoot != null) { revisedRoot.GlobalId = thisRoot.GlobalId; revisedRoot.OwnerHistory = thisRoot.OwnerHistory; revisedRoot.Name = thisRoot.Name; revisedRoot.Description = thisRoot.Description; IfcObjectDefinition thisObjectDefinition = this as IfcObjectDefinition, revisedObjectDefinition = revised as IfcObjectDefinition; if (thisObjectDefinition != null && revisedObjectDefinition != null) { foreach (IfcRelAggregates rel in thisObjectDefinition.IsDecomposedBy.ToList()) { rel.RelatingObject = revisedObjectDefinition; } foreach (IfcRelNests rel in thisObjectDefinition.IsNestedBy.ToList()) { rel.RelatingObject = revisedObjectDefinition; } foreach (IfcRelAssigns assigns in thisObjectDefinition.HasAssignments.ToList()) { assigns.RelatedObjects.Remove(thisObjectDefinition); assigns.RelatedObjects.Add(revisedObjectDefinition); } IfcRelDeclares relDeclares = thisObjectDefinition.HasContext; if (relDeclares != null) { relDeclares.RelatedDefinitions.Remove(thisObjectDefinition); relDeclares.RelatedDefinitions.Add(revisedObjectDefinition); } foreach (IfcRelAssociates associates in thisObjectDefinition.HasAssociations.ToList()) { associates.RelatedObjects.Remove(thisObjectDefinition); associates.RelatedObjects.Add(revisedObjectDefinition); } IfcObject thisObject = this as IfcObject, revisedObject = revised as IfcObject; if (thisObject != null && revisedObject != null) { revisedObject.ObjectType = thisObject.ObjectType; if (thisObject.mIsTypedBy != null) { thisObject.mIsTypedBy.mRelatedObjects.Remove(thisObject); } IfcProduct thisProduct = this as IfcProduct, revisedProduct = revised as IfcProduct; if (thisProduct != null && revisedProduct != null) { thisProduct.detachFromHost(); IfcElement thisElement = this as IfcElement, revisedElement = revised as IfcElement; if (thisElement != null && revisedElement != null) { revisedElement.Tag = thisElement.Tag; } } } else { IfcTypeObject thisTypeObject = this as IfcTypeObject, revisedTypeObject = revised as IfcTypeObject; if (thisTypeObject != null && revisedTypeObject != null) { IfcTypeProduct thisTypeProduct = this as IfcTypeProduct, revisedTypeProduct = revised as IfcTypeProduct; if (thisTypeProduct != null && revisedTypeProduct != null) { revisedTypeProduct.Tag = thisTypeProduct.Tag; IfcElementType thisElementType = this as IfcElementType, revisedElementType = revised as IfcElementType; if (thisElementType != null && revisedElementType != null) { revisedElementType.ElementType = thisElementType.ElementType; } } } } } } else { IfcRepresentationItem representationItem = this as IfcRepresentationItem, revisedItem = revised as IfcRepresentationItem; if (representationItem != null && revisedItem != null) { IfcStyledItem styledItem = representationItem.StyledByItem; if (styledItem != null) { styledItem.Item = revisedItem; } foreach (IfcShapeModel shapeModel in representationItem.mRepresents.ToList()) { shapeModel.Items.Remove(representationItem); shapeModel.Items.Add(revisedItem); } IfcPresentationLayerAssignment layerAssignment = representationItem.mLayerAssignment; if (layerAssignment != null) { layerAssignment.AssignedItems.Remove(representationItem); layerAssignment.AssignedItems.Add(revisedItem); } } } mDatabase[revised.mIndex] = null; revised.mIndex = mIndex; mDatabase[mIndex] = revised; }
internal void setAggregate(BaseClassIfc obj) { IfcProduct product = obj as IfcProduct; if (product != null) { mProducts.Add(product); IfcBuildingStorey buildingStorey = obj as IfcBuildingStorey; if (buildingStorey != null) { mBuildingStories.Add(buildingStorey); } IfcGrid grid = obj as IfcGrid; if (grid != null) { mGrids.Add(grid); } IfcSlab slab = product as IfcSlab; if (slab != null) { mSlabs.Add(slab); } IfcStructuralItem structuralItem = obj as IfcStructuralItem; if (structuralItem != null) { mStructItems.Add(structuralItem); } IfcWall wall = product as IfcWall; if (wall != null) { mWalls.Add(wall); } return; } //IfcApplication application = obj as IfcApplication; //if (application != null) // mApplications.Add(application); IfcComplexProperty cp = obj as IfcComplexProperty; if (cp != null) { mComplexProperties.Add(cp); return; } IfcCoordinateOperation coordOp = obj as IfcCoordinateOperation; if (coordOp != null) { mCoordinateOperations.Add(coordOp); return; } IfcEdgeCurve edgeCurve = obj as IfcEdgeCurve; if (edgeCurve != null) { mEdgeCurves.Add(edgeCurve); return; } IfcExternalReferenceRelationship externalReferenceRelationship = obj as IfcExternalReferenceRelationship; if (externalReferenceRelationship != null) { mExternalRelationships.Add(externalReferenceRelationship); return; } //IfcExtrudedAreaSolid extrudedAreaSolid = result as IfcExtrudedAreaSolid; //if(extrudedAreaSolid != null) //{ // if(result as IfcExtrudedAreaSolidTapered == null) // aggregate.mExtrusions.Add(extrudedAreaSolid); // return extrudedAreaSolid; //} IfcGeometricRepresentationSubContext geometricRepresentationContext = obj as IfcGeometricRepresentationSubContext; if (geometricRepresentationContext != null) { mGeomContexts.Add(geometricRepresentationContext); return; } IfcGroup group = obj as IfcGroup; if (group != null) { IfcZone zone = group as IfcZone; if (zone != null) { mZones.Add(zone); return; } mGroups.Add(group); return; } IfcIndexedColourMap indexedColourMap = obj as IfcIndexedColourMap; if (indexedColourMap != null) { mIndexedColourMap.Add(indexedColourMap); return; } IfcIndexedTextureMap indexedTextureMap = obj as IfcIndexedTextureMap; if (indexedTextureMap != null) { mIndexedTextureMap.Add(indexedTextureMap); return; } IfcLocalPlacement localPlacement = obj as IfcLocalPlacement; if (localPlacement != null) { mLocalPlacements.Add(localPlacement); return; } IfcMappedItem mi = obj as IfcMappedItem; if (mi != null) { mMappedItems.Add(mi); return; } IfcMaterial material = obj as IfcMaterial; if (material != null) { mMaterials.Add(material); return; } IfcMaterialProperties materialProperties = obj as IfcMaterialProperties; if (materialProperties != null) { mMaterialProperties.Add(materialProperties); return; } IfcMaterialPropertiesSuperSeded materialPropertiesSS = obj as IfcMaterialPropertiesSuperSeded; if (materialPropertiesSS != null) { mMaterialPropertiesSS.Add(materialPropertiesSS); return; } // IfcMechanicalFastener mechanicalFastener = result as IfcMechanicalFastener; //if(mechanicalFastener != null) //{ // mFasteners.Add(mechanicalFastener); // return mechanicalFastener; //} //IfcOwnerHistory ownerHistory = result as IfcOwnerHistory; //if(ownerHistory != null) //{ // mOwnHistories.Add(ownerHistory); // return ownerHistory; //} IfcPresentationLayerAssignment presentationLayerAssignment = obj as IfcPresentationLayerAssignment; if (presentationLayerAssignment != null) { mPresentationLayerAssignments.Add(presentationLayerAssignment); return; } IfcProductRepresentation productRepresentation = obj as IfcProductRepresentation; if (productRepresentation != null) { mProductReps.Add(productRepresentation); return; } IfcPropertySet propSet = obj as IfcPropertySet; if (propSet != null) { mPropertySets.Add(propSet); return; } //IfcProfileDef profileDef = obj as IfcProfileDef; //if (profileDef != null) //{ // mProfiles.Add(profileDef); // return profileDef; //} IfcRelationship relationship = obj as IfcRelationship; if (relationship != null) { mRelationships.Add(relationship); return; } IfcRepresentation representation = obj as IfcRepresentation; if (representation != null) { mRepresentations.Add(representation); return; } //IfcRepresentationMap representationMap = obj as IfcRepresentationMap; //if (representationMap != null) //{ // mRepMaps.Add(representationMap); // return representationMap; //} IfcResourceConstraintRelationship rcr = obj as IfcResourceConstraintRelationship; if (rcr != null) { mConstraintRelationships.Add(rcr); return; } IfcShapeAspect shapeAspect = obj as IfcShapeAspect; if (shapeAspect != null) { mShapeAspects.Add(shapeAspect); return; } IfcStyledItem styledItem = obj as IfcStyledItem; if (styledItem != null) { mStyledItems.Add(styledItem); return; } IfcTypeProduct typeProduct = obj as IfcTypeProduct; if (typeProduct != null) { mTypeProducts.Add(typeProduct); return; } setCustomAggregate(obj); }
internal IfcStyledRepresentation(IfcStyledItem ri) : base(ri) { }
internal static void parseFields(IfcStyledItem i, List<string> arrFields, ref int ipos) { IfcRepresentationItem.parseFields(i, arrFields, ref ipos); i.mItem = ParserSTEP.ParseLink(arrFields[ipos++]); i.mStyles = ParserSTEP.SplitListLinks(arrFields[ipos++]); i.mName = arrFields[ipos++].Replace("'", ""); }
internal static IfcStyledItem Parse(string strDef) { IfcStyledItem i = new IfcStyledItem(); int ipos = 0; parseFields(i, ParserSTEP.SplitLineFields(strDef), ref ipos); return i; }
internal IfcStyledItem(IfcStyledItem el) : base(el) { mItem = el.mItem; mStyles.AddRange(el.mStyles); }