Salome HOME
updated copyright message
[modules/homard.git] / src / HOMARDGUI / MonCreateCase.cxx
1 // Copyright (C) 2011-2023  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "MonCreateCase.h"
21 #include "MonCreateBoundaryCAO.h"
22 #include "MonEditBoundaryCAO.h"
23 #include "MonCreateBoundaryAn.h"
24 #include "MonEditBoundaryAn.h"
25 #include "MonCreateBoundaryDi.h"
26 #include "MonEditBoundaryDi.h"
27 #include "HOMARD.hxx"
28
29 #include <QFileDialog>
30 #include <QMessageBox>
31
32 #include "SalomeApp_Tools.h"
33 #include "HOMARDGUI_Utils.h"
34 #include "HomardQtCommun.h"
35 #include <utilities.h>
36
37 #ifdef WIN32
38 #include <direct.h>
39 #endif
40
41 using namespace std;
42
43 // -----------------------------------------------------------------------------------------
44 /* Constructs a MonCreateCase
45  * Inherits from CasHomard
46  * Sets attributes to default values
47  */
48 // -----------------------------------------------------------------------------------------
49 MonCreateCase::MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0 )
50     :
51     Ui_CreateCase(),
52     _aCaseName(""),_aDirName(""),
53     _ConfType(0),
54     _ExtType(0),
55     _Pyram(0)
56 {
57   MESSAGE("Debut du constructeur de MonCreateCase");
58   myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
59   setupUi(this);
60   setModal(modal);
61   InitConnect();
62
63   SetNewName() ;
64
65   GBBoundaryC->setVisible(0);
66   GBBoundaryA->setVisible(0);
67   GBBoundaryD->setVisible(0);
68
69   CBBoundaryA->setVisible(0);
70   CBBoundaryD->setVisible(0);
71
72   GBAdvancedOptions->setVisible(0);
73   Comment->setVisible(0);
74   CBPyramid->setChecked(false);
75 //
76   adjustSize();
77
78 //   MESSAGE("Fin du constructeur de MonCreateCase");
79 }
80 // ------------------------------------------------------------------------
81 MonCreateCase::~MonCreateCase()
82 // ------------------------------------------------------------------------
83 {
84     // no need to delete child widgets, Qt does it all for us
85 }
86 // ------------------------------------------------------------------------
87 void MonCreateCase::InitConnect()
88 // ------------------------------------------------------------------------
89 {
90     connect( LEName,      SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged()));
91     connect( PushDir,     SIGNAL(pressed()), this, SLOT(SetDirName()));
92     connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName()));
93
94     connect( RBConforme,     SIGNAL(clicked()), this, SLOT(SetConforme()));
95     connect( RBNonConforme,  SIGNAL(clicked()), this, SLOT(SetNonConforme()));
96
97     connect( RBBoundaryNo,      SIGNAL(clicked()), this, SLOT(SetBoundaryNo()));
98     connect( RBBoundaryCAO,     SIGNAL(clicked()), this, SLOT(SetBoundaryCAO()));
99     connect( RBBoundaryNonCAO,  SIGNAL(clicked()), this, SLOT(SetBoundaryNonCAO()));
100
101     connect( PBBoundaryCAONew,  SIGNAL(pressed()), this, SLOT(PushBoundaryCAONew()));
102     connect( PBBoundaryCAOEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOEdit()) );
103     connect( PBBoundaryCAOHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOHelp()) );
104     connect( CBBoundaryD,       SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryD()));
105     connect( PBBoundaryDiNew,   SIGNAL(pressed()), this, SLOT(PushBoundaryDiNew()));
106     connect( PBBoundaryDiEdit,  SIGNAL(pressed()), this, SLOT(PushBoundaryDiEdit()) );
107     connect( PBBoundaryDiHelp,  SIGNAL(pressed()), this, SLOT(PushBoundaryDiHelp()) );
108     connect( CBBoundaryA,       SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryA()));
109     connect( PBBoundaryAnNew,   SIGNAL(pressed()), this, SLOT(PushBoundaryAnNew()));
110     connect( PBBoundaryAnEdit,  SIGNAL(pressed()), this, SLOT(PushBoundaryAnEdit()) );
111     connect( PBBoundaryAnHelp,  SIGNAL(pressed()), this, SLOT(PushBoundaryAnHelp()) );
112
113     connect( CBAdvanced,     SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced()));
114     connect( RBStandard,     SIGNAL(clicked()), this, SLOT(SetStandard()));
115     connect( RBBox,          SIGNAL(clicked()), this, SLOT(SetBox()));
116     connect( RBNC1NpA,       SIGNAL(clicked()), this, SLOT(SetNC1NpA()));
117     connect( RBNCQuelconque, SIGNAL(clicked()), this, SLOT(SetNCQuelconque()));
118
119     connect( RBMED,          SIGNAL(clicked()), this, SLOT(SetMED()));
120     connect( RBSaturne,      SIGNAL(clicked()), this, SLOT(SetSaturne()));
121     connect( RBSaturne2D,    SIGNAL(clicked()), this, SLOT(SetSaturne2D()));
122
123     connect( buttonOk,       SIGNAL(pressed()), this, SLOT(PushOnOK()));
124     connect( buttonApply,    SIGNAL(pressed()), this, SLOT(PushOnApply(0)));
125     connect( buttonCancel,   SIGNAL(pressed()), this, SLOT(close()));
126     connect( buttonHelp,     SIGNAL(pressed()), this, SLOT(PushOnHelp()));
127 }
128 // ------------------------------------------------------------------------
129 void MonCreateCase::InitBoundarys()
130 // ------------------------------------------------------------------------
131 // Initialisation des menus avec les frontieres deja enregistrees
132 {
133   MESSAGE("InitBoundarys");
134 // Pour les frontieres analytiques : la colonne des groupes
135   HOMARD::ListGroupType_var _listeGroupesCas = aCase->GetGroups();
136   QTableWidgetItem *__colItem = new QTableWidgetItem();
137   __colItem->setText(QApplication::translate("CreateCase", "", 0));
138   TWBoundary->setHorizontalHeaderItem(0, __colItem);
139   for ( int i = 0; i < _listeGroupesCas->length(); i++ )
140   {
141     TWBoundary->insertRow(i);
142     TWBoundary->setItem( i, 0, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed()));
143     TWBoundary->item( i, 0 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
144   }
145 // Pour les frontieres CAO : la liste a saisir
146 // Pour les frontieres discretes : la liste a saisir
147 // Pour les frontieres analytiques : les colonnes de chaque frontiere
148   HOMARD::HOMARD_Boundary_var myBoundary ;
149   HOMARD::listeBoundarys_var  mesBoundarys = myHomardGen->GetAllBoundarysName();
150 //   MESSAGE("Nombre de frontieres enregistrees : "<<mesBoundarys->length());
151   for (int i=0; i<mesBoundarys->length(); i++)
152   {
153     myBoundary = myHomardGen->GetBoundary(mesBoundarys[i]);
154     int type_obj = myBoundary->GetType() ;
155     if ( type_obj==-1 )     { CBBoundaryCAO->addItem(QString(mesBoundarys[i])); }
156     else if ( type_obj==0 ) { CBBoundaryDi->addItem(QString(mesBoundarys[i])); }
157     else                    { AddBoundaryAn(QString(mesBoundarys[i])); }
158   }
159 // Ajustement
160   TWBoundary->resizeColumnsToContents();
161   TWBoundary->resizeRowsToContents();
162   TWBoundary->clearSelection();
163 }
164 // -------------------------------
165 bool MonCreateCase::PushOnApply(int option)
166 // --------------------------------
167 {
168   MESSAGE("PushOnApply");
169   QString aCaseName=LEName->text().trimmed();
170   if ( aCaseName == "" )
171   {
172     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
173                               QObject::tr("HOM_CASE_NAME") );
174     return false;
175   }
176
177   QString aDirName=LEDirName->text().trimmed();
178   if (aDirName == QString(""))
179   {
180     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
181                               QObject::tr("HOM_CASE_DIRECTORY_1") );
182     return false;
183   }
184
185   if ( aDirName != _aDirName)
186   { QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ;
187     if ( ( CaseNameDir != "" ) & ( CaseNameDir != aCaseName ) )
188     {
189       QString texte ;
190       texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ;
191       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
192                                 texte );
193       return false;
194     }
195   }
196   if (CHDIR(aDirName.toStdString().c_str()) != 0)
197   {
198     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
199                               QObject::tr("HOM_CASE_DIRECTORY_3") );
200     return false;
201   }
202
203   QString aFileName=LEFileName->text().trimmed();
204   if (aFileName ==QString(""))
205   {
206     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
207                               QObject::tr("HOM_CASE_MESH") );
208     return false;
209   }
210
211   QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aFileName);
212   if (aMeshName == "" )
213   {
214     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
215                               QObject::tr("HOM_MED_FILE_2") );
216     return false;
217   }
218
219 // On verifie qu'un groupe n'est pas associe a deux frontieres differentes
220   if (CBBoundaryA->isChecked())
221   {
222     QStringList ListeGroup ;
223     QString NomGroup ;
224     int nbcol = TWBoundary->columnCount();
225     int nbrow = TWBoundary->rowCount();
226     for ( int col=1; col< nbcol; col++)
227     {
228       for ( int row=0; row< nbrow; row++)
229       {
230         if ( TWBoundary->item( row, col )->checkState() ==  Qt::Checked )
231         {
232 //        Nom du groupe
233           NomGroup = QString(TWBoundary->item(row, 0)->text()) ;
234 //           MESSAGE("NomGroup "<<NomGroup.toStdString().c_str());
235           for ( int nugr = 0 ; nugr<ListeGroup.size(); nugr++)
236           {
237 //             MESSAGE("....... "<<ListeGroup[nugr].toStdString().c_str());
238             if ( NomGroup == ListeGroup[nugr] )
239             {
240               QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
241                                         QObject::tr("HOM_CASE_GROUP").arg(NomGroup) );
242               return false;
243             }
244           }
245           ListeGroup.insert(0, NomGroup );
246         }
247       }
248     }
249   }
250
251 // Creation du cas
252   if (aCaseName != _aCaseName )
253   {
254     _aCaseName = aCaseName;
255     try
256     {
257     aCase = myHomardGen->CreateCase( \
258             CORBA::string_dup(_aCaseName.toStdString().c_str()),  \
259             CORBA::string_dup(aMeshName.toStdString().c_str()),  \
260             CORBA::string_dup(aFileName.toStdString().c_str()) );
261     }
262     catch( SALOME::SALOME_Exception& S_ex )
263     {
264       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
265                                 QObject::tr(CORBA::string_dup(S_ex.details.text)) );
266       return false;
267     }
268     LEFileName->setReadOnly(true);
269     PushFichier->hide();
270     InitBoundarys();
271   }
272
273 // Repertoire et type
274   aCase->SetDirName(aDirName.toStdString().c_str());
275   _aDirName=aDirName;
276   aCase->SetConfType(_ConfType);
277   aCase->SetExtType(_ExtType);
278
279 //   Menage des eventuelles frontieres deja enregistrees
280   aCase->SupprBoundaryGroup() ;
281
282   // Enregistrement et publication dans l'arbre d'etudes a la sortie definitive
283   if ( option > 0 )
284   {
285     if (RBBoundaryCAO->isChecked())
286     {
287       QString monBoundaryCAOName=CBBoundaryCAO->currentText();
288       if (monBoundaryCAOName != "" )
289       {
290         aCase->AddBoundary(monBoundaryCAOName.toStdString().c_str());
291       }
292     }
293     if (CBBoundaryD->isChecked())
294     {
295       QString monBoundaryDiName=CBBoundaryDi->currentText();
296       if (monBoundaryDiName != "" )
297       {
298         aCase->AddBoundary(monBoundaryDiName.toStdString().c_str());
299       }
300     }
301     if (CBBoundaryA->isChecked())
302     {
303       QString NomGroup ;
304       int nbcol = TWBoundary->columnCount();
305       int nbrow = TWBoundary->rowCount();
306       for ( int col=1; col< nbcol; col++)
307       {
308         for ( int row=0; row< nbrow; row++)
309         {
310           if ( TWBoundary->item( row, col )->checkState() ==  Qt::Checked )
311           {
312   //        Nom du groupe
313             NomGroup = QString(TWBoundary->item(row, 0)->text()) ;
314   //        Nom de la frontiere
315             QTableWidgetItem *__colItem = new QTableWidgetItem();
316             __colItem = TWBoundary->horizontalHeaderItem(col);
317             aCase->AddBoundaryGroup(QString(__colItem->text()).toStdString().c_str(), NomGroup.toStdString().c_str());
318           }
319         }
320       }
321     }
322   }
323
324
325 // Options avancees
326   if (CBAdvanced->isChecked())
327   {
328 // Autorisation des pyramides
329     if (CBPyramid->isChecked()) { _Pyram = 1 ; }
330   }
331   aCase->SetPyram(_Pyram);
332
333   HOMARD_UTILS::updateObjBrowser();
334
335   return true;
336 }
337 // ---------------------------
338 void MonCreateCase::PushOnOK()
339 // ---------------------------
340 {
341   bool bOK = PushOnApply(1);
342   if ( bOK ) this->close();
343 }
344 //------------------------------
345 void MonCreateCase::PushOnHelp()
346 //-------------------------------
347 {
348   std::string LanguageShort = myHomardGen->GetLanguageShort();
349   HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str()));
350 }
351 // ---------------------------------
352 void MonCreateCase::SetNewName()
353 // ------------------------------
354 {
355   HOMARD::listeCases_var  MyCases = myHomardGen->GetAllCasesName();
356   int num = 0; QString aCaseName="";
357   while (aCaseName=="" )
358   {
359     aCaseName.setNum(num+1) ;
360     aCaseName.insert(0, QString("Case_")) ;
361     for ( int i=0; i<MyCases->length(); i++)
362     {
363       if ( aCaseName ==  QString((MyCases)[i]))
364       {
365         num ++ ;
366         aCaseName = "" ;
367         break ;
368       }
369    }
370   }
371   LEName->clear() ;
372   LEName->insert(aCaseName);
373 }
374
375 // ------------------------------------------------------------------------
376 void MonCreateCase::SetDirName()
377 // ------------------------------------------------------------------------
378 {
379   QString aDirName=QFileDialog::getExistingDirectory ();
380   if (!(aDirName.isEmpty()))LEDirName->setText(aDirName);
381 }
382 // ------------------------------------------------------------------------
383 void MonCreateCase::SetFileName()
384 // ------------------------------------------------------------------------
385 {
386   QString fileName0 = LEFileName->text().trimmed();
387   QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ;
388   if (fileName.isEmpty()) fileName = fileName0 ;
389   LEFileName->setText(fileName);
390 }
391 // ------------------------------------------------------------------------
392 void MonCreateCase::SetConforme()
393 // ------------------------------------------------------------------------
394 {
395 //
396   _ConfType=0;
397   RBNC1NpA->setVisible(0);
398   RBNCQuelconque->setVisible(0);
399 //
400   adjustSize();
401 }
402 // ------------------------------------------------------------------------
403 void MonCreateCase::SetNonConforme()
404 // ------------------------------------------------------------------------
405 {
406 //
407   _ConfType=1;
408   RBNC1NpA->setVisible(1);
409   RBNCQuelconque->setVisible(1);
410 //
411   adjustSize();
412 }
413 // ------------------------------------------------------------------------
414 void MonCreateCase::SetStandard()
415 // ------------------------------------------------------------------------
416 {
417   if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) { _ConfType = 0 ; }
418   else { _ConfType = 1 ; }
419   RBStandard->setChecked(true);
420 }
421 // ------------------------------------------------------------------------
422 void MonCreateCase::SetBox()
423 // ------------------------------------------------------------------------
424 {
425   if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) { _ConfType = -1 ; }
426   else { _ConfType = -2 ; }
427 }
428 // ------------------------------------------------------------------------
429 void MonCreateCase::SetNC1NpA()
430 // ------------------------------------------------------------------------
431 {
432   _ConfType = 2;
433 }
434 // ------------------------------------------------------------------------
435 void MonCreateCase::SetNCQuelconque()
436 // ------------------------------------------------------------------------
437 {
438   _ConfType = 3;
439 }
440 // ------------------------------------------------------------------------
441 void MonCreateCase::SetMED()
442 // ------------------------------------------------------------------------
443 {
444   _ExtType = 0 ;
445   RBMED->setChecked(true);
446 }
447 // ------------------------------------------------------------------------
448 void MonCreateCase::SetSaturne()
449 // ------------------------------------------------------------------------
450 {
451   _ExtType = 1 ;
452   RBSaturne->setChecked(true);
453 }
454 // ------------------------------------------------------------------------
455 void MonCreateCase::SetSaturne2D()
456 // ------------------------------------------------------------------------
457 {
458   _ExtType = 2 ;
459   RBSaturne2D->setChecked(true);
460 }
461 // ------------------------------------------------------------------------
462 void MonCreateCase::SetBoundaryNo()
463 // ------------------------------------------------------------------------
464 {
465 //
466   GBBoundaryC->setVisible(0);
467   GBBoundaryA->setVisible(0);
468   GBBoundaryD->setVisible(0);
469   CBBoundaryD->setVisible(0);
470   CBBoundaryA->setVisible(0);
471 //
472   adjustSize();
473 }
474 // ------------------------------------------------------------------------
475 void MonCreateCase::SetBoundaryCAO()
476 // ------------------------------------------------------------------------
477 {
478 //
479   GBBoundaryC->setVisible(1);
480   GBBoundaryA->setVisible(0);
481   GBBoundaryD->setVisible(0);
482   CBBoundaryD->setVisible(0);
483   CBBoundaryA->setVisible(0);
484 //
485   adjustSize();
486 }
487 // ------------------------------------------------------------------------
488 void MonCreateCase::SetBoundaryNonCAO()
489 // ------------------------------------------------------------------------
490 {
491 //
492   GBBoundaryC->setVisible(0);
493   CBBoundaryD->setVisible(1);
494   CBBoundaryA->setVisible(1);
495 //
496   adjustSize();
497 }
498 // ------------------------------------------------------------------------
499 void MonCreateCase::AddBoundaryCAO(QString newBoundary)
500 // ------------------------------------------------------------------------
501 {
502   CBBoundaryCAO->insertItem(0,newBoundary);
503   CBBoundaryCAO->setCurrentIndex(0);
504 }
505 // ------------------------------------------------------------------------
506 void MonCreateCase::PushBoundaryCAONew()
507 // ------------------------------------------------------------------------
508 {
509    MonCreateBoundaryCAO *BoundaryDlg = new MonCreateBoundaryCAO(this, true,
510                 HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ;
511    BoundaryDlg->show();
512 }
513 // ------------------------------------------------------------------------
514 void MonCreateCase::PushBoundaryCAOEdit()
515 // ------------------------------------------------------------------------
516 {
517   if (CBBoundaryCAO->currentText() == QString(""))  return;
518   MonEditBoundaryCAO *BoundaryDlg = new MonEditBoundaryCAO(this, true,
519        HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryCAO->currentText() ) ;
520   BoundaryDlg->show();
521 }
522 // ------------------------------------------------------------------------
523 void MonCreateCase::PushBoundaryCAOHelp()
524 // ------------------------------------------------------------------------
525 {
526   std::string LanguageShort = myHomardGen->GetLanguageShort();
527   HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str()));
528 }
529 // ------------------------------------------------------------------------
530 void MonCreateCase::SetBoundaryD()
531 // ------------------------------------------------------------------------
532 {
533   MESSAGE("Debut de SetBoundaryD ");
534   if (CBBoundaryD->isChecked())
535   {
536     bool bOK = PushOnApply(0);
537     if (bOK) { GBBoundaryD->setVisible(1); }
538     else     { GBBoundaryD->setVisible(0);
539                CBBoundaryD->setChecked(0);
540                CBBoundaryD->setCheckState(Qt::Unchecked); }
541   }
542   else { GBBoundaryD->setVisible(0); }
543 //
544   adjustSize();
545 }
546 // ------------------------------------------------------------------------
547 void MonCreateCase::AddBoundaryDi(QString newBoundary)
548 // ------------------------------------------------------------------------
549 {
550   CBBoundaryDi->insertItem(0,newBoundary);
551   CBBoundaryDi->setCurrentIndex(0);
552 }
553 // ------------------------------------------------------------------------
554 void MonCreateCase::PushBoundaryDiNew()
555 // ------------------------------------------------------------------------
556 {
557    MonCreateBoundaryDi *BoundaryDlg = new MonCreateBoundaryDi(this, true,
558                 HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ;
559    BoundaryDlg->show();
560 }
561 // ------------------------------------------------------------------------
562 void MonCreateCase::PushBoundaryDiEdit()
563 // ------------------------------------------------------------------------
564 {
565   if (CBBoundaryDi->currentText() == QString(""))  return;
566   MonEditBoundaryDi *BoundaryDlg = new MonEditBoundaryDi(this, true,
567        HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryDi->currentText() ) ;
568   BoundaryDlg->show();
569 }
570 // ------------------------------------------------------------------------
571 void MonCreateCase::PushBoundaryDiHelp()
572 // ------------------------------------------------------------------------
573 {
574   std::string LanguageShort = myHomardGen->GetLanguageShort();
575   HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str()));
576 }
577 // ------------------------------------------------------------------------
578 void MonCreateCase::SetBoundaryA()
579 // ------------------------------------------------------------------------
580 {
581   MESSAGE("Debut de SetBoundaryA ");
582   if (CBBoundaryA->isChecked())
583   {
584     bool bOK = PushOnApply(0);
585     if (bOK) { GBBoundaryA->setVisible(1); }
586     else     { GBBoundaryA->setVisible(0);
587                CBBoundaryA->setChecked(0);
588                CBBoundaryA->setCheckState(Qt::Unchecked); }
589   }
590   else { GBBoundaryA->setVisible(0); }
591 //
592   adjustSize();
593 }
594 // ------------------------------------------------------------------------
595 void MonCreateCase::AddBoundaryAn(QString newBoundary)
596 // ------------------------------------------------------------------------
597 {
598   MESSAGE("Debut de AddBoundaryAn ");
599 // Ajout d'une nouvelle colonne
600   int nbcol = TWBoundary->columnCount();
601 //   MESSAGE("nbcol " <<  nbcol);
602   nbcol += 1 ;
603   TWBoundary->setColumnCount ( nbcol ) ;
604   QTableWidgetItem *__colItem = new QTableWidgetItem();
605   __colItem->setText(QApplication::translate("CreateCase", newBoundary.toStdString().c_str(), 0));
606   TWBoundary->setHorizontalHeaderItem(nbcol-1, __colItem);
607 /*  TWBoundary->horizontalHeaderItem(nbcol-1)->setFlags( Qt::ItemIsSelectable|Qt::ItemIsEnabled );*/
608 // Chaque case est a cocher
609   int nbrow = TWBoundary->rowCount();
610 //   MESSAGE("nbrow " <<  nbrow);
611   for ( int i = 0; i < nbrow; i++ )
612   {
613     TWBoundary->setItem( i, nbcol-1, new QTableWidgetItem( QString ("") ) );
614     TWBoundary->item( i, nbcol-1 )->setFlags( 0 );
615     TWBoundary->item( i, nbcol-1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled  );
616     TWBoundary->item( i, nbcol-1 )->setCheckState( Qt::Unchecked );
617   }
618   TWBoundary->resizeColumnToContents(nbcol-1);
619 //   TWBoundary->resizeRowsToContents();
620 //   MESSAGE("Fin de AddBoundaryAn ");
621 }
622 // ------------------------------------------------------------------------
623 void MonCreateCase::PushBoundaryAnNew()
624 // ------------------------------------------------------------------------
625 {
626    MonCreateBoundaryAn *BoundaryDlg = new MonCreateBoundaryAn(this, true,
627                 HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ;
628    BoundaryDlg->show();
629 }
630 // ------------------------------------------------------------------------
631 void MonCreateCase::PushBoundaryAnEdit()
632 // ------------------------------------------------------------------------
633 {
634   QString nom="";
635   int nbcol = TWBoundary->columnCount();
636   for ( int i = 1; i < nbcol; i++ )
637   {
638     QTableWidgetItem *__colItem = new QTableWidgetItem();
639     __colItem = TWBoundary->horizontalHeaderItem(i);
640     nom = QString(__colItem->text()) ;
641     MESSAGE("nom "<<nom.toStdString().c_str());
642     if (nom != QString(""))
643     { MonEditBoundaryAn *BoundaryDlg = new MonEditBoundaryAn(this, true,
644         HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, nom ) ;
645       BoundaryDlg->show(); }
646   }
647 }
648 // ------------------------------------------------------------------------
649 void MonCreateCase::PushBoundaryAnHelp()
650 // ------------------------------------------------------------------------
651 {
652   std::string LanguageShort = myHomardGen->GetLanguageShort();
653   HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-analytique"), QString(LanguageShort.c_str()));
654 }
655 // ------------------------------------------------------------------------
656 void MonCreateCase::CaseNameChanged()
657 // ------------------------------------------------------------------------
658 {
659     if (_aCaseName != LEName->text().trimmed())
660     {
661        LEFileName->setReadOnly(false);
662        PushFichier->show();
663     }
664 }
665 // ------------------------------------------------------------------------
666 void MonCreateCase::SetAdvanced()
667 // ------------------------------------------------------------------------
668 {
669   MESSAGE("Debut de SetAdvanced ");
670   if (CBAdvanced->isChecked())
671   { GBAdvancedOptions->setVisible(1);
672     GBConforme->setVisible(1);
673     RBStandard->setVisible(1);
674     RBBox->setVisible(1);
675     if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) )
676     { RBNC1NpA->setVisible(0);
677       RBNCQuelconque->setVisible(0);}
678     else
679     { RBNC1NpA->setVisible(1);
680       RBNCQuelconque->setVisible(1);}
681     GBFormat->setVisible(1);
682     RBMED->setVisible(1);
683     RBSaturne2D->setVisible(1);
684   }
685   else
686   { GBAdvancedOptions->setVisible(0);
687     CBPyramid->setChecked(false);
688     _Pyram = 0 ;
689     SetStandard() ;
690     SetMED() ;
691  }
692 //
693   adjustSize();
694 }