From: ouv Date: Wed, 22 Jul 2009 10:42:51 +0000 (+0000) Subject: Fix of the problem with vtkRenderer::GetActors() method X-Git-Tag: V4_1_0_maintainance_20090727 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4fc58b6ffd0589e263ddc9da0692a220a7700cdf;p=modules%2Fvisu.git Fix of the problem with vtkRenderer::GetActors() method --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 8365a3b5..cd4b97da 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -60,6 +60,8 @@ #include "SVTK_ViewModel.h" #include "SVTK_Functor.h" +#include "VTKViewer_Algorithm.h" + #include "SPlot2d_ViewModel.h" #include "VisuGUI_SetupPlot2dDlg.h" #include "Plot2d_SetupCurveDlg.h" @@ -879,7 +881,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_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 4e7f6d00..d5a3536d 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" @@ -1281,7 +1283,8 @@ namespace { // First find all visible Gauss Points presentations vtkRenderer* aRenderer = theViewWindow->getRenderer(); - vtkActorCollection* anActors = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection* anActors = aCopy.GetActors(); TGetVisibleEntries aGetVisibleEntries(theVisibleEntries); SVTK::ForEach(anActors, aGetVisibleEntries); @@ -1698,7 +1701,8 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) QPtrVector 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_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index a1083df6..5c437cf8 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" @@ -162,7 +164,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 14abf15f..3076cbca 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -822,7 +822,8 @@ namespace VISU const char* theActorClassName = "VISU_Actor") { 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 18c21813..deacf485 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.cxx +++ b/src/VISUGUI/VisuGUI_ViewTools.cxx @@ -76,7 +76,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 3959784f..2de854cb 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.h +++ b/src/VISUGUI/VisuGUI_ViewTools.h @@ -147,7 +147,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 ec504d39..dc7693a2 100644 --- a/src/VISU_I/VISU_ViewManager_i.cc +++ b/src/VISU_I/VISU_ViewManager_i.cc @@ -288,7 +288,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)) { diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx index daf72b11..0dceae05 100644 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ b/src/VVTK/VVTK_PickingDlg.cxx @@ -98,7 +98,8 @@ namespace if ( mySelector->HasIndex( myIO ) ) mySelector->GetIndex(myIO, myMapIndex); - myActor = SVTK::Find(myInteractor->getRenderer()->GetActors(), + VTK::ActorCollectionCopy aCopy(myInteractor->getRenderer()->GetActors()); + myActor = SVTK::Find(aCopy.GetActors(), SVTK::TIsSameIObject( myIO )); if ( !myActor ) return aResult; diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 9af0e7d7..47d1bf68 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -33,6 +33,8 @@ #include "VISU_PlanesWidget.hxx" #include "VISU_SphereWidget.hxx" +#include "VTKViewer_Algorithm.h" + #include #include #include @@ -108,7 +110,8 @@ VISU_FPSActor float aLastRenderTimeInSeconds = aRenderer->GetLastRenderTimeInSeconds(); if(aLastRenderTimeInSeconds > aTol){ size_t aNumberOfCells = 0; - if(vtkActorCollection *anActorCollection = aRenderer->GetActors()){ + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + if(vtkActorCollection *anActorCollection = aCopy.GetActors()){ anActorCollection->InitTraversal(); while(vtkActor *anActor = anActorCollection->GetNextActor()){ if(anActor->GetVisibility()){ diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx index 0df80ec5..dbf0af9f 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -43,6 +43,7 @@ #include "SUIT_Session.h" #include "SVTK_RenderWindowInteractor.h" +#include "VTKViewer_Algorithm.h" #include #include @@ -813,7 +814,8 @@ bool VVTK_SegmentationCursorDlg::CheckNumberOfFaces() int aNumberOfPoints = 0; vtkActor* anActor; - vtkActorCollection* anActColl = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection* anActColl = aCopy.GetActors(); for( anActColl->InitTraversal(); ( anActor = anActColl->GetNextActor() ) != NULL; ) { if( VISU_GaussPtsAct1* aGaussActor = VISU_GaussPtsAct1::SafeDownCast( anActor ) ) diff --git a/src/VVTK/VVTK_ViewModel.cxx b/src/VVTK/VVTK_ViewModel.cxx index 573868d0..93031ffb 100644 --- a/src/VVTK/VVTK_ViewModel.cxx +++ b/src/VVTK/VVTK_ViewModel.cxx @@ -115,7 +115,8 @@ VVTK_Viewer if(SVTK_ViewWindow* aViewWindow = dynamic_cast(aViews.at(i))){ bool aResult; VVTK::TIsOneActorVisibleAction anAction(aResult); - SVTK::ForEachIf(aViewWindow->getRenderer()->GetActors(), + VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors()); + SVTK::ForEachIf(aCopy.GetActors(), SVTK::TIsSameIObject(theIO), anAction); return anAction.myResult;