]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix of the problem with vtkRenderer::GetActors() method V4_1_0_maintainance_20090727
authorouv <ouv@opencascade.com>
Wed, 22 Jul 2009 10:42:51 +0000 (10:42 +0000)
committerouv <ouv@opencascade.com>
Wed, 22 Jul 2009 10:42:51 +0000 (10:42 +0000)
12 files changed:
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_Module.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
src/VVTK/VVTK_PickingDlg.cxx
src/VVTK/VVTK_Renderer.cxx
src/VVTK/VVTK_SegmentationCursorDlg.cxx
src/VVTK/VVTK_ViewModel.cxx

index 8365a3b5a6f76f9dfd7d93b9e712db1a93eb3bae..cd4b97da452b823653ad97ff9d5a4d2965d0c3ab 100644 (file)
@@ -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)) {
index 4e7f6d0064d5e74d081496dc1fdd0b247a1039cf..d5a3536dc83800b713dc020223a91e72dac7e8ad 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"
 
@@ -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<VISU_GaussPtsAct>(anActors,
                                    aGetVisibleEntries);
@@ -1698,7 +1701,8 @@ void VisuGUI_Module::storeVisualParameters(int savePoint)
       QPtrVector<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 a1083df6ba54e0004bdfff9e06c146fd2351f7d5..5c437cf8bbd4e0f13d93f9b3d11780f106c2d304 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"
@@ -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<VISU_Actor*>(anActor)) {
index 14abf15f62bdabef63c766c842c7212ba5c2828d..3076cbcaae0c8b0464057dc19e113dab28893eba 100644 (file)
@@ -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;
index 18c218138136020ada013da10b39b71e3e8220cc..deacf4858011c0a4f8bb4326332dd7705edc7e72 100644 (file)
@@ -76,7 +76,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 3959784f8fb74fe773225ca536817b0845d0feae..2de854cb3365820eef2829ad7376024f58a6134c 100644 (file)
@@ -147,7 +147,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 ec504d393e6c8bf438becc058a2237c52be065b0..dc7693a223b5041a4c33ba31840ebc6975b0581f 100644 (file)
@@ -288,7 +288,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 +478,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 +508,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));
   }
 
@@ -734,7 +737,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 a6b6acd7dfacda8e3a065ce8484cbc824741b14b..1066eae13f6d5d592226d1b86e6b51b5c261dbb9 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"
@@ -1626,7 +1627,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)) {
index daf72b11d585d622d9be4c1558451838b7b65ab6..0dceae058b6ce8562efe9e3bcc262c7ed98fcff7 100644 (file)
@@ -98,7 +98,8 @@ namespace
       if ( mySelector->HasIndex( myIO ) )
        mySelector->GetIndex(myIO, myMapIndex);
        
-      myActor = SVTK::Find<VISU_GaussPtsAct>(myInteractor->getRenderer()->GetActors(),
+      VTK::ActorCollectionCopy aCopy(myInteractor->getRenderer()->GetActors());
+      myActor = SVTK::Find<VISU_GaussPtsAct>(aCopy.GetActors(),
                                             SVTK::TIsSameIObject<VISU_GaussPtsAct>( myIO ));
       if ( !myActor )
        return aResult;
index 9af0e7d7831cf40604d93f31c3e1fbfe5f215fd0..47d1bf6884af6730604daaf22acdb81c49f75420 100644 (file)
@@ -33,6 +33,8 @@
 #include "VISU_PlanesWidget.hxx"
 #include "VISU_SphereWidget.hxx"
 
+#include "VTKViewer_Algorithm.h"
+
 #include <vtkObjectFactory.h>
 #include <vtkProperty.h>
 #include <vtkPointPicker.h>
@@ -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()){
index 0df80ec5fa1f5742e9315011194151148432b5e0..dbf0af9fa31253362b5bb037428f65bc53264a5f 100644 (file)
@@ -43,6 +43,7 @@
 #include "SUIT_Session.h"
 
 #include "SVTK_RenderWindowInteractor.h"
+#include "VTKViewer_Algorithm.h"
 
 #include <vtkActorCollection.h>
 #include <vtkCallbackCommand.h>
@@ -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 ) )
index 573868d09917170c4481bf708186c0b2cf2ef026..93031ffbc6da37c65ac7b32a33543ac0a1104edb 100644 (file)
@@ -115,7 +115,8 @@ VVTK_Viewer
     if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i))){
       bool aResult;
       VVTK::TIsOneActorVisibleAction anAction(aResult);
-      SVTK::ForEachIf<SALOME_Actor>(aViewWindow->getRenderer()->GetActors(),
+      VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
+      SVTK::ForEachIf<SALOME_Actor>(aCopy.GetActors(),
                                    SVTK::TIsSameIObject<SALOME_Actor>(theIO),
                                    anAction);
       return anAction.myResult;