1 // Created on: 1996-03-08
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <BRepAdaptor_Surface.hxx>
19 #include <Standard_Type.hxx>
20 #include <StdSelect_BRepOwner.hxx>
21 #include <StdSelect_FaceFilter.hxx>
24 #include <TopoDS_Shape.hxx>
26 IMPLEMENT_STANDARD_RTTIEXT(StdSelect_FaceFilter,SelectMgr_Filter)
35 StdSelect_FaceFilter::
36 StdSelect_FaceFilter(const StdSelect_TypeOfFace aTypeOfFace):
39 void StdSelect_FaceFilter::
40 SetType(const StdSelect_TypeOfFace aTypeOfFace)
41 {mytype = aTypeOfFace;}
44 //==================================================
47 //==================================================
48 StdSelect_TypeOfFace StdSelect_FaceFilter::Type() const
53 Standard_Boolean StdSelect_FaceFilter::
54 IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
56 Handle(StdSelect_BRepOwner) aBO (Handle(StdSelect_BRepOwner)::DownCast(EO));
58 return Standard_False;
60 const TopoDS_Shape& anobj = aBO->Shape();
61 if(anobj.ShapeType()!= TopAbs_FACE)
62 return Standard_False;
65 case StdSelect_AnyFace:
69 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
70 return (surf.GetType() == GeomAbs_Plane);
72 case StdSelect_Cylinder:
74 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
75 return (surf.GetType() == GeomAbs_Cylinder);
77 case StdSelect_Sphere:
79 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
80 return (surf.GetType() == GeomAbs_Sphere);
84 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
85 return ( surf.GetType() == GeomAbs_Torus);
89 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
90 return ( surf.GetType() == GeomAbs_Cylinder ||
91 surf.GetType() == GeomAbs_Cone ||
92 surf.GetType() == GeomAbs_Torus
94 surf.GetType() == GeomAbs_Sphere ||
95 surf.GetType() == GeomAbs_SurfaceOfRevolution
98 case StdSelect_Cone: // waiting for the free cdl, it is used for Cone
100 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
101 return (surf.GetType() == GeomAbs_Cone);
104 return Standard_False;
106 Standard_Boolean StdSelect_FaceFilter::ActsOn(const TopAbs_ShapeEnum aStandardMode) const
107 {return aStandardMode==TopAbs_FACE;}