Version: 9.12.0
SVTK_Functor.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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
Handle(TDocStd_Application) CAF_Application
Get OCAF application.
Definition: CAF_Application.cxx:97
Definition: SALOME_ListIO.hxx:29
Definition: SALOME_Actor.cxx:148
Definition: VTKViewer_Algorithm.cxx:23
Definition: SVTK_Functor.h:117
SALOME_ListIO & myList
Definition: SVTK_Functor.h:118
void operator()(TActor *theActor)
To calculate the functor.
Definition: SVTK_Functor.h:123
TCollectIfVisible(SALOME_ListIO &theList)
To construct the functor.
Definition: SVTK_Functor.h:120
Definition: SVTK_Functor.h:96
bool myIsHighlight
Definition: SVTK_Functor.h:97
THighlight(bool theIsHighlight)
To construct the functor.
Definition: SVTK_Functor.h:99
void operator()(TActor *theActor)
To calculate the functor.
Definition: SVTK_Functor.h:103
This functor check, if the actor have pointed entry.
Definition: SVTK_Functor.h:47
bool operator()(TActor *theActor)
To calculate the functor.
Definition: SVTK_Functor.h:54
TIsSameEntry(const char *theEntry)
To construct the functor.
Definition: SVTK_Functor.h:50
std::string myEntry
Definition: SVTK_Functor.h:48
This functor check, if the actor point to the same SALOME_InteractiveObject.
Definition: SVTK_Functor.h:71
Handle(SALOME_InteractiveObject) myIObject
bool operator()(TActor *theActor)
To calculate the functor.
Definition: SVTK_Functor.h:78
TIsSameIObject(const Handle(SALOME_InteractiveObject)&theIObject)
To construct the functor.
Definition: SVTK_Functor.h:74