Salome HOME
Issue #583: Provide validator for cylindrical face
[modules/shaper.git] / src / GeomAPI / GeomAPI_Face.cpp
index b569598357b982526ca0221c1332289ac200bbfb..4b300475928fe493a2d309c1eb00efe7e030e57c 100644 (file)
@@ -16,6 +16,7 @@
 #include <BRepAdaptor_Surface.hxx>
 #include <Geom_Surface.hxx>
 #include <Geom_Plane.hxx>
+#include <Geom_CylindricalSurface.hxx>
 #include <GeomLib_IsPlanarSurface.hxx>
 
 GeomAPI_Face::GeomAPI_Face()
@@ -69,6 +70,13 @@ bool GeomAPI_Face::isPlanar() const
   return isPlanar.IsPlanar() == Standard_True;
 }
 
+bool GeomAPI_Face::isCylindrical() const
+{
+  const TopoDS_Shape& aShape = const_cast<GeomAPI_Face*>(this)->impl<TopoDS_Shape>();
+  Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape));
+  return aSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) == Standard_True;
+}
+
 std::shared_ptr<GeomAPI_Pln> GeomAPI_Face::getPlane() const
 {
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Face*>(this)->impl<TopoDS_Shape>();