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