From: dmv Date: Thu, 9 Apr 2009 08:55:10 +0000 (+0000) Subject: IPAL21003 Impossible create group from existing group shown only X-Git-Tag: V4_1_5rc1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=642b591975f3b34de88d0dd64ba9a4b77c7f1b80;p=modules%2Fgui.git IPAL21003 Impossible create group from existing group shown only --- diff --git a/src/VTKViewer/VTKViewer_Algorithm.h b/src/VTKViewer/VTKViewer_Algorithm.h index fefcb3a8a..7a31b7f57 100644 --- a/src/VTKViewer/VTKViewer_Algorithm.h +++ b/src/VTKViewer/VTKViewer_Algorithm.h @@ -29,6 +29,7 @@ #define VTKViewer_Algorithm_H #include +#include class vtkActor; @@ -41,10 +42,12 @@ namespace VTK TFunction ForEach(vtkActorCollection *theCollection, TFunction theFun) { if(theCollection){ - theCollection->InitTraversal(); - while(vtkActor *anAct = theCollection->GetNextActor()) - if(TActor *anActor = dynamic_cast(anAct)) + vtkCollectionIterator* anIterator = theCollection->NewIterator(); + while (anIterator->IsDoneWithTraversal()) { + if(TActor *anActor = dynamic_cast(anIterator->GetObject())) theFun(anActor); + anIterator->GoToNextItem(); + } } return theFun; } @@ -59,11 +62,14 @@ namespace VTK TFunction theFun) { if(theCollection){ - theCollection->InitTraversal(); - while(vtkActor *anAct = theCollection->GetNextActor()) - if(TActor *anActor = dynamic_cast(anAct)) + vtkCollectionIterator* anIterator = theCollection->NewIterator(); + while (anIterator->IsDoneWithTraversal()) { + if(TActor *anActor = dynamic_cast(anIterator->GetObject())) { if(thePredicate(anActor)) theFun(anActor); + } + anIterator->GoToNextItem(); + } } return theFun; } @@ -76,11 +82,14 @@ namespace VTK TActor* Find(vtkActorCollection *theCollection, TPredicate thePredicate) { if(theCollection){ - theCollection->InitTraversal(); - while(vtkActor *anAct = theCollection->GetNextActor()) - if(TActor *anActor = dynamic_cast(anAct)) + vtkCollectionIterator* anIterator = theCollection->NewIterator(); + while (anIterator->IsDoneWithTraversal()) { + if(TActor* anActor = dynamic_cast(anIterator->GetObject())) { if(thePredicate(anActor)) return anActor; + } + anIterator->GoToNextItem(); + } } return NULL; }