Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SVTK_Functor_H
00024 #define SVTK_Functor_H
00025
00026 #include <functional>
00027
00028 #include <string>
00029
00030 #include <VTKViewer_Functor.h>
00031
00032 #include <SALOME_InteractiveObject.hxx>
00033 #include <SALOME_ListIO.hxx>
00040 namespace SVTK
00041 {
00042 using namespace VTK;
00043
00045 template<class TActor>
00046 struct TIsSameEntry
00047 {
00048 std::string myEntry;
00050 TIsSameEntry(const char* theEntry):
00051 myEntry(theEntry)
00052 {}
00054 bool operator()(TActor* theActor)
00055 {
00056 if ( theActor->hasIO() )
00057 {
00058 Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
00059 if ( anIO->hasEntry() )
00060 return myEntry == anIO->getEntry();
00061 }
00062 return false;
00063 }
00064 };
00065
00066
00067
00069 template<class TActor>
00070 struct TIsSameIObject
00071 {
00072 Handle(SALOME_InteractiveObject) myIObject;
00074 TIsSameIObject(const Handle(SALOME_InteractiveObject)& theIObject):
00075 myIObject(theIObject)
00076 {}
00078 bool operator()(TActor* theActor)
00079 {
00080 if(theActor->hasIO())
00081 {
00082 Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
00083 return myIObject->isSame(anIO);
00084 }
00085 return false;
00086 }
00087 };
00088
00089
00090
00094 template<class TActor>
00095 struct THighlight
00096 {
00097 bool myIsHighlight;
00099 THighlight(bool theIsHighlight):
00100 myIsHighlight( theIsHighlight )
00101 {}
00103 void operator()(TActor* theActor)
00104 {
00105 if(theActor->GetVisibility() && theActor->GetMapper())
00106 theActor->highlight( myIsHighlight );
00107 }
00108 };
00109
00110
00111
00115 template<class TActor>
00116 struct TCollectIfVisible
00117 {
00118 SALOME_ListIO& myList;
00120 TCollectIfVisible (SALOME_ListIO& theList) : myList(theList)
00121 {}
00123 void operator()(TActor* theActor)
00124 {
00125 if(theActor->GetVisibility() && theActor->hasIO())
00126 myList.Append( theActor->getIO() );
00127 }
00128 };
00129 }
00130
00131
00132 #endif