From 9131b211e3e42fdad87f4789bc12ddbeafa774bc Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 19 Aug 2005 11:50:16 +0000 Subject: [PATCH] To introduce highlight action --- src/SVTK/SVTK_Functor.h | 47 +++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/src/SVTK/SVTK_Functor.h b/src/SVTK/SVTK_Functor.h index 68d054c1e..74cddb3c3 100644 --- a/src/SVTK/SVTK_Functor.h +++ b/src/SVTK/SVTK_Functor.h @@ -11,38 +11,57 @@ namespace VTK { - template struct TIsSameEntry + template + struct TIsSameEntry { std::string myEntry; TIsSameEntry(const char* theEntry): myEntry(theEntry) {} bool operator()(TActor* theActor) { - if ( theActor->hasIO() ) + if ( theActor->hasIO() ) { - Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); - if ( anIO->hasEntry() ) - return myEntry == anIO->getEntry(); - } - return false; + Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); + if ( anIO->hasEntry() ) + return myEntry == anIO->getEntry(); + } + return false; } }; - template struct TIsSameIObject + + //---------------------------------------------------------------- + template + struct TIsSameIObject { Handle(SALOME_InteractiveObject) myIObject; TIsSameIObject(const Handle(SALOME_InteractiveObject)& theIObject): - myIObject(theIObject) + myIObject(theIObject) {} bool operator()(TActor* theActor) { - if(theActor->hasIO()) + if(theActor->hasIO()) { - Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); - return myIObject->isSame(anIO); - } - return false; + Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); + return myIObject->isSame(anIO); + } + return false; + } + }; + + + //---------------------------------------------------------------- + template + struct THighlight + { + bool myIsHighlight; + THighlight(bool theIsHighlight): myIsHighlight( theIsHighlight ) {} + void operator()(TActor* theActor) + { + if(theActor->GetVisibility() && theActor->GetMapper()) + theActor->highlight( myIsHighlight ); } }; + } -- 2.39.2