public ValidationResult Validate_SingleBodyRepresentation <T, U, V>(bool acceptSubTypes) where T : IfcRepresentationItem where U : IfcRepresentationItem where V : IfcRepresentationItem { ValidationResult result = null; IfcRepresentationItem singleModelRepresenationItem = SingleBodyRepresentationItem(ref result); if (singleModelRepresenationItem == null) { return(result); } if (!(singleModelRepresenationItem is T || singleModelRepresenationItem is U || singleModelRepresenationItem is V)) { return(new ValidationResult("Single Body representation item (" + singleModelRepresenationItem.StepClassName + ") is not " + typeof(T).Name + " or " + typeof(U).Name + " or " + typeof(V).Name)); } if (!acceptSubTypes) { if (singleModelRepresenationItem.GetType().IsSubclassOf(typeof(T))) { return(new ValidationResult("Single Body representation item (" + singleModelRepresenationItem.StepClassName + ") is subclass of " + typeof(T).Name)); } if (singleModelRepresenationItem.GetType().IsSubclassOf(typeof(U))) { return(new ValidationResult("Single Body representation item (" + singleModelRepresenationItem.StepClassName + ") is subclass of " + typeof(U).Name)); } if (singleModelRepresenationItem.GetType().IsSubclassOf(typeof(V))) { return(new ValidationResult("Single Body representation item (" + singleModelRepresenationItem.StepClassName + ") is subclass of " + typeof(V).Name)); } } return(ValidationResult.Success); }
internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); if (xml.HasAttribute("RepresentationIdentifier")) { mRepresentationIdentifier = xml.Attributes["RepresentationIdentifier"].Value; } if (xml.HasAttribute("RepresentationType")) { RepresentationType = xml.Attributes["RepresentationType"].Value; } foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "ContextOfItems") == 0) { ContextOfItems = mDatabase.ParseXml <IfcRepresentationContext>(child as XmlElement); } else if (string.Compare(name, "Items", true) == 0) { foreach (XmlNode cn in child.ChildNodes) { IfcRepresentationItem ri = mDatabase.ParseXml <IfcRepresentationItem>(cn as XmlElement); if (ri != null) { Items.Add(ri); } } } else if (string.Compare(name, "LayerAssignments", true) == 0) { 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, "RepresentationIdentifier", true) == 0) { mRepresentationIdentifier = child.InnerText; } else if (string.Compare(name, "RepresentationType", true) == 0) { RepresentationType = child.InnerText; } } }
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 static void parseFields(IfcGeometricRepresentationItem i, List <string> arrFields, ref int ipos) { IfcRepresentationItem.parseFields(i, arrFields, ref ipos); }
public IfcRepresentationMap(IfcRepresentationItem item) : base(item.mDatabase) { mMappingOrigin = new IfcAxis2Placement3D(item.mDatabase).mIndex; MappedRepresentation = new IfcShapeRepresentation(new List<IfcRepresentationItem>() { item }); }
protected static void parseFields(IfcRepresentationItem i, List<string> arrFields, ref int ipos) { }
protected IfcRepresentationItem(IfcRepresentationItem p) : base() { }
protected IfcRepresentation(IfcRepresentationItem ri, string identifier, string repType) : this(ri.mDatabase, identifier, repType) { mItems.Add(ri.mIndex); }
protected IfcRepresentation(IfcRepresentationItem ri) : this(ri.mDatabase,"","") { mItems.Add(ri.mIndex); }
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; }
private bool setIdentifiers(IfcRepresentationItem ri) { IfcGeometricRepresentationItem gri = ri as IfcGeometricRepresentationItem; if (ri != null) { mRepresentationIdentifier = "Body"; mRepresentationType = "MappedRepresentation"; IfcMappedItem mi = ri as IfcMappedItem; if (mi != null) return true; mRepresentationType = "SolidModel"; IfcSolidModel sm = ri as IfcSolidModel; //IfcCsgSolid ,IfcManifoldSolidBrep,IfcSweptAreaSolid,IfcSweptDiskSolid if (sm != null) return true; mRepresentationType = "CSG"; IfcBooleanResult br = ri as IfcBooleanResult; if (br != null) return true; IfcCsgPrimitive3D csg = ri as IfcCsgPrimitive3D; if (csg != null) return true; mRepresentationType = "SectionedSpine"; IfcSectionedSpine ss = ri as IfcSectionedSpine; if (ss != null) return true; mRepresentationIdentifier = "Body"; mRepresentationType = "SurfaceModel"; IfcFaceBasedSurfaceModel fbs = ri as IfcFaceBasedSurfaceModel; if (fbs != null) return true; IfcShellBasedSurfaceModel sbs = ri as IfcShellBasedSurfaceModel; if (sbs != null) return true; mRepresentationType = "Tessellation"; IfcTessellatedItem ti = ri as IfcTessellatedItem; if (ti != null) return true; mRepresentationIdentifier = "Surface"; mRepresentationType = "Surface3D"; IfcSurface s = ri as IfcSurface; if (s != null) return true; mRepresentationIdentifier = "Curve"; mRepresentationType = "Curve3D"; IfcCurve c = ri as IfcCurve; if (c != null) return true; } mRepresentationIdentifier = "$"; mRepresentationType = "$"; return false; }
internal static IfcShapeRepresentation CreateRepresentation(IfcRepresentationItem ri) { if (ri == null) return null; IfcBooleanResult br = ri as IfcBooleanResult; if (br != null) return new IfcShapeRepresentation(br); IfcCurve c = ri as IfcCurve; if (c != null) return new IfcShapeRepresentation(c); IfcCsgPrimitive3D csg = ri as IfcCsgPrimitive3D; if (csg != null) return new IfcShapeRepresentation(csg); IfcCsgSolid csgs = ri as IfcCsgSolid; if (csgs != null) return new IfcShapeRepresentation(csgs); IfcExtrudedAreaSolid eas = ri as IfcExtrudedAreaSolid; if (eas != null) return new IfcShapeRepresentation(eas); IfcFacetedBrep fb = ri as IfcFacetedBrep; if (fb != null) return new IfcShapeRepresentation(fb); IfcFaceBasedSurfaceModel fbs = ri as IfcFaceBasedSurfaceModel; if (fbs != null) return new IfcShapeRepresentation(fbs); IfcGeometricSet gs = ri as IfcGeometricSet; if (gs != null) return new IfcShapeRepresentation(gs); IfcPoint p = ri as IfcPoint; if (p != null) return new IfcShapeRepresentation(p); IfcSectionedSpine ss = ri as IfcSectionedSpine; if (ss != null) return new IfcShapeRepresentation(ss); IfcShellBasedSurfaceModel sbs = ri as IfcShellBasedSurfaceModel; if (sbs != null) return new IfcShapeRepresentation(sbs); IfcSurface s = ri as IfcSurface; if (s != null) return new IfcShapeRepresentation(s); IfcSweptAreaSolid sas = ri as IfcSweptAreaSolid; if (sas != null) return new IfcShapeRepresentation(sas); IfcSweptDiskSolid sds = ri as IfcSweptDiskSolid; if (sds != null) return new IfcShapeRepresentation(sds); IfcAdvancedBrep b = ri as IfcAdvancedBrep; if (b != null) return new IfcShapeRepresentation(b); IfcTessellatedItem ti = ri as IfcTessellatedItem; if (ti != null) return new IfcShapeRepresentation(ti); IfcMappedItem mi = ri as IfcMappedItem; if (mi != null) return new IfcShapeRepresentation(mi); ri.mDatabase.logError("XXX Error in identiying " + ri.ToString() + " as shape representation, please contact Jon!"); return null; }
protected IfcShapeModel(IfcRepresentationItem ri, string identifier, string repType) : base(ri, identifier, repType) { }
protected IfcStyleModel(IfcRepresentationItem ri) : base(ri) { }