From c6735117e1b786d39bbae7bd3b8e4a1297fff099 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 26 May 2015 19:58:11 +0300 Subject: [PATCH] Temporary providing a compound shape type in selection and validation to provide a selection of a Sketch result in the browser. --- src/GeomAPI/GeomAPI_Shape.cpp | 6 ++++++ src/GeomAPI/GeomAPI_Shape.h | 3 +++ src/GeomValidators/GeomValidators_ShapeType.cpp | 4 ++++ src/GeomValidators/GeomValidators_ShapeType.h | 3 ++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/GeomAPI/GeomAPI_Shape.cpp b/src/GeomAPI/GeomAPI_Shape.cpp index 07d3ac09c..955fb1233 100644 --- a/src/GeomAPI/GeomAPI_Shape.cpp +++ b/src/GeomAPI/GeomAPI_Shape.cpp @@ -55,6 +55,12 @@ bool GeomAPI_Shape::isFace() const return aShape.ShapeType() == TopAbs_FACE; } +bool GeomAPI_Shape::isCompound() const +{ + const TopoDS_Shape& aShape = const_cast(this)->impl(); + return aShape.ShapeType() == TopAbs_COMPOUND; +} + bool GeomAPI_Shape::isSolid() const { const TopoDS_Shape& aShape = const_cast(this)->impl(); diff --git a/src/GeomAPI/GeomAPI_Shape.h b/src/GeomAPI/GeomAPI_Shape.h index e4e05c476..6f61d9f0f 100644 --- a/src/GeomAPI/GeomAPI_Shape.h +++ b/src/GeomAPI/GeomAPI_Shape.h @@ -36,6 +36,9 @@ class GEOMAPI_EXPORT GeomAPI_Shape : public GeomAPI_Interface /// Returns whether the shape is a face virtual bool isFace() const; + /// Returns whether the shape is a face + virtual bool isCompound() const; + /// Returns whether the shape is a solid virtual bool isSolid() const; diff --git a/src/GeomValidators/GeomValidators_ShapeType.cpp b/src/GeomValidators/GeomValidators_ShapeType.cpp index b8012aedf..2fbf7cad7 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.cpp +++ b/src/GeomValidators/GeomValidators_ShapeType.cpp @@ -30,6 +30,7 @@ GeomValidators_ShapeType::TypeOfShape GeomValidators_ShapeType::shapeType(const MyEdgeTypes["circle"] = Circle; MyEdgeTypes["solid"] = Solid; MyEdgeTypes["face"] = Face; + MyEdgeTypes["compound"] = Compound; } std::string aType = std::string(theType.c_str()); if (MyEdgeTypes.find(aType) != MyEdgeTypes.end()) @@ -150,6 +151,9 @@ bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape, case Face: aValid = theShape->isFace(); break; + case Compound: + aValid = theShape->isCompound(); + break; default: break; } } diff --git a/src/GeomValidators/GeomValidators_ShapeType.h b/src/GeomValidators/GeomValidators_ShapeType.h index c55c4535b..de7fae9ba 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.h +++ b/src/GeomValidators/GeomValidators_ShapeType.h @@ -32,7 +32,8 @@ class GeomValidators_ShapeType : public ModelAPI_AttributeValidator Line, Circle, Solid, - Face + Face, + Compound }; public: -- 2.39.2