X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Face.cpp;h=826b8477ae7a5ebb95545ea5dc3040489a29ac0a;hb=3d28bcbab2f3ed0e40295e64f4e836caebc19fca;hp=2055bdc6dac6951b35fb2e822c1eb46b5eee628b;hpb=3874b57fe5aba25ff5aee2a07654fc23c1ee8eb0;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Face.cpp b/src/GeomAPI/GeomAPI_Face.cpp index 2055bdc6d..826b8477a 100644 --- a/src/GeomAPI/GeomAPI_Face.cpp +++ b/src/GeomAPI/GeomAPI_Face.cpp @@ -16,6 +16,9 @@ #include #include #include +#include +#include +#include GeomAPI_Face::GeomAPI_Face() : GeomAPI_Shape() @@ -64,9 +67,23 @@ bool GeomAPI_Face::isPlanar() const { const TopoDS_Shape& aShape = const_cast(this)->impl(); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape)); - if (aSurf->IsKind(STANDARD_TYPE(Geom_Plane))) - return true; - return false; + Handle(Geom_RectangularTrimmedSurface) aTrimmed = + Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf); + if (!aTrimmed.IsNull()) + aSurf = aTrimmed->BasisSurface(); + GeomLib_IsPlanarSurface isPlanar(aSurf); + return isPlanar.IsPlanar() == Standard_True; +} + +bool GeomAPI_Face::isCylindrical() const +{ + const TopoDS_Shape& aShape = const_cast(this)->impl(); + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape)); + Handle(Geom_RectangularTrimmedSurface) aTrimmed = + Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf); + if (!aTrimmed.IsNull()) + aSurf = aTrimmed->BasisSurface(); + return aSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) == Standard_True; } std::shared_ptr GeomAPI_Face::getPlane() const