From 654c9decaa622177c0b888885171f371247c466d Mon Sep 17 00:00:00 2001 From: ouv Date: Wed, 22 Jul 2009 10:40:43 +0000 Subject: [PATCH] Fix of the problem with vtkRenderer::GetActors() method --- src/VISUGUI/VisuGUI.cxx | 5 ++++- src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx | 3 ++- src/VISUGUI/VisuGUI_Module.cxx | 5 ++++- src/VISUGUI/VisuGUI_SelectionPanel.cxx | 5 ++++- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 5 ++++- src/VISUGUI/VisuGUI_Tools.cxx | 3 ++- src/VISUGUI/VisuGUI_ViewTools.cxx | 3 ++- src/VISUGUI/VisuGUI_ViewTools.h | 3 ++- src/VISU_I/VISU_ViewManager_i.cc | 13 +++++++++---- src/VISU_I/VISU_View_i.cc | 4 +++- 10 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index befa55e7..afaa6c43 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -63,6 +63,8 @@ #include "SVTK_Functor.h" //#include "SVTK_MainWindow.h" +#include "VTKViewer_Algorithm.h" + #include "SPlot2d_ViewModel.h" #include "VisuGUI_SetupPlot2dDlg.h" #include "Plot2d_SetupCurveDlg.h" @@ -993,7 +995,8 @@ VisuGUI vw->unHighlightAll(); if (vtkRenderer *aRen = vw->getRenderer()) { vtkActor *anActor; - vtkActorCollection *anActColl = aRen->GetActors(); + VTK::ActorCollectionCopy aCopy(aRen->GetActors()); + vtkActorCollection *anActColl = aCopy.GetActors(); for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) { if (anActor->GetVisibility() > 0) if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) { diff --git a/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx b/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx index 8c26c8a6..972065d0 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx @@ -106,7 +106,8 @@ namespace if ( mySelector->HasIndex( myIO ) ) mySelector->GetIndex(myIO, myMapIndex); - myActor = SVTK::Find(anInteractor->getRenderer()->GetActors(), + VTK::ActorCollectionCopy aCopy(anInteractor->getRenderer()->GetActors()); + myActor = SVTK::Find(aCopy.GetActors(), SVTK::TIsSameIObject( myIO )); if ( !myActor ) return aResult; diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 7a4d2a61..86299587 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -57,6 +57,8 @@ #include "SVTK_RenderWindowInteractor.h" #include "VISU_Event.h" +#include "VTKViewer_Algorithm.h" + #include "VisuGUI_Prs3dTools.h" #include "VisuGUI_ClippingDlg.h" @@ -1693,7 +1695,8 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) QVector views = vman->getViews(); for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) { if ( SVTK_ViewWindow* vtkView = dynamic_cast( views[i] ) ) { - vtkActorCollection* allActors = vtkView->getRenderer()->GetActors(); + VTK::ActorCollectionCopy aCopy(vtkView->getRenderer()->GetActors()); + vtkActorCollection* allActors = aCopy.GetActors(); allActors->InitTraversal(); while ( vtkActor* actor = allActors->GetNextActor() ) { if ( actor->GetVisibility() ) { // store only visible actors diff --git a/src/VISUGUI/VisuGUI_SelectionPanel.cxx b/src/VISUGUI/VisuGUI_SelectionPanel.cxx index f0dc15d2..6413a1d8 100644 --- a/src/VISUGUI/VisuGUI_SelectionPanel.cxx +++ b/src/VISUGUI/VisuGUI_SelectionPanel.cxx @@ -64,6 +64,8 @@ #include "SVTK_Selector.h" #include "SVTK_RenderWindowInteractor.h" +#include "VTKViewer_Algorithm.h" + #include "utilities.h" // OCCT Includes @@ -951,7 +953,8 @@ bool onIdEdit (const QString& theText, aViewWindow->highlight(anIO, true, true); SVTK_RenderWindowInteractor* anInteractor = aViewWindow->GetInteractor(); - VISU_Actor* anActor = SVTK::Find(anInteractor->getRenderer()->GetActors(), + VTK::ActorCollectionCopy aCopy(anInteractor->getRenderer()->GetActors()); + VISU_Actor* anActor = SVTK::Find(aCopy.GetActors(), SVTK::TIsSameIObject( anIO )); anActor->Highlight( anIO ); diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 68bd2e2b..48022226 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -62,6 +62,8 @@ #include "SVTK_ViewWindow.h" +#include "VTKViewer_Algorithm.h" + #include "SUIT_OverrideCursor.h" #include "SUIT_MessageBox.h" #include "SUIT_ResourceMgr.h" @@ -168,7 +170,8 @@ ArrangeDlg::ArrangeDlg(QWidget* theParent, myCurrent = 0; init(); QStringList aPrsNames; - vtkActorCollection *aCollection = myViewWindow->getRenderer()->GetActors(); + VTK::ActorCollectionCopy aCopy(myViewWindow->getRenderer()->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); aCollection->InitTraversal(); while(vtkActor* anActor = aCollection->GetNextActor()){ if (VISU_Actor* anVISUActor = dynamic_cast(anActor)) { diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index ae08c39d..dc16a187 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -870,7 +870,8 @@ namespace VISU const char* theActorClassName) { vtkRenderer *aRen = theViewWindow->getRenderer(); - vtkActorCollection *anActColl = aRen->GetActors(); + VTK::ActorCollectionCopy aCopy(aRen->GetActors()); + vtkActorCollection *anActColl = aCopy.GetActors(); vtkProp *prop; vtkFloatingPointType *bounds; int somethingVisible = false; diff --git a/src/VISUGUI/VisuGUI_ViewTools.cxx b/src/VISUGUI/VisuGUI_ViewTools.cxx index f2c4fecf..e1339401 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.cxx +++ b/src/VISUGUI/VisuGUI_ViewTools.cxx @@ -77,7 +77,8 @@ namespace VISU { if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(theModule)) { vtkRenderer *aRen = aViewWindow->getRenderer(); - vtkActorCollection *anActColl = aRen->GetActors(); + VTK::ActorCollectionCopy aCopy(aRen->GetActors()); + vtkActorCollection *anActColl = aCopy.GetActors(); anActColl->InitTraversal(); VISU_Actor* aResActor = NULL; bool isOk = true; diff --git a/src/VISUGUI/VisuGUI_ViewTools.h b/src/VISUGUI/VisuGUI_ViewTools.h index b13f1710..432b7947 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.h +++ b/src/VISUGUI/VisuGUI_ViewTools.h @@ -148,7 +148,8 @@ namespace VISU if (TViewWindow* aViewWindow = GetActiveViewWindow(theModule)) { aViewWindow->unHighlightAll(); if (vtkRenderer *aRen = aViewWindow->getRenderer()) { - vtkActorCollection *aCollection = aRen->GetActors(); + VTK::ActorCollectionCopy aCopy(aRen->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); aCollection->InitTraversal(); while (vtkActor *anAct = aCollection->GetNextActor()) { if (anAct->GetVisibility() > 0) diff --git a/src/VISU_I/VISU_ViewManager_i.cc b/src/VISU_I/VISU_ViewManager_i.cc index 1878c107..88fd6973 100644 --- a/src/VISU_I/VISU_ViewManager_i.cc +++ b/src/VISU_I/VISU_ViewManager_i.cc @@ -39,6 +39,7 @@ #include "SVTK_ViewWindow.h" #include "SVTK_ViewModel.h" +#include "VTKViewer_Algorithm.h" #include "SPlot2d_Curve.h" #include "Plot2d_ViewFrame.h" #include "Plot2d_ViewWindow.h" @@ -288,7 +289,8 @@ namespace VISU { if (!vf) return NULL; if(MYDEBUG) MESSAGE("UpdateViewer - theDisplaing = "<(myViewWindow); vtkRenderer* aRenderer = aViewWindow->getRenderer(); - vtkActorCollection* anActors = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection* anActors = aCopy.GetActors(); anActors->InitTraversal(); while (vtkActor *anAct = anActors->GetNextActor()) { if (VISU_ActorBase* anActor = dynamic_cast(anAct)) { -- 2.39.2