Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SVTK_Functor.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef SVTK_Functor_H
24 #define SVTK_Functor_H
25 
26 #include <functional>
27 
28 #include <string>
29 
30 #include <VTKViewer_Functor.h>
31 
33 #include <SALOME_ListIO.hxx>
40 namespace SVTK
41 {
42  using namespace VTK;
43 
45  template<class TActor>
46  struct TIsSameEntry
47  {
48  std::string myEntry;
50  TIsSameEntry(const char* theEntry):
51  myEntry(theEntry)
52  {}
54  bool operator()(TActor* theActor)
55  {
56  if ( theActor->hasIO() )
57  {
58  Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
59  if ( anIO->hasEntry() )
60  return myEntry == anIO->getEntry();
61  }
62  return false;
63  }
64  };
65 
66 
67  //----------------------------------------------------------------
69  template<class TActor>
71  {
75  myIObject(theIObject)
76  {}
78  bool operator()(TActor* theActor)
79  {
80  if(theActor->hasIO())
81  {
82  Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
83  return myIObject->isSame(anIO);
84  }
85  return false;
86  }
87  };
88 
89 
90  //----------------------------------------------------------------
94  template<class TActor>
95  struct THighlight
96  {
99  THighlight(bool theIsHighlight):
100  myIsHighlight( theIsHighlight )
101  {}
103  void operator()(TActor* theActor)
104  {
105  if(theActor->GetVisibility() && theActor->GetMapper())
106  theActor->highlight( myIsHighlight );
107  }
108  };
109 
110 
111  //----------------------------------------------------------------
115  template<class TActor>
117  {
120  TCollectIfVisible (SALOME_ListIO& theList) : myList(theList)
121  {}
123  void operator()(TActor* theActor)
124  {
125  if(theActor->GetVisibility() && theActor->hasIO())
126  myList.Append( theActor->getIO() );
127  }
128  };
129 }
130 
131 
132 #endif