Salome HOME
Debug
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_BuildCompoundDlg.cxx
index 3ec453d0b21ffcd44e71f58bfd9f1eba7b00f6a7..13535fe369f42b5d74e628fec49bb26790b6bdfb 100644 (file)
@@ -39,6 +39,7 @@
 #include <SUIT_MessageBox.h>
 #include <SUIT_ResourceMgr.h>
 #include <SalomeApp_Study.h>
+#include <SalomeApp_Notebook.h>
 #include <SUIT_OverrideCursor.h>
 
 #include <LightApp_Application.h>
@@ -72,6 +73,7 @@
 //=================================================================================
 SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule )
   : QDialog(SMESH::GetDesktop(theModule)),
+    SMESHGUI_Helper(theModule),
     mySMESHGUI(theModule),
     mySelectionMgr(SMESH::GetSelectionMgr(theModule))
 {
@@ -289,27 +291,27 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
   if (!isValid())
     return false;
 
+  SMESH::SMESH_Mesh_var aCompoundMesh;
+
   if (!myMesh->_is_nil()) {
-    QStringList aParameters;
-    aParameters << (CheckBoxMerge->isChecked() ? SpinBoxTol->text() : QString(" "));
-    try        {
+    try {
       SUIT_OverrideCursor aWaitCursor;
 
       SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
       // concatenate meshes
-      SMESH::SMESH_Mesh_var aCompoundMesh;
       if(CheckBoxCommon->isChecked())
-       aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray, 
-                                                        !(ComboBoxUnion->currentIndex()), 
-                                                        CheckBoxMerge->isChecked(), 
-                                                        SpinBoxTol->GetValue());
+        aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray, 
+                                                         !(ComboBoxUnion->currentIndex()), 
+                                                         CheckBoxMerge->isChecked(), 
+                                                         SpinBoxTol->GetValue());
       else
-       aCompoundMesh = aSMESHGen->Concatenate(myMeshArray, 
-                                              !(ComboBoxUnion->currentIndex()), 
-                                              CheckBoxMerge->isChecked(), 
-                                              SpinBoxTol->GetValue());
+        aCompoundMesh = aSMESHGen->Concatenate(myMeshArray, 
+                                               !(ComboBoxUnion->currentIndex()), 
+                                               CheckBoxMerge->isChecked(), 
+                                               SpinBoxTol->GetValue());
      
-      aCompoundMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+      if( CheckBoxMerge->isChecked() )
+        getNotebook()->setParameters( aCompoundMesh, 1, SpinBoxTol );
 
       SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
       mySMESHGUI->updateObjBrowser();
@@ -319,8 +321,16 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
 
     LineEditName->setText(GetDefaultName(tr("COMPOUND_MESH")));
 
-    //mySelectionMgr->clearSelected();
-    SMESH::UpdateView();
+    // IPAL21468 Compound is hidden after creation.
+    if ( SMESHGUI::automaticUpdate() ) {
+      mySelectionMgr->clearSelected();
+      SMESH::UpdateView();
+      
+      _PTR(SObject) aSO = SMESH::FindSObject(aCompoundMesh.in());
+      if ( SMESH_Actor* anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str()) )
+        SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
+    }// end IPAL21468
+
     return true;
   }
   return false;
@@ -360,10 +370,10 @@ void SMESHGUI_BuildCompoundDlg::ClickOnHelp()
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
-                            tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                            arg(app->resourceMgr()->stringValue("ExternalBrowser",
-                                                                "application")).
-                            arg(myHelpFileName));
+                             tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser",
+                                                                 "application")).
+                             arg(myHelpFileName));
   }
 }
 
@@ -504,17 +514,7 @@ void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge)
 //=================================================================================
 bool SMESHGUI_BuildCompoundDlg::isValid()
 {
-  QString msg;
-  bool ok=true;
-  if(CheckBoxMerge->isChecked())
-    ok = SpinBoxTol->isValid( msg, true );
-
-  if( !ok ) {
-    QString str( tr( "SMESH_INCORRECT_INPUT" ) );
-    if ( !msg.isEmpty() )
-      str += "\n" + msg;
-    SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
-    return false;
-  }
+  if( CheckBoxMerge->isChecked() )
+    return checkParameters( true, 1, SpinBoxTol );
   return true;
 }