internal static bool IfcUniqueQuantityNames(IItemSet <IfcPhysicalQuantity> Quantities) { // note: this function has been substantially rewritten to take advangate of linq. // var propNames = Quantities.Select(x => x.Name).ToList(); var isUnique = propNames.Distinct().Count() == Quantities.Count(); return(isUnique); }
internal static bool IfcUniquePropertyTemplateNames(IItemSet <IfcPropertyTemplate> PropertyTemplates) { // note: this function has been substantially rewritten to take advangate of linq. // var propNames = PropertyTemplates.Select(x => x.Name).ToList(); var isUnique = propNames.Distinct().Count() == PropertyTemplates.Count(); return(isUnique); }
internal static bool IfcTopologyRepresentationTypes(IfcLabel?RepType, IItemSet <IfcRepresentationItem> Items) { // local variables int Count = 0; if (!RepType.HasValue) { return(true); // deduced from Undefined clause below } switch (RepType.Value) { case "Vertex": Count = Items.Count(x => x is IIfcVertex); break; case "Edge": Count = Items.Count(x => x is IIfcEdge); break; case "Path": Count = Items.Count(x => x is IIfcPath); break; case "Face": Count = Items.Count(x => x is IIfcFace); break; case "Shell": Count = Items.Count(x => x is IIfcOpenShell || x is IIfcClosedShell ); break; case "Undefined": return(true); } return(Count == Items.Count); }
internal static bool IfcShapeRepresentationTypes(IfcLabel?RepType, IItemSet <IfcRepresentationItem> Items) { // local variables int Count = 0; if (!RepType.HasValue) { return(Count == Items.Count); } switch (RepType.Value) { case "Point": Count = Items.Count(x => x is IIfcPoint); break; //case "PointCloud": // Count = Items.Count(x => x is IIfcCartesianPointList3D); // break; case "Curve": Count = Items.Count(x => x is IIfcCurve); break; case "Curve2D": Count = Items.Count(x => x is IIfcCurve && ((IIfcCurve)x).Dim == 2); break; case "Curve3D": Count = Items.Count(x => x is IIfcCurve && ((IIfcCurve)x).Dim == 3); break; case "Surface": Count = Items.Count(x => x is IIfcSurface); break; case "Surface2D": Count = Items.Count(x => x is IIfcSurface && ((IIfcSurface)x).Dim == 2); break; case "Surface3D": Count = Items.Count(x => x is IIfcSurface && ((IIfcSurface)x).Dim == 3); break; case "FillArea": Count = Items.Count(x => x is IIfcAnnotationFillArea); break; case "Text": Count = Items.Count(x => x is IIfcTextLiteral); break; //case "AdvancedSurface": // Count = Items.Count(x => x is IIfcBSplineSurface); // break; case "Annotation2D": Count = Items.Count(x => x is IIfcPoint || x is IIfcCurve || x is IIfcGeometricCurveSet || x is IIfcAnnotationFillArea || x is IIfcTextLiteral ); break; case "GeometricSet": Count = Items.Count(x => x is IIfcGeometricSet || x is IIfcPoint || x is IIfcCurve || x is IIfcSurface); break; case "GeometricCurveSet": Count = Items.Count(x => x is IIfcGeometricCurveSet || x is IIfcGeometricSet || x is IIfcPoint || x is IIfcCurve); foreach (var ifcRepresentationItem in Items) { if (ifcRepresentationItem is IIfcGeometricSet) { var asIIfcGeometricSet = ifcRepresentationItem as IIfcGeometricSet; if (asIIfcGeometricSet.Elements.Count(temp => temp is IfcSurface) > 0) { Count--; } } } break; //case "Tessellation": // Count = Items.Count(x => x is IIfcTessellatedItem); // break; case "SurfaceOrSolidModel": Count = Items.Count(x => // x is IIfcTessellatedItem x is IIfcShellBasedSurfaceModel || x is IIfcFaceBasedSurfaceModel || x is IIfcSolidModel ); break; case "SurfaceModel": Count = Items.Count(x => x is IIfcShellBasedSurfaceModel || x is IIfcFaceBasedSurfaceModel ); break; case "SolidModel": Count = Items.Count(x => x is IIfcSolidModel); break; case "SweptSolid": // todo: check this, i'm not sure this is how to interpret the clause Count = Items.Count(x => x is IIfcExtrudedAreaSolid || x is IIfcRevolvedAreaSolid ); break; case "AdvancedSweptSolid": Count = Items.Count(x => x is IIfcSweptAreaSolid || x is IIfcSweptDiskSolid ); break; case "CSG": Count = Items.Count(x => x is IIfcBooleanResult || x is IIfcCsgPrimitive3D || x is IIfcCsgSolid); break; case "Clipping": Count = Items.Count(x => x is IIfcBooleanClippingResult); break; case "Brep": Count = Items.Count(x => x is IIfcFacetedBrep); break; case "AdvancedBrep": Count = Items.Count(x => x is IIfcManifoldSolidBrep); break; case "BoundingBox": Count = Items.Count(x => x is IIfcBoundingBox); if (Items.Count > 1) { Count = 0; } break; case "SectionedSpine": Count = Items.Count(x => x is IIfcSectionedSpine); break; case "LightSource": Count = Items.Count(x => x is IIfcLightSource); break; case "MappedRepresentation": Count = Items.Count(x => x is IIfcMappedItem); break; } return(Count == Items.Count); }