1 // Copyright (C) 2011 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "MonCreateZone.h"
23 #include "MonCreateHypothesis.h"
25 #include <QFileDialog>
26 #include <QMessageBox>
28 #include "SalomeApp_Tools.h"
29 #include "HOMARDGUI_Utils.h"
30 #include "HomardQtCommun.h"
31 #include <utilities.h>
33 #include <SUIT_Desktop.h>
34 #include <SUIT_MessageBox.h>
35 #include <SUIT_ResourceMgr.h>
36 #include <SUIT_Session.h>
37 #include <SUIT_ViewManager.h>
39 // ------------------------------------------------------------------------------------------------------------------------
40 MonCreateZone::MonCreateZone(MonCreateHypothesis* parent, bool modal,
41 HOMARD::HOMARD_Gen_var myHomardGen,
43 // ------------------------------------------------------------------------------------------------------------------------------
44 /* Constructs a MonCreateZone
45 appele pour une vraie creation
46 initialise une boite et non une sphere
48 QDialog(0), Ui_CreateZone(),
54 _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0),
55 _ZoneXcentre(0), _ZoneYcentre(0), _ZoneZcentre(0), _ZoneRayon(0),
56 _Xmin(0), _Xmax(0), _Xincr(0), _Ymin(0), _Ymax(0), _Yincr(0), _Zmin(0), _Zmax(0), _Zincr(0),
57 _ZoneXmin(0), _ZoneXmax(0), _ZoneYmin(0), _ZoneYmax(0), _ZoneZmin(0), _ZoneZmax(0),
58 _Xaxis(0), _Yaxis(0), _Zaxis(0), _RayonInt(0), _Haut(0),
59 _ZoneXaxis(0), _ZoneYaxis(0), _ZoneZaxis(0), _ZoneRayonInt(0), _ZoneHaut(0),
63 MESSAGE("Constructeur") ;
64 _myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen) ;
70 InitValZone() ; // Cherche les valeurs de la boite englobante le maillage
71 InitMinMax() ; // Initialise les bornes des boutons
72 SetBox() ; // Propose une boite en premier choix
75 // --------------------------------------------------------------------------------------------------------------
76 MonCreateZone::MonCreateZone(MonCreateHypothesis* parent,
77 HOMARD::HOMARD_Gen_var myHomardGen,
79 // --------------------------------------------------------------------------------------------------------------
80 // Constructeur appele par MonEditZone
82 QDialog(0), Ui_CreateZone(),
83 _myHomardGen(myHomardGen),
89 _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0),
90 _ZoneXcentre(0), _ZoneYcentre(0), _ZoneZcentre(0), _ZoneRayon(0),
91 _ZoneXmin(0), _ZoneXmax(0), _ZoneYmin(0), _ZoneYmax(0), _ZoneZmin(0), _ZoneZmax(0),
92 _Xaxis(0), _Yaxis(0), _Zaxis(0), _RayonInt(0), _Haut(0),
93 _ZoneXaxis(0), _ZoneYaxis(0), _ZoneZaxis(0), _ZoneRayonInt(0), _ZoneHaut(0),
94 // Pour affichage lors de l edition d une Zone sans nom de Cas
95 _Xmin(1), _Xmax(1), _Xincr(1), _Ymin(1), _Ymax(1), _Yincr(1), _Zmin(1), _Zmax(1), _Zincr(1),
99 // MESSAGE("Debut de MonCreateZone")
106 // ------------------------------------------------------------------------
107 MonCreateZone::~MonCreateZone()
108 // ------------------------------------------------------------------------
110 // no need to delete child widgets, Qt does it all for us
112 // ------------------------------------------------------------------------
113 void MonCreateZone::InitConnect()
114 // ------------------------------------------------------------------------
116 connect( RBBox, SIGNAL(clicked()) , this, SLOT(SetBox()) ) ;
117 connect( RBSphere, SIGNAL(clicked()) , this, SLOT(SetSphere()) ) ;
118 connect( RBCylinder, SIGNAL(clicked()) , this, SLOT(SetCylinder()) ) ;
119 connect( RBPipe, SIGNAL(clicked()) , this, SLOT(SetPipe()) ) ;
120 connect( buttonOk, SIGNAL( pressed() ), this, SLOT( PushOnOK() ) ) ;
121 connect( buttonApply, SIGNAL( pressed() ), this, SLOT( PushOnApply() ) ) ;
122 connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) ) ;
123 connect( buttonHelp, SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) ) ;
125 // ------------------------------------------------------------------------
126 void MonCreateZone::InitValZone()
127 // ------------------------------------------------------------------------
130 // 1. Les coordonnees extremes du maillage
132 if (_aCaseName == QString("")) { return; }
134 HOMARD::HOMARD_Cas_var aCas = _myHomardGen->GetCas(_aCaseName.toStdString().c_str()) ;
135 HOMARD::extrema_var MesExtremes = aCas->GetBoundingBox() ;
136 int num = MesExtremes->length() ;
138 _Xmin=MesExtremes[0]; _Xmax=MesExtremes[1]; _Xincr=MesExtremes[2];
139 _Ymin=MesExtremes[3]; _Ymax=MesExtremes[4]; _Yincr=MesExtremes[5];
140 _Zmin=MesExtremes[6]; _Zmax=MesExtremes[7]; _Zincr=MesExtremes[8];
141 _DMax=MesExtremes[9];
142 if ( _Xincr < 0 ) { _Orient = 2 ; }
143 else if ( _Yincr < 0 ) { _Orient = 3 ; }
144 else if ( _Zincr < 0 ) { _Orient = 1 ; }
145 MESSAGE ("_Xmin : " << _Xmin << " _Xmax : " << _Xmax << " _Xincr : " << _Xincr ) ;
146 MESSAGE ("_Ymin : " << _Ymin << " _Ymax : " << _Ymax << " _Yincr : " << _Yincr ) ;
147 MESSAGE ("_Zmin : " << _Zmin << " _Zmax : " << _Zmax << " _Zincr : " << _Zincr) ;
148 MESSAGE ("_DMax : " << _DMax) ;
149 MESSAGE ("_Orient : " << _Orient) ;
150 // 2. Caracteristiques des zones
159 _ZoneXmin = _Xmin - _Xincr;
160 _ZoneXmax = _Xmax + _Xincr;
162 _Xcentre=(_Xmin + _Xmax)/2.;
171 _ZoneYmin = _Ymin - _Yincr;
172 _ZoneYmax = _Ymax + _Yincr;
174 _Ycentre=(_Ymin + _Ymax)/2.;
183 _ZoneZmin = _Zmin - _Zincr;
184 _ZoneZmax = _Zmax + _Zincr;
186 _Zcentre=(_Zmin + _Zmax)/2.;
190 // Axe et hauteur pour cylindre et tuyau
192 // 3. Gestion des icones
193 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr() ;
194 QPixmap pix = resMgr->loadPixmap( "HOMARD", "boxdxyz.png" ) ;
195 if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "boxdxyz.png" ) ; }
196 else { pix = resMgr->loadPixmap( "HOMARD", "boxdxy.png" ) ; }
197 QIcon IS=QIcon(pix) ;
200 if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" ) ; }
201 else { pix = resMgr->loadPixmap( "HOMARD", "disk.png" ) ;
202 RBCylinder->setText(QApplication::translate("CreateZone", "Disk", 0, QApplication::UnicodeUTF8));
203 TLXbase->setText(QApplication::translate("CreateZone", "X centre", 0, QApplication::UnicodeUTF8));
204 TLYbase->setText(QApplication::translate("CreateZone", "Y centre", 0, QApplication::UnicodeUTF8));
205 TLZbase->setText(QApplication::translate("CreateZone", "Z centre", 0, QApplication::UnicodeUTF8)); }
207 RBCylinder->setIcon(IS) ;
209 if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "pipe.png" ) ; }
210 else { pix = resMgr->loadPixmap( "HOMARD", "diskwithhole.png" ) ;
211 RBPipe->setText(QApplication::translate("CreateZone", "Disk with hole", 0, QApplication::UnicodeUTF8));
212 TLXbase_p->setText(QApplication::translate("CreateZone", "X centre", 0, QApplication::UnicodeUTF8));
213 TLYbase_p->setText(QApplication::translate("CreateZone", "Y centre", 0, QApplication::UnicodeUTF8));
214 TLZbase_p->setText(QApplication::translate("CreateZone", "Z centre", 0, QApplication::UnicodeUTF8)); }
216 RBPipe->setIcon(IS) ;
218 if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" ) ;
220 RBSphere->setIcon(IS) ; }
221 else { RBSphere->setVisible(0) ; }
224 // ------------------------------------------------------------------------
225 void MonCreateZone::InitMinMax()
226 // ------------------------------------------------------------------------
230 SpinBox_Xmini->setRange(_ZoneXmin,_ZoneXmax) ;
231 SpinBox_Xmaxi->setRange(_ZoneXmin,_ZoneXmax) ;
232 SpinBox_Xmini->setSingleStep(_Xincr) ;
233 SpinBox_Xmaxi->setSingleStep(_Xincr) ;
234 SpinBox_Xcentre->setSingleStep(_Xincr) ;
237 SpinBox_Xmini->setValue(_ZoneXmin) ;
238 SpinBox_Xmaxi->setValue(_ZoneXmax) ;
239 SpinBox_Xcentre->setValue(_Xcentre) ;
240 SpinBox_Xbase->setValue(_Xcentre) ;
241 SpinBox_Xbase_p->setValue(_Xcentre) ;
242 SpinBox_Xmini->setEnabled(false) ;
243 SpinBox_Xmaxi->setEnabled(false) ;
244 SpinBox_Xcentre->setEnabled(false) ;
245 SpinBox_Xbase->setEnabled(false) ;
246 SpinBox_Xbase_p->setEnabled(false) ;
250 SpinBox_Ymini->setRange(_ZoneYmin,_ZoneYmax) ;
251 SpinBox_Ymaxi->setRange(_ZoneYmin,_ZoneYmax) ;
252 SpinBox_Ymini->setSingleStep(_Yincr) ;
253 SpinBox_Ymaxi->setSingleStep(_Yincr) ;
254 SpinBox_Ycentre->setSingleStep(_Yincr) ;
257 SpinBox_Ymini->setValue(_ZoneYmin) ;
258 SpinBox_Ymaxi->setValue(_ZoneYmax) ;
259 SpinBox_Ycentre->setValue(_Ycentre) ;
260 SpinBox_Ybase->setValue(_Ycentre) ;
261 SpinBox_Ybase_p->setValue(_Ycentre) ;
262 SpinBox_Ymini->setEnabled(false) ;
263 SpinBox_Ymaxi->setEnabled(false) ;
264 SpinBox_Ycentre->setEnabled(false) ;
265 SpinBox_Ybase->setEnabled(false) ;
266 SpinBox_Ybase_p->setEnabled(false) ;
270 SpinBox_Zmini->setRange(_ZoneZmin,_ZoneZmax) ;
271 SpinBox_Zmaxi->setRange(_ZoneZmin,_ZoneZmax) ;
272 SpinBox_Zmini->setSingleStep(_Zincr) ;
273 SpinBox_Zmaxi->setSingleStep(_Zincr) ;
274 SpinBox_Zcentre->setSingleStep(_Zincr) ;
277 SpinBox_Zmini->setValue(_ZoneZmin) ;
278 SpinBox_Zmaxi->setValue(_ZoneZmax) ;
279 SpinBox_Zcentre->setValue(_Zcentre) ;
280 SpinBox_Zbase->setValue(_Zcentre) ;
281 SpinBox_Zbase_p->setValue(_Zcentre) ;
282 SpinBox_Zmini->setEnabled(false) ;
283 SpinBox_Zmaxi->setEnabled(false) ;
284 SpinBox_Zcentre->setEnabled(false) ;
285 SpinBox_Zbase->setEnabled(false) ;
286 SpinBox_Zbase_p->setEnabled(false) ;
289 SpinBox_Rayon->setSingleStep(_Rayon/10.) ;
290 SpinBox_Rayon->setMinimum(0.) ;
291 SpinBox_Radius->setSingleStep(_Rayon/10.) ;
292 SpinBox_Radius->setMinimum(0.) ;
293 SpinBox_Radius_int->setSingleStep(_Rayon/20.) ;
294 SpinBox_Radius_int->setMinimum(0.) ;
295 SpinBox_Radius_ext->setSingleStep(_Rayon/10.) ;
296 SpinBox_Radius_ext->setMinimum(0.) ;
298 // Si une coordonnee est constante, inutile de demander l'axe et la hauteur
300 SpinBox_Xaxis->setVisible(0) ;
301 SpinBox_Yaxis->setVisible(0) ;
302 SpinBox_Zaxis->setVisible(0) ;
303 SpinBox_Haut->setVisible(0) ;
304 TLXaxis->setVisible(0) ;
305 TLYaxis->setVisible(0) ;
306 TLZaxis->setVisible(0) ;
307 TLHaut->setVisible(0) ;
308 SpinBox_Xaxis_p->setVisible(0) ;
309 SpinBox_Yaxis_p->setVisible(0) ;
310 SpinBox_Zaxis_p->setVisible(0) ;
311 SpinBox_Haut_p->setVisible(0) ;
312 TLXaxis_p->setVisible(0) ;
313 TLYaxis_p->setVisible(0) ;
314 TLZaxis_p->setVisible(0) ;
315 TLHaut_p->setVisible(0) ;
318 SpinBox_Haut->setMinimum(0.) ;
319 SpinBox_Haut->setSingleStep(_Rayon/10.) ;
320 SpinBox_Haut_p->setMinimum(0.) ;
321 SpinBox_Haut_p->setSingleStep(_Rayon/10.) ;
324 // ------------------------------------------------------------------------
325 bool MonCreateZone::PushOnApply()
326 // ------------------------------------------------------------------------
327 // Appele lorsque l'un des boutons Ok ou Apply est presse
330 std::cerr << LEZoneName->text().trimmed().toStdString() << std::endl;
331 if (LEZoneName->text().trimmed()=="")
333 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
334 QObject::tr("HOM_ZONE_NAME") ) ;
340 case 11 : // il s agit d un rectangle
342 case 12 : // il s agit d un rectangle
344 case 13 : // il s agit d un rectangle
346 case 2 : // il s agit d un parallelipipede rectangle
348 if ( (_ZoneXmin != SpinBox_Xmini->value()) or
349 (_ZoneXmax != SpinBox_Xmaxi->value()) or
350 (_ZoneYmin != SpinBox_Ymini->value()) or
351 (_ZoneYmax != SpinBox_Ymaxi->value()) or
352 (_ZoneZmin != SpinBox_Zmini->value()) or
353 (_ZoneZmax != SpinBox_Zmaxi->value()) )
356 _ZoneXmin= SpinBox_Xmini->value() ; _ZoneXmax= SpinBox_Xmaxi->value() ;
357 _ZoneYmin= SpinBox_Ymini->value() ; _ZoneYmax= SpinBox_Ymaxi->value() ;
358 _ZoneZmin= SpinBox_Zmini->value() ; _ZoneZmax= SpinBox_Zmaxi->value() ;
362 case 4 : // il s agit d une sphere
364 if ( (_ZoneXcentre != SpinBox_Xcentre->value()) or
365 (_ZoneYcentre != SpinBox_Ycentre->value()) or
366 (_ZoneZcentre != SpinBox_Zbase->value()) or
367 (_ZoneRayon != SpinBox_Rayon->value()) )
370 _ZoneXcentre=SpinBox_Xcentre->value() ;
371 _ZoneYcentre=SpinBox_Ycentre->value() ;
372 _ZoneZcentre=SpinBox_Zcentre->value() ;
373 _ZoneRayon=SpinBox_Rayon->value() ;
377 case 31 : // il s agit d un disque issu d'un cylindre
379 case 32 : // il s agit d un disque issu d'un cylindre
381 case 33 : // il s agit d un disque issu d'un cylindre
383 case 5 : // il s agit d un cylindre
385 if ( (_ZoneXcentre != SpinBox_Xbase->value()) or
386 (_ZoneYcentre != SpinBox_Ybase->value()) or
387 (_ZoneZcentre != SpinBox_Zbase->value()) or
388 (_ZoneRayon != SpinBox_Radius->value()) or
389 (_ZoneHaut != SpinBox_Haut->value()) or
390 (_ZoneXaxis != SpinBox_Xaxis->value()) or
391 (_ZoneYaxis != SpinBox_Yaxis->value()) or
392 (_ZoneZaxis != SpinBox_Zaxis->value()) )
395 _ZoneXcentre=SpinBox_Xbase->value() ;
396 _ZoneYcentre=SpinBox_Ybase->value() ;
397 _ZoneZcentre=SpinBox_Zbase->value() ;
398 _ZoneXaxis=SpinBox_Xaxis->value() ;
399 _ZoneYaxis=SpinBox_Yaxis->value() ;
400 _ZoneZaxis=SpinBox_Zaxis->value() ;
401 _ZoneRayon=SpinBox_Radius->value() ;
402 _ZoneHaut=SpinBox_Haut->value() ;
406 case 61 : // il s agit d un disque avec trou
408 case 62 : // il s agit d un disque avec trou
410 case 63 : // il s agit d un disque avec trou
412 case 7 : // il s agit d un tuyau
414 if ( (_ZoneXcentre != SpinBox_Xbase_p->value()) or
415 (_ZoneYcentre != SpinBox_Ybase_p->value()) or
416 (_ZoneZcentre != SpinBox_Zbase_p->value()) or
417 (_ZoneRayonInt != SpinBox_Radius_int->value()) or
418 (_ZoneRayon != SpinBox_Radius_ext->value()) or
419 (_ZoneHaut != SpinBox_Haut_p->value()) or
420 (_ZoneXaxis != SpinBox_Xaxis_p->value()) or
421 (_ZoneYaxis != SpinBox_Yaxis_p->value()) or
422 (_ZoneZaxis != SpinBox_Zaxis_p->value()) )
425 _ZoneXcentre=SpinBox_Xbase_p->value() ;
426 _ZoneYcentre=SpinBox_Ybase_p->value() ;
427 _ZoneZcentre=SpinBox_Zbase_p->value() ;
428 _ZoneXaxis=SpinBox_Xaxis_p->value() ;
429 _ZoneYaxis=SpinBox_Yaxis_p->value() ;
430 _ZoneZaxis=SpinBox_Zaxis_p->value() ;
431 _ZoneRayonInt=SpinBox_Radius_int->value() ;
432 _ZoneRayon=SpinBox_Radius_ext->value() ;
433 _ZoneHaut=SpinBox_Haut_p->value() ;
440 // Pour un rectangle ou un parallelepipede :
441 if ( ( _ZoneType >= 11 and _ZoneType <= 13 ) or _ZoneType == 2 )
443 if ((_ZoneXmin >= _ZoneXmax) and (_Xincr > 0)) {
444 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
445 QObject::tr("HOM_ZONE_LIMIT").arg("X") ) ;
448 if ((_ZoneYmin >= _ZoneYmax) and (_Yincr > 0)) {
449 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
450 QObject::tr("HOM_ZONE_LIMIT").arg("Y") ) ;
453 if ((_ZoneZmin >= _ZoneZmax) and (_Zincr > 0)) {
454 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
455 QObject::tr("HOM_ZONE_LIMIT").arg("Z") ) ;
458 // L'axe pour un cylindre ou un tuyau :
459 if ( _ZoneType == 5 or _ZoneType == 7 )
461 double daux = _ZoneXaxis*_ZoneXaxis + _ZoneYaxis*_ZoneYaxis + _ZoneZaxis*_ZoneZaxis ;
462 if ( daux < 0.0000001 )
464 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
465 QObject::tr("HOM_AXE") );
469 // Rayons pour disque avec trou ou un tuyau :
470 if ( ( _ZoneType >= 61 and _ZoneType <= 63 ) or _ZoneType == 7 )
472 if ( _ZoneRayonInt >= _ZoneRayon )
474 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
475 QObject::tr("HOM_ZONE_RAYON") );
479 bool bOK = CreateOrUpdateZone() ;
483 // ---------------------------------------------------
484 bool MonCreateZone:: CreateOrUpdateZone()
485 //----------------------------------------------------
486 // Creation de la zone
488 MESSAGE("CreateOrUpdateZone _ZoneType ="<<_ZoneType);
489 if (_aZoneName != LEZoneName->text().trimmed())
491 _aZoneName = LEZoneName->text().trimmed() ;
494 case 11 : // il s agit d un rectangle
495 { aZone = _myHomardGen->CreateZoneBox2D(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
496 _ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _Orient );
499 case 12 : // il s agit d un rectangle
500 { aZone = _myHomardGen->CreateZoneBox2D(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
501 _ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax, _Orient );
504 case 13 : // il s agit d un rectangle
505 { aZone = _myHomardGen->CreateZoneBox2D(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
506 _ZoneZmin, _ZoneZmax, _ZoneXmin, _ZoneXmax, _Orient );
509 case 2 : // il s agit d un parallelepipede
510 { aZone = _myHomardGen->CreateZoneBox(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
511 _ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax );
514 case 4 : // il s agit d une sphere
515 { aZone = _myHomardGen->CreateZoneSphere(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
516 _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneRayon );
519 case 31 : // il s agit d un disque issu d'un cylindre
520 { aZone = _myHomardGen->CreateZoneDisk(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
521 _ZoneXcentre, _ZoneYcentre, _ZoneRayon, _Orient );
524 case 32 : // il s agit d un disque issu d'un cylindre
525 { aZone = _myHomardGen->CreateZoneDisk(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
526 _ZoneYcentre, _ZoneZcentre, _ZoneRayon, _Orient );
529 case 33 : // il s agit d un disque issu d'un cylindre
530 { aZone = _myHomardGen->CreateZoneDisk(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
531 _ZoneZcentre, _ZoneXcentre, _ZoneRayon, _Orient );
534 case 5 : // il s agit d un cylindre
535 { aZone = _myHomardGen->CreateZoneCylinder(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
536 _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut );
539 case 61 : // il s agit d un disque avec trou
540 { aZone = _myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
541 _ZoneXcentre, _ZoneYcentre, _ZoneRayon, _ZoneRayonInt, _Orient );
544 case 62 : // il s agit d un disque avec trou
545 { aZone = _myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
546 _ZoneYcentre, _ZoneZcentre, _ZoneRayon, _ZoneRayonInt, _Orient );
549 case 63 : // il s agit d un disque avec trou
550 { aZone = _myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
551 _ZoneZcentre, _ZoneXcentre, _ZoneRayon, _ZoneRayonInt, _Orient );
554 case 7 : // il s agit d un tuyau
555 { aZone = _myHomardGen->CreateZonePipe(CORBA::string_dup(_aZoneName.toStdString().c_str()), \
556 _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut, _ZoneRayonInt );
560 _parent->addZoneinTWZone(_aZoneName) ;
562 // Mise en place des attributs
563 aZone->SetLimit(_Xincr, _Yincr, _Zincr) ;
565 HOMARD_UTILS::updateObjBrowser() ;
568 // ------------------------------------------------------------------------
569 void MonCreateZone::PushOnOK()
570 // ------------------------------------------------------------------------
572 if (PushOnApply()) this->close() ;
574 // ------------------------------------------------------------------------
575 void MonCreateZone::PushOnHelp()
576 // ------------------------------------------------------------------------
578 HOMARD_UTILS::PushOnHelp(QString("gui_create_zone.html") ) ;
581 // -----------------------------------
582 void MonCreateZone::SetNewZoneName()
583 // -----------------------------------
585 // Recherche d'un nom par defaut qui n'existe pas encore
587 HOMARD::listeZones_var MyZones = _myHomardGen->GetAllZones() ;
588 int num = 0; QString aZoneName="";
589 while (aZoneName=="" )
591 aZoneName.setNum(num+1) ;
592 aZoneName.insert(0, QString("Zone_")) ;
593 for ( int i=0; i<MyZones->length() ; i++)
595 if ( aZoneName == QString(MyZones[i]))
603 LEZoneName->clear() ;
604 LEZoneName->insert(aZoneName) ;
606 // ------------------------------------------------------------------------
607 void MonCreateZone::SetBox()
608 // ------------------------------------------------------------------------
610 gBBox->setVisible(1) ;
611 gBSphere->setVisible(0) ;
612 gBCylindre->setVisible(0) ;
613 gBPipe->setVisible(0) ;
616 // Sachant que l'increment est le 1/100eme de l'ecart (min/max), cela revient
617 // a initialiser la boite sur une boite 'centrale' comprise entre 2/5 et 3/5
618 if ( _Xincr > 0 ) { SpinBox_Xmini->setValue(_Xcentre-10*_Xincr) ;
619 SpinBox_Xmaxi->setValue(_Xcentre+10*_Xincr) ; }
620 else { _ZoneType=12 ; }
621 if ( _Yincr > 0 ) { SpinBox_Ymini->setValue(_Ycentre-10*_Yincr) ;
622 SpinBox_Ymaxi->setValue(_Ycentre+10*_Yincr) ; }
623 else { _ZoneType=13 ; }
624 if ( _Zincr > 0 ) { SpinBox_Zmini->setValue(_Zcentre-10*_Zincr) ;
625 SpinBox_Zmaxi->setValue(_Zcentre+10*_Zincr) ; }
626 else { _ZoneType=11 ; }
628 // ------------------------------------------------------------------------
629 void MonCreateZone::SetSphere()
630 // ------------------------------------------------------------------------
632 MESSAGE("Debut de SetSphere")
633 gBBox->setVisible(0) ;
634 gBSphere->setVisible(1) ;
635 gBCylindre->setVisible(0) ;
636 gBPipe->setVisible(0) ;
639 SpinBox_Xcentre->setValue(_Xcentre) ;
640 SpinBox_Ycentre->setValue(_Ycentre) ;
641 SpinBox_Zcentre->setValue(_Zcentre) ;
642 SpinBox_Rayon->setValue(_Rayon) ;
643 MESSAGE("Fin de SetSphere")
645 // ------------------------------------------------------------------------
646 void MonCreateZone::SetCylinder()
647 // ------------------------------------------------------------------------
649 MESSAGE("Debut de SetCylinder")
650 gBBox->setVisible(0) ;
651 gBSphere->setVisible(0) ;
652 gBCylindre->setVisible(1) ;
653 gBPipe->setVisible(0) ;
656 if ( _Xincr > 0 ) { SpinBox_Xbase->setValue(_Xcentre) ;
657 SpinBox_Xaxis->setValue(0.) ; }
658 else { _ZoneType=32 ; }
659 if ( _Yincr > 0 ) { SpinBox_Ybase->setValue(_Ycentre) ;
660 SpinBox_Yaxis->setValue(0.) ; }
661 else { _ZoneType=33 ; }
662 if ( _Zincr > 0 ) { SpinBox_Zbase->setValue(_Zcentre) ;
663 SpinBox_Zaxis->setValue(1.) ; }
664 else { _ZoneType=31 ; }
665 SpinBox_Radius->setValue(_Rayon) ;
666 SpinBox_Haut->setValue(_Haut) ;
667 MESSAGE("Fin de SetCylinder")
669 // ------------------------------------------------------------------------
670 void MonCreateZone::SetPipe()
671 // ------------------------------------------------------------------------
673 MESSAGE("Debut de SetPipe")
674 gBBox->setVisible(0) ;
675 gBSphere->setVisible(0) ;
676 gBCylindre->setVisible(0) ;
677 gBPipe->setVisible(1) ;
680 if ( _Xincr > 0 ) { SpinBox_Xbase_p->setValue(_Xcentre) ;
681 SpinBox_Xaxis_p->setValue(0.) ; }
682 else { _ZoneType=62 ; }
683 if ( _Yincr > 0 ) { SpinBox_Ybase_p->setValue(_Ycentre) ;
684 SpinBox_Yaxis_p->setValue(0.) ; }
685 else { _ZoneType=63 ; }
686 if ( _Zincr > 0 ) { SpinBox_Zbase_p->setValue(_Zcentre) ;
687 SpinBox_Zaxis_p->setValue(1.) ; }
688 else { _ZoneType=61 ; }
689 SpinBox_Radius_int->setValue(_RayonInt) ;
690 SpinBox_Radius_ext->setValue(_Rayon) ;
691 SpinBox_Haut_p->setValue(_Haut) ;
692 MESSAGE("Fin de SetPipe")