#include "VISU_ColoredPrs3dHolder_i.hh"
#include "VISU_ColoredPrs3dFactory.hh"
-#include "VISU_View_i.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 "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
+#include <vtkActorCollection.h>
+#include <vtkRenderer.h>
+
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
aPrs3d->SetTimeStampNumber(theInput.myTimeStampNumber);
aPrs3d->SameAs(thePrs);
if(!CORBA::is_nil(theView3D)){
- if(aPrs3d != aLastVisitedPrs3d){
- VISU::ColoredPrs3d_var aColoredPrs3d = aLastVisitedPrs3d->_this();
- theView3D->Erase(aColoredPrs3d);
- aColoredPrs3d = aPrs3d->_this();
- theView3D->Display(aColoredPrs3d);
- }else
- theView3D->Update();
- return true;
+ 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)){
+ if(aPrs3d != aLastVisitedPrs3d){
+ vtkRenderer* aRenderer = aViewWindow->getRenderer();
+ vtkActorCollection* anActors = aRenderer->GetActors();
+ Handle(SALOME_InteractiveObject) anIO = aPrs3d->GetIO();
+ SVTK::ForEachIf<VISU_Actor>(anActors,
+ SVTK::TIsSameIObject<SALOME_Actor>(anIO),
+ SVTK::TSetVisibility<VISU_Actor>(false));
+ VISU_Actor* anActor =
+ SVTK::Find<VISU_Actor>(anActors,
+ VISU::TIsSamePrs3d(aPrs3d));
+ if(!anActor){
+ anActor = aPrs3d->CreateActor();
+ aViewWindow->AddActor(anActor);
+ }else
+ anActor->SetVisibility(true);
+ anActor->UpdateFromFactory();
+ }
+ aViewWindow->Repaint();
+ return true;
+ }
+ }
+ }
}
return false;
#define VISU_ViewManager_i_HeaderFile
#include "VISUConfig.hh"
+#include "VISU_Actor.h"
class SalomeApp_Application;
-class VISU_Actor;
-
class SUIT_ViewWindow;
class SVTK_ViewWindow;
class vtkCamera;
-namespace VISU {
+namespace VISU
+{
class Prs3d_i;
class Curve_i;
VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs = NULL);
void UpdatePlot2d (Plot2d_ViewFrame *theView, int theDisplaying, Curve_i* theCurve);
- VISU_Actor* GetActor (VISU::Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow);
-
void DeleteActors (VISU::Prs3d_i* thePrs);
void DeleteActors (VISU::Curve_i* thePrs);
+
+ VISU_Actor* GetActor (VISU::Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow);
+
+ struct TIsSamePrs3d
+ {
+ VISU::Prs3d_i* myPrs3d;
+
+ TIsSamePrs3d(VISU::Prs3d_i* thePrs3d):
+ myPrs3d(thePrs3d)
+ {}
+
+ bool
+ operator()(VISU_Actor* theActor)
+ {
+ return theActor->GetPrs3d() == myPrs3d;
+ }
+ };
}
#endif