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.
17 #include <StdSelect_FaceFilter.ixx>
18 #include <BRepAdaptor_Surface.hxx>
19 #include <TopoDS_Face.hxx>
20 #include <TopoDS_Shape.hxx>
23 #include <StdSelect_BRepOwner.hxx>
32 StdSelect_FaceFilter::
33 StdSelect_FaceFilter(const StdSelect_TypeOfFace aTypeOfFace):
36 void StdSelect_FaceFilter::
37 SetType(const StdSelect_TypeOfFace aTypeOfFace)
38 {mytype = aTypeOfFace;}
41 //==================================================
44 //==================================================
45 StdSelect_TypeOfFace StdSelect_FaceFilter::Type() const
50 Standard_Boolean StdSelect_FaceFilter::
51 IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
53 if (Handle(StdSelect_BRepOwner)::DownCast(EO).IsNull()) return Standard_False;
54 const TopoDS_Shape& anobj= Handle(StdSelect_BRepOwner)::DownCast (EO)->Shape();
55 if(anobj.ShapeType()!= TopAbs_FACE)return Standard_False;
57 case StdSelect_AnyFace:
61 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
62 return (surf.GetType() == GeomAbs_Plane);
64 case StdSelect_Cylinder:
66 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
67 return (surf.GetType() == GeomAbs_Cylinder);
69 case StdSelect_Sphere:
71 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
72 return (surf.GetType() == GeomAbs_Sphere);
76 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
77 return ( surf.GetType() == GeomAbs_Torus);
81 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
82 return ( surf.GetType() == GeomAbs_Cylinder ||
83 surf.GetType() == GeomAbs_Cone ||
84 surf.GetType() == GeomAbs_Torus
86 surf.GetType() == GeomAbs_Sphere ||
87 surf.GetType() == GeomAbs_SurfaceOfRevolution
90 case StdSelect_Cone: // waiting for the free cdl, it is used for Cone
92 BRepAdaptor_Surface surf(TopoDS::Face(anobj));
93 return (surf.GetType() == GeomAbs_Cone);
96 return Standard_False;
98 Standard_Boolean StdSelect_FaceFilter::ActsOn(const TopAbs_ShapeEnum aStandardMode) const
99 {return aStandardMode==TopAbs_FACE;}