Salome HOME
updated copyright message
[modules/homard.git] / src / HOMARDGUI / MonCreateBoundaryDi.cxx
index 08d9799a8abdcfbad2b29f0dd9868439fa78533c..4b78f602983878bfea98e612aa687b2b535670b3 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2011-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2023  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,8 +17,6 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-using namespace std;
-
 #include "MonCreateBoundaryDi.h"
 #include "MonCreateListGroup.h"
 #include "MonCreateCase.h"
@@ -31,16 +29,18 @@ using namespace std;
 #include "HomardQtCommun.h"
 #include <utilities.h>
 
+using namespace std;
+
 // -------------------------------------------------------------------------------
 MonCreateBoundaryDi::MonCreateBoundaryDi(MonCreateCase* parent, bool modal,
-                                         HOMARD::HOMARD_Gen_var myHomardGen,
-                                         QString caseName, QString aBoundaryName)
+                                         HOMARD::HOMARD_Gen_var myHomardGen0,
+                                         QString caseName, QString aName)
 // ---------------------------------------------------------------------------------
 /* Constructs a MonCreateBoundaryDi */
     :
     QDialog(0), Ui_CreateBoundaryDi(),
-    _parent(parent), _aBoundaryName(aBoundaryName),
-    _myHomardGen(HOMARD::HOMARD_Gen::_duplicate(myHomardGen)),
+    _parent(parent), _aName(aName),
+    myHomardGen(HOMARD::HOMARD_Gen::_duplicate(myHomardGen0)),
     _aCaseName(caseName)
     {
       MESSAGE("Constructeur") ;
@@ -48,7 +48,7 @@ MonCreateBoundaryDi::MonCreateBoundaryDi(MonCreateCase* parent, bool modal,
       setModal(modal);
       InitConnect();
 
-     if ( _aBoundaryName == QString("") ) {SetNewBoundaryName();};
+     if ( _aName == QString("") ) {SetNewName();};
     }
 
 // ------------------------------------------------------------------------
@@ -77,8 +77,8 @@ bool MonCreateBoundaryDi::PushOnApply()
 {
 // Verifications
 
-  QString aBoundaryName=LEBoundaryName->text().trimmed();
-  if (aBoundaryName=="") {
+  QString aName=LEName->text().trimmed();
+  if (aName=="") {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                               QObject::tr("HOM_BOUN_NAME") );
     return false;
@@ -103,19 +103,19 @@ bool MonCreateBoundaryDi::PushOnApply()
   }
 
 // Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
-  if ( _aBoundaryName != aBoundaryName )
+  if ( _aName != aName )
   {
    try
    {
-     _aBoundaryName=aBoundaryName;
-     _aBoundary=_myHomardGen->CreateBoundaryDi(CORBA::string_dup(_aBoundaryName.toStdString().c_str()), aMeshName.toStdString().c_str(), aMeshFile.toStdString().c_str());
-     _parent->AddBoundaryDi(_aBoundaryName);
-     _aBoundary->SetCaseCreation(_aCaseName.toStdString().c_str());
+     _aName=aName;
+     aBoundary=myHomardGen->CreateBoundaryDi(CORBA::string_dup(_aName.toStdString().c_str()), aMeshName.toStdString().c_str(), aMeshFile.toStdString().c_str());
+     _parent->AddBoundaryDi(_aName);
+     aBoundary->SetCaseCreation(_aCaseName.toStdString().c_str());
    }
    catch( SALOME::SALOME_Exception& S_ex )
    {
       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-                                QString(CORBA::string_dup(S_ex.details.text)) );
+                                QObject::tr(CORBA::string_dup(S_ex.details.text)) );
       return false;
    }
   }
@@ -139,7 +139,8 @@ void MonCreateBoundaryDi::PushOnOK()
 void MonCreateBoundaryDi::PushOnHelp()
 // ------------------------------------------------------------------------
 {
-  HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html#frontiere-discrete"));
+  std::string LanguageShort = myHomardGen->GetLanguageShort();
+  HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str()));
 }
 // ------------------------------------------------------------------------
 void MonCreateBoundaryDi::AssocieLesGroupes()
@@ -151,38 +152,38 @@ void MonCreateBoundaryDi::AssocieLesGroupes()
   int i=0;
   for (it = _listeGroupesBoundary.constBegin(); it != _listeGroupesBoundary.constEnd(); it++)
      aSeqGroupe[i++]=(*it).toStdString().c_str();
-  _aBoundary->SetGroups(aSeqGroupe);
+  aBoundary->SetGroups(aSeqGroupe);
 
 }
 
 // -------------------------------------------------
-void MonCreateBoundaryDi::SetNewBoundaryName()
+void MonCreateBoundaryDi::SetNewName()
 // --------------------------------------------------
 {
 
-  HOMARD::listeBoundarys_var  MyBoundarys = _myHomardGen->GetAllBoundarysName();
-  int num = 0; QString aBoundaryName="";
-  while (aBoundaryName == QString("") )
+  HOMARD::listeBoundarys_var  MyObjects = myHomardGen->GetAllBoundarysName();
+  int num = 0; QString aName="";
+  while (aName == QString("") )
   {
-    aBoundaryName.setNum(num+1) ;
-    aBoundaryName.insert(0, QString("Boun_")) ;
-    for ( int i=0; i<MyBoundarys->length(); i++)
+    aName.setNum(num+1) ;
+    aName.insert(0, QString("Boun_")) ;
+    for ( int i=0; i<MyObjects->length(); i++)
     {
-      if ( aBoundaryName ==  QString(MyBoundarys[i]))
+      if ( aName ==  QString(MyObjects[i]))
       {
-          num=num+1;
-          aBoundaryName="";
-          break;
+        num ++ ;
+        aName = "" ;
+        break ;
       }
    }
   }
-  LEBoundaryName->setText(aBoundaryName);
+  LEName->setText(aName);
 }
 // ------------------------------------------------------------------------
 void MonCreateBoundaryDi::SetMeshFile()
 // ------------------------------------------------------------------------
 {
-  QString aMeshFile = HOMARD_QT_COMMUN::PushNomFichier();
+  QString aMeshFile = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") );
   if (!(aMeshFile.isEmpty())) LEFileName->setText(aMeshFile);
 }
 
@@ -203,7 +204,7 @@ void MonCreateBoundaryDi::SetFiltrage()
     return;
   }
 
-  MonCreateListGroup *aDlg = new MonCreateListGroup(NULL,this,  TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen),
+  MonCreateListGroup *aDlg = new MonCreateListGroup(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),
                             _aCaseName, _listeGroupesBoundary) ;
   aDlg->show();
 }