Salome HOME
0020317: EDF SMESH 1004: "Edit group" changes the name of the group
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupDlg.cxx
index 5b3b5e22c9822d9cc0d3e6115fbc62be1b972cc6..24246eec6491fef2abead7bca158318204ba99af 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// SMESH SMESHGUI : GUI for SMESH component
-// File   : SMESHGUI_GroupDlg.cxx
-// Author : Natalia KOPNOVA, Open CASCADE S.A.S.
-// SMESH includes
-//
+//  SMESH SMESHGUI : GUI for SMESH component
+//  File   : SMESHGUI_GroupDlg.cxx
+//  Author : Natalia KOPNOVA, Open CASCADE S.A.S.
+//  SMESH includes
+
 #include "SMESHGUI_GroupDlg.h"
 
 #include "SMESHGUI.h"
@@ -592,7 +592,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
     myGeomGroupLine->setText( aShapeName );
     myNameChanged = true;
     myName->blockSignals(true);
-    myName->setText( "Group On " + aShapeName);
+    myName->setText(theGroup->GetName());
     myName->blockSignals(false);
   }
   updateButtons();
@@ -2205,12 +2205,10 @@ bool SMESHGUI_GroupDlg::SetAppropriateActor()
       // iterate on all actors in current view window, search for
       // any visible actor, that belongs to group or submesh of current mesh
       vtkActorCollection *aCollection = aViewWindow->getRenderer()->GetActors();
-      aCollection->InitTraversal();
-      for (vtkActor *anAct = aCollection->GetNextActor();
-           anAct && !isActor;
-           anAct = aCollection->GetNextActor())
+      int nbItems = aCollection->GetNumberOfItems();
+      for (int i=0; i<nbItems && !isActor; i++)
       {
-        SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct);
+        SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(aCollection->GetItemAsObject(i));
         if (anActor && anActor->hasIO()) {
           Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
           if (aViewWindow->isVisible(anIO)) {