Salome HOME
suppression des impressions sytématiques
[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   MESSAGE("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 //   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   ADAPT::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   ADAPT::HOMARD_Boundary_var myBoundary ;
149   ADAPT::listeBoundarys_var  mesBoundarys = myAdaptGen->GetAllBoundarysName();
150 //   MESSAGE("Nombre de frontieres enregistrees : "<<mesBoundarys->length());
151   for (int i=0; i<mesBoundarys->length(); i++)
152   {
153     myBoundary = myAdaptGen->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 = myAdaptGen->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 = myAdaptGen->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 = myAdaptGen->GetLanguageShort();
349   HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str()));
350 }
351 // ---------------------------------
352 void MonCreateCase::SetNewName()
353 // ------------------------------
354 {
355   ADAPT::listeCases_var  MyCases = myAdaptGen->GetAllCasesName();
356   int num = 0; QString aCaseName="";
357   while (aCaseName=="" )
358   {
359     aCaseName.setNum(num+1) ;
360     aCaseName.insert(0, QString("Case_")) ;
361 //    std::cout  << "aCaseName : --" << aCaseName.toStdString().c_str() << "--" << std::endl;
362     for ( int i=0; i<MyCases->length(); i++)
363     {
364       if ( aCaseName ==  QString((MyCases)[i]))
365       {
366         num ++ ;
367         aCaseName = "" ;
368         break ;
369       }
370    }
371   }
372   LEName->clear() ;
373   LEName->insert(aCaseName);
374 }
375
376 // ------------------------------------------------------------------------
377 void MonCreateCase::SetDirName()
378 // ------------------------------------------------------------------------
379 {
380   QString aDirName=QFileDialog::getExistingDirectory ();
381   if (!(aDirName.isEmpty()))LEDirName->setText(aDirName);
382 }
383 // ------------------------------------------------------------------------
384 void MonCreateCase::SetFileName()
385 // ------------------------------------------------------------------------
386 {
387   QString fileName0 = LEFileName->text().trimmed();
388   QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ;
389   if (fileName.isEmpty()) fileName = fileName0 ;
390   LEFileName->setText(fileName);
391 }
392 // ------------------------------------------------------------------------
393 void MonCreateCase::SetConforme()
394 // ------------------------------------------------------------------------
395 {
396 //
397   _ConfType=0;
398   RBNC1NpA->setVisible(0);
399   RBNCQuelconque->setVisible(0);
400 //
401   adjustSize();
402 }
403 // ------------------------------------------------------------------------
404 void MonCreateCase::SetNonConforme()
405 // ------------------------------------------------------------------------
406 {
407 //
408   _ConfType=1;
409   RBNC1NpA->setVisible(1);
410   RBNCQuelconque->setVisible(1);
411 //
412   adjustSize();
413 }
414 // ------------------------------------------------------------------------
415 void MonCreateCase::SetStandard()
416 // ------------------------------------------------------------------------
417 {
418   if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) { _ConfType = 0 ; }
419   else { _ConfType = 1 ; }
420   RBStandard->setChecked(true);
421 }
422 // ------------------------------------------------------------------------
423 void MonCreateCase::SetBox()
424 // ------------------------------------------------------------------------
425 {
426   if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) { _ConfType = -1 ; }
427   else { _ConfType = -2 ; }
428 }
429 // ------------------------------------------------------------------------
430 void MonCreateCase::SetNC1NpA()
431 // ------------------------------------------------------------------------
432 {
433   _ConfType = 2;
434 }
435 // ------------------------------------------------------------------------
436 void MonCreateCase::SetNCQuelconque()
437 // ------------------------------------------------------------------------
438 {
439   _ConfType = 3;
440 }
441 // ------------------------------------------------------------------------
442 void MonCreateCase::SetMED()
443 // ------------------------------------------------------------------------
444 {
445   _ExtType = 0 ;
446   RBMED->setChecked(true);
447 }
448 // ------------------------------------------------------------------------
449 void MonCreateCase::SetSaturne()
450 // ------------------------------------------------------------------------
451 {
452   _ExtType = 1 ;
453   RBSaturne->setChecked(true);
454 }
455 // ------------------------------------------------------------------------
456 void MonCreateCase::SetSaturne2D()
457 // ------------------------------------------------------------------------
458 {
459   _ExtType = 2 ;
460   RBSaturne2D->setChecked(true);
461 }
462 // ------------------------------------------------------------------------
463 void MonCreateCase::SetBoundaryNo()
464 // ------------------------------------------------------------------------
465 {
466 //
467   GBBoundaryC->setVisible(0);
468   GBBoundaryA->setVisible(0);
469   GBBoundaryD->setVisible(0);
470   CBBoundaryD->setVisible(0);
471   CBBoundaryA->setVisible(0);
472 //
473   adjustSize();
474 }
475 // ------------------------------------------------------------------------
476 void MonCreateCase::SetBoundaryCAO()
477 // ------------------------------------------------------------------------
478 {
479 //
480   GBBoundaryC->setVisible(1);
481   GBBoundaryA->setVisible(0);
482   GBBoundaryD->setVisible(0);
483   CBBoundaryD->setVisible(0);
484   CBBoundaryA->setVisible(0);
485 //
486   adjustSize();
487 }
488 // ------------------------------------------------------------------------
489 void MonCreateCase::SetBoundaryNonCAO()
490 // ------------------------------------------------------------------------
491 {
492 //
493   GBBoundaryC->setVisible(0);
494   CBBoundaryD->setVisible(1);
495   CBBoundaryA->setVisible(1);
496 //
497   adjustSize();
498 }
499 // ------------------------------------------------------------------------
500 void MonCreateCase::AddBoundaryCAO(QString newBoundary)
501 // ------------------------------------------------------------------------
502 {
503   CBBoundaryCAO->insertItem(0,newBoundary);
504   CBBoundaryCAO->setCurrentIndex(0);
505 }
506 // ------------------------------------------------------------------------
507 void MonCreateCase::PushBoundaryCAONew()
508 // ------------------------------------------------------------------------
509 {
510    MonCreateBoundaryCAO *BoundaryDlg = new MonCreateBoundaryCAO(this, true,
511                 ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName, "") ;
512    BoundaryDlg->show();
513 }
514 // ------------------------------------------------------------------------
515 void MonCreateCase::PushBoundaryCAOEdit()
516 // ------------------------------------------------------------------------
517 {
518   if (CBBoundaryCAO->currentText() == QString(""))  return;
519   MonEditBoundaryCAO *BoundaryDlg = new MonEditBoundaryCAO(this, true,
520        ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName, CBBoundaryCAO->currentText() ) ;
521   BoundaryDlg->show();
522 }
523 // ------------------------------------------------------------------------
524 void MonCreateCase::PushBoundaryCAOHelp()
525 // ------------------------------------------------------------------------
526 {
527   std::string LanguageShort = myAdaptGen->GetLanguageShort();
528   HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str()));
529 }
530 // ------------------------------------------------------------------------
531 void MonCreateCase::SetBoundaryD()
532 // ------------------------------------------------------------------------
533 {
534   MESSAGE("Debut de SetBoundaryD ");
535   if (CBBoundaryD->isChecked())
536   {
537     bool bOK = PushOnApply(0);
538     if (bOK) { GBBoundaryD->setVisible(1); }
539     else     { GBBoundaryD->setVisible(0);
540                CBBoundaryD->setChecked(0);
541                CBBoundaryD->setCheckState(Qt::Unchecked); }
542   }
543   else { GBBoundaryD->setVisible(0); }
544 //
545   adjustSize();
546 }
547 // ------------------------------------------------------------------------
548 void MonCreateCase::AddBoundaryDi(QString newBoundary)
549 // ------------------------------------------------------------------------
550 {
551   CBBoundaryDi->insertItem(0,newBoundary);
552   CBBoundaryDi->setCurrentIndex(0);
553 }
554 // ------------------------------------------------------------------------
555 void MonCreateCase::PushBoundaryDiNew()
556 // ------------------------------------------------------------------------
557 {
558    MonCreateBoundaryDi *BoundaryDlg = new MonCreateBoundaryDi(this, true,
559                 ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName, "") ;
560    BoundaryDlg->show();
561 }
562 // ------------------------------------------------------------------------
563 void MonCreateCase::PushBoundaryDiEdit()
564 // ------------------------------------------------------------------------
565 {
566   if (CBBoundaryDi->currentText() == QString(""))  return;
567   MonEditBoundaryDi *BoundaryDlg = new MonEditBoundaryDi(this, true,
568        ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName, CBBoundaryDi->currentText() ) ;
569   BoundaryDlg->show();
570 }
571 // ------------------------------------------------------------------------
572 void MonCreateCase::PushBoundaryDiHelp()
573 // ------------------------------------------------------------------------
574 {
575   std::string LanguageShort = myAdaptGen->GetLanguageShort();
576   HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str()));
577 }
578 // ------------------------------------------------------------------------
579 void MonCreateCase::SetBoundaryA()
580 // ------------------------------------------------------------------------
581 {
582   MESSAGE("Debut de SetBoundaryA ");
583   if (CBBoundaryA->isChecked())
584   {
585     bool bOK = PushOnApply(0);
586     if (bOK) { GBBoundaryA->setVisible(1); }
587     else     { GBBoundaryA->setVisible(0);
588                CBBoundaryA->setChecked(0);
589                CBBoundaryA->setCheckState(Qt::Unchecked); }
590   }
591   else { GBBoundaryA->setVisible(0); }
592 //
593   adjustSize();
594 }
595 // ------------------------------------------------------------------------
596 void MonCreateCase::AddBoundaryAn(QString newBoundary)
597 // ------------------------------------------------------------------------
598 {
599   MESSAGE("Debut de AddBoundaryAn ");
600 // Ajout d'une nouvelle colonne
601   int nbcol = TWBoundary->columnCount();
602 //   MESSAGE("nbcol " <<  nbcol);
603   nbcol += 1 ;
604   TWBoundary->setColumnCount ( nbcol ) ;
605   QTableWidgetItem *__colItem = new QTableWidgetItem();
606   __colItem->setText(QApplication::translate("CreateCase", newBoundary.toStdString().c_str(), 0));
607   TWBoundary->setHorizontalHeaderItem(nbcol-1, __colItem);
608 /*  TWBoundary->horizontalHeaderItem(nbcol-1)->setFlags( Qt::ItemIsSelectable|Qt::ItemIsEnabled );*/
609 // Chaque case est a cocher
610   int nbrow = TWBoundary->rowCount();
611 //   MESSAGE("nbrow " <<  nbrow);
612   for ( int i = 0; i < nbrow; i++ )
613   {
614     TWBoundary->setItem( i, nbcol-1, new QTableWidgetItem( QString ("") ) );
615     TWBoundary->item( i, nbcol-1 )->setFlags( 0 );
616     TWBoundary->item( i, nbcol-1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled  );
617     TWBoundary->item( i, nbcol-1 )->setCheckState( Qt::Unchecked );
618   }
619   TWBoundary->resizeColumnToContents(nbcol-1);
620 //   TWBoundary->resizeRowsToContents();
621 //   MESSAGE("Fin de AddBoundaryAn ");
622 }
623 // ------------------------------------------------------------------------
624 void MonCreateCase::PushBoundaryAnNew()
625 // ------------------------------------------------------------------------
626 {
627    MonCreateBoundaryAn *BoundaryDlg = new MonCreateBoundaryAn(this, true,
628                 ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName) ;
629    BoundaryDlg->show();
630 }
631 // ------------------------------------------------------------------------
632 void MonCreateCase::PushBoundaryAnEdit()
633 // ------------------------------------------------------------------------
634 {
635   QString nom="";
636   int nbcol = TWBoundary->columnCount();
637   for ( int i = 1; i < nbcol; i++ )
638   {
639     QTableWidgetItem *__colItem = new QTableWidgetItem();
640     __colItem = TWBoundary->horizontalHeaderItem(i);
641     nom = QString(__colItem->text()) ;
642     MESSAGE("nom "<<nom.toStdString().c_str());
643     if (nom != QString(""))
644     { MonEditBoundaryAn *BoundaryDlg = new MonEditBoundaryAn(this, true,
645         ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), _aCaseName, nom ) ;
646       BoundaryDlg->show(); }
647   }
648 }
649 // ------------------------------------------------------------------------
650 void MonCreateCase::PushBoundaryAnHelp()
651 // ------------------------------------------------------------------------
652 {
653   std::string LanguageShort = myAdaptGen->GetLanguageShort();
654   HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-analytique"), QString(LanguageShort.c_str()));
655 }
656 // ------------------------------------------------------------------------
657 void MonCreateCase::CaseNameChanged()
658 // ------------------------------------------------------------------------
659 {
660     if (_aCaseName != LEName->text().trimmed())
661     {
662        LEFileName->setReadOnly(false);
663        PushFichier->show();
664     }
665 }
666 // ------------------------------------------------------------------------
667 void MonCreateCase::SetAdvanced()
668 // ------------------------------------------------------------------------
669 {
670   MESSAGE("Debut de SetAdvanced ");
671   if (CBAdvanced->isChecked())
672   { GBAdvancedOptions->setVisible(1);
673     GBConforme->setVisible(1);
674     RBStandard->setVisible(1);
675     RBBox->setVisible(1);
676     if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) )
677     { RBNC1NpA->setVisible(0);
678       RBNCQuelconque->setVisible(0);}
679     else
680     { RBNC1NpA->setVisible(1);
681       RBNCQuelconque->setVisible(1);}
682     GBFormat->setVisible(1);
683     RBMED->setVisible(1);
684     RBSaturne2D->setVisible(1);
685   }
686   else
687   { GBAdvancedOptions->setVisible(0);
688     CBPyramid->setChecked(false);
689     _Pyram = 0 ;
690     SetStandard() ;
691     SetMED() ;
692  }
693 //
694   adjustSize();
695 }