-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-//
-// File : GEOM_LogicalFilter.cxx
-// Author : Sergey LITONIN
-// Module : GEOM
-
-#include "GEOM_LogicalFilter.hxx"
-
-/*
- Class : GEOM_LogicalFilter
- Description : Filter for combaining several filters with logical operation (OR or AND)
-*/
-
-IMPLEMENT_STANDARD_HANDLE( GEOM_LogicalFilter, SALOME_Filter )
-IMPLEMENT_STANDARD_RTTIEXT( GEOM_LogicalFilter, SALOME_Filter )
-//=======================================================================
-// name : GEOM_LogicalFilter::GEOM_LogicalFilter
-// Purpose : Constructor
-//=======================================================================
-GEOM_LogicalFilter::GEOM_LogicalFilter( const GEOM_ListOfFilter& theFilters,
- const int theLogOp )
-{
- myFilters = theFilters;
- myLogOp = theLogOp;
-}
+#include "GEOM_LogicalFilter.h"
//=======================================================================
-// name : GEOM_LogicalFilter::GEOM_LogicalFilter
-// Purpose : Constructor
+// function : GEOM_LogicalFilter
+// purpose :
//=======================================================================
-GEOM_LogicalFilter::GEOM_LogicalFilter( const Handle(SALOME_Filter)& theFilter,
- const int theLogOp )
+GEOM_LogicalFilter::GEOM_LogicalFilter( const QList<SUIT_SelectionFilter*>& lst, const int op )
+: SUIT_SelectionFilter()
{
- myFilters.Append( theFilter );
- myLogOp = theLogOp;
+ setFilters( lst );
+ setOperation( op );
}
//=======================================================================
-// name : GEOM_LogicalFilter::~GEOM_LogicalFilter
-// Purpose : Destructor
+// function : ~GEOM_LogicalFilter
+// purpose :
//=======================================================================
GEOM_LogicalFilter::~GEOM_LogicalFilter()
{
}
//=======================================================================
-// name : GEOM_LogicalFilter::IsOk
-// Purpose : Verify validity of entry object
+// function : isOk
+// purpose :
//=======================================================================
-Standard_Boolean GEOM_LogicalFilter::IsOk( const Handle(SALOME_InteractiveObject)& theIO ) const
+bool GEOM_LogicalFilter::isOk( const SUIT_DataOwner* owner ) const
{
- GEOM_ListOfFilter::Iterator anIter( myFilters );
- for ( ; anIter.More(); anIter.Next() )
+ GEOM_LogicalFilter* non_const_this = (GEOM_LogicalFilter*)this;
+ QListIterator<SUIT_SelectionFilter*> it( non_const_this->myFilters );
+ while ( it.hasNext() )
{
- Handle(SALOME_Filter) aFilter = anIter.Value();
- if ( !aFilter.IsNull() )
- {
- if ( myLogOp == LO_OR && anIter.Value()->IsOk( theIO ) )
- return true;
- if ( myLogOp == LO_AND && !anIter.Value()->IsOk( theIO ) )
- return false;
- if ( myLogOp == LO_NOT )
- return !anIter.Value()->IsOk( theIO );
- }
+ SUIT_SelectionFilter* filter = it.next();
+ if ( !filter ) continue;
+
+ if ( myOperation == LO_OR && filter->isOk( owner ) )
+ return true;
+ if ( myOperation == LO_AND && !filter->isOk( owner ) )
+ return false;
+ if ( myOperation == LO_NOT )
+ return !filter->isOk( owner );
}
- return myLogOp == LO_OR ? false : true;
+ return ( myOperation != LO_OR );
}
//=======================================================================
-// name : GEOM_LogicalFilter::SetFilters
-// Purpose : Set new list of filters. Old wilters are removed
+// function : setFilters
+// purpose :
//=======================================================================
-void GEOM_LogicalFilter::SetFilters( const GEOM_ListOfFilter& theFilters )
+void GEOM_LogicalFilter::setFilters( const QList<SUIT_SelectionFilter*>& lst )
{
- myFilters = theFilters;
+ myFilters = lst;
}
//=======================================================================
-// name : GEOM_LogicalFilter::SetLogOp
-// Purpose : Set logical operation
+// function : setOperation
+// purpose :
//=======================================================================
-void GEOM_LogicalFilter::SetLogOp( const int theLogOp )
+void GEOM_LogicalFilter::setOperation( const int op )
{
- myLogOp = theLogOp;
+ myOperation = op;
}
//=======================================================================
-// name : GEOM_LogicalFilter::GetFilters
-// Purpose : Get list of filters
+// function : getFilters
+// purpose :
//=======================================================================
-const GEOM_ListOfFilter& GEOM_LogicalFilter::GetFilters() const
+QList<SUIT_SelectionFilter*> GEOM_LogicalFilter::getFilters() const
{
return myFilters;
}
//=======================================================================
-// name : GEOM_LogicalFilter::GetLogOp
-// Purpose : Get logical operation
+// function : getOperation
+// purpose :
//=======================================================================
-int GEOM_LogicalFilter::GetLogOp() const
+int GEOM_LogicalFilter::getOperation() const
{
- return myLogOp;
+ return myOperation;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-