]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx
Salome HOME
7d51a886af358ff06e1b6da179f722489afb45e4
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_HomardBoundaryDlg.cxx
1 // Copyright (C) 2011-2021  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 "SMESHGUI_HomardBoundaryDlg.h"
21
22 #include "SMESHGUI_HomardAdaptDlg.h"
23 #include "SMESHGUI_HomardListGroup.h"
24
25 #include "SMESHGUI_Utils.h"
26
27 #include <QFileDialog>
28 #include <QMessageBox>
29
30 #include "SalomeApp_Tools.h"
31 #include "SMESHGUI_HomardUtils.h"
32 #include <utilities.h>
33
34 #include <SUIT_Desktop.h>
35 #include <SUIT_MessageBox.h>
36 #include <SUIT_ResourceMgr.h>
37 #include <SUIT_Session.h>
38 #include <SUIT_ViewManager.h>
39
40 #include "math.h"
41 #define PI 3.141592653589793
42
43 using namespace std;
44
45 // ----------------------------------------------------------------------------------
46 SMESH_CreateBoundaryAn::SMESH_CreateBoundaryAn(SMESHGUI_HomardAdaptDlg* parent, bool modal,
47                                          SMESHHOMARD::HOMARD_Gen_var myHomardGen0,
48                                          QString caseName) :
49 /* Constructs a SMESH_CreateBoundaryAn
50    appele pour une vraie creation
51    initialise un cylindre et non une sphere
52 */
53     QDialog(0), SMESH_Ui_CreateBoundaryAn(),
54     _parent(parent),
55     _Name (""),
56     _Type(1),
57     _BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0),
58     _BoundaryAnXaxis(0), _BoundaryAnYaxis(0), _BoundaryAnZaxis(0),
59     _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0),
60     _Xmin(0), _Xmax(0), _Xincr(0), _Ymin(0), _Ymax(0), _Yincr(0), _Zmin(0), _Zmax(0), _Zincr(0), _DMax(0),
61     _BoundaryAnXcone1(0), _BoundaryAnYcone1(0), _BoundaryAnZcone1(0), _BoundaryAnRayon1(0),
62     _BoundaryAnXcone2(0), _BoundaryAnYcone2(0), _BoundaryAnZcone2(0), _BoundaryAnRayon2(0),
63     _BoundaryAnXaxisCone(0), _BoundaryAnYaxisCone(0), _BoundaryAnZaxisCone(0),
64     _BoundaryAnXorigCone(0), _BoundaryAnYorigCone(0), _BoundaryAnZorigCone(0),
65     _BoundaryAngle(0),
66     _BoundaryAnToreXcentre(0), _BoundaryAnToreYcentre(0), _BoundaryAnToreZcentre(0),
67     _BoundaryAnToreXaxe(0), _BoundaryAnToreYaxe(0), _BoundaryAnToreZaxe(0),
68     _BoundaryAnToreRRev(0), _BoundaryAnToreRPri(0),
69     Chgt (false)
70     {
71       MESSAGE("Constructeur") ;
72       myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
73       setupUi(this);
74       setModal(modal);
75
76       // Gestion des icones
77       QPixmap pix ;
78       QIcon IS ;
79       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
80       pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" );
81       IS=QIcon(pix);
82       RBSphere->setIcon(IS);
83       pix = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" );
84       IS=QIcon(pix);
85       RBCylindre->setIcon(IS);
86       pix = resMgr->loadPixmap( "HOMARD", "cone.png" );
87       IS=QIcon(pix);
88       RBCone->setIcon(IS);
89       pix = resMgr->loadPixmap( "HOMARD", "conepointvector.png" );
90       IS=QIcon(pix);
91       RB_Def_angle->setIcon(IS);
92       pix = resMgr->loadPixmap( "HOMARD", "conedxyz.png" );
93       IS=QIcon(pix);
94       RB_Def_radius->setIcon(IS);
95       pix = resMgr->loadPixmap( "HOMARD", "toruspointvector.png" );
96       IS=QIcon(pix);
97       RBTore->setIcon(IS);
98
99       InitConnect( );
100
101       SetNewName() ;
102       InitValBoundaryAn();          // Cherche les valeurs de la boite englobante le maillage
103       InitMinMax();                 // Initialise les bornes des boutons
104       SetCylinder();                // Propose un cylindre en premier choix
105     }
106
107 // -------------------------------------------------------------------------------
108 SMESH_CreateBoundaryAn::SMESH_CreateBoundaryAn(SMESHGUI_HomardAdaptDlg* parent,
109                                          SMESHHOMARD::HOMARD_Gen_var myHomardGen0,
110                                          QString caseName):
111     QDialog(0), SMESH_Ui_CreateBoundaryAn(),
112     _parent(parent),
113     _Name (""),
114     _Type(1),
115     _BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0),
116     _BoundaryAnXaxis(0), _BoundaryAnYaxis(0), _BoundaryAnZaxis(0),
117     // Pour affichage lors de l edition d une BoundaryAn sans nom de Cas
118     _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0),
119     _Xmin(1), _Xmax(1), _Xincr(1), _Ymin(1), _Ymax(1), _Yincr(1), _Zmin(1), _Zmax(1), _Zincr(1), _DMax(1),
120      Chgt (false),
121      myHomardGen(myHomardGen0)
122     {
123   //  MESSAGE("Debut de  SMESH_CreateBoundaryAn")
124       setupUi(this);
125       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
126       QPixmap pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" );
127       QIcon IS=QIcon(pix);
128       RBSphere->setIcon(IS);
129       QPixmap pix2 = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" );
130       QIcon IS2=QIcon(pix2);
131       RBCylindre->setIcon(IS2);
132       QPixmap pix3 = resMgr->loadPixmap( "HOMARD", "cone.png" );
133       QIcon IS3=QIcon(pix3);
134       RBCone->setIcon(IS3);
135       QPixmap pix4 = resMgr->loadPixmap( "HOMARD", "conepointvector.png" );
136       QIcon IS4=QIcon(pix4);
137       RB_Def_angle->setIcon(IS4);
138       QPixmap pix5 = resMgr->loadPixmap( "HOMARD", "conedxyz.png" );
139       QIcon IS5=QIcon(pix5);
140       RB_Def_radius->setIcon(IS5);
141       setModal(true);
142       InitConnect();
143     }
144
145 // ------------------------------------------------------------------------
146 SMESH_CreateBoundaryAn::~SMESH_CreateBoundaryAn()
147 // ------------------------------------------------------------------------
148 {
149     // no need to delete child widgets, Qt does it all for us
150 }
151 // ------------------------------------------------------------------------
152 void SMESH_CreateBoundaryAn::InitConnect()
153 // ------------------------------------------------------------------------
154 {
155     connect( RBCylindre,    SIGNAL(clicked()) , this, SLOT(SetCylinder()) ) ;
156     connect( RBSphere,      SIGNAL(clicked()) , this, SLOT(SetSphere()) ) ;
157     connect( RBCone,        SIGNAL(clicked()) , this, SLOT(SetCone()) ) ;
158     connect( RB_Def_radius, SIGNAL(clicked()) , this, SLOT(SetConeR()) );
159     connect( RB_Def_angle,  SIGNAL(clicked()) , this, SLOT(SetConeA()) );
160     connect( RBTore,        SIGNAL(clicked()) , this, SLOT(SetTore()) ) ;
161     connect( buttonOk,     SIGNAL( pressed() ), this, SLOT( PushOnOK() ) );
162     connect( buttonApply,  SIGNAL( pressed() ), this, SLOT( PushOnApply() ) );
163     connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) );
164     connect( buttonHelp,   SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) );
165 }
166 // ------------------------------------------------------------------------
167 void SMESH_CreateBoundaryAn::InitValBoundaryAn()
168 // ------------------------------------------------------------------------
169 {
170   //
171   //  1. Les coordonnees extremes du maillage
172   //
173     SMESHHOMARD::HOMARD_Cas_var aCas = myHomardGen->GetCase();
174     SMESHHOMARD::extrema_var  MesExtremes = aCas->GetBoundingBox();
175     int num = MesExtremes->length() ;
176     ASSERT(num == 10);
177     _Xmin=MesExtremes[0]; _Xmax=MesExtremes[1]; _Xincr=MesExtremes[2];
178     _Ymin=MesExtremes[3]; _Ymax=MesExtremes[4]; _Yincr=MesExtremes[5];
179     _Zmin=MesExtremes[6]; _Zmax=MesExtremes[7]; _Zincr=MesExtremes[8];
180     _DMax=MesExtremes[9];
181      MESSAGE ("_Xmin : " << _Xmin << " _Xmax : " << _Xmax << " _Xincr : " << _Xincr ) ;
182      MESSAGE ("_Ymin : " << _Ymin << " _Ymax : " << _Ymax << " _Yincr : " << _Yincr ) ;
183      MESSAGE ("_Zmin : " << _Zmin << " _Zmax : " << _Zmax << " _Zincr : " << _Zincr) ;
184      MESSAGE ("_DMax : " << _DMax);
185
186 //  2. Caracteristiques des frontieres
187 // en X
188     _Xcentre=(_Xmin + _Xmax)/2.;
189 // en Y
190     _Ycentre=(_Ymin + _Ymax)/2.;
191 // en Z
192     _Zcentre=(_Zmin + _Zmax)/2.;
193 // Rayon
194     _Rayon= _DMax/4.;
195 }
196
197 // ------------------------------------------------------------------------
198 void SMESH_CreateBoundaryAn::InitMinMax()
199 // ------------------------------------------------------------------------
200 {
201   // Cylindre
202   // . X du centre
203   SpinBox_Xcent->setValue(_Xcentre);
204   SpinBox_Xcent->setSingleStep(_Xincr);
205   // . Y du centre
206   SpinBox_Ycent->setValue(_Ycentre);
207   SpinBox_Ycent->setSingleStep(_Yincr);
208   // . Z du centre
209   SpinBox_Zcent->setValue(_Zcentre);
210   SpinBox_Zcent->setSingleStep(_Zincr);
211   // . X de l'axe
212   SpinBox_Xaxis->setValue(0.);
213   SpinBox_Xaxis->setSingleStep(0.1);
214   // . Y de l'axe
215   SpinBox_Yaxis->setValue(0.);
216   SpinBox_Yaxis->setSingleStep(0.1);
217   // . Z de l'axe
218   SpinBox_Zaxis->setValue(1.);
219   SpinBox_Zaxis->setSingleStep(0.1);
220   // . Rayon
221   SpinBox_Radius->setValue(_Rayon);
222   SpinBox_Radius->setSingleStep(_Rayon/10.);
223
224   // Sphere
225   // . X du centre
226   SpinBox_Xcentre->setValue(_Xcentre);
227   SpinBox_Xcentre->setSingleStep(_Xincr);
228   // . Y du centre
229   SpinBox_Ycentre->setValue(_Ycentre);
230   SpinBox_Ycentre->setSingleStep(_Yincr);
231   // . Z du centre
232   SpinBox_Zcentre->setValue(_Zcentre);
233   SpinBox_Zcentre->setSingleStep(_Zincr);
234   // . Rayon
235   SpinBox_Rayon->setValue(_Rayon);
236   SpinBox_Rayon->setSingleStep(_Rayon/10.);
237
238   // Cone en rayons
239   // . X des centres
240   _BoundaryAnXcone1 = _Xcentre ;
241   SpinBox_Cone_X1->setSingleStep(_Xincr);
242   _BoundaryAnXcone2 = _Xcentre ;
243   SpinBox_Cone_X2->setSingleStep(_Xincr);
244   // . Y des centres
245   _BoundaryAnYcone1 = _Ycentre ;
246   SpinBox_Cone_Y1->setSingleStep(_Yincr);
247   _BoundaryAnYcone2 = _Ycentre ;
248   SpinBox_Cone_Y2->setSingleStep(_Yincr);
249   // . Z des centres
250   _BoundaryAnZcone1 = _Zmin ;
251   SpinBox_Cone_Z1->setSingleStep(_Zincr);
252   _BoundaryAnZcone2 = _Zmax ;
253   SpinBox_Cone_Z2->setSingleStep(_Zincr);
254   // . Rayons/Angles
255   _BoundaryAnRayon1 = 0. ;
256   _BoundaryAnRayon2 = _Rayon ;
257   SpinBox_Cone_V2->setSingleStep(_Rayon/10.);
258
259   // Cone en angle
260   convertRayonAngle(1) ;
261   SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone);
262   SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone);
263   SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone);
264   SpinBox_Cone_V1->setValue(_BoundaryAngle);
265   SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone);
266   SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone);
267   SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone);
268
269   // Tore
270   // . X du centre
271   SpinBoxToreXcent->setValue(_Xcentre);
272   SpinBoxToreXcent->setSingleStep(_Xincr);
273   // . Y du centre
274   SpinBoxToreYcent->setValue(_Ycentre);
275   SpinBoxToreYcent->setSingleStep(_Yincr);
276   // . Z du centre
277   SpinBoxToreZcent->setValue(_Zcentre);
278   SpinBoxToreZcent->setSingleStep(_Zincr);
279   // . X de l'axe
280   SpinBoxToreXaxe->setValue(0.);
281   SpinBoxToreXaxe->setSingleStep(0.1);
282   // . Y de l'axe
283   SpinBoxToreYaxe->setValue(0.);
284   SpinBoxToreYaxe->setSingleStep(0.1);
285   // . Z de l'axe
286   SpinBoxToreZaxe->setValue(1.);
287   SpinBoxToreZaxe->setSingleStep(0.1);
288   // . Rayon de revolution
289   SpinBoxToreRRev->setValue(_Rayon);
290   SpinBoxToreRRev->setSingleStep(_Rayon/10.);
291   // . Rayon primaire
292   SpinBoxToreRPri->setValue(_Rayon/3.);
293   SpinBoxToreRPri->setSingleStep(_Rayon/20.);
294 }
295 // ------------------------------------------------------------------------
296 bool SMESH_CreateBoundaryAn::PushOnApply()
297 // ------------------------------------------------------------------------
298 // Appele lorsque l'un des boutons Ok ou Apply est presse
299 //
300 {
301   if (LEName->text().trimmed()=="")
302   {
303     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
304                               QObject::tr("HOM_BOUN_NAME") );
305     return false;
306   }
307
308   switch (_Type)
309   {
310       case 1 : // il s agit d un cylindre
311       {
312         if ((_BoundaryAnXcentre != SpinBox_Xcent->value())  ||
313             (_BoundaryAnYcentre != SpinBox_Ycent->value())  ||
314             (_BoundaryAnZcentre != SpinBox_Zcent->value())  ||
315             (_BoundaryAnRayon   != SpinBox_Radius->value()) ||
316             (_BoundaryAnXaxis   != SpinBox_Xaxis->value()) ||
317             (_BoundaryAnYaxis   != SpinBox_Yaxis->value()) ||
318             (_BoundaryAnZaxis   != SpinBox_Zaxis->value()) )
319         {
320           Chgt = true;
321           _BoundaryAnXaxis= SpinBox_Xaxis->value();
322           _BoundaryAnYaxis= SpinBox_Yaxis->value();
323           _BoundaryAnZaxis= SpinBox_Zaxis->value();
324           _BoundaryAnXcentre=SpinBox_Xcent->value();
325           _BoundaryAnYcentre=SpinBox_Ycent->value();
326           _BoundaryAnZcentre=SpinBox_Zcent->value();
327           _BoundaryAnRayon=SpinBox_Radius->value();
328         }
329         break;
330       }
331
332       case 2 : // il s agit d une sphere
333       {
334         if ((_BoundaryAnXcentre != SpinBox_Xcentre->value()) ||
335             (_BoundaryAnYcentre != SpinBox_Ycentre->value()) ||
336             (_BoundaryAnZcentre != SpinBox_Zcentre->value()) ||
337             (_BoundaryAnRayon   != SpinBox_Rayon->value())  )
338         {
339            Chgt = true;
340           _BoundaryAnXcentre=SpinBox_Xcentre->value();
341           _BoundaryAnYcentre=SpinBox_Ycentre->value();
342           _BoundaryAnZcentre=SpinBox_Zcentre->value();
343           _BoundaryAnRayon=SpinBox_Rayon->value();
344         }
345         break;
346       }
347
348       case 3 : // il s agit d un cone defini par un axe et un angle
349       {
350         if ((_BoundaryAnXaxisCone != SpinBox_Cone_X1->value())  ||
351             (_BoundaryAnYaxisCone != SpinBox_Cone_Y1->value())  ||
352             (_BoundaryAnZaxisCone != SpinBox_Cone_Z1->value())  ||
353             (_BoundaryAnXorigCone != SpinBox_Cone_X2->value())  ||
354             (_BoundaryAnYorigCone != SpinBox_Cone_Y2->value())  ||
355             (_BoundaryAnZorigCone != SpinBox_Cone_Z2->value())  ||
356             (_BoundaryAngle       != SpinBox_Cone_V1->value()) )
357         {
358            Chgt = true;
359           _BoundaryAnXaxisCone = SpinBox_Cone_X1->value() ;
360           _BoundaryAnYaxisCone = SpinBox_Cone_Y1->value() ;
361           _BoundaryAnZaxisCone = SpinBox_Cone_Z1->value() ;
362           _BoundaryAnXorigCone = SpinBox_Cone_X2->value() ;
363           _BoundaryAnYorigCone = SpinBox_Cone_Y2->value() ;
364           _BoundaryAnZorigCone = SpinBox_Cone_Z2->value() ;
365           _BoundaryAngle       = SpinBox_Cone_V1->value() ;
366         }
367         break;
368       }
369
370       case 4 : // il s agit d un cone defini par les 2 rayons
371       {
372         if ((_BoundaryAnXcone1 != SpinBox_Cone_X1->value())  ||
373             (_BoundaryAnYcone1 != SpinBox_Cone_Y1->value())  ||
374             (_BoundaryAnZcone1 != SpinBox_Cone_Z1->value())  ||
375             (_BoundaryAnRayon1 != SpinBox_Cone_V1->value())  ||
376             (_BoundaryAnXcone2 != SpinBox_Cone_X2->value())  ||
377             (_BoundaryAnYcone2 != SpinBox_Cone_Y2->value())  ||
378             (_BoundaryAnZcone2 != SpinBox_Cone_Z2->value())  ||
379             (_BoundaryAnRayon2 != SpinBox_Cone_V2->value()) )
380         {
381            Chgt = true;
382           _BoundaryAnXcone1 = SpinBox_Cone_X1->value() ;
383           _BoundaryAnYcone1 = SpinBox_Cone_Y1->value() ;
384           _BoundaryAnZcone1 = SpinBox_Cone_Z1->value() ;
385           _BoundaryAnRayon1 = SpinBox_Cone_V1->value() ;
386           _BoundaryAnXcone2 = SpinBox_Cone_X2->value() ;
387           _BoundaryAnYcone2 = SpinBox_Cone_Y2->value() ;
388           _BoundaryAnZcone2 = SpinBox_Cone_Z2->value() ;
389           _BoundaryAnRayon2 = SpinBox_Cone_V2->value() ;
390         }
391         break;
392       }
393       case 5 : // il s agit d un tore
394       {
395         if ((_BoundaryAnToreXcentre != SpinBoxToreXcent->value())  ||
396             (_BoundaryAnToreYcentre != SpinBoxToreYcent->value())  ||
397             (_BoundaryAnToreZcentre != SpinBoxToreZcent->value())  ||
398             (_BoundaryAnToreRRev   != SpinBoxToreRRev->value()) ||
399             (_BoundaryAnToreRPri   != SpinBoxToreRPri->value()) ||
400             (_BoundaryAnToreXaxe   != SpinBoxToreXaxe->value()) ||
401             (_BoundaryAnToreYaxe   != SpinBoxToreYaxe->value()) ||
402             (_BoundaryAnToreZaxe   != SpinBoxToreZaxe->value()) )
403         {
404           Chgt = true;
405           _BoundaryAnToreXcentre= SpinBoxToreXcent->value();
406           _BoundaryAnToreYcentre= SpinBoxToreYcent->value();
407           _BoundaryAnToreZcentre= SpinBoxToreZcent->value();
408           _BoundaryAnToreRRev=SpinBoxToreRRev->value();
409           _BoundaryAnToreRPri=SpinBoxToreRPri->value();
410           _BoundaryAnToreXaxe=SpinBoxToreXaxe->value();
411           _BoundaryAnToreYaxe=SpinBoxToreYaxe->value();
412           _BoundaryAnToreZaxe=SpinBoxToreZaxe->value();
413         }
414         break;
415       }
416
417  }
418
419 // Controles
420 // L'axe pour un cylindre
421   if ( _Type == 5 )
422   {
423     double daux = _BoundaryAnXaxis*_BoundaryAnXaxis + _BoundaryAnYaxis*_BoundaryAnYaxis + _BoundaryAnZaxis*_BoundaryAnZaxis ;
424     if ( daux < 0.0000001 )
425     {
426       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
427                                 QObject::tr("HOM_AXE") );
428       return false;
429     }
430   }
431
432   //
433   // Création ou mise à jour de la frontière
434   //
435   bool bOK = CreateOrUpdateBoundaryAn();
436
437   //if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; }
438
439   return bOK;
440
441 }
442 // ---------------------------------------------------
443 bool SMESH_CreateBoundaryAn::CreateOrUpdateBoundaryAn()
444 //----------------------------------------------------
445 //  Creation de l'objet boundary
446 {
447   MESSAGE("Debut de CreateOrUpdateBoundaryAn avec _Type ="<<_Type<<", _Name ="<<_Name.toStdString().c_str()<<" et LEName ="<<LEName->text().trimmed().toStdString().c_str());
448 //
449   if (_Name != LEName->text().trimmed())
450   {
451     _Name = LEName->text().trimmed() ;
452     try
453     {
454       switch (_Type)
455       {
456         case 1 : // il s agit d un cylindre
457         { aBoundaryAn = myHomardGen->CreateBoundaryCylinder(CORBA::string_dup(_Name.toStdString().c_str()), \
458             _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon );
459           break;
460         }
461         case 2 : // il s agit d une sphere
462         { aBoundaryAn = myHomardGen->CreateBoundarySphere(CORBA::string_dup(_Name.toStdString().c_str()), \
463             _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon);
464           break;
465        }
466         case 3 : // il s agit d un cone defini par un axe et un angle
467         { aBoundaryAn = myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_Name.toStdString().c_str()), \
468             _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone, _BoundaryAngle, \
469             _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnYorigCone);
470           break;
471         }
472         case 4 : // il s agit d un cone defini par les 2 rayons
473         { aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_Name.toStdString().c_str()), \
474             _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \
475             _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2);
476           break;
477         }
478         case 5 : // il s agit d un tore
479         { aBoundaryAn = myHomardGen->CreateBoundaryTorus(CORBA::string_dup(_Name.toStdString().c_str()), \
480             _BoundaryAnToreXcentre, _BoundaryAnToreYcentre, _BoundaryAnToreZcentre, _BoundaryAnToreXaxe, _BoundaryAnToreYaxe, _BoundaryAnToreZaxe, _BoundaryAnToreRRev, _BoundaryAnToreRPri );
481           break;
482         }
483       }
484     }
485     catch( SALOME::SALOME_Exception& S_ex )
486     {
487       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
488                                 QObject::tr(CORBA::string_dup(S_ex.details.text)) );
489       return false ;
490     }
491     _parent->AddBoundaryAn(_Name);
492
493     return true;
494   }
495   else {
496     QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
497                              QObject::tr("HOM_SELECT_OBJECT_4") );
498     return false ;
499   }
500   MESSAGE("Fin de CreateOrUpdateBoundaryAn");
501 }
502 // ------------------------------------------------------------------------
503 void SMESH_CreateBoundaryAn::PushOnOK()
504 // ------------------------------------------------------------------------
505 {
506      if (PushOnApply()) this->close();
507 }
508 // ------------------------------------------------------------------------
509 void SMESH_CreateBoundaryAn::PushOnHelp()
510 // ------------------------------------------------------------------------
511 {
512   SMESH::ShowHelpFile(QString("gui_create_boundary.html"));
513   //std::string LanguageShort = myHomardGen->GetLanguageShort();
514   //HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("un-cylindre"), QString(LanguageShort.c_str()));
515 }
516
517 // -----------------------------------
518 void SMESH_CreateBoundaryAn::SetNewName()
519 // -----------------------------------
520 {
521 // Recherche d'un nom par defaut qui n'existe pas encore
522
523   SMESHHOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName();
524   int num = 0; QString aName="";
525   while (aName=="" )
526   {
527     aName.setNum(num+1) ;
528     aName.insert(0, QString("Boun_")) ;
529     for ( int i=0; i<MyObjects->length(); i++)
530     {
531       if ( aName ==  QString(MyObjects[i]))
532       {
533         num ++ ;
534         aName = "" ;
535         break ;
536       }
537    }
538   }
539   LEName->setText(aName);
540 }
541 // ------------------------------------------------------------------------
542 void SMESH_CreateBoundaryAn::SetCylinder()
543 // ------------------------------------------------------------------------
544 {
545   MESSAGE("Debut de SetCylinder")
546   gBCylindre->setVisible(1);
547   gBSphere->setVisible(0);
548   gBCone->setVisible(0);
549   gBTore->setVisible(0);
550 //
551   _Type=1;
552 //
553   adjustSize();
554 //   MESSAGE("Fin de SetCylinder")
555 }
556 // ------------------------------------------------------------------------
557 void SMESH_CreateBoundaryAn::SetSphere()
558 // ------------------------------------------------------------------------
559 {
560   MESSAGE("Debut de SetSphere")
561   gBCylindre->setVisible(0);
562   gBSphere->setVisible(1);
563   gBCone->setVisible(0);
564   gBTore->setVisible(0);
565 //
566   _Type=2;
567 //
568   adjustSize();
569 //   MESSAGE("Fin de SetSphere")
570 }
571 // ------------------------------------------------------------------------
572 void SMESH_CreateBoundaryAn::SetConeR()
573 // ------------------------------------------------------------------------
574 {
575   MESSAGE("Debut de SetConeR")
576 //
577 // Stockage et conversion des valeurs si elles ont change
578   if ((_BoundaryAnXaxisCone != SpinBox_Cone_X1->value())  ||
579       (_BoundaryAnYaxisCone != SpinBox_Cone_Y1->value())  ||
580       (_BoundaryAnZaxisCone != SpinBox_Cone_Z1->value())  ||
581       (_BoundaryAnXorigCone != SpinBox_Cone_X2->value())  ||
582       (_BoundaryAnYorigCone != SpinBox_Cone_Y2->value())  ||
583       (_BoundaryAnZorigCone != SpinBox_Cone_Z2->value())  ||
584       (_BoundaryAngle       != SpinBox_Cone_V1->value()) )
585   {
586     MESSAGE("Stockage et conversion")
587     _BoundaryAnXaxisCone = SpinBox_Cone_X1->value() ;
588     _BoundaryAnYaxisCone = SpinBox_Cone_Y1->value() ;
589     _BoundaryAnZaxisCone = SpinBox_Cone_Z1->value() ;
590     _BoundaryAnXorigCone = SpinBox_Cone_X2->value() ;
591     _BoundaryAnYorigCone = SpinBox_Cone_Y2->value() ;
592     _BoundaryAnZorigCone = SpinBox_Cone_Z2->value() ;
593     _BoundaryAngle       = SpinBox_Cone_V1->value() ;
594     convertRayonAngle(-1) ;
595   }
596 //
597   _Type=4;
598 //
599   TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X centre 1", 0));
600   SpinBox_Cone_X1->setValue(_BoundaryAnXcone1);
601   TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y centre 1", 0));
602   SpinBox_Cone_Y1->setValue(_BoundaryAnYcone1);
603   TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z centre 1", 0));
604   SpinBox_Cone_Z1->setValue(_BoundaryAnZcone1);
605 //
606   TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Radius 1", 0));
607   SpinBox_Cone_V1->setSingleStep(_Rayon/10.);
608   SpinBox_Cone_V1->setMaximum(100000.*_DMax);
609   SpinBox_Cone_V1->setValue(_BoundaryAnRayon1);
610 //
611   TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre 2", 0));
612   SpinBox_Cone_X2->setValue(_BoundaryAnXcone2);
613   TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre 2", 0));
614   SpinBox_Cone_Y2->setValue(_BoundaryAnYcone2);
615   TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre 2", 0));
616   SpinBox_Cone_Z2->setValue(_BoundaryAnZcone2);
617 //
618   TLCone_V2->setVisible(1);
619   SpinBox_Cone_V2->setVisible(1);
620   TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0));
621   SpinBox_Cone_V2->setValue(_BoundaryAnRayon2);
622 //
623 //   MESSAGE("Fin de SetConeR")
624 }
625 // ------------------------------------------------------------------------
626 void SMESH_CreateBoundaryAn::SetConeA()
627 // ------------------------------------------------------------------------
628 {
629   MESSAGE("Debut de SetConeA")
630 // Stockage et conversion des valeurs si elles ont change
631   if ((_BoundaryAnXcone1 != SpinBox_Cone_X1->value())  ||
632       (_BoundaryAnYcone1 != SpinBox_Cone_Y1->value())  ||
633       (_BoundaryAnZcone1 != SpinBox_Cone_Z1->value())  ||
634       (_BoundaryAnRayon1 != SpinBox_Cone_V1->value())  ||
635       (_BoundaryAnXcone2 != SpinBox_Cone_X2->value())  ||
636       (_BoundaryAnYcone2 != SpinBox_Cone_Y2->value())  ||
637       (_BoundaryAnZcone2 != SpinBox_Cone_Z2->value())  ||
638       (_BoundaryAnRayon2 != SpinBox_Cone_V2->value()) )
639   {
640     MESSAGE("Stockage et conversion")
641     _BoundaryAnXcone1 = SpinBox_Cone_X1->value() ;
642     _BoundaryAnYcone1 = SpinBox_Cone_Y1->value() ;
643     _BoundaryAnZcone1 = SpinBox_Cone_Z1->value() ;
644     _BoundaryAnRayon1 = SpinBox_Cone_V1->value() ;
645     _BoundaryAnXcone2 = SpinBox_Cone_X2->value() ;
646     _BoundaryAnYcone2 = SpinBox_Cone_Y2->value() ;
647     _BoundaryAnZcone2 = SpinBox_Cone_Z2->value() ;
648     _BoundaryAnRayon2 = SpinBox_Cone_V2->value() ;
649     convertRayonAngle(1) ;
650   }
651 //
652   _Type=3;
653 //
654   TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X axis", 0));
655   SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone);
656   TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y axis", 0));
657   SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone);
658   TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z axis", 0));
659   SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone);
660 //
661   TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre", 0));
662   SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone);
663   TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre", 0));
664   SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone);
665   TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre", 0));
666   SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone);
667 //
668   TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Angle", 0));
669   SpinBox_Cone_V1->setValue(_BoundaryAngle);
670   SpinBox_Cone_V1->setSingleStep(1.);
671   SpinBox_Cone_V1->setMaximum(90.);
672 //
673   TLCone_V2->setVisible(0);
674   SpinBox_Cone_V2->setVisible(0);
675 //   MESSAGE("Fin de SetConeA")
676 }
677
678
679 // ------------------------------------------------------------------------
680 void SMESH_CreateBoundaryAn::SetCone()
681 // ------------------------------------------------------------------------
682 {
683   MESSAGE("Debut de SetCone")
684   gBCylindre->setVisible(0);
685   gBSphere->setVisible(0);
686   gBCone->setVisible(1);
687   gBTore->setVisible(0);
688 //
689   if ( RB_Def_radius->isChecked() )
690   {
691     SetConeR();
692   }
693   else
694   {
695     SetConeA();
696   }
697 //
698   adjustSize();
699 //   MESSAGE("Fin de SetCone")
700 }
701 // ------------------------------------------------------------------------
702 void SMESH_CreateBoundaryAn::SetTore()
703 // ------------------------------------------------------------------------
704 {
705   MESSAGE("Debut de SetTore")
706   gBCylindre->setVisible(0);
707   gBSphere->setVisible(0);
708   gBCone->setVisible(0);
709   gBTore->setVisible(1);
710 //
711   _Type=5;
712 //
713   adjustSize();
714 //   MESSAGE("Fin de SetTore")
715 }
716 // ------------------------------------------------------------------------
717 void SMESH_CreateBoundaryAn::convertRayonAngle(int option)
718 // ------------------------------------------------------------------------
719 // Conversion entre les deux formulations du cone :
720 // par deux rayons ou avec un axe et un angle.
721 // Voir sfcoi1 de HOMARD
722 {
723   MESSAGE("Debut de convertRayonAngle, option = "<<option)
724 //
725 //         o
726 //         !    .
727 //         !        .
728 //       RA!            .
729 //         !                o
730 //         !              RB!   .
731 //         !                !       .
732 //         A----------------B----------O
733 //
734 //   Thales : RA/RB = AO/BO  ==> BO = AB*RB/(RA-RB)
735 //   Angle  : tg(alpha) = RA/AO
736 //
737   double daux ;
738 // De rayon vers angle :
739   if ( option == 1 )
740   {
741     double xa, ya, za, ra ;
742     double xb, yb, zb, rb ;
743 // Positionnement de A vers B, avec RA>RB
744     if ( _BoundaryAnRayon1 > _BoundaryAnRayon2 )
745     {
746       xa = _BoundaryAnXcone1 ;
747       ya = _BoundaryAnYcone1 ;
748       za = _BoundaryAnZcone1 ;
749       ra = _BoundaryAnRayon1 ;
750       xb = _BoundaryAnXcone2 ;
751       yb = _BoundaryAnYcone2 ;
752       zb = _BoundaryAnZcone2 ;
753       rb = _BoundaryAnRayon2 ;
754     }
755     else
756     {
757       xa = _BoundaryAnXcone2 ;
758       ya = _BoundaryAnYcone2 ;
759       za = _BoundaryAnZcone2 ;
760       ra = _BoundaryAnRayon2 ;
761       xb = _BoundaryAnXcone1 ;
762       yb = _BoundaryAnYcone1 ;
763       zb = _BoundaryAnZcone1 ;
764       rb = _BoundaryAnRayon1 ;
765     }
766 // Axe : relie les deux centres, de A vers B.  L'axe est normalise
767     _BoundaryAnXaxisCone = xb - xa ;
768     _BoundaryAnYaxisCone = yb - ya ;
769     _BoundaryAnZaxisCone = zb - za ;
770     daux = sqrt ( _BoundaryAnXaxisCone*_BoundaryAnXaxisCone + _BoundaryAnYaxisCone*_BoundaryAnYaxisCone + _BoundaryAnZaxisCone*_BoundaryAnZaxisCone ) ;
771     _BoundaryAnXaxisCone = _BoundaryAnXaxisCone/daux ;
772     _BoundaryAnYaxisCone = _BoundaryAnYaxisCone/daux ;
773     _BoundaryAnZaxisCone = _BoundaryAnZaxisCone/daux ;
774 // Origine
775     daux = daux * rb / (ra-rb) ;
776     _BoundaryAnXorigCone = xb + daux*_BoundaryAnXaxisCone ;
777     _BoundaryAnYorigCone = yb + daux*_BoundaryAnYaxisCone ;
778     _BoundaryAnZorigCone = zb + daux*_BoundaryAnZaxisCone ;
779 // Angle en degre
780     daux = ra / sqrt((_BoundaryAnXorigCone-xa)*(_BoundaryAnXorigCone-xa) + (_BoundaryAnYorigCone-ya)*(_BoundaryAnYorigCone-ya) + (_BoundaryAnZorigCone-za)*(_BoundaryAnZorigCone-za) ) ;
781     _BoundaryAngle = atan(daux)*180./PI ;
782   }
783 // D'angle vers rayon :
784   else
785   {
786     double xax, yax, zax ;
787 // L'axe est normalise
788     daux = sqrt ( _BoundaryAnXaxisCone*_BoundaryAnXaxisCone + _BoundaryAnYaxisCone*_BoundaryAnYaxisCone + _BoundaryAnZaxisCone*_BoundaryAnZaxisCone ) ;
789     xax = _BoundaryAnXaxisCone/daux ;
790     yax = _BoundaryAnYaxisCone/daux ;
791     zax = _BoundaryAnZaxisCone/daux ;
792 // Centre 1 : l'origine
793     _BoundaryAnXcone1 = _BoundaryAnXorigCone ;
794     _BoundaryAnYcone1 = _BoundaryAnYorigCone ;
795     _BoundaryAnZcone1 = _BoundaryAnZorigCone ;
796 // Rayon 1 : nul
797     _BoundaryAnRayon1 = 0. ;
798 // Centre 2 : l'origine decalee d'une longueur arbitraire le long de l'axe
799     _BoundaryAnXcone2 = _BoundaryAnXorigCone + _DMax*xax ;
800     _BoundaryAnYcone2 = _BoundaryAnYorigCone + _DMax*yax ;
801     _BoundaryAnZcone2 = _BoundaryAnZorigCone + _DMax*zax ;
802 // Rayon 2 : a calculer
803     _BoundaryAnRayon2 = _DMax*tan(_BoundaryAngle*PI/180.) ;
804   }
805 //   MESSAGE("Fin de convertRayonAngle")
806 }
807
808 // -------------------------------------------------------------------------------
809 SMESH_CreateBoundaryCAO::SMESH_CreateBoundaryCAO(SMESHGUI_HomardAdaptDlg* parent, bool modal,
810                                            SMESHHOMARD::HOMARD_Gen_var myHomardGen0,
811                                            QString caseName, QString aName)
812 // ---------------------------------------------------------------------------------
813 /* Constructs a SMESH_CreateBoundaryCAO */
814     :
815     QDialog(0), SMESH_Ui_CreateBoundaryCAO(),
816     _parent(parent), _aName(aName),
817     myHomardGen(SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0))
818     {
819       MESSAGE("Constructeur") ;
820       setupUi(this);
821       setModal(modal);
822       InitConnect();
823
824      if ( _aName == QString("") ) {SetNewName();};
825     }
826
827 // ------------------------------------------------------------------------
828 SMESH_CreateBoundaryCAO::~SMESH_CreateBoundaryCAO()
829 // ------------------------------------------------------------------------
830 {
831     // no need to delete child widgets, Qt does it all for us
832 }
833 // ------------------------------------------------------------------------
834 void SMESH_CreateBoundaryCAO::InitConnect()
835 // ------------------------------------------------------------------------
836 {
837     connect( PushFichier,  SIGNAL(pressed()), this, SLOT(SetCAOFile()));
838     connect( buttonOk,     SIGNAL(pressed()), this, SLOT( PushOnOK()));
839     connect( buttonApply,  SIGNAL(pressed()), this, SLOT( PushOnApply()));
840     connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
841     connect( buttonHelp,   SIGNAL(pressed()), this, SLOT( PushOnHelp()));
842     connect( CBGroupe,     SIGNAL(stateChanged(int)), this, SLOT( SetFiltrage()));
843 }
844
845 // ------------------------------------------------------------------------
846 bool SMESH_CreateBoundaryCAO::PushOnApply()
847 // ------------------------------------------------------------------------
848 // Appele lorsque l'un des boutons Ok ou Apply est presse
849 //
850 {
851 // Verifications
852
853   QString aName=LEName->text().trimmed();
854   if (aName=="") {
855     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
856                               QObject::tr("HOM_BOUN_NAME") );
857     return false;
858   }
859
860 //  La CAO
861   QString aCAOFile=LEFileName->text().trimmed();
862   if (aCAOFile ==QString(""))
863   {
864     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
865                               QObject::tr("HOM_BOUN_CAO") );
866     return false;
867   }
868
869 // Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
870   if ( _aName != aName )
871   {
872    try
873    {
874      _aName=aName;
875      aBoundary=myHomardGen->CreateBoundaryCAO(CORBA::string_dup(_aName.toStdString().c_str()), aCAOFile.toStdString().c_str());
876      _parent->AddBoundaryCAO(_aName);
877      aBoundary->SetCaseCreation("Case_1");
878    }
879    catch( SALOME::SALOME_Exception& S_ex )
880    {
881       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
882                                 QObject::tr(CORBA::string_dup(S_ex.details.text)) );
883       return false;
884    }
885   }
886
887 // Les groupes
888   AssocieLesGroupes();
889
890   //HOMARD_UTILS::updateObjBrowser();
891   return true;
892 }
893
894
895 // ------------------------------------------------------------------------
896 void SMESH_CreateBoundaryCAO::PushOnOK()
897 // ------------------------------------------------------------------------
898 {
899      if (PushOnApply()) this->close();
900      if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
901 }
902 // ------------------------------------------------------------------------
903 void SMESH_CreateBoundaryCAO::PushOnHelp()
904 // ------------------------------------------------------------------------
905 {
906   SMESH::ShowHelpFile(QString("gui_create_boundary.html"));
907   //std::string LanguageShort = myHomardGen->GetLanguageShort();
908   //HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str()));
909 }
910 // ------------------------------------------------------------------------
911 void SMESH_CreateBoundaryCAO::AssocieLesGroupes()
912 // ------------------------------------------------------------------------
913 {
914   SMESHHOMARD::ListGroupType_var aSeqGroupe = new SMESHHOMARD::ListGroupType;
915   aSeqGroupe->length(_listeGroupesBoundary.size());
916   QStringList::const_iterator it;
917   int i=0;
918   for (it = _listeGroupesBoundary.constBegin(); it != _listeGroupesBoundary.constEnd(); it++)
919      aSeqGroupe[i++]=(*it).toStdString().c_str();
920   aBoundary->SetGroups(aSeqGroupe);
921
922 }
923
924 // -------------------------------------------------
925 void SMESH_CreateBoundaryCAO::SetNewName()
926 // --------------------------------------------------
927 {
928
929   SMESHHOMARD::listeBoundarys_var  MyObjects = myHomardGen->GetAllBoundarysName();
930   int num = 0; QString aName="";
931   while (aName == QString("") )
932   {
933     aName.setNum(num+1) ;
934     aName.insert(0, QString("Boun_")) ;
935     for ( int i=0; i<MyObjects->length(); i++)
936     {
937       if ( aName ==  QString(MyObjects[i]))
938       {
939         num ++ ;
940         aName = "" ;
941         break ;
942       }
943    }
944   }
945   LEName->setText(aName);
946 }
947 // ------------------------------------------------------------------------
948 void SMESH_CreateBoundaryCAO::SetCAOFile()
949 // ------------------------------------------------------------------------
950 {
951   QString aCAOFile = SMESH_HOMARD_QT_COMMUN::PushNomFichier( false, QString("xao") );
952   if (!(aCAOFile.isEmpty())) LEFileName->setText(aCAOFile);
953 }
954
955 // ------------------------------------------------------------------------
956 void SMESH_CreateBoundaryCAO::setGroups (QStringList listGroup)
957 // ------------------------------------------------------------------------
958 {
959     _listeGroupesBoundary = listGroup;
960 }
961 // ------------------------------------------------------------------------
962 void SMESH_CreateBoundaryCAO::SetFiltrage()
963 // // ------------------------------------------------------------------------
964 {
965   if (!CBGroupe->isChecked()) return;
966
967   SMESH_CreateListGroupCAO *aDlg = new SMESH_CreateListGroupCAO
968     (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen),
969      "Case_1", _listeGroupesBoundary);
970   aDlg->show();
971 }
972
973 // -------------------------------------------------------------------------------
974 SMESH_CreateBoundaryDi::SMESH_CreateBoundaryDi(SMESHGUI_HomardAdaptDlg* parent, bool modal,
975                                          SMESHHOMARD::HOMARD_Gen_var myHomardGen0,
976                                          QString caseName, QString aName)
977 // ---------------------------------------------------------------------------------
978 /* Constructs a SMESH_CreateBoundaryDi */
979     :
980     QDialog(0), SMESH_Ui_CreateBoundaryDi(),
981     _parent(parent), _aName(aName),
982     myHomardGen(SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0))
983     {
984       MESSAGE("Constructeur") ;
985       setupUi(this);
986       setModal(modal);
987       InitConnect();
988
989      if ( _aName == QString("") ) {SetNewName();};
990     }
991
992 // ------------------------------------------------------------------------
993 SMESH_CreateBoundaryDi::~SMESH_CreateBoundaryDi()
994 // ------------------------------------------------------------------------
995 {
996     // no need to delete child widgets, Qt does it all for us
997 }
998 // ------------------------------------------------------------------------
999 void SMESH_CreateBoundaryDi::InitConnect()
1000 // ------------------------------------------------------------------------
1001 {
1002     connect( PushFichier,  SIGNAL(pressed()), this, SLOT(SetMeshFile()));
1003     connect( buttonOk,     SIGNAL(pressed()), this, SLOT( PushOnOK()));
1004     connect( buttonApply,  SIGNAL(pressed()), this, SLOT( PushOnApply()));
1005     connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
1006     connect( buttonHelp,   SIGNAL(pressed()), this, SLOT( PushOnHelp()));
1007     connect( CBGroupe,     SIGNAL(stateChanged(int)), this, SLOT( SetFiltrage()));
1008 }
1009
1010 // ------------------------------------------------------------------------
1011 bool SMESH_CreateBoundaryDi::PushOnApply()
1012 // ------------------------------------------------------------------------
1013 // Appele lorsque l'un des boutons Ok ou Apply est presse
1014 //
1015 {
1016 // Verifications
1017
1018   QString aName=LEName->text().trimmed();
1019   if (aName=="") {
1020     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
1021                               QObject::tr("HOM_BOUN_NAME") );
1022     return false;
1023   }
1024
1025 //  Le maillage de la frontiere discrete
1026   QString aMeshFile=LEFileName->text().trimmed();
1027   if (aMeshFile ==QString(""))
1028   {
1029     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
1030                               QObject::tr("HOM_BOUN_MESH") );
1031     return false;
1032   }
1033
1034   //  Le nom du maillage de la frontiere discrete
1035   QString aMeshName = SMESH_HOMARD_QT_COMMUN::LireNomMaillage(aMeshFile);
1036   if (aMeshName == "" )
1037   {
1038     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
1039                               QObject::tr("HOM_MED_FILE_2") );
1040     return false;
1041   }
1042
1043 // Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
1044   if ( _aName != aName )
1045   {
1046    try
1047    {
1048      _aName=aName;
1049      aBoundary=myHomardGen->CreateBoundaryDi(CORBA::string_dup(_aName.toStdString().c_str()), aMeshName.toStdString().c_str(), aMeshFile.toStdString().c_str());
1050      _parent->AddBoundaryDi(_aName);
1051      aBoundary->SetCaseCreation("Case_1");
1052    }
1053    catch( SALOME::SALOME_Exception& S_ex )
1054    {
1055       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
1056                                 QObject::tr(CORBA::string_dup(S_ex.details.text)) );
1057       return false;
1058    }
1059   }
1060
1061 // Les groupes
1062   AssocieLesGroupes();
1063
1064   //HOMARD_UTILS::updateObjBrowser();
1065   return true;
1066 }
1067
1068
1069 // ------------------------------------------------------------------------
1070 void SMESH_CreateBoundaryDi::PushOnOK()
1071 // ------------------------------------------------------------------------
1072 {
1073      if (PushOnApply()) this->close();
1074      if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
1075 }
1076 // ------------------------------------------------------------------------
1077 void SMESH_CreateBoundaryDi::PushOnHelp()
1078 // ------------------------------------------------------------------------
1079 {
1080   SMESH::ShowHelpFile(QString("gui_create_boundary.html"));
1081   //std::string LanguageShort = myHomardGen->GetLanguageShort();
1082   //HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str()));
1083 }
1084 // ------------------------------------------------------------------------
1085 void SMESH_CreateBoundaryDi::AssocieLesGroupes()
1086 // ------------------------------------------------------------------------
1087 {
1088   SMESHHOMARD::ListGroupType_var aSeqGroupe = new SMESHHOMARD::ListGroupType;
1089   aSeqGroupe->length(_listeGroupesBoundary.size());
1090   QStringList::const_iterator it;
1091   int i=0;
1092   for (it = _listeGroupesBoundary.constBegin(); it != _listeGroupesBoundary.constEnd(); it++)
1093      aSeqGroupe[i++]=(*it).toStdString().c_str();
1094   aBoundary->SetGroups(aSeqGroupe);
1095
1096 }
1097
1098 // -------------------------------------------------
1099 void SMESH_CreateBoundaryDi::SetNewName()
1100 // --------------------------------------------------
1101 {
1102
1103   SMESHHOMARD::listeBoundarys_var  MyObjects = myHomardGen->GetAllBoundarysName();
1104   int num = 0; QString aName="";
1105   while (aName == QString("") )
1106   {
1107     aName.setNum(num+1) ;
1108     aName.insert(0, QString("Boun_")) ;
1109     for ( int i=0; i<MyObjects->length(); i++)
1110     {
1111       if ( aName ==  QString(MyObjects[i]))
1112       {
1113         num ++ ;
1114         aName = "" ;
1115         break ;
1116       }
1117    }
1118   }
1119   LEName->setText(aName);
1120 }
1121 // ------------------------------------------------------------------------
1122 void SMESH_CreateBoundaryDi::SetMeshFile()
1123 // ------------------------------------------------------------------------
1124 {
1125   QString aMeshFile = SMESH_HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") );
1126   if (!(aMeshFile.isEmpty())) LEFileName->setText(aMeshFile);
1127 }
1128
1129 // ------------------------------------------------------------------------
1130 void SMESH_CreateBoundaryDi::setGroups (QStringList listGroup)
1131 // ------------------------------------------------------------------------
1132 {
1133     _listeGroupesBoundary = listGroup;
1134 }
1135 // ------------------------------------------------------------------------
1136 void SMESH_CreateBoundaryDi::SetFiltrage()
1137 // // ------------------------------------------------------------------------
1138 {
1139   if (!CBGroupe->isChecked()) return;
1140
1141   SMESH_CreateListGroup *aDlg = new SMESH_CreateListGroup
1142     (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen),
1143      "Case_1", _listeGroupesBoundary);
1144   aDlg->show();
1145 }
1146
1147 // ------------------------------------------------------------------------
1148 SMESH_EditBoundaryAn::SMESH_EditBoundaryAn( SMESHGUI_HomardAdaptDlg* parent, bool modal,
1149                                       SMESHHOMARD::HOMARD_Gen_var myHomardGen,
1150                                       QString caseName, QString Name ):
1151 // ------------------------------------------------------------------------
1152 /* Constructs a SMESH_EditBoundaryAn
1153     herite de SMESH_CreateBoundaryAn
1154 */
1155     SMESH_CreateBoundaryAn(parent, myHomardGen, caseName)
1156 {
1157     MESSAGE("Debut de SMESH_EditBoundaryAn pour " << Name.toStdString().c_str());
1158     setWindowTitle(QObject::tr("HOM_BOUN_A_EDIT_WINDOW_TITLE"));
1159     _Name=Name;
1160     aBoundaryAn = myHomardGen->GetBoundary(_Name.toStdString().c_str());
1161     InitValEdit();
1162 }
1163 // ------------------------------------------------------------------------
1164 SMESH_EditBoundaryAn::~SMESH_EditBoundaryAn()
1165 // ------------------------------------------------------------------------
1166 {
1167     // no need to delete child widgets, Qt does it all for us
1168 }
1169 // ------------------------------------------------------------------------
1170 void SMESH_EditBoundaryAn::InitValEdit()
1171 // ------------------------------------------------------------------------
1172 {
1173   LEName->setText(_Name);
1174   LEName->setReadOnly(true);
1175   _Type = aBoundaryAn->GetType();
1176   MESSAGE("_Type : "<<_Type);
1177   InitValBoundaryAnLimit();
1178   InitValBoundaryAn();
1179   switch (_Type)
1180   {
1181     case 1 : // il s agit d un cylindre
1182     {
1183       InitValBoundaryAnCylindre();
1184       SetCylinder();
1185       break;
1186     }
1187     case 2: // il s agit d une sphere
1188     {
1189       InitValBoundaryAnSphere();
1190       SetSphere();
1191       break;
1192     }
1193     case 3: // il s agit d un cone defini par un axe et un angle
1194     {
1195       InitValBoundaryAnConeA();
1196       SetConeA();
1197       break;
1198     }
1199     case 4: // il s agit d un cone defini par les 2 rayons
1200     {
1201       InitValBoundaryAnConeR();
1202       SetConeR();
1203       break;
1204     }
1205     case 5: // il s agit d un tore
1206     {
1207       InitValBoundaryAnTore();
1208       SetTore();
1209       break;
1210     }
1211   };
1212 }
1213 // ------------------------------------------------------------------------
1214 void SMESH_EditBoundaryAn::InitValBoundaryAnLimit()
1215 // ------------------------------------------------------------------------
1216 {
1217   SMESHHOMARD::double_array_var  mesCoordLimits = aBoundaryAn->GetLimit();
1218   ASSERT(mesCoordLimits->length() == 3 );
1219   _Xincr=mesCoordLimits[0];
1220   _Yincr=mesCoordLimits[1];
1221   _Zincr=mesCoordLimits[2];
1222 }
1223 // ------------------------------------------------------------------------
1224 void SMESH_EditBoundaryAn::InitValBoundaryAnCylindre()
1225 // ------------------------------------------------------------------------
1226 {
1227   SMESHHOMARD::double_array_var  mesCoordBoundary = aBoundaryAn->GetCoords();
1228   ASSERT(mesCoordBoundary->length() == 7 );
1229   _BoundaryAnXcentre=mesCoordBoundary[0];
1230   _BoundaryAnYcentre=mesCoordBoundary[1];
1231   _BoundaryAnZcentre=mesCoordBoundary[2];
1232   _BoundaryAnXaxis=mesCoordBoundary[3];
1233   _BoundaryAnYaxis=mesCoordBoundary[4];
1234   _BoundaryAnZaxis=mesCoordBoundary[5];
1235   _BoundaryAnRayon=mesCoordBoundary[6];
1236 }
1237 // ------------------------------------------------------------------------
1238 void SMESH_EditBoundaryAn::InitValBoundaryAnSphere()
1239 // ------------------------------------------------------------------------
1240 {
1241   SMESHHOMARD::double_array_var  mesCoordBoundary = aBoundaryAn->GetCoords();
1242   ASSERT(mesCoordBoundary->length() == 4 );
1243   _BoundaryAnXcentre=mesCoordBoundary[0];
1244   _BoundaryAnYcentre=mesCoordBoundary[1];
1245   _BoundaryAnZcentre=mesCoordBoundary[2];
1246   _BoundaryAnRayon=mesCoordBoundary[3];
1247 }
1248 // ------------------------------------------------------------------------
1249 void SMESH_EditBoundaryAn::InitValBoundaryAnConeA()
1250 // ------------------------------------------------------------------------
1251 {
1252   SMESHHOMARD::double_array_var  mesCoordBoundary = aBoundaryAn->GetCoords();
1253   ASSERT(mesCoordBoundary->length() == 7 );
1254   _BoundaryAnXaxisCone=mesCoordBoundary[0];
1255   _BoundaryAnYaxisCone=mesCoordBoundary[1];
1256   _BoundaryAnZaxisCone=mesCoordBoundary[2];
1257   _BoundaryAngle=mesCoordBoundary[3];
1258   _BoundaryAnXorigCone=mesCoordBoundary[4];
1259   _BoundaryAnYorigCone=mesCoordBoundary[5];
1260   _BoundaryAnZorigCone=mesCoordBoundary[6];
1261   convertRayonAngle(-1) ;
1262 }
1263 // ------------------------------------------------------------------------
1264 void SMESH_EditBoundaryAn::InitValBoundaryAnConeR()
1265 // ------------------------------------------------------------------------
1266 {
1267   SMESHHOMARD::double_array_var  mesCoordBoundary = aBoundaryAn->GetCoords();
1268   ASSERT(mesCoordBoundary->length() == 8 );
1269   _BoundaryAnXcone1=mesCoordBoundary[0];
1270   _BoundaryAnYcone1=mesCoordBoundary[1];
1271   _BoundaryAnZcone1=mesCoordBoundary[2];
1272   _BoundaryAnRayon1=mesCoordBoundary[3];
1273   _BoundaryAnXcone2=mesCoordBoundary[4];
1274   _BoundaryAnYcone2=mesCoordBoundary[5];
1275   _BoundaryAnZcone2=mesCoordBoundary[6];
1276   _BoundaryAnRayon2=mesCoordBoundary[7];
1277   convertRayonAngle(1) ;
1278 }
1279 // ------------------------------------------------------------------------
1280 void SMESH_EditBoundaryAn::InitValBoundaryAnTore()
1281 // ------------------------------------------------------------------------
1282 {
1283   SMESHHOMARD::double_array_var  mesCoordBoundary = aBoundaryAn->GetCoords();
1284   ASSERT(mesCoordBoundary->length() == 8 );
1285   _BoundaryAnXcentre=mesCoordBoundary[0];
1286   _BoundaryAnYcentre=mesCoordBoundary[1];
1287   _BoundaryAnZcentre=mesCoordBoundary[2];
1288   _BoundaryAnXaxis=mesCoordBoundary[3];
1289   _BoundaryAnYaxis=mesCoordBoundary[4];
1290   _BoundaryAnZaxis=mesCoordBoundary[5];
1291   _BoundaryAnRayon1=mesCoordBoundary[6];
1292   _BoundaryAnRayon2=mesCoordBoundary[7];
1293 }
1294 // ------------------------------------------------------------------------
1295 void SMESH_EditBoundaryAn::SetCylinder()
1296 // ------------------------------------------------------------------------
1297 {
1298   gBCylindre->setVisible(1);
1299   gBSphere->setVisible(0);
1300   gBCone->setVisible(0);
1301   gBTore->setVisible(0);
1302   RBCylindre->setChecked(1);
1303   _Type=1;
1304   RBSphere->setDisabled(true);
1305   RBCone->setDisabled(true);
1306   RBTore->setDisabled(true);
1307
1308   SpinBox_Xcent->setValue(_BoundaryAnXcentre);
1309   SpinBox_Ycent->setValue(_BoundaryAnYcentre);
1310   SpinBox_Zcent->setValue(_BoundaryAnZcentre);
1311
1312   SpinBox_Xaxis->setValue(_BoundaryAnXaxis);
1313   SpinBox_Yaxis->setValue(_BoundaryAnYaxis);
1314   SpinBox_Zaxis->setValue(_BoundaryAnZaxis);
1315
1316
1317   SpinBox_Xaxis->setSingleStep(0.1);
1318   SpinBox_Xcentre->setSingleStep(_Xincr);
1319   SpinBox_Yaxis->setSingleStep(0.1);
1320   SpinBox_Ycentre->setSingleStep(_Yincr);
1321   SpinBox_Zaxis->setSingleStep(0.1);
1322   SpinBox_Zcentre->setSingleStep(_Zincr);
1323 // Rayon
1324   SpinBox_Radius->setValue(_BoundaryAnRayon);
1325   SpinBox_Radius->setSingleStep(_BoundaryAnRayon/10.);
1326 //
1327   adjustSize();
1328 }
1329 // ------------------------------------------------------------------------
1330 void SMESH_EditBoundaryAn::SetSphere()
1331 // ------------------------------------------------------------------------
1332 {
1333   gBCylindre->setVisible(0);
1334   gBSphere->setVisible(1);
1335   RBSphere->setChecked(1);
1336   gBCone->setVisible(0);
1337   gBTore->setVisible(0);
1338   RBCylindre->setDisabled(true);
1339   RBCone->setDisabled(true);
1340   RBTore->setDisabled(true);
1341   _Type=2 ;
1342
1343   SpinBox_Xcentre->setValue(_BoundaryAnXcentre);
1344   if ( _Xincr > 0) { SpinBox_Xcentre->setSingleStep(_Xincr); }
1345   else             { SpinBox_Xcentre->setSingleStep(1) ; }
1346
1347   SpinBox_Ycentre->setValue(_BoundaryAnYcentre);
1348   if ( _Yincr > 0) { SpinBox_Ycentre->setSingleStep(_Yincr); }
1349   else             { SpinBox_Ycentre->setSingleStep(1) ; }
1350
1351   SpinBox_Zcentre->setValue(_BoundaryAnZcentre);
1352   if ( _Zincr > 0) { SpinBox_Zcentre->setSingleStep(_Zincr); }
1353   else             { SpinBox_Zcentre->setSingleStep(1);}
1354
1355   SpinBox_Rayon->setValue(_BoundaryAnRayon);
1356 //
1357   adjustSize();
1358 }
1359 // ------------------------------------------------------------------------
1360 void SMESH_EditBoundaryAn::SetConeA()
1361 // ------------------------------------------------------------------------
1362 {
1363   gBCylindre->setVisible(0);
1364   gBSphere->setVisible(0);
1365   gBCone->setVisible(1);
1366   RBCone->setChecked(1);
1367   gBTore->setVisible(0);
1368   RB_Def_angle->setChecked(1);
1369   RBCylindre->setDisabled(true);
1370   RBSphere->setDisabled(true);
1371   RBTore->setDisabled(true);
1372   _Type=3;
1373 //
1374   TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X axis", 0));
1375   SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone);
1376   TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y axis", 0));
1377   SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone);
1378   TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z axis", 0));
1379   SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone);
1380 //
1381   TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre", 0));
1382   SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone);
1383   TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre", 0));
1384   SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone);
1385   TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre", 0));
1386   SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone);
1387 //
1388   TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Angle", 0));
1389   SpinBox_Cone_V1->setValue(_BoundaryAngle);
1390   SpinBox_Cone_V1->setSingleStep(1.);
1391   SpinBox_Cone_V1->setMaximum(90.);
1392 //
1393   TLCone_V2->setVisible(0);
1394   SpinBox_Cone_V2->setVisible(0);
1395 //
1396   adjustSize();
1397 }
1398 // ------------------------------------------------------------------------
1399 void SMESH_EditBoundaryAn::SetConeR()
1400 // ------------------------------------------------------------------------
1401 {
1402   gBCylindre->setVisible(0);
1403   gBSphere->setVisible(0);
1404   gBCone->setVisible(1);
1405   gBTore->setVisible(0);
1406   RBCone->setChecked(1);
1407   RB_Def_radius->setChecked(1);
1408   RBCylindre->setDisabled(true);
1409   RBSphere->setDisabled(true);
1410   RBTore->setDisabled(true);
1411   _Type=4;
1412 //
1413   TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X centre 1", 0));
1414   SpinBox_Cone_X1->setValue(_BoundaryAnXcone1);
1415   TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y centre 1", 0));
1416   SpinBox_Cone_Y1->setValue(_BoundaryAnYcone1);
1417   TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z centre 1", 0));
1418   SpinBox_Cone_Z1->setValue(_BoundaryAnZcone1);
1419 //
1420   TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Radius 1", 0));
1421   SpinBox_Cone_V1->setSingleStep(_Rayon/10.);
1422   SpinBox_Cone_V1->setMaximum(100000.*_DMax);
1423   SpinBox_Cone_V1->setValue(_BoundaryAnRayon1);
1424 //
1425   TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre 2", 0));
1426   SpinBox_Cone_X2->setValue(_BoundaryAnXcone2);
1427   TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre 2", 0));
1428   SpinBox_Cone_Y2->setValue(_BoundaryAnYcone2);
1429   TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre 2", 0));
1430   SpinBox_Cone_Z2->setValue(_BoundaryAnZcone2);
1431 //
1432   TLCone_V2->setVisible(1);
1433   SpinBox_Cone_V2->setVisible(1);
1434   TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0));
1435   SpinBox_Cone_V2->setValue(_BoundaryAnRayon2);
1436 //
1437   adjustSize();
1438 }
1439 // ------------------------------------------------------------------------
1440 void SMESH_EditBoundaryAn::SetTore()
1441 // ------------------------------------------------------------------------
1442 {
1443   gBCylindre->setVisible(0);
1444   gBSphere->setVisible(0);
1445   gBCone->setVisible(0);
1446   gBTore->setVisible(1);
1447   RBTore->setChecked(1);
1448   _Type=5;
1449   RBCylindre->setDisabled(true);
1450   RBSphere->setDisabled(true);
1451   RBCone->setDisabled(true);
1452
1453   SpinBoxToreXcent->setValue(_BoundaryAnXcentre);
1454   SpinBoxToreYcent->setValue(_BoundaryAnYcentre);
1455   SpinBoxToreZcent->setValue(_BoundaryAnZcentre);
1456
1457   SpinBoxToreXaxe->setValue(_BoundaryAnXaxis);
1458   SpinBoxToreYaxe->setValue(_BoundaryAnYaxis);
1459   SpinBoxToreZaxe->setValue(_BoundaryAnZaxis);
1460
1461
1462   SpinBoxToreXaxe->setSingleStep(0.1);
1463   SpinBoxToreXcent->setSingleStep(_Xincr);
1464   SpinBoxToreYaxe->setSingleStep(0.1);
1465   SpinBoxToreYcent->setSingleStep(_Yincr);
1466   SpinBoxToreZaxe->setSingleStep(0.1);
1467   SpinBoxToreZcent->setSingleStep(_Zincr);
1468 // Rayon de revolution
1469   SpinBoxToreRRev->setValue(_BoundaryAnRayon1);
1470   SpinBoxToreRRev->setSingleStep(_BoundaryAnRayon1/10.);
1471 // Rayon primaire
1472   SpinBoxToreRPri->setValue(_BoundaryAnRayon2);
1473   SpinBoxToreRPri->setSingleStep(_BoundaryAnRayon2/10.);
1474 //
1475   adjustSize();
1476 }
1477 // ---------------------------------------------------
1478 bool SMESH_EditBoundaryAn::CreateOrUpdateBoundaryAn()
1479 //----------------------------------------------------
1480 //  Mise a jour des attributs de la BoundaryAn
1481 {
1482   switch (_Type)
1483   {
1484     case 1 : // il s agit d un cylindre
1485     {
1486       aBoundaryAn->SetCylinder(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon );
1487       break;
1488     }
1489     case 2 : // il s agit d une sphere
1490     {
1491       aBoundaryAn->SetSphere(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon);
1492       break;
1493     }
1494     case 3 : // il s agit d un cone defini par un axe et un angle
1495     {
1496       aBoundaryAn = myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_Name.toStdString().c_str()), \
1497       _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone, _BoundaryAngle, \
1498       _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnYorigCone);
1499       break;
1500     }
1501     case 4 : // il s agit d un cone defini par les 2 rayons
1502     {
1503       aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_Name.toStdString().c_str()), \
1504         _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \
1505         _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2);
1506       break;
1507     }
1508     case 5 : // il s agit d un tore
1509     {
1510       aBoundaryAn->SetTorus(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon1, _BoundaryAnRayon2 );
1511       break;
1512     }
1513   }
1514   if (Chgt) myHomardGen->InvalideBoundary(_Name.toStdString().c_str());
1515   //HOMARD_UTILS::updateObjBrowser();
1516   return true;
1517 }
1518
1519 // --------------------------------------------------------------------------------------
1520 /* Constructs a SMESH_EditBoundaryCAO
1521     herite de SMESH_CreateBoundaryCAO
1522 */
1523 // --------------------------------------------------------------------------------------
1524 SMESH_EditBoundaryCAO::SMESH_EditBoundaryCAO( SMESHGUI_HomardAdaptDlg* parent, bool modal,
1525                                               SMESHHOMARD::HOMARD_Gen_var myHomardGen,
1526                                               QString caseName, QString Name):
1527     SMESH_CreateBoundaryCAO(parent, modal, myHomardGen, caseName, Name)
1528 {
1529     MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str());
1530     setWindowTitle(QObject::tr("HOM_BOUN_C_EDIT_WINDOW_TITLE"));
1531     try {
1532       aBoundary = myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str()));
1533       InitValEdit();
1534     }
1535     catch( SALOME::SALOME_Exception& S_ex ) {
1536       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
1537                                 QObject::tr(CORBA::string_dup(S_ex.details.text)) );
1538       return;
1539     }
1540
1541     SMESHHOMARD::ListGroupType_var maListe = aBoundary->GetGroups();
1542     for ( int i = 0; i < maListe->length(); i++ )
1543        _listeGroupesBoundary << QString(maListe[i]);
1544
1545 }
1546 // ------------------------------
1547 SMESH_EditBoundaryCAO::~SMESH_EditBoundaryCAO()
1548 // ------------------------------
1549 {
1550 }
1551 // ------------------------------
1552 void SMESH_EditBoundaryCAO::InitValEdit()
1553 // ------------------------------
1554 {
1555       LEName->setText(_aName);
1556       LEName->setReadOnly(true);
1557
1558       QString aDataFile = aBoundary->GetDataFile();
1559       LEFileName->setText(aDataFile);
1560       LEFileName->setReadOnly(1);
1561       PushFichier->setVisible(0);
1562 //
1563       adjustSize();
1564 }
1565 // ------------------------------
1566 bool SMESH_EditBoundaryCAO::PushOnApply()
1567 // ------------------------------
1568 {
1569      return true;
1570 }
1571 // ------------------------------------------------------------------------
1572 void SMESH_EditBoundaryCAO::SetFiltrage()
1573 // // ------------------------------------------------------------------------
1574 {
1575   if (!CBGroupe->isChecked()) return;
1576   SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase();
1577   SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
1578
1579   SMESH_EditListGroupCAO *aDlg = new SMESH_EditListGroupCAO
1580     (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen),
1581      "Case_1", _listeGroupesBoundary) ;
1582   aDlg->show();
1583 }
1584
1585 // -------------------------------------------------------------------------------------------------------------------------------------
1586 SMESH_EditBoundaryDi::SMESH_EditBoundaryDi( SMESHGUI_HomardAdaptDlg* parent, bool modal,
1587                                       SMESHHOMARD::HOMARD_Gen_var myHomardGen,
1588                                       QString caseName, QString Name):
1589 // -------------------------------------------------------------------------------------------------------------------------------------
1590 /* Constructs a SMESH_EditBoundaryDi
1591     herite de SMESH_CreateBoundaryDi
1592 */
1593   SMESH_CreateBoundaryDi(parent, modal, myHomardGen, caseName, Name)
1594 {
1595     MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str());
1596     setWindowTitle(QObject::tr("HOM_BOUN_D_EDIT_WINDOW_TITLE"));
1597     try {
1598       aBoundary = myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str()));
1599       InitValEdit();
1600     }
1601     catch( SALOME::SALOME_Exception& S_ex ) {
1602       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
1603                                 QObject::tr(CORBA::string_dup(S_ex.details.text)) );
1604       return;
1605     }
1606
1607     SMESHHOMARD::ListGroupType_var maListe = aBoundary->GetGroups();
1608     for ( int i = 0; i < maListe->length(); i++ )
1609        _listeGroupesBoundary << QString(maListe[i]);
1610
1611 }
1612 // ------------------------------
1613 SMESH_EditBoundaryDi::~SMESH_EditBoundaryDi()
1614 // ------------------------------
1615 {
1616 }
1617 // ------------------------------
1618 void SMESH_EditBoundaryDi::InitValEdit()
1619 // ------------------------------
1620 {
1621       LEName->setText(_aName);
1622       LEName->setReadOnly(true);
1623
1624       QString aDataFile = aBoundary->GetDataFile();
1625       LEFileName->setText(aDataFile);
1626       LEFileName->setReadOnly(1);
1627       PushFichier->setVisible(0);
1628 //
1629       adjustSize();
1630 }
1631 // ------------------------------
1632 bool SMESH_EditBoundaryDi::PushOnApply()
1633 // ------------------------------
1634 {
1635      return true;
1636 }
1637 // ------------------------------------------------------------------------
1638 void SMESH_EditBoundaryDi::SetFiltrage()
1639 // // ------------------------------------------------------------------------
1640 {
1641   if (!CBGroupe->isChecked()) return;
1642   SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase();
1643   SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
1644
1645   SMESH_EditListGroup *aDlg = new SMESH_EditListGroup
1646     (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen),
1647      "Case_1", _listeGroupesBoundary);
1648   aDlg->show();
1649 }