Salome HOME
changement homardGen ==> adaptGen
[modules/smesh.git] / src / ADAPTGUI / MonEditBoundaryDi.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 "MonEditBoundaryDi.h"
21 #include "MonEditListGroup.h"
22
23 #include <QMessageBox>
24
25 #include "SalomeApp_Tools.h"
26 #include "HOMARDGUI_Utils.h"
27 #include "HomardQtCommun.h"
28 #include <utilities.h>
29
30 using namespace std;
31
32 // -------------------------------------------------------------------------------------------------------------------------------------
33 MonEditBoundaryDi::MonEditBoundaryDi( MonCreateCase* parent, bool modal,
34                                       ADAPT::ADAPT_Gen_var myAdaptGen,
35                                       QString caseName, QString Name):
36 // -------------------------------------------------------------------------------------------------------------------------------------
37 /* Constructs a MonEditBoundaryDi
38     herite de MonCreateBoundaryDi
39 */
40     MonCreateBoundaryDi(parent, modal, myAdaptGen, caseName, Name)
41 {
42     MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str());
43     setWindowTitle(QObject::tr("HOM_BOUN_D_EDIT_WINDOW_TITLE"));
44     try
45     {
46      aBoundary=myAdaptGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str()));
47      if (caseName==QString("")) { _aCaseName=aBoundary->GetCaseCreation();}
48      InitValEdit();
49     }
50     catch( SALOME::SALOME_Exception& S_ex )
51     {
52       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
53                                 QObject::tr(CORBA::string_dup(S_ex.details.text)) );
54       return;
55     }
56
57     ADAPT::ListGroupType_var maListe = aBoundary->GetGroups();
58     for ( int i = 0; i < maListe->length(); i++ )
59        _listeGroupesBoundary << QString(maListe[i]);
60
61 }
62 // ------------------------------
63 MonEditBoundaryDi::~MonEditBoundaryDi()
64 // ------------------------------
65 {
66 }
67 // ------------------------------
68 void MonEditBoundaryDi::InitValEdit()
69 // ------------------------------
70 {
71       LEName->setText(_aName);
72       LEName->setReadOnly(true);
73
74       QString aDataFile = aBoundary->GetDataFile();
75       LEFileName->setText(aDataFile);
76       LEFileName->setReadOnly(1);
77       PushFichier->setVisible(0);
78 //
79       adjustSize();
80 }
81 // ------------------------------
82 bool MonEditBoundaryDi::PushOnApply()
83 // ------------------------------
84 {
85      return true;
86 }
87 // ------------------------------------------------------------------------
88 void MonEditBoundaryDi::SetFiltrage()
89 // // ------------------------------------------------------------------------
90 {
91   if (!CBGroupe->isChecked()) return;
92   if (_aCaseName.toStdString().c_str() == QString())
93   {
94     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
95                               QObject::tr("HOM_BOUN_CASE") );
96     return;
97   }
98   ADAPT::HOMARD_Cas_var monCas= myAdaptGen->GetCase(_aCaseName.toStdString().c_str());
99   ADAPT::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
100
101   MonEditListGroup *aDlg = new MonEditListGroup(NULL, this, true, ADAPT::ADAPT_Gen::_duplicate(myAdaptGen),
102                             _aCaseName, _listeGroupesBoundary) ;
103   aDlg->show();
104 }
105