Salome HOME
{
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupDlg.cxx
index 1fbdabfad59f94b6d3a1fe2f3971efa80b47821b..01e0f81950bd932f33150d60a6ab3b5de70b7e45 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"
@@ -560,11 +560,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 +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();
@@ -798,6 +798,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 +936,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;
@@ -2206,7 +2208,7 @@ bool SMESHGUI_GroupDlg::SetAppropriateActor()
       // any visible actor, that belongs to group or submesh of current mesh
       vtkActorCollection *aCollection = aViewWindow->getRenderer()->GetActors();
       int nbItems = aCollection->GetNumberOfItems();
-      for (int i=0; i<nbItems; i++)
+      for (int i=0; i<nbItems && !isActor; i++)
       {
         SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(aCollection->GetItemAsObject(i));
         if (anActor && anActor->hasIO()) {