1 // SMESHGUI_Filter : Filters for VTK viewer
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_Filter.cxx
25 // Author : Sergey LITONIN
28 #include "SMESHGUI_Filter.h"
33 #include <Precision.hxx>
34 #include "SMESH_Actor.h"
37 IMPLEMENT_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
38 IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_Filter, VTKViewer_Filter)
41 Class : SMESHGUI_Filter
42 Description : Selection filter for VTK viewer. This class aggregate object
43 of SMESH_Filter class and uses it for verification of criterion
46 //=======================================================================
47 // name : SMESHGUI_Filter::SMESHGUI_Filter
48 // Purpose : Constructor
49 //=======================================================================
50 SMESHGUI_Filter::SMESHGUI_Filter()
55 SMESHGUI_Filter::~SMESHGUI_Filter()
59 //=======================================================================
60 // name : SMESHGUI_Filter::IsValid
61 // Purpose : Verify whether entry id satisfies to criterion of the filter
62 //=======================================================================
63 bool SMESHGUI_Filter::IsValid( const int theCellId ) const
65 if ( myActor == 0 || myPred->_is_nil() )
68 SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
70 int aMeshId = anActor->GetElemObjId( theCellId );
72 return myPred->IsSatisfy( aMeshId );
75 //=======================================================================
76 // name : SMESHGUI_Filter::SetPredicate
77 // Purpose : Set new pridicate to the filter
78 //=======================================================================
79 void SMESHGUI_Filter::SetPredicate( SMESH::Predicate_ptr thePred )
84 //=======================================================================
85 // name : SMESHGUI_Filter::GetActor
86 // Purpose : Get actor of the filter
87 //=======================================================================
88 SALOME_Actor* SMESHGUI_Filter::GetActor() const
93 //=======================================================================
94 // name : SMESHGUI_Filter::SetActor
95 // Purpose : Set new actor
96 //=======================================================================
97 void SMESHGUI_Filter::SetActor( SALOME_Actor* theActor )
99 if ( myActor == theActor )
101 VTKViewer_Filter::SetActor( theActor );
103 if ( myActor != 0 && !myPred->_is_nil() )
105 Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
106 if ( !anIO.IsNull() )
108 Standard_Boolean aRes = false;
109 SMESH::SMESH_Mesh_ptr aMeshPtr = SMESHGUI::GetSMESHGUI()->ConvertIOinMesh( anIO, aRes );
111 myPred->SetMesh( aMeshPtr );