From 2664853506114b18bff34021239ae51bd38cd5d6 Mon Sep 17 00:00:00 2001 From: ouv Date: Wed, 22 Jul 2009 10:33:59 +0000 Subject: [PATCH] Fix of the problem with vtkRenderer::GetActors() method --- src/VVTK/VVTK_PickingDlg.cxx | 3 ++- src/VVTK/VVTK_Renderer.cxx | 5 ++++- src/VVTK/VVTK_SegmentationCursorDlg.cxx | 4 +++- src/VVTK/VVTK_ViewModel.cxx | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx index d9188157..4f7a33cb 100644 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ b/src/VVTK/VVTK_PickingDlg.cxx @@ -102,7 +102,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 b6507172..a9528508 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 + #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 02172f1e..a752d1b7 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -831,7 +832,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 3a625a19..c8286570 100644 --- a/src/VVTK/VVTK_ViewModel.cxx +++ b/src/VVTK/VVTK_ViewModel.cxx @@ -113,7 +113,8 @@ bool VVTK_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& theIO ) 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; -- 2.39.2