1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "GEOM_LogicalFilter.h"
22 //=======================================================================
23 // function : GEOM_LogicalFilter
25 //=======================================================================
26 GEOM_LogicalFilter::GEOM_LogicalFilter( const QPtrList<SUIT_SelectionFilter>& lst, const int op )
27 : SUIT_SelectionFilter()
33 //=======================================================================
34 // function : ~GEOM_LogicalFilter
36 //=======================================================================
37 GEOM_LogicalFilter::~GEOM_LogicalFilter()
41 //=======================================================================
44 //=======================================================================
45 bool GEOM_LogicalFilter::isOk( const SUIT_DataOwner* owner ) const
47 GEOM_LogicalFilter* non_const_this = (GEOM_LogicalFilter*)this;
48 for ( SUIT_SelectionFilter* filter = non_const_this->myFilters.first(); filter; filter = non_const_this->myFilters.next() )
50 if ( myOperation == LO_OR && filter->isOk( owner ) )
52 if ( myOperation == LO_AND && !filter->isOk( owner ) )
54 if ( myOperation == LO_NOT )
55 return !filter->isOk( owner );
58 return ( myOperation != LO_OR );
61 //=======================================================================
62 // function : setFilters
64 //=======================================================================
65 void GEOM_LogicalFilter::setFilters( const QPtrList<SUIT_SelectionFilter>& lst )
70 //=======================================================================
71 // function : setOperation
73 //=======================================================================
74 void GEOM_LogicalFilter::setOperation( const int op )
79 //=======================================================================
80 // function : getFilters
82 //=======================================================================
83 QPtrList<SUIT_SelectionFilter> GEOM_LogicalFilter::getFilters() const
88 //=======================================================================
89 // function : getOperation
91 //=======================================================================
92 int GEOM_LogicalFilter::getOperation() const