Salome HOME
merge V5_1_4
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_BuildCompoundDlg.cxx
index 2d6b7435bfb7dbc0b048ddf0f0a4495e9904e29a..bc6c1daf55051bd90eb7ce9f0319812ee78c14ce 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -19,6 +19,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // SMESH SMESHGUI : GUI for SMESH component
 // File   : SMESHGUI_BuildCompoundDlg.cxx
 // Author : Alexander KOVALEV, Open CASCADE S.A.S.
@@ -137,7 +138,7 @@ SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule )
   TextLabelTol = new QLabel(tr("SMESH_TOLERANCE"), GroupArgs);
   TextLabelTol->setAlignment(Qt::AlignCenter);
   SpinBoxTol = new SMESHGUI_SpinBox(GroupArgs);
-  SpinBoxTol->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, 6);
+  SpinBoxTol->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, "len_tol_precision" );
 
   GroupArgsLayout->addWidget(TextLabelMeshes, 0, 0);
   GroupArgsLayout->addWidget(SelectButton,    0, 1);
@@ -289,27 +290,28 @@ 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( SMESHGUI::JoinObjectParameters(aParameters) );
+      aCompoundMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
 
       SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
       mySMESHGUI->updateObjBrowser();
@@ -319,8 +321,18 @@ 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
+
+    SMESHGUI::Modified();
+
     return true;
   }
   return false;
@@ -360,10 +372,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));
   }
 }