1 // Copyright (C) 2007-2019 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, or (at your option) any later version.
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
23 #ifndef SVTK_Functor_H
24 #define SVTK_Functor_H
30 #include <VTKViewer_Functor.h>
32 #include <SALOME_InteractiveObject.hxx>
33 #include <SALOME_ListIO.hxx>
36 This file contains numbers of functors that allows user to perform corresponding operations with existing presentations.
37 Combination with algorithms it gives powerful, flexible and simple to extend way to introduce new type of operation.
44 //! This functor check, if the actor have pointed entry
45 template<class TActor>
49 //! To construct the functor
50 TIsSameEntry(const char* theEntry):
53 //! To calculate the functor
54 bool operator()(TActor* theActor)
56 if ( theActor->hasIO() )
58 Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
59 if ( anIO->hasEntry() )
60 return myEntry == anIO->getEntry();
67 //----------------------------------------------------------------
68 //! This functor check, if the actor point to the same #SALOME_InteractiveObject
69 template<class TActor>
72 Handle(SALOME_InteractiveObject) myIObject;
73 //! To construct the functor
74 TIsSameIObject(const Handle(SALOME_InteractiveObject)& theIObject):
77 //! To calculate the functor
78 bool operator()(TActor* theActor)
82 Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
83 return myIObject->isSame(anIO);
90 //----------------------------------------------------------------
92 This highlight every input actor
94 template<class TActor>
98 //! To construct the functor
99 THighlight(bool theIsHighlight):
100 myIsHighlight( theIsHighlight )
102 //! To calculate the functor
103 void operator()(TActor* theActor)
105 if(theActor->GetVisibility() && theActor->GetMapper())
106 theActor->highlight( myIsHighlight );
111 //----------------------------------------------------------------
113 This collect visible IO in list
115 template<class TActor>
116 struct TCollectIfVisible
118 SALOME_ListIO& myList;
119 //! To construct the functor
120 TCollectIfVisible (SALOME_ListIO& theList) : myList(theList)
122 //! To calculate the functor
123 void operator()(TActor* theActor)
125 if(theActor->GetVisibility() && theActor->hasIO())
126 myList.Append( theActor->getIO() );