Salome HOME
Copyright update 2022
[modules/homard.git] / src / HOMARDGUI / MonMeshInfo.cxx
index d6b665312f3f56dc22d0e73e310e4097cd7fc4a8..f71a5a2193cbc2aca093fc31aa9050f90a9746fc 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2011-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2022  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,9 +17,8 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-using namespace std;
-
 #include "MonMeshInfo.h"
+#include "HOMARD.hxx"
 
 #include <QFileDialog>
 #include <QMessageBox>
@@ -27,11 +26,17 @@ using namespace std;
 #include "SalomeApp_Tools.h"
 #include "HOMARDGUI_Utils.h"
 #include "HomardQtCommun.h"
+#include "MonEditFile.h"
 #include <utilities.h>
 
+#ifdef WIN32
+#include <direct.h>
+#endif
+
+using namespace std;
 
 // -----------------------------------------------------------------------------------------
-MonMeshInfo::MonMeshInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen)
+MonMeshInfo::MonMeshInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen0)
 // -----------------------------------------------------------------------------------------
 /* Constructs a MonMeshInfo
  * Inherits from CasHomard
@@ -46,7 +51,7 @@ MonMeshInfo::MonMeshInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myH
     _Entanglement(0),
     _Quality(0)
 {
-      _myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen);
+      myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
       setupUi(this);
       setModal(modal);
       InitConnect();
@@ -100,13 +105,18 @@ bool MonMeshInfo::PushOnApply()
                               QObject::tr("HOM_CASE_DIRECTORY_1") );
     return false;
   }
-  if ((aDirName != _aDirName) and (_myHomardGen->VerifieDir( aDirName.toStdString().c_str()) == false))
-  {
-    QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-                              QObject::tr("HOM_CASE_DIRECTORY_2") );
-    return false;
+  if ( aDirName != _aDirName)
+  { QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ;
+    if ( CaseNameDir != "" )
+    {
+      QString texte ;
+      texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ;
+      QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+                                texte );
+      return false;
+    }
   }
-  if (chdir(aDirName.toStdString().c_str()) != 0)
+  if (CHDIR(aDirName.toStdString().c_str()) != 0)
   {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                               QObject::tr("HOM_CASE_DIRECTORY_3") );
@@ -128,7 +138,7 @@ bool MonMeshInfo::PushOnApply()
                               QObject::tr("HOM_MED_FILE_2") );
     return false;
   }
-  if ( ( _Quality == 0 ) and ( _Diametre == 0 ) and ( _Connection == 0 ) and ( _BlockSize == 0 ) and ( _Entanglement == 0 ) )
+  if ( ( _Quality == 0 ) && ( _Diametre == 0 ) && ( _Connection == 0 ) && ( _BlockSize == 0 ) && ( _Entanglement == 0 ) )
   {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                               QObject::tr("HOM_MESH_INFO") );
@@ -140,7 +150,7 @@ bool MonMeshInfo::PushOnApply()
     _aCaseName = aCaseName;
     try
     {
-      _myHomardGen->MeshInfo( \
+      myHomardGen->MeshInfo( \
             CORBA::string_dup(_aCaseName.toStdString().c_str()),  \
             CORBA::string_dup(aMeshName.toStdString().c_str()),  \
             CORBA::string_dup(aFileName.toStdString().c_str()),  \
@@ -155,27 +165,36 @@ bool MonMeshInfo::PushOnApply()
     }
   }
 
-  HOMARD_UTILS::updateObjBrowser();
+  // Le bilan de l'analyse a afficher
+  aCase = myHomardGen->GetCase(_aCaseName.toStdString().c_str());
+  string iter0 = aCase->GetIter0Name();
+  HOMARD::HOMARD_Iteration_var aIter =  myHomardGen->GetIteration(iter0.c_str());
+  aFileName = aIter->GetFileInfo() ;
+  MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), aFileName, 1 ) ;
+  if ( aDlg->_codret == 0 ) { aDlg->show(); }
+
+HOMARD_UTILS::updateObjBrowser();
   return true;
 }
 // ---------------------------
 void MonMeshInfo::PushOnOK()
 // ---------------------------
 {
-     bool bOK = PushOnApply();
-     if ( bOK )  this->close();
+  bool bOK = PushOnApply();
+  if ( bOK )  this->close();
 }
 //------------------------------
 void MonMeshInfo::PushOnHelp()
 //-------------------------------
 {
-  HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"));
+  std::string LanguageShort = myHomardGen->GetLanguageShort();
+  HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str()));
 }
 // ---------------------------------
 void MonMeshInfo::SetNewCaseName()
 // ------------------------------
 {
-  HOMARD::listeCases_var  MyCases = _myHomardGen->GetAllCasesName();
+  HOMARD::listeCases_var  MyCases = myHomardGen->GetAllCasesName();
   int num = 0; QString aCaseName="";
   while (aCaseName=="" )
   {
@@ -183,18 +202,17 @@ void MonMeshInfo::SetNewCaseName()
     aCaseName.insert(0, QString("Case_")) ;
     for ( int i=0; i<MyCases->length(); i++)
     {
-      if ( aCaseName ==  QString((MyCases)[i]))
+      if ( aCaseName == QString((MyCases)[i]) )
       {
-          num=num+1;
-          aCaseName="";
-          break;
+        num ++ ;
+        aCaseName = "" ;
+        break ;
       }
    }
   }
   LECaseName->clear() ;
   LECaseName->insert(aCaseName);
 }
-
 // ------------------------------------------------------------------------
 void MonMeshInfo::SetDirName()
 // ------------------------------------------------------------------------
@@ -207,7 +225,7 @@ void MonMeshInfo::SetFileName()
 // ------------------------------------------------------------------------
 {
   QString fileName0 = LEFileName->text().trimmed();
-  QString fileName = HOMARD_QT_COMMUN::PushNomFichier();
+  QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ;
   if (fileName.isEmpty()) fileName = fileName0 ;
   LEFileName->setText(fileName);
 }
@@ -215,11 +233,11 @@ void MonMeshInfo::SetFileName()
 void MonMeshInfo::CaseNameChanged()
 // ------------------------------------------------------------------------
 {
-    if (_aCaseName != LECaseName->text().trimmed())
-    {
-       LEFileName->setReadOnly(false);
-       PushFichier->show();
-    }
+  if (_aCaseName != LECaseName->text().trimmed())
+  {
+    LEFileName->setReadOnly(false);
+    PushFichier->show();
+  }
 }
 // ------------------------------------------------------------------------
 void MonMeshInfo::SetBlockSize()