Salome HOME
Merge from PortingMED3 07Apr11
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_RotationDlg.cxx
index d13cabbf14e0ce012146ec21da7d30068a166058..46adee7b666720e174e20096192c9c015c6ae40e 100644 (file)
@@ -430,6 +430,7 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
 
     int actionButton = ActionGroup->checkedId();
     bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
+    QStringList anEntryList;
     try {
       SUIT_OverrideCursor aWaitCursor;
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
@@ -469,6 +470,8 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
                                              LineEditNewMesh->text().toLatin1().data());
         if (!mesh->_is_nil()) {
           mesh->SetParameters(aParameters.join(":").toLatin1().constData());
+          if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
+            anEntryList.append( aSObject->GetID().c_str() );
 #ifdef WITHGENERICOBJ
           // obj has been published in study. Its refcount has been incremented.
           // It is safe to decrement its refcount
@@ -483,9 +486,13 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
     }
 
     SMESH::UpdateView();
-    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
-         actionButton == MAKE_MESH_BUTTON )
+    if ( ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) ||
+         actionButton == MAKE_MESH_BUTTON ) {
       mySMESHGUI->updateObjBrowser(true); // new groups may appear
+      if( LightApp_Application* anApp =
+          dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+        anApp->browseObjects( anEntryList, isApplyAndClose() );
+    }
     Init(false);
     mySelectedObject = SMESH::SMESH_IDSource::_nil();
     SelectionIntoArgument();
@@ -502,6 +509,7 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_RotationDlg::ClickOnOk()
 {
+  setIsApplyAndClose( true );
   if( ClickOnApply() )
     ClickOnCancel();
 }
@@ -967,6 +975,7 @@ void SMESHGUI_RotationDlg::onActionClicked(int button)
     break;
   }
   setNewMeshName();
+  toDisplaySimulation();
 }
 
 //=======================================================================
@@ -1069,7 +1078,7 @@ void SMESHGUI_RotationDlg::onDisplaySimulation( bool toDisplayPreview ) {
       
       anElementsId->length(aListElementsId.count());
       for (int i = 0; i < aListElementsId.count(); i++)
-       anElementsId[i] = aListElementsId[i].toInt();
+        anElementsId[i] = aListElementsId[i].toInt();
       
       SMESH::AxisStruct anAxis;
       
@@ -1082,18 +1091,19 @@ void SMESHGUI_RotationDlg::onDisplaySimulation( bool toDisplayPreview ) {
       double anAngle = (SpinBox_Angle->GetValue())*PI/180;
       
       try {
-       SUIT_OverrideCursor aWaitCursor;
-       bool copy = ActionGroup->checkedId() == COPY_ELEMS_BUTTON;
-       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
-       if(CheckBoxMesh->isChecked())
-         aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, copy);
-       else
-         aMeshEditor->Rotate(anElementsId, anAxis, anAngle, copy);
+        SUIT_OverrideCursor aWaitCursor;
+        bool copy = ( ActionGroup->checkedId() == COPY_ELEMS_BUTTON  ||
+                      ActionGroup->checkedId() == MAKE_MESH_BUTTON );
+        SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
+        if(CheckBoxMesh->isChecked())
+          aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, copy);
+        else
+          aMeshEditor->Rotate(anElementsId, anAxis, anAngle, copy);
 
         SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
-        mySimulation->SetData(aMeshPreviewStruct._retn());     
+        mySimulation->SetData(aMeshPreviewStruct._retn());      
       } catch (...) {
-       hidePreview();
+        hidePreview();
       }
     }
     else {