Salome HOME
Fix of the problem with vtkRenderer::GetActors() method V5_1_main_20090724 V5_1_main_20090727
authorouv <ouv@opencascade.com>
Wed, 22 Jul 2009 10:40:43 +0000 (10:40 +0000)
committerouv <ouv@opencascade.com>
Wed, 22 Jul 2009 10:40:43 +0000 (10:40 +0000)
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_SelectionPanel.cxx
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_ViewTools.cxx
src/VISUGUI/VisuGUI_ViewTools.h
src/VISU_I/VISU_ViewManager_i.cc
src/VISU_I/VISU_View_i.cc

index befa55e7465c676ebc05d72514bb1b2b777091b0..afaa6c4341fd7063d7ea428e0e224ae1a2361ea9 100644 (file)
@@ -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)) {
index 8c26c8a656401283c6f3e885a24afd85efa648f7..972065d0352cbe605a001da2d3ead37d3f7b7703 100644 (file)
@@ -106,7 +106,8 @@ namespace
       if ( mySelector->HasIndex( myIO ) )
        mySelector->GetIndex(myIO, myMapIndex);
        
-      myActor = SVTK::Find<VISU_GaussPtsAct>(anInteractor->getRenderer()->GetActors(),
+      VTK::ActorCollectionCopy aCopy(anInteractor->getRenderer()->GetActors());
+      myActor = SVTK::Find<VISU_GaussPtsAct>(aCopy.GetActors(),
                                             SVTK::TIsSameIObject<VISU_GaussPtsAct>( myIO ));
       if ( !myActor )
        return aResult;
index 7a4d2a61b2c50eaa0d59d5d5e65d6ea6870bd10c..862995878ed71d9b2be7c6a4a13bec18a53aec5a 100644 (file)
@@ -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<SUIT_ViewWindow*> views = vman->getViews();
       for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) {
        if ( SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>( 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
index f0dc15d240cd83fdf04c7bbf69434b5f4929b0d1..6413a1d88a131fa853f44ed5d78bbc9c947f89ab 100644 (file)
@@ -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<VISU_Actor>(anInteractor->getRenderer()->GetActors(),
+    VTK::ActorCollectionCopy aCopy(anInteractor->getRenderer()->GetActors());
+    VISU_Actor* anActor = SVTK::Find<VISU_Actor>(aCopy.GetActors(),
                                                 SVTK::TIsSameIObject<VISU_Actor>( anIO ));
     anActor->Highlight( anIO );
 
index 68bd2e2bca32753cd1dc2b717db5387a5da589fb..48022226a0e08769d943f408092255c05b2089e4 100644 (file)
@@ -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<VISU_Actor*>(anActor)) {
index ae08c39d83697590365cabf73703cc32278e7a06..dc16a1870068468fd05435299ba12d3740624f1d 100644 (file)
@@ -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;
index f2c4fecfbd74ecd26e8d43e688cc088f646baa6b..e1339401975f26fb2397403393b899384717e952 100644 (file)
@@ -77,7 +77,8 @@ namespace VISU
   {
     if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(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;
index b13f17100b9ea05c3870ea26b410266941cd92cd..432b79470c0c741e19ba7fb6581514a2fb1f5e63 100644 (file)
@@ -148,7 +148,8 @@ namespace VISU
     if (TViewWindow* aViewWindow = GetActiveViewWindow<TViewWindow>(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)
index 1878c1074255f505b36e00bf1f6496ed1c869035..88fd6973a94e903b8fbc13bb993f5f9d7545096b 100644 (file)
@@ -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 = "<<theDisplaing<<"; thePrs = "<<thePrs);
     vtkRenderer *aRen = vf->getRenderer();
-    vtkActorCollection *anActColl = aRen->GetActors();
+    VTK::ActorCollectionCopy aCopy(aRen->GetActors());
+    vtkActorCollection* anActColl = aCopy.GetActors();
     vtkActor *anActor;
     VISU_Actor *anVISUActor = NULL, *aResActor = NULL;
     for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;){
@@ -477,7 +479,8 @@ namespace VISU {
       return NULL;
 
     vtkRenderer* aRenderer = theViewWindow->getRenderer();
-    vtkActorCollection* anActors = aRenderer->GetActors();
+    VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
+    vtkActorCollection* anActors = aCopy.GetActors();
     return SVTK::Find<VISU_Actor>(anActors, VISU::TIsSamePrs3d(thePrs3d));
   }
 
@@ -506,7 +509,8 @@ namespace VISU {
       return NULL;
 
     vtkRenderer* aRenderer = theViewWindow->getRenderer();
-    vtkActorCollection* anActors = aRenderer->GetActors();
+    VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
+    vtkActorCollection* anActors = aCopy.GetActors();
     return SVTK::Find<VISU_ActorBase>(anActors, VISU::TIsSameActor(theActor));
   }
 
@@ -736,7 +740,8 @@ namespace VISU {
        if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
          if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
             VISU_Actor* anActor = NULL;
-            vtkActorCollection *anActColl = vw->getRenderer()->GetActors();
+           VTK::ActorCollectionCopy aCopy(vw->getRenderer()->GetActors());
+            vtkActorCollection *anActColl = aCopy.GetActors();
            anActColl->InitTraversal();
             vtkActor *aVTKActor = anActColl->GetNextActor();
            for (; !anActor && aVTKActor; aVTKActor = anActColl->GetNextActor()) {
index 92e8d75a16c3eeae38bfbe6c4ee957984b0314fa..b789176cfd4851f219ef8ad5e86c8ff9d9c6925e 100644 (file)
@@ -51,6 +51,7 @@
 
 #include "SVTK_ViewWindow.h"
 #include "SVTK_ViewModel.h"
+#include "VTKViewer_Algorithm.h"
 
 #include "SPlot2d_ViewModel.h"
 #include "Plot2d_ViewFrame.h"
@@ -1630,7 +1631,8 @@ namespace VISU {
       {
        SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(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<VISU_ActorBase*>(anAct)) {