Salome HOME
Merge remote-tracking branch 'origin/master' into gni/adaptation
[modules/smesh.git] / src / ADAPTGUI / MonCreateCase.cxx
1 // Copyright (C) 2011-2020  CEA/DEN, EDF R&D
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, ADAPT::ADAPT_Gen_var myAdaptGen0 )
50     :
51     Ui_CreateCase(),
52     _aCaseName(""),_aDirName(""),
53     _ConfType(0),
54     _ExtType(0),
55     _Pyram(0)
56 {
57   INFOS("Debut du constructeur de MonCreateCase");
58   myAdaptGen=ADAPT::ADAPT_Gen::_duplicate(myAdaptGen0);
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   INFOS("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     INFOS("Debut de InitConnect");
91     connect( LEName,      SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged()));
92     connect( PushDir,     SIGNAL(pressed()), this, SLOT(SetDirName()));
93     connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName()));
94
95     connect( RBConforme,     SIGNAL(clicked()), this, SLOT(SetConforme()));
96     connect( RBNonConforme,  SIGNAL(clicked()), this, SLOT(SetNonConforme()));
97
98     connect( RBBoundaryNo,      SIGNAL(clicked()), this, SLOT(SetBoundaryNo()));
99     connect( RBBoundaryCAO,     SIGNAL(clicked()), this, SLOT(SetBoundaryCAO()));
100     connect( RBBoundaryNonCAO,  SIGNAL(clicked()), this, SLOT(SetBoundaryNonCAO()));
101
102     connect( PBBoundaryCAONew,  SIGNAL(pressed()), this, SLOT(PushBoundaryCAONew()));
103     connect( PBBoundaryCAOEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOEdit()) );
104     connect( PBBoundaryCAOHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOHelp()) );
105     connect( CBBoundaryD,       SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryD()));
106     connect( PBBoundaryDiNew,   SIGNAL(pressed()), this, SLOT(PushBoundaryDiNew()));
107     connect( PBBoundaryDiEdit,  SIGNAL(pressed()), this, SLOT(PushBoundaryDiEdit()) );
108     connect( PBBoundaryDiHelp,  SIGNAL(pressed()), this, SLOT(PushBoundaryDiHelp()) );
109     connect( CBBoundaryA,       SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryA()));
110     connect( PBBoundaryAnNew,   SIGNAL(pressed()), this, SLOT(PushBoundaryAnNew()));
111     connect( PBBoundaryAnEdit,  SIGNAL(pressed()), this, SLOT(PushBoundaryAnEdit()) );
112     connect( PBBoundaryAnHelp,  SIGNAL(pressed()), this, SLOT(PushBoundaryAnHelp()) );
113
114     connect( CBAdvanced,     SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced()));
115     connect( RBStandard,     SIGNAL(clicked()), this, SLOT(SetStandard()));
116     connect( RBBox,          SIGNAL(clicked()), this, SLOT(SetBox()));
117     connect( RBNC1NpA,       SIGNAL(clicked()), this, SLOT(SetNC1NpA()));
118     connect( RBNCQuelconque, SIGNAL(clicked()), this, SLOT(SetNCQuelconque()));
119
120     connect( RBMED,          SIGNAL(clicked()), this, SLOT(SetMED()));
121     connect( RBSaturne,      SIGNAL(clicked()), this, SLOT(SetSaturne()));
122     connect( RBSaturne2D,    SIGNAL(clicked()), this, SLOT(SetSaturne2D()));
123
124     connect( buttonOk,       SIGNAL(pressed()), this, SLOT(PushOnOK()));
125     connect( buttonApply,    SIGNAL(pressed()), this, SLOT(PushOnApply(0)));
126     connect( buttonCancel,   SIGNAL(pressed()), this, SLOT(close()));
127     connect( buttonHelp,     SIGNAL(pressed()), this, SLOT(PushOnHelp()));
128     INFOS("Fin de InitConnect");
129 }
130 // ------------------------------------------------------------------------
131 void MonCreateCase::InitBoundarys()
132 // ------------------------------------------------------------------------
133 // Initialisation des menus avec les frontieres deja enregistrees
134 {
135   INFOS("InitBoundarys");
136 // Pour les frontieres analytiques : la colonne des groupes
137   ADAPT::ListGroupType_var _listeGroupesCas = aCase->GetGroups();
138   QTableWidgetItem *__colItem = new QTableWidgetItem();
139   __colItem->setText(QApplication::translate("CreateCase", "", 0));
140   TWBoundary->setHorizontalHeaderItem(0, __colItem);
141   for ( int i = 0; i < _listeGroupesCas->length(); i++ )
142   {
143     TWBoundary->insertRow(i);
144     TWBoundary->setItem( i, 0, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed()));
145     TWBoundary->item( i, 0 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
146   }
147 // Pour les frontieres CAO : la liste a saisir
148 // Pour les frontieres discretes : la liste a saisir
149 // Pour les frontieres analytiques : les colonnes de chaque frontiere
150   ADAPT::HOMARD_Boundary_var myBoundary ;
151   ADAPT::listeBoundarys_var  mesBoundarys = myAdaptGen->GetAllBoundarysName();
152 //   INFOS("Nombre de frontieres enregistrees : "<<mesBoundarys->length());
153   for (int i=0; i<mesBoundarys->length(); i++)
154   {
155     myBoundary = myAdaptGen->GetBoundary(mesBoundarys[i]);
156     int type_obj = myBoundary->GetType() ;
157     if ( type_obj==-1 )     { CBBoundaryCAO->addItem(QString(mesBoundarys[i])); }
158     else if ( type_obj==0 ) { CBBoundaryDi->addItem(QString(mesBoundarys[i])); }
159     else                    { AddBoundaryAn(QString(mesBoundarys[i])); }
160   }
161 // Ajustement
162   TWBoundary->resizeColumnsToContents();
163   TWBoundary->resizeRowsToContents();
164   TWBoundary->clearSelection();
165 }
166 // -------------------------------
167 bool MonCreateCase::PushOnApply(int option)
168 // --------------------------------
169 {
170   INFOS("PushOnApply");
171   QString aCaseName=LEName->text().trimmed();
172   if ( aCaseName == "" )
173   {
174     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
175                               QObject::tr("HOM_CASE_NAME") );
176     return false;
177   }
178
179   QString aDirName=LEDirName->text().trimmed();
180   if (aDirName == QString(""))
181   {
182     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
183                               QObject::tr("HOM_CASE_DIRECTORY_1") );
184     return false;
185   }
186
187   if ( aDirName != _aDirName)
188   { QString CaseNameDir = myAdaptGen->VerifieDir( aDirName.toStdString().c_str()) ;
189     if ( ( CaseNameDir != "" ) & ( CaseNameDir != aCaseName ) )
190     {
191       QString texte ;
192       texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ;
193       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
194                                 texte );
195       return false;
196     }
197   }
198   if (CHDIR(aDirName.toStdString().c_str()) != 0)
199   {
200     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
201                               QObject::tr("HOM_CASE_DIRECTORY_3") );
202     return false;
203   }
204
205   QString aFileName=LEFileName->text().trimmed();
206   if (aFileName ==QString(""))
207   {
208     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
209                               QObject::tr("HOM_CASE_MESH") );
210     return false;
211   }
212
213   QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aFileName);
214   if (aMeshName == "" )
215   {
216     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
217                               QObject::tr("HOM_MED_FILE_2") );
218     return false;
219   }
220
221 // On verifie qu'un groupe n'est pas associe a deux frontieres differentes
222   if (CBBoundaryA->isChecked())
223   {
224     QStringList ListeGroup ;
225     QString NomGroup ;
226     int nbcol = TWBoundary->columnCount();
227     int nbrow = TWBoundary->rowCount();
228     for ( int col=1; col< nbcol; col++)
229     {
230       for ( int row=0; row< nbrow; row++)
231       {
232         if ( TWBoundary->item( row, col )->checkState() ==  Qt::Checked )
233         {
234 //        Nom du groupe
235           NomGroup = QString(TWBoundary->item(row, 0)->text()) ;
236 //           INFOS("NomGroup "<<NomGroup.toStdString().c_str());
237           for ( int nugr = 0 ; nugr<ListeGroup.size(); nugr++)
238           {
239 //             INFOS("....... "<<ListeGroup[nugr].toStdString().c_str());
240             if ( NomGroup == ListeGroup[nugr] )
241             {
242               QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
243                                         QObject::tr("HOM_CASE_GROUP").arg(NomGroup) );
244               return false;
245             }
246           }
247           ListeGroup.insert(0, NomGroup );
248         }
249       }
250     }
251   }
252
253 // Creation du cas
254   if (aCaseName != _aCaseName )
255   {
256     _aCaseName = aCaseName;
257     try
258     {
259     aCase = myAdaptGen->CreateCase( \
260             CORBA::string_dup(_aCaseName.toStdString().c_str()),  \
261             CORBA::string_dup(aMeshName.toStdString().c_str()),  \
262             CORBA::string_dup(aFileName.toStdString().c_str()) );
263     }
264     catch( SALOME::SALOME_Exception& S_ex )
265     {
266       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
267                                 QObject::tr(CORBA::string_dup(S_ex.details.text)) );
268       return false;
269     }
270     LEFileName->setReadOnly(true);
271     PushFichier->hide();
272     InitBoundarys();
273   }
274
275 // Repertoire et type
276   aCase->SetDirName(aDirName.toStdString().c_str());
277   _aDirName=aDirName;
278   aCase->SetConfType(_ConfType);
279   aCase->SetExtType(_ExtType);
280
281 //   Menage des eventuelles frontieres deja enregistrees
282   aCase->SupprBoundaryGroup() ;
283
284   // Enregistrement et publication dans l'arbre d'etudes a la sortie definitive
285   if ( option > 0 )
286   {
287     if (RBBoundaryCAO->isChecked())
288     {
289       QString monBoundaryCAOName=CBBoundaryCAO->currentText();
290       if (monBoundaryCAOName != "" )
291       {
292         aCase->AddBoundary(monBoundaryCAOName.toStdString().c_str());
293       }
294     }
295     if (CBBoundaryD->isChecked())
296     {
297       QString monBoundaryDiName=CBBoundaryDi->currentText();
298       if (monBoundaryDiName != "" )
299       {
300         aCase->AddBoundary(monBoundaryDiName.toStdString().c_str());
301       }
302     }
303     if (CBBoundaryA->isChecked())
304     {
305       QString NomGroup ;
306       int nbcol = TWBoundary->columnCount();
307       int nbrow = TWBoundary->rowCount();
308       for ( int col=1; col< nbcol; col++)
309       {
310         for ( int row=0; row< nbrow; row++)
311         {
312           if ( TWBoundary->item( row, col )->checkState() ==  Qt::Checked )
313           {
314   //        Nom du groupe
315             NomGroup = QString(TWBoundary->item(row, 0)->text()) ;
316   //        Nom de la frontiere
317             QTableWidgetItem *__colItem = new QTableWidgetItem();
318             __colItem = TWBoundary->horizontalHeaderItem(col);
319             aCase->AddBoundaryGroup(QString(__colItem->text()).toStdString().c_str(), NomGroup.toStdString().c_str());
320           }
321         }
322       }
323     }
324   }
325
326
327 // Options avancees
328   if (CBAdvanced->isChecked())
329   {
330 // Autorisation des pyramides
331     if (CBPyramid->isChecked()) { _Pyram = 1 ; }
332   }
333   aCase->SetPyram(_Pyram);
334
335   HOMARD_UTILS::updateObjBrowser();
336
337   return true;
338 }
339 // ---------------------------
340 void MonCreateCase::PushOnOK()
341 // ---------------------------
342 {
343   bool bOK = PushOnApply(1);
344   if ( bOK ) this->close();
345 }
346 //------------------------------
347 void MonCreateCase::PushOnHelp()
348 //-------------------------------
349 {
350   std::string LanguageShort = myAdaptGen->GetLanguageShort();
351   HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str()));
352 }
353 // ---------------------------------
354 void MonCreateCase::SetNewName()
355 // ------------------------------
356 {
357   INFOS("Debut de SetNewName");
358   ADAPT::listeCases_var  MyCases = myAdaptGen->GetAllCasesName();
359   INFOS("MyCases construit");
360   int num = 0; QString aCaseName="";
361   while (aCaseName=="" )
362   {
363     aCaseName.setNum(num+1) ;
364     aCaseName.insert(0, QString("Case_")) ;
365     std::cout  << "aCaseName : --" << aCaseName.toStdString().c_str() << "--" << std::endl;
366     for ( int i=0; i<MyCases->length(); i++)
367     {
368       if ( aCaseName ==  QString((MyCases)[i]))
369       {
370         num ++ ;
371         aCaseName = "" ;
372         break ;
373       }
374    }
375   }
376   INFOS("aCaseName construit");
377   LEName->clear() ;
378   LEName->insert(aCaseName);
379   INFOS("Fin de SetNewName");
380 }
381
382 // ------------------------------------------------------------------------
383 void MonCreateCase::SetDirName()
384 // ------------------------------------------------------------------------
385 {
386   QString aDirName=QFileDialog::getExistingDirectory ();
387   if (!(aDirName.isEmpty()))LEDirName->setText(aDirName);
388 }
389 // ------------------------------------------------------------------------
390 void MonCreateCase::SetFileName()
391 // ------------------------------------------------------------------------
392 {
393   QString fileName0 = LEFileName->text().trimmed();
394   QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ;
395   if (fileName.isEmpty()) fileName = fileName0 ;
396   LEFileName->setText(fileName);
397 }
398 // ------------------------------------------------------------------------
399 void MonCreateCase::SetConforme()
400 // ------------------------------------------------------------------------
401 {
402 //
403   _ConfType=0;
404   RBNC1NpA->setVisible(0);
405   RBNCQuelconque->setVisible(0);
406 //
407   adjustSize();
408 }
409 // ------------------------------------------------------------------------
410 void MonCreateCase::SetNonConforme()
411 // ------------------------------------------------------------------------
412 {
413 //
414   _ConfType=1;
415   RBNC1NpA->setVisible(1);
416   RBNCQuelconque->setVisible(1);
417 //
418   adjustSize();
419 }
420 // ------------------------------------------------------------------------
421 void MonCreateCase::SetStandard()
422 // ------------------------------------------------------------------------
423 {
424   if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) { _ConfType = 0 ; }
425   else { _ConfType = 1 ; }
426   RBStandard->setChecked(true);
427 }
428 // ------------------------------------------------------------------------
429 void MonCreateCase::SetBox()
430 // ------------------------------------------------------------------------
431 {
432   if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) { _ConfType = -1 ; }
433   else { _ConfType = -2 ; }
434 }
435 // ------------------------------------------------------------------------
436 void MonCreateCase::SetNC1NpA()
437 // ------------------------------------------------------------------------
438 {
439   _ConfType = 2;
440 }
441 // ------------------------------------------------------------------------
442 void MonCreateCase::SetNCQuelconque()
443 // ------------------------------------------------------------------------
444 {
445   _ConfType = 3;
446 }
447 // ------------------------------------------------------------------------
448 void MonCreateCase::SetMED()
449 // ------------------------------------------------------------------------
450 {
451   _ExtType = 0 ;
452   RBMED->setChecked(true);
453 }
454 // ------------------------------------------------------------------------
455 void MonCreateCase::SetSaturne()
456 // ------------------------------------------------------------------------
457 {
458   _ExtType = 1 ;
459   RBSaturne->setChecked(true);
460 }
461 // ------------------------------------------------------------------------
462 void MonCreateCase::SetSaturne2D()
463 // ------------------------------------------------------------------------
464 {
465   _ExtType = 2 ;
466   RBSaturne2D->setChecked(true);
467 }
468 // ------------------------------------------------------------------------
469 void MonCreateCase::SetBoundaryNo()
470 // ------------------------------------------------------------------------
471 {
472 //
473   GBBoundaryC->setVisible(0);
474   GBBoundaryA->setVisible(0);
475   GBBoundaryD->setVisible(0);
476   CBBoundaryD->setVisible(0);
477   CBBoundaryA->setVisible(0);
478 //
479   adjustSize();
480 }
481 // ------------------------------------------------------------------------
482 void MonCreateCase::SetBoundaryCAO()
483 // ------------------------------------------------------------------------
484 {
485 //
486   GBBoundaryC->setVisible(1);
487   GBBoundaryA->setVisible(0);
488   GBBoundaryD->setVisible(0);
489   CBBoundaryD->setVisible(0);
490   CBBoundaryA->setVisible(0);
491 //
492   adjustSize();
493 }
494 // ------------------------------------------------------------------------
495 void MonCreateCase::SetBoundaryNonCAO()
496 // ------------------------------------------------------------------------
497 {
498 //
499   GBBoundaryC->setVisible(0);
500   CBBoundaryD->setVisible(1);
501   CBBoundaryA->setVisible(1);
502 //
503   adjustSize();
504 }
505 // ------------------------------------------------------------------------
506 void MonCreateCase::AddBoundaryCAO(QString newBoundary)
507 // ------------------------------------------------------------------------
508 {
509   CBBoundaryCAO->insertItem(0,newBoundary);
510   CBBoundaryCAO->setCurrentIndex(0);
511 }
512 // ------------------------------------------------------------------------
513 void MonCreateCase::PushBoundaryCAONew()
514 // ------------------------------------------------------------------------
515 {
516    MonCreateBoundaryCAO *BoundaryDlg = new MonCreateBoundaryCAO(this, true,
517                 ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName, "") ;
518    BoundaryDlg->show();
519 }
520 // ------------------------------------------------------------------------
521 void MonCreateCase::PushBoundaryCAOEdit()
522 // ------------------------------------------------------------------------
523 {
524   if (CBBoundaryCAO->currentText() == QString(""))  return;
525   MonEditBoundaryCAO *BoundaryDlg = new MonEditBoundaryCAO(this, true,
526        ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName, CBBoundaryCAO->currentText() ) ;
527   BoundaryDlg->show();
528 }
529 // ------------------------------------------------------------------------
530 void MonCreateCase::PushBoundaryCAOHelp()
531 // ------------------------------------------------------------------------
532 {
533   std::string LanguageShort = myAdaptGen->GetLanguageShort();
534   HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str()));
535 }
536 // ------------------------------------------------------------------------
537 void MonCreateCase::SetBoundaryD()
538 // ------------------------------------------------------------------------
539 {
540   INFOS("Debut de SetBoundaryD ");
541   if (CBBoundaryD->isChecked())
542   {
543     bool bOK = PushOnApply(0);
544     if (bOK) { GBBoundaryD->setVisible(1); }
545     else     { GBBoundaryD->setVisible(0);
546                CBBoundaryD->setChecked(0);
547                CBBoundaryD->setCheckState(Qt::Unchecked); }
548   }
549   else { GBBoundaryD->setVisible(0); }
550 //
551   adjustSize();
552 }
553 // ------------------------------------------------------------------------
554 void MonCreateCase::AddBoundaryDi(QString newBoundary)
555 // ------------------------------------------------------------------------
556 {
557   CBBoundaryDi->insertItem(0,newBoundary);
558   CBBoundaryDi->setCurrentIndex(0);
559 }
560 // ------------------------------------------------------------------------
561 void MonCreateCase::PushBoundaryDiNew()
562 // ------------------------------------------------------------------------
563 {
564    MonCreateBoundaryDi *BoundaryDlg = new MonCreateBoundaryDi(this, true,
565                 ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName, "") ;
566    BoundaryDlg->show();
567 }
568 // ------------------------------------------------------------------------
569 void MonCreateCase::PushBoundaryDiEdit()
570 // ------------------------------------------------------------------------
571 {
572   if (CBBoundaryDi->currentText() == QString(""))  return;
573   MonEditBoundaryDi *BoundaryDlg = new MonEditBoundaryDi(this, true,
574        ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName, CBBoundaryDi->currentText() ) ;
575   BoundaryDlg->show();
576 }
577 // ------------------------------------------------------------------------
578 void MonCreateCase::PushBoundaryDiHelp()
579 // ------------------------------------------------------------------------
580 {
581   std::string LanguageShort = myAdaptGen->GetLanguageShort();
582   HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str()));
583 }
584 // ------------------------------------------------------------------------
585 void MonCreateCase::SetBoundaryA()
586 // ------------------------------------------------------------------------
587 {
588   INFOS("Debut de SetBoundaryA ");
589   if (CBBoundaryA->isChecked())
590   {
591     bool bOK = PushOnApply(0);
592     if (bOK) { GBBoundaryA->setVisible(1); }
593     else     { GBBoundaryA->setVisible(0);
594                CBBoundaryA->setChecked(0);
595                CBBoundaryA->setCheckState(Qt::Unchecked); }
596   }
597   else { GBBoundaryA->setVisible(0); }
598 //
599   adjustSize();
600 }
601 // ------------------------------------------------------------------------
602 void MonCreateCase::AddBoundaryAn(QString newBoundary)
603 // ------------------------------------------------------------------------
604 {
605   INFOS("Debut de AddBoundaryAn ");
606 // Ajout d'une nouvelle colonne
607   int nbcol = TWBoundary->columnCount();
608 //   INFOS("nbcol " <<  nbcol);
609   nbcol += 1 ;
610   TWBoundary->setColumnCount ( nbcol ) ;
611   QTableWidgetItem *__colItem = new QTableWidgetItem();
612   __colItem->setText(QApplication::translate("CreateCase", newBoundary.toStdString().c_str(), 0));
613   TWBoundary->setHorizontalHeaderItem(nbcol-1, __colItem);
614 /*  TWBoundary->horizontalHeaderItem(nbcol-1)->setFlags( Qt::ItemIsSelectable|Qt::ItemIsEnabled );*/
615 // Chaque case est a cocher
616   int nbrow = TWBoundary->rowCount();
617 //   INFOS("nbrow " <<  nbrow);
618   for ( int i = 0; i < nbrow; i++ )
619   {
620     TWBoundary->setItem( i, nbcol-1, new QTableWidgetItem( QString ("") ) );
621     TWBoundary->item( i, nbcol-1 )->setFlags( 0 );
622     TWBoundary->item( i, nbcol-1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled  );
623     TWBoundary->item( i, nbcol-1 )->setCheckState( Qt::Unchecked );
624   }
625   TWBoundary->resizeColumnToContents(nbcol-1);
626 //   TWBoundary->resizeRowsToContents();
627 //   INFOS("Fin de AddBoundaryAn ");
628 }
629 // ------------------------------------------------------------------------
630 void MonCreateCase::PushBoundaryAnNew()
631 // ------------------------------------------------------------------------
632 {
633    MonCreateBoundaryAn *BoundaryDlg = new MonCreateBoundaryAn(this, true,
634                 ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName) ;
635    BoundaryDlg->show();
636 }
637 // ------------------------------------------------------------------------
638 void MonCreateCase::PushBoundaryAnEdit()
639 // ------------------------------------------------------------------------
640 {
641   QString nom="";
642   int nbcol = TWBoundary->columnCount();
643   for ( int i = 1; i < nbcol; i++ )
644   {
645     QTableWidgetItem *__colItem = new QTableWidgetItem();
646     __colItem = TWBoundary->horizontalHeaderItem(i);
647     nom = QString(__colItem->text()) ;
648     INFOS("nom "<<nom.toStdString().c_str());
649     if (nom != QString(""))
650     { MonEditBoundaryAn *BoundaryDlg = new MonEditBoundaryAn(this, true,
651         ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName, nom ) ;
652       BoundaryDlg->show(); }
653   }
654 }
655 // ------------------------------------------------------------------------
656 void MonCreateCase::PushBoundaryAnHelp()
657 // ------------------------------------------------------------------------
658 {
659   std::string LanguageShort = myAdaptGen->GetLanguageShort();
660   HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-analytique"), QString(LanguageShort.c_str()));
661 }
662 // ------------------------------------------------------------------------
663 void MonCreateCase::CaseNameChanged()
664 // ------------------------------------------------------------------------
665 {
666     if (_aCaseName != LEName->text().trimmed())
667     {
668        LEFileName->setReadOnly(false);
669        PushFichier->show();
670     }
671 }
672 // ------------------------------------------------------------------------
673 void MonCreateCase::SetAdvanced()
674 // ------------------------------------------------------------------------
675 {
676   INFOS("Debut de SetAdvanced ");
677   if (CBAdvanced->isChecked())
678   { GBAdvancedOptions->setVisible(1);
679     GBConforme->setVisible(1);
680     RBStandard->setVisible(1);
681     RBBox->setVisible(1);
682     if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) )
683     { RBNC1NpA->setVisible(0);
684       RBNCQuelconque->setVisible(0);}
685     else
686     { RBNC1NpA->setVisible(1);
687       RBNCQuelconque->setVisible(1);}
688     GBFormat->setVisible(1);
689     RBMED->setVisible(1);
690     RBSaturne2D->setVisible(1);
691   }
692   else
693   { GBAdvancedOptions->setVisible(0);
694     CBPyramid->setChecked(false);
695     _Pyram = 0 ;
696     SetStandard() ;
697     SetMED() ;
698   INFOS("Fin de SetAdvanced ");
699  }
700 //
701   adjustSize();
702 }