]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMGUI/GeometryGUI_SphereDlg.cxx
Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/geom.git] / src / GEOMGUI / GeometryGUI_SphereDlg.cxx
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : GeometryGUI_SphereDlg.cxx
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 using namespace std;
30 #include "GeometryGUI_SphereDlg.h"
31 #include "GeometryGUI_SpinBox.h"
32
33 #include "GeometryGUI.h"
34
35 #include "QAD_Application.h"
36 #include "QAD_Desktop.h"
37 #include "QAD_Config.h"
38 #include "utilities.h"
39
40 #include <qbuttongroup.h>
41 #include <qgroupbox.h>
42 #include <qlabel.h>
43 #include <qlineedit.h>
44 #include <qpushbutton.h>
45 #include <qradiobutton.h>
46 #include <qlayout.h>
47 #include <qvariant.h>
48 #include <qtooltip.h>
49 #include <qwhatsthis.h>
50 #include <qimage.h>
51 #include <qvalidator.h>
52 #include <qpixmap.h>
53
54
55
56 //=================================================================================
57 // class    : GeometryGUI_SphereDlg()
58 // purpose  : Constructs a GeometryGUI_SphereDlg which is a child of 'parent', with the 
59 //            name 'name' and widget flags set to 'f'.
60 //            The dialog will by default be modeless, unless you set 'modal' to
61 //            TRUE to construct a modal dialog.
62 //=================================================================================
63 GeometryGUI_SphereDlg::GeometryGUI_SphereDlg( QWidget* parent,  const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
64     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
65 {
66     QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SPHERE_P")));
67     QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
68     QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SPHERE_DXYZ")));
69
70     if ( !name )
71       setName( "GeometryGUI_SphereDlg" );
72     resize( 303, 219 ); 
73     setCaption( tr( "GEOM_SPHERE_TITLE"  ) );
74     setSizeGripEnabled( TRUE );
75     GeometryGUI_SphereDlgLayout = new QGridLayout( this ); 
76     GeometryGUI_SphereDlgLayout->setSpacing( 6 );
77     GeometryGUI_SphereDlgLayout->setMargin( 11 );
78     
79     /***************************************************************/
80     GroupButtons = new QGroupBox( this, "GroupButtons" );
81     GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
82     GroupButtons->setTitle( tr( ""  ) );
83     GroupButtons->setColumnLayout(0, Qt::Vertical );
84     GroupButtons->layout()->setSpacing( 0 );
85     GroupButtons->layout()->setMargin( 0 );
86     GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
87     GroupButtonsLayout->setAlignment( Qt::AlignTop );
88     GroupButtonsLayout->setSpacing( 6 );
89     GroupButtonsLayout->setMargin( 11 );
90     buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
91     buttonCancel->setText( tr( "GEOM_BUT_CLOSE"  ) );
92     buttonCancel->setAutoDefault( TRUE );
93     GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
94     buttonApply = new QPushButton( GroupButtons, "buttonApply" );
95     buttonApply->setText( tr( "GEOM_BUT_APPLY"  ) );
96     buttonApply->setAutoDefault( TRUE );
97     GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
98     QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
99     GroupButtonsLayout->addItem( spacer_9, 0, 2 );
100     buttonOk = new QPushButton( GroupButtons, "buttonOk" );
101     buttonOk->setText( tr( "GEOM_BUT_OK"  ) );
102     buttonOk->setAutoDefault( TRUE );
103     buttonOk->setDefault( TRUE );
104     GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
105     GeometryGUI_SphereDlgLayout->addWidget( GroupButtons, 2, 0 );
106
107     /***************************************************************/
108     GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
109     GroupConstructors->setTitle( tr( "GEOM_SPHERE"  ) );
110     GroupConstructors->setExclusive( TRUE );
111     GroupConstructors->setColumnLayout(0, Qt::Vertical );
112     GroupConstructors->layout()->setSpacing( 0 );
113     GroupConstructors->layout()->setMargin( 0 );
114     GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
115     GroupConstructorsLayout->setAlignment( Qt::AlignTop );
116     GroupConstructorsLayout->setSpacing( 6 );
117     GroupConstructorsLayout->setMargin( 11 );
118     QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
119     GroupConstructorsLayout->addItem( spacer_2, 0, 3 );
120     Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
121     Constructor1->setText( tr( ""  ) );
122     Constructor1->setPixmap( image0 );
123     Constructor1->setChecked( TRUE );
124     Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
125     Constructor1->setMinimumSize( QSize( 50, 0 ) );
126     GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
127     QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
128     GroupConstructorsLayout->addItem( spacer_3, 0, 1 );
129     Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
130     Constructor2->setText( tr( ""  ) );
131     GroupConstructors->insert( Constructor2, 1 );
132     Constructor2->setMinimumSize( QSize( 50, 0 ) );
133     Constructor2->setPixmap( image2 );
134     GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
135     GeometryGUI_SphereDlgLayout->addWidget( GroupConstructors, 0, 0 );
136     GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
137     GroupConstructor1->setTitle( tr( "GEOM_SPHERE_CR"  ) );
138     GroupConstructor1->setColumnLayout(0, Qt::Vertical );
139     GroupConstructor1->layout()->setSpacing( 0 );
140     GroupConstructor1->layout()->setMargin( 0 );
141     GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
142     GroupConstructor1Layout->setAlignment( Qt::AlignTop );
143     GroupConstructor1Layout->setSpacing( 6 );
144     GroupConstructor1Layout->setMargin( 11 );
145     LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" );
146     LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
147     GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 );
148     SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" );
149     SelectButtonC1A1->setText( tr( ""  ) );
150     SelectButtonC1A1->setPixmap( image1 );
151     GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 );
152     TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" );
153     TextLabelC1A1->setText( tr( "GEOM_CENTER"  ) );
154     TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
155     TextLabelC1A1->setFrameShape( QLabel::NoFrame );
156     TextLabelC1A1->setFrameShadow( QLabel::Plain );
157     GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 );
158     TextLabelC1A2 = new QLabel( GroupConstructor1, "TextLabelC1A2" );
159     TextLabelC1A2->setText( tr( "GEOM_RADIUS"  ) );
160     TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
161     TextLabelC1A2->setFrameShape( QLabel::NoFrame );
162     TextLabelC1A2->setFrameShadow( QLabel::Plain );
163     GroupConstructor1Layout->addWidget( TextLabelC1A2, 1, 0 );
164
165     SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupConstructor1, "GeomSpinBox_C1A2" ) ;
166     GroupConstructor1Layout->addWidget( SpinBox_C1A2, 1, 2 );
167
168     GeometryGUI_SphereDlgLayout->addWidget( GroupConstructor1, 1, 0 );
169
170     /***************************************************************/
171     GroupConstructor2 = new QGroupBox( this, "GroupConstructor2" );
172     GroupConstructor2->setTitle( tr( "GEOM_SPHERE_RO"  ) );
173     GroupConstructor2->setColumnLayout(0, Qt::Vertical );
174     GroupConstructor2->layout()->setSpacing( 0 );
175     GroupConstructor2->layout()->setMargin( 0 );
176     GroupConstructor2Layout = new QGridLayout( GroupConstructor2->layout() );
177     GroupConstructor2Layout->setAlignment( Qt::AlignTop );
178     GroupConstructor2Layout->setSpacing( 6 );
179     GroupConstructor2Layout->setMargin( 11 );
180
181     SpinBox_C2A1 = new GeometryGUI_SpinBox( GroupConstructor2, "GeomSpinBox_C2A1" ) ;
182     GroupConstructor2Layout->addWidget( SpinBox_C2A1, 0, 1 );
183
184     TextLabelC2A1 = new QLabel( GroupConstructor2, "TextLabelC2A1" );
185     TextLabelC2A1->setText( tr( "GEOM_RADIUS" ) );
186     TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) );
187     TextLabelC2A1->setFrameShape( QLabel::NoFrame );
188     TextLabelC2A1->setFrameShadow( QLabel::Plain );
189     GroupConstructor2Layout->addWidget( TextLabelC2A1, 0, 0 );
190     QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
191     GroupConstructor2Layout->addItem( spacer_5, 1, 1 );
192     GeometryGUI_SphereDlgLayout->addWidget( GroupConstructor2, 1, 0 );
193
194     Init(Sel) ; /* Initialisations */
195 }
196
197
198 //=================================================================================
199 // function : ~GeometryGUI_SphereDlg()
200 // purpose  : Destroys the object and frees any allocated resources
201 //=================================================================================
202 GeometryGUI_SphereDlg::~GeometryGUI_SphereDlg()
203 {  
204   /* no need to delete child widgets, Qt does it all for us */
205 }
206
207
208 //=================================================================================
209 // function : Init()
210 // purpose  :
211 //=================================================================================
212 void GeometryGUI_SphereDlg::Init( SALOME_Selection* Sel )
213 {
214
215   /* Get setting of step value from file configuration */
216   double step ;
217   QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
218   step = St.toDouble() ;
219
220   /* min, max, step and decimals for spin boxes */
221   SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
222   SpinBox_C1A2->SetValue( 100.0 ) ;  
223   SpinBox_C2A1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
224   SpinBox_C2A1->SetValue( 100.0 ) ;
225   
226   GroupConstructor1->show();
227   GroupConstructor2->hide();
228   myConstructorId = 0 ;
229   Constructor1->setChecked( TRUE );
230   myEditCurrentArgument = LineEditC1A1 ;        
231   mySelection = Sel;
232   myGeomGUI = GeometryGUI::GetGeometryGUI() ;
233   myPoint1.SetCoord( 0.0, 0.0, 0.0 );
234   
235   myRadius = 100.0 ;
236   myOkRadius = true ;
237   myOkPoint1 = false ;
238   
239   mySimulationTopoDs.Nullify() ;
240   myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;  
241   
242   /* Filters definition */
243   Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
244   myGeom = GEOM::GEOM_Gen::_narrow(comp);
245   myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
246   mySelection->AddFilter(myVertexFilter) ; /* first filter used */
247
248   /* signals and slots connections */
249   connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
250   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
251   connect( buttonApply, SIGNAL( clicked() ),  this, SLOT(ClickOnApply() ) );
252   connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );  
253   connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
254   
255   connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
256
257   connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
258   connect( SpinBox_C2A1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
259
260   connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;  
261   connect( mySelection, SIGNAL( currentSelectionChanged() ),     this, SLOT( SelectionIntoArgument() ) );
262   /* to close dialog if study change */
263   connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
264  
265   /* Move widget on the botton right corner of main widget */
266   int x, y ;
267   myGeomGUI->DefineDlgPosition( this, x, y ) ;
268   this->move( x, y ) ;
269   this->show() ; /* displays Dialog */
270
271   return ;
272 }
273
274
275
276 //=================================================================================
277 // function : ConstructorsClicked()
278 // purpose  : Radio button management
279 //=================================================================================
280 void GeometryGUI_SphereDlg::ConstructorsClicked(int constructorId)
281 {
282   myGeomGUI->EraseSimulationShape() ;
283
284   switch (constructorId)
285     {
286     case 0:
287       {
288         GroupConstructor1->show();
289         GroupConstructor2->hide();
290         myConstructorId = constructorId ;
291         myEditCurrentArgument = SpinBox_C1A2 ;  
292         LineEditC1A1->setText(tr("")) ;
293         SpinBox_C1A2->SetValue( 100.0 ) ;
294         myRadius = 100.0 ;
295         myOkRadius = true ;
296         myOkPoint1 = false ;
297         /* filter for next selections */
298         mySelection->ClearFilters() ;
299         mySelection->AddFilter( myVertexFilter );
300         connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
301         break;
302       }
303     case 1:
304       {
305         GroupConstructor1->hide();
306         GroupConstructor2->show();
307         myConstructorId = constructorId ;
308         myEditCurrentArgument = SpinBox_C2A1 ;;
309         SpinBox_C2A1->SetValue( 100.0 ) ;
310         myRadius = 100.0 ;
311         myOkRadius = true ;
312         myPoint1.SetCoord( 0.0, 0.0, 0.0 ); /* at origin */
313         myOkPoint1 = false ;
314         mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
315         myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; 
316         /* no filters here */
317         mySelection->ClearFilters() ;
318         break;
319       }
320     }
321  return ;
322 }
323
324 //=================================================================================
325 // function : ClickOnApply()
326 // purpose  :
327 //=================================================================================
328 void GeometryGUI_SphereDlg::ClickOnApply()
329 {
330   myGeomGUI->EraseSimulationShape() ;
331   mySimulationTopoDs.Nullify() ;
332   myGeomGUI->GetDesktop()->putInfo( tr("") ) ; 
333   switch(myConstructorId)
334     { 
335     case 0 :
336       { 
337         if( myOkPoint1 && myOkRadius ) {
338           myGeomGUI->MakeSphereAndDisplay( myPoint1, myRadius ) ;
339         }
340         break ;
341       }
342     case 1 :
343       {
344         if( myOkRadius )
345           myGeomGUI->MakeSphereAndDisplay( myPoint1, myRadius ) ;
346         break ;
347       }
348     }
349   return ;
350 }
351
352
353 //=================================================================================
354 // function : ClickOnOk()
355 // purpose  :
356 //=================================================================================
357 void GeometryGUI_SphereDlg::ClickOnOk()
358 {
359   this->ClickOnApply() ;
360   this->ClickOnCancel() ;
361
362   return ;
363 }
364
365 //=================================================================================
366 // function : ClickOnCancel()
367 // purpose  :
368 //=================================================================================
369 void GeometryGUI_SphereDlg::ClickOnCancel()
370 {
371   mySelection->ClearFilters() ;
372   myGeomGUI->EraseSimulationShape() ;
373   mySimulationTopoDs.Nullify() ;
374   disconnect( mySelection, 0, this, 0 );
375   myGeomGUI->ResetState() ;
376   reject() ;
377   return ;
378 }
379
380
381 //=================================================================================
382 // function : SelectionIntoArgument()
383 // purpose  : Called when selection as changed or other case
384 //=================================================================================
385 void GeometryGUI_SphereDlg::SelectionIntoArgument()
386 {
387   myGeomGUI->EraseSimulationShape() ; 
388   mySimulationTopoDs.Nullify() ;
389   
390   /* Future name of selection */
391   QString aString = "";
392
393   int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
394   if ( nbSel != 1 ) {
395     if ( myEditCurrentArgument == LineEditC1A1 ) {
396       LineEditC1A1->setText("") ;
397       myOkPoint1 = false ;
398     }
399     return ;
400   }
401   
402   /* nbSel == 1 ! */
403   TopoDS_Shape S; 
404   if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
405     return ;
406     
407   /* Constructor 1 treatment */
408   if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
409     LineEditC1A1->setText(aString) ;
410     myOkPoint1 = true ;
411   }
412   
413   if( ( myOkPoint1 || myConstructorId == 1 ) && myOkRadius )  {
414     mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
415     myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; 
416   }
417   return ;
418 }
419
420
421 //=================================================================================
422 // function : LineEditReturnPressed()
423 // purpose  :
424 //=================================================================================
425 void GeometryGUI_SphereDlg::LineEditReturnPressed()
426 {
427   QLineEdit* send = (QLineEdit*)sender();  
428   if( send == LineEditC1A1 )
429     myEditCurrentArgument = LineEditC1A1 ;
430   else
431     return ;
432   
433   /* User name of object input management                          */
434   /* If successfull the selection is changed and signal emitted... */
435   /* so SelectionIntoArgument() is automatically called.           */
436   QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ;
437   const QString objectUserName = LE->text() ;
438   QWidget* thisWidget = (QWidget*)this ;
439   if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
440     LE->setText( objectUserName ) ;
441   }
442   return ;
443 }
444
445
446 //=================================================================================
447 // function : ValueChangedInSpinBox()
448 // purpose  :
449 //=================================================================================
450 void GeometryGUI_SphereDlg::ValueChangedInSpinBox( double newValue )
451 {  
452   myRadius = newValue ;
453   myOkRadius = true ;
454   
455   if ( ( myOkPoint1 || myConstructorId == 1 ) && myOkRadius ) {
456     mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
457     myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; 
458   }
459   else {
460     myGeomGUI->EraseSimulationShape() ; 
461     mySimulationTopoDs.Nullify() ;
462   }
463
464   return ;
465 }
466
467
468
469 //=================================================================================
470 // function : SetEditCurrentArgument()
471 // purpose  :
472 //=================================================================================
473 void GeometryGUI_SphereDlg::SetEditCurrentArgument()
474 {
475   QPushButton* send = (QPushButton*)sender();
476   switch (myConstructorId)
477     {
478     case 0: /* default constructor */
479       { 
480         if(send == SelectButtonC1A1) {
481           LineEditC1A1->setFocus() ;
482           myEditCurrentArgument = LineEditC1A1;
483           mySelection->AddFilter(myVertexFilter) ;
484           SelectionIntoArgument() ;
485         }
486         break;
487       }
488     case 1:
489       {
490         /* no selection button here */
491         break;
492       }
493
494     }
495   return ;
496 }
497
498 //=================================================================================
499 // function : DeactivateActiveDialog()
500 // purpose  :
501 //=================================================================================
502 void GeometryGUI_SphereDlg::DeactivateActiveDialog()
503 {
504   if ( GroupConstructors->isEnabled() ) {
505
506     GroupConstructors->setEnabled(false) ;
507     GroupConstructor1->setEnabled(false) ;
508     GroupConstructor2->setEnabled(false) ;
509     GroupButtons->setEnabled(false) ;
510     disconnect( mySelection, 0, this, 0 );
511     myGeomGUI->EraseSimulationShape() ;
512     mySelection->ClearFilters() ;
513   }
514   return ;
515 }
516
517 //=================================================================================
518 // function : ActivateThisDialog()
519 // purpose  :
520 //=================================================================================
521 void GeometryGUI_SphereDlg::ActivateThisDialog()
522 {
523   /* Emit a signal to deactivate other active dialog */
524   myGeomGUI->EmitSignalDeactivateDialog() ;
525   GroupConstructors->setEnabled(true) ;
526   GroupConstructor1->setEnabled(true) ;
527   GroupConstructor2->setEnabled(true) ;
528   GroupButtons->setEnabled(true) ;
529
530   connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
531   if( !mySimulationTopoDs.IsNull() )
532     myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
533
534   return ;
535 }
536
537
538 //=================================================================================
539 // function : enterEvent()
540 // purpose  :
541 //=================================================================================
542 void GeometryGUI_SphereDlg::enterEvent(QEvent* e)
543 {
544   if ( GroupConstructors->isEnabled() )
545     return ;  
546   ActivateThisDialog() ;
547 }
548
549
550 //=================================================================================
551 // function : closeEvent()
552 // purpose  :
553 //=================================================================================
554 void GeometryGUI_SphereDlg::closeEvent( QCloseEvent* e )
555 {
556   this->ClickOnCancel() ; /* same than click on cancel button */
557 }
558
559
560