Salome HOME
Another fix like previous one.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupDlg.cxx
index b7d28889e9d0ac3715a6e3ae1935cb84b67c545f..80e98c0cfe2474c18f935542bdd590c637c2f03e 100644 (file)
@@ -61,6 +61,8 @@
 
 #include <SVTK_ViewWindow.h>
 
+#include <VTKViewer_Algorithm.h>
+
 // SALOME KERNEL includes
 #include <SALOMEDSClient_Study.hxx>
 
@@ -560,11 +562,11 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
   myGrpTypeGroup->button(grpType)->setChecked(true);
   onGrpTypeChanged(grpType);
 
+  myTypeId = aType;
   if ( grpType == 0 ) {
     myCurrentLineEdit = 0;
     myElements->clear();
     setSelectionMode(aType);
-    myTypeId = aType;
 
     setShowEntityMode(); // depends on myTypeId
 
@@ -592,7 +594,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();
@@ -798,6 +800,7 @@ bool SMESHGUI_GroupDlg::onApply()
 
       _PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup);
       if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) {
+       anActor->setName(myName->text().toLatin1().data());
        switch ( myTypeId ) {
        case 0: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
        case 1: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
@@ -935,6 +938,7 @@ bool SMESHGUI_GroupDlg::onApply()
 
       _PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom);
       if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) {
+       anActor->setName(myName->text().toLatin1().data());
        switch ( myTypeId ) {
        case 0: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
        case 1: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
@@ -2204,7 +2208,8 @@ 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();
+      VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
+      vtkActorCollection *aCollection = aCopy.GetActors();
       int nbItems = aCollection->GetNumberOfItems();
       for (int i=0; i<nbItems && !isActor; i++)
       {