]> SALOME platform Git repositories - modules/gui.git/blob - src/SVTK/SVTK_Functor.h
Salome HOME
74cddb3c31941f1338cdaef21d56abed97fc03ad
[modules/gui.git] / src / SVTK / SVTK_Functor.h
1 #ifndef SVTK_Functor_H
2 #define SVTK_Functor_H
3
4 #include <functional>
5
6 #include <string>
7
8 #include <VTKViewer_Functor.h>
9
10 #include "SALOME_InteractiveObject.hxx"
11
12 namespace VTK
13 {
14   template<class TActor> 
15   struct TIsSameEntry
16   {
17     std::string myEntry;
18     TIsSameEntry(const char* theEntry): myEntry(theEntry) {}
19     bool operator()(TActor* theActor)
20     {
21       if ( theActor->hasIO() )
22       {
23         Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
24         if ( anIO->hasEntry() )
25           return myEntry == anIO->getEntry();
26       }
27       return false;
28     }
29   };
30
31
32   //----------------------------------------------------------------
33   template<class TActor> 
34   struct TIsSameIObject
35   {
36     Handle(SALOME_InteractiveObject) myIObject;
37     TIsSameIObject(const Handle(SALOME_InteractiveObject)& theIObject):
38       myIObject(theIObject)
39     {}
40     bool operator()(TActor* theActor)
41     {
42       if(theActor->hasIO())
43       {
44         Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
45         return myIObject->isSame(anIO);
46       }
47       return false;
48     }
49   };
50
51
52   //----------------------------------------------------------------
53   template<class TActor> 
54   struct THighlight
55   {
56     bool myIsHighlight;
57     THighlight(bool theIsHighlight): myIsHighlight( theIsHighlight ) {}
58     void operator()(TActor* theActor) 
59     {
60       if(theActor->GetVisibility() && theActor->GetMapper())
61         theActor->highlight( myIsHighlight );
62     }
63   };
64
65 }
66
67
68 #endif