#include "LightApp_SelectionMgr.h"
-#include "SVTK_Functor.h"
-#include "SVTK_Renderer.h"
-#include "SVTK_RenderWindowInteractor.h"
-
-#include "VTKViewer_Algorithm.h"
-
#include "SALOME_ListIteratorOfListIO.hxx"
#include "VISU_Actor.h"
#include "VVTK_ViewWindow.h"
#include "VISU_Gen_i.hh"
-#include "VISU_ColoredPrs3d_i.hh"
-#include "VISU_ColoredPrs3dHolder_i.hh"
-
#include "VisuGUI_Module.h"
#include "VisuGUI_Tools.h"
+#include "VisuGUI_Prs3dTools.h"
+
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
#include <vtkActorCollection.h>
#include <vtkRenderer.h>
if( CORBA::is_nil( aHolder.in() ) )
continue;
+ VISU::ColoredPrs3d_var aPrs3d = aHolder->GetDevice();
VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput();
anInput->myTimeStampNumber = aNumber;
- aHolder->Apply( aHolder->GetDevice(), anInput, myView3D );
+ aHolder->Apply( aPrs3d, anInput, myView3D );
}
myTimeStampStrings->setCurrentItem( value );
#include "VISU_ColoredPrs3dHolder_i.hh"
#include "VISU_ColoredPrs3dFactory.hh"
-#include "VISU_ViewManager_i.hh"
-#include "VISU_View_i.hh"
#include "VISU_Convertor.hxx"
#include "VISU_PipeLine.hxx"
#include "VVTK_ViewWindow.h"
#include "SUIT_ResourceMgr.h"
+#include "VISU_Actor.h"
+#include "VISU_View_i.hh"
+
#include "VTKViewer_Algorithm.h"
#include "SVTK_Functor.h"
}
+//----------------------------------------------------------------------------
+namespace VISU
+{
+ struct TIsSamePrs3d
+ {
+ VISU::Prs3d_i* myPrs3d;
+
+ TIsSamePrs3d(VISU::Prs3d_i* thePrs3d):
+ myPrs3d(thePrs3d)
+ {}
+
+ bool
+ operator()(VISU_Actor* theActor)
+ {
+ return theActor->GetPrs3d() == myPrs3d;
+ }
+ };
+}
+
+
//----------------------------------------------------------------------------
bool
VISU::ColoredPrs3dCache_i
aPrs3d->SetFieldName(theInput.myFieldName);
aPrs3d->SetTimeStampNumber(theInput.myTimeStampNumber);
aPrs3d->SameAs(thePrs);
+ aPrs3d->UpdateActors();
if(!CORBA::is_nil(theView3D)){
PortableServer::ServantBase_var aServant = GetServant(theView3D);
if(VISU::View3D_i* aView3d = dynamic_cast<VISU::View3D_i*>(aServant.in())){
if(SUIT_ViewWindow* aView = aView3d->GetViewWindow()){
if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aView)){
+ // Find actor that corresponds to the holder
+ vtkRenderer* aRenderer = aViewWindow->getRenderer();
+ vtkActorCollection* anActors = aRenderer->GetActors();
+ VISU_Actor* anActor =
+ SVTK::Find<VISU_Actor>(anActors,
+ VISU::TIsSamePrs3d(aLastVisitedPrs3d));
+ // If the holder was erased from view then do nothing
+ if(!anActor->GetVisibility())
+ return true;
+
if(aPrs3d != aLastVisitedPrs3d){
- vtkRenderer* aRenderer = aViewWindow->getRenderer();
- vtkActorCollection* anActors = aRenderer->GetActors();
+ // To erase all actors that corresponds to the holder
Handle(SALOME_InteractiveObject) anIO = aPrs3d->GetIO();
SVTK::ForEachIf<VISU_Actor>(anActors,
SVTK::TIsSameIObject<SALOME_Actor>(anIO),
SVTK::TSetVisibility<VISU_Actor>(false));
- VISU_Actor* anActor =
+ // To find the new one that corresponds to fresh presentation
+ VISU_Actor* aNewActor =
SVTK::Find<VISU_Actor>(anActors,
VISU::TIsSamePrs3d(aPrs3d));
- if(!anActor){
+ if(!aNewActor){
anActor = aPrs3d->CreateActor();
- aViewWindow->AddActor(anActor);
+ aViewWindow->AddActor(aNewActor);
}else
- anActor->SetVisibility(true);
- anActor->UpdateFromFactory();
+ aNewActor->SetVisibility(true);
}
aViewWindow->Repaint();
return true;