#include <VTKViewer_Functor.h>
#include "SALOME_InteractiveObject.hxx"
+#include "SALOME_ListIO.hxx"
+
+#include <TColStd_MapOfTransient.hxx>
/*!
\file SVTK_Functor.h
}
};
+ //----------------------------------------------------------------
+ //! This functor check, if the actor's #SALOME_InteractiveObject is in the given list
+ template<class TActor>
+ struct TIsInList
+ {
+ TColStd_MapOfTransient myIObjects;
+ //! To construct the functor
+ TIsInList( const SALOME_ListIO& theObjList )
+ {
+ SALOME_ListIteratorOfListIO anIter( theObjList );
+ for(; anIter.More(); anIter.Next() ){
+ if ( !myIObjects.Contains( anIter.Value() ) )
+ myIObjects.Add( anIter.Value() );
+ }
+ }
+
+ //! To calculate the functor
+ bool operator()(TActor* theActor)
+ {
+ if(theActor->hasIO())
+ {
+ Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
+ return myIObjects.Contains( anIO );
+ }
+ return false;
+ }
+ };
+
//----------------------------------------------------------------
/*!
#include <vtkActorCollection.h>
#include <vtkRenderer.h>
+#include <set>
+
/*!
Constructor
*/
}
}
};
+
+ struct TAddAction
+ {
+ std::set<SALOME_Actor*>* myActors;
+ TAddAction( std::set<SALOME_Actor*>* actors ):
+ myActors( actors )
+ {}
+
+ void
+ operator()( SALOME_Actor* theActor)
+ {
+ if(myActors && theActor->GetMapper() && theActor->hasIO()){
+ myActors->insert( theActor );
+ }
+ }
+ };
}
/*!
vtkActorCollection* anActors = myMainWindow->getRenderer()->GetActors();
using namespace SVTK;
- ForEach<SALOME_Actor>(anActors,
- THighlightAction( false ));
SVTK_Selector* aSelector = myMainWindow->GetSelector();
const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
- SALOME_ListIteratorOfListIO anIter(aListIO);
- for(; anIter.More(); anIter.Next()){
- ForEachIf<SALOME_Actor>(anActors,
- TIsSameIObject<SALOME_Actor>(anIter.Value()),
- THighlightAction(true));
- }
+
+ ForEachIfElse<SALOME_Actor>(anActors,
+ TIsInList<SALOME_Actor>(aListIO),
+ THighlightAction(true),
+ THighlightAction(false));
myMainWindow->Repaint(false);
}