1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef SVTK_Functor_H
23 #define SVTK_Functor_H
29 #include <VTKViewer_Functor.h>
31 #include "SALOME_InteractiveObject.hxx"
35 This file contains numbers of functors that allows user to perform corresponding operations with existing presentations.
36 Combination with algorithms it gives powerful, flexible and simple to extend way to introduce new type of operation.
43 //! This functor check, if the actor have pointed entry
44 template<class TActor>
48 //! To construct the functor
49 TIsSameEntry(const char* theEntry):
52 //! To calculate the functor
53 bool operator()(TActor* theActor)
55 if ( theActor->hasIO() )
57 Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
58 if ( anIO->hasEntry() )
59 return myEntry == anIO->getEntry();
66 //----------------------------------------------------------------
67 //! This functor check, if the actor point to the same #SALOME_InteractiveObject
68 template<class TActor>
71 Handle(SALOME_InteractiveObject) myIObject;
72 //! To construct the functor
73 TIsSameIObject(const Handle(SALOME_InteractiveObject)& theIObject):
76 //! To calculate the functor
77 bool operator()(TActor* theActor)
81 Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
82 return myIObject->isSame(anIO);
89 //----------------------------------------------------------------
91 This highlight every input actor
93 template<class TActor>
97 //! To construct the functor
98 THighlight(bool theIsHighlight):
99 myIsHighlight( theIsHighlight )
101 //! To calculate the functor
102 void operator()(TActor* theActor)
104 if(theActor->GetVisibility() && theActor->GetMapper())
105 theActor->highlight( myIsHighlight );