1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
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 : GEOM_LogicalFilter.cxx
25 // Author : Sergey LITONIN
28 #include "GEOM_LogicalFilter.hxx"
31 Class : GEOM_LogicalFilter
32 Description : Filter for combaining several filters with logical operation (OR or AND)
35 IMPLEMENT_STANDARD_HANDLE( GEOM_LogicalFilter, SALOME_Filter )
36 IMPLEMENT_STANDARD_RTTIEXT( GEOM_LogicalFilter, SALOME_Filter )
38 //=======================================================================
39 // name : GEOM_LogicalFilter::GEOM_LogicalFilter
40 // Purpose : Constructor
41 //=======================================================================
42 GEOM_LogicalFilter::GEOM_LogicalFilter( const GEOM_ListOfFilter& theFilters,
45 myFilters = theFilters;
49 //=======================================================================
50 // name : GEOM_LogicalFilter::GEOM_LogicalFilter
51 // Purpose : Constructor
52 //=======================================================================
53 GEOM_LogicalFilter::GEOM_LogicalFilter( const Handle(SALOME_Filter)& theFilter,
56 myFilters.Append( theFilter );
60 //=======================================================================
61 // name : GEOM_LogicalFilter::~GEOM_LogicalFilter
62 // Purpose : Destructor
63 //=======================================================================
64 GEOM_LogicalFilter::~GEOM_LogicalFilter()
68 //=======================================================================
69 // name : GEOM_LogicalFilter::IsOk
70 // Purpose : Verify validity of entry object
71 //=======================================================================
72 Standard_Boolean GEOM_LogicalFilter::IsOk( const Handle(SALOME_InteractiveObject)& theIO ) const
74 GEOM_ListOfFilter::Iterator anIter( myFilters );
75 for ( ; anIter.More(); anIter.Next() )
77 Handle(SALOME_Filter) aFilter = anIter.Value();
78 if ( !aFilter.IsNull() )
80 if ( myLogOp == LO_OR && anIter.Value()->IsOk( theIO ) )
82 if ( myLogOp == LO_AND && !anIter.Value()->IsOk( theIO ) )
84 if ( myLogOp == LO_NOT )
85 return !anIter.Value()->IsOk( theIO );
89 return myLogOp == LO_OR ? false : true;
92 //=======================================================================
93 // name : GEOM_LogicalFilter::SetFilters
94 // Purpose : Set new list of filters. Old wilters are removed
95 //=======================================================================
96 void GEOM_LogicalFilter::SetFilters( const GEOM_ListOfFilter& theFilters )
98 myFilters = theFilters;
101 //=======================================================================
102 // name : GEOM_LogicalFilter::SetLogOp
103 // Purpose : Set logical operation
104 //=======================================================================
105 void GEOM_LogicalFilter::SetLogOp( const int theLogOp )
110 //=======================================================================
111 // name : GEOM_LogicalFilter::GetFilters
112 // Purpose : Get list of filters
113 //=======================================================================
114 const GEOM_ListOfFilter& GEOM_LogicalFilter::GetFilters() const
119 //=======================================================================
120 // name : GEOM_LogicalFilter::GetLogOp
121 // Purpose : Get logical operation
122 //=======================================================================
123 int GEOM_LogicalFilter::GetLogOp() const