Ejemplo n.º 1
0
 public override string WhereRule()
 {
     if (Bounds.OfType <IfcFaceOuterBound>().Count() > 1)
     {
         return("WR1 Face : At most one of the bounds shall be of the type FaceOuterBound\n");
     }
     else
     {
         return("");
     }
 }
 public override string WhereRule()
 {
     if (_relatedElements.OfType <IfcSpatialStructureElement>().Count() > 0)
     {
         return
             ("WR31 RelContainedInSpatialStructure : The relationship object shall not be used to include other spatial structure elements into a spatial structure element.  ");
     }
     else
     {
         return("");
     }
 }
Ejemplo n.º 3
0
        public override string WhereRule()
        {
            IfcProfileDef pDef = _profiles.FirstOrDefault();
            string        err  = "";

            if (pDef != null)
            {
                IfcProfileTypeEnum pType = pDef.ProfileType;
                foreach (IfcProfileDef profile in _profiles)
                {
                    if (pType != profile.ProfileType)
                    {
                        err += "WR1 CompositeProfileDef : Either all profiles are areas or all profiles are curves\n";
                        break;
                    }
                }
            }
            if (_profiles.OfType <IfcCompositeProfileDef>().Count() > 0)
            {
                err +=
                    "WR2 CompositeProfileDef :   A composite profile should not include another composite profile, i.e. no recursive definitions should be allowed.\n";
            }
            return(err);
        }
Ejemplo n.º 4
0
        private bool ShapeRepresentationTypesComply(
            out string errStr)
        {
            string repType = RepresentationType.GetValueOrDefault();
            string msg     = "";
            bool   found   = true;
            XbimSet <IfcRepresentationItem> items = Items;
            int count = 0;

            //split case statements to overcome bug in db4o, which cannot traverse more than 5 deep in a case statement
            switch (repType)
            {
            case "Curve2D":
                count = items.OfType <IfcCurve>().Where(i => i.Dim == 2).Count();
                msg   = "RepresentationType = Curve2D, but Items contains shapes that are not Curve";
                break;

            case "Annotation2D":
                count =
                    items.Where(
                        i =>
                        i is IfcPoint || i is IfcCurve || i is IfcGeometricCurveSet || i is IfcAnnotationFillArea ||
                        i is IfcDefinedSymbol || i is IfcTextLiteral || i is IfcDraughtingCallOut).Count();
                msg =
                    "RepresentationType = Annotation2D, but Items contains shapes that are not GeometricCurveSet, Curve, or AnnotationFillArea, DefinedSymbol, TextLiteral or DraughtingCallOut";
                break;

            case "GeometricSet":
                count =
                    items.Where(i => i is IfcGeometricSet || i is IfcPoint || i is IfcCurve || i is IfcSurface).
                    Count();
                msg =
                    "RepresentationType = GeometricSet, but Items contains shapes that are not Point, Curve, or Surface";
                break;

            case "GeometricCurveSet":
                count =
                    items.Where(
                        i => i is IfcGeometricCurveSet || i is IfcPoint || i is IfcCurve || i is IfcGeometricSet).
                    Count();
                msg =
                    "RepresentationType = GeometricCurveSet, but Items contains shapes that are not Point, Curve, or GeometricSet";
                foreach (IfcRepresentationItem item in items)
                {
                    IfcGeometricSet gs = item as IfcGeometricSet;
                    if (gs != null)
                    {
                        if (gs.Elements.OfType <IfcSurface>().Count() > 0)
                        {
                            count--;
                        }
                    }
                }
                break;

            case "SurfaceModel":
                count =
                    items.Where(
                        i =>
                        i is IfcShellBasedSurfaceModel || i is IfcFaceBasedSurfaceModel || i is IfcFacetedBrep ||
                        i is IfcFacetedBrepWithVoids).Count();
                msg =
                    "RepresentationType = SurfaceModel, but Items contains shapes that are not ShellBasedSurfaceModel, FaceBasedSurfaceModel, FacetedBrepWithVoids or FacetedBrep";
                break;

            default:
                found = false;
                break;
            }
            if (!found)
            {
                found = true;
                switch (repType)
                {
                case "SolidModel":
                    count = items.OfType <IfcSolidModel>().Count();
                    msg   = "RepresentationType = SolidModel, but Items contains shapes that are not SolidModel";
                    break;

                case "SweptSolid":
                    count = items.OfType <IfcSweptAreaSolid>().Count();
                    msg   = "RepresentationType = SweptSolid, but Items contains shapes that are not SweptAreaSolid";
                    break;

                case "CSG":
                    count = items.OfType <IfcBooleanResult>().Count();
                    msg   = "RepresentationType = CSG, but Items contains shapes that are not BooleanResult";
                    break;

                case "Clipping":
                    count = items.OfType <IfcBooleanClippingResult>().Count();
                    msg   =
                        "RepresentationType = Clipping, but Items contains shapes that are not BooleanClippingResult";
                    break;

                case "AdvancedSweptSolid":
                    count = items.Where(i => i is IfcSurfaceCurveSweptAreaSolid || i is IfcSweptDiskSolid).Count();
                    msg   =
                        "RepresentationType = AdvancedSweptSolid, but Items contains shapes that are not SurfaceCurveSweptAreaSolid or SweptDiskSolid";
                    break;

                default:
                    found = false;
                    break;
                }
            }
            if (!found)
            {
                found = true;
                switch (repType)
                {
                case "Brep":
                    count = items.Where(i => i is IfcFacetedBrep || i is IfcFacetedBrepWithVoids).Count();
                    msg   =
                        "RepresentationType = Brep, but Items contains shapes that are not FacetedBrep or FacetedBrepWithVoids";
                    break;

                case "BoundingBox":
                    count = items.OfType <IfcBoundingBox>().Count();
                    msg   = "RepresentationType = BoundingBox, but Items contains shapes that are not BoundingBox";
                    if (items.Count > 1)
                    {
                        count = 0;
                    }
                    break;

                case "SectionedSpine":
                    count = items.OfType <IfcSectionedSpine>().Count();
                    msg   =
                        "RepresentationType = SectionedSpine, but Items contains shapes that are not SectionedSpine";
                    break;

                case "MappedRepresentation":
                    count = items.OfType <IfcMappedItem>().Count();
                    msg   =
                        "RepresentationType = MappedRepresentation, but Items contains shapes that are not MappedItem";
                    break;

                default:
                    found = false;
                    break;
                }
            }
            if (!found)
            {
                errStr = string.Format("Illegal or unknown Representation Identifier, {0}", repType);
                return(false);
            }
            if (count != items.Count)
            {
                errStr = msg;
                return(false);
            }
            else
            {
                errStr = "";
                return(true);
            }
        }