]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMGUI/GeometryGUI_PrismDlg.cxx
Salome HOME
sources v1.2c
[modules/geom.git] / src / GEOMGUI / GeometryGUI_PrismDlg.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_PrismDlg.cxx
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 using namespace std;
30 #include "GeometryGUI_PrismDlg.h"
31
32 #include "GeometryGUI.h"
33 #include "QAD_Application.h"
34 #include "QAD_Desktop.h"
35 #include "QAD_Config.h"
36 #include "utilities.h"
37
38 #include <qbuttongroup.h>
39 #include <qframe.h>
40 #include <qgroupbox.h>
41 #include <qlineedit.h>
42 #include <qvalidator.h>
43 #include <qpushbutton.h>
44 #include <qradiobutton.h>
45 #include <qlineedit.h>
46 #include <qlayout.h>
47 #include <qcheckbox.h>
48 #include <qvariant.h>
49 #include <qtooltip.h>
50 #include <qwhatsthis.h>
51 #include <qimage.h>
52 #include <qpixmap.h>
53 #include <qevent.h>
54 #include <qlabel.h>
55
56
57
58 //=================================================================================
59 // class    : GeometryGUI_PrismDlg()
60 // purpose  : Constructs a GeometryGUI_PrismDlg which is a child of 'parent', with the 
61 //            name 'name' and widget flags set to 'f'.
62 //            The dialog will by default be modeless, unless you set 'modal' to
63 //            TRUE to construct a modal dialog.
64 //=================================================================================
65 GeometryGUI_PrismDlg::GeometryGUI_PrismDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
66     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
67 {
68
69     QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_PRISM")));
70     QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT")));
71
72     if ( !name )
73         setName( "GeometryGUI_PrismDlg" );
74     resize( 303, 225 ); 
75     setCaption( tr( "GEOM_PRISM_TITLE"  ) );
76     setSizeGripEnabled( TRUE );
77     GeometryGUI_PrismDlgLayout = new QGridLayout( this ); 
78     GeometryGUI_PrismDlgLayout->setSpacing( 6 );
79     GeometryGUI_PrismDlgLayout->setMargin( 11 );
80
81     /**************************************************************/
82     GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
83     GroupConstructors->setTitle( tr( "GEOM_PRISM"  ) );
84     GroupConstructors->setExclusive( TRUE );
85     GroupConstructors->setColumnLayout(0, Qt::Vertical );
86     GroupConstructors->layout()->setSpacing( 0 );
87     GroupConstructors->layout()->setMargin( 0 );
88     GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
89     GroupConstructorsLayout->setAlignment( Qt::AlignTop );
90     GroupConstructorsLayout->setSpacing( 6 );
91     GroupConstructorsLayout->setMargin( 11 );
92     Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
93     Constructor1->setText( tr( ""  ) );
94     Constructor1->setPixmap( image0 );
95     Constructor1->setChecked( TRUE );
96     Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
97     GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
98     QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
99     GroupConstructorsLayout->addItem( spacer, 0, 2 );
100     GeometryGUI_PrismDlgLayout->addWidget( GroupConstructors, 0, 0 );
101
102     /**************************************************************/
103     GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
104     GroupConstructor1->setTitle( tr( "GEOM_PRISM_BSV"  ) );
105     GroupConstructor1->setColumnLayout(0, Qt::Vertical );
106     GroupConstructor1->layout()->setSpacing( 0 );
107     GroupConstructor1->layout()->setMargin( 0 );
108     GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
109     GroupConstructor1Layout->setAlignment( Qt::AlignTop );
110     GroupConstructor1Layout->setSpacing( 6 );
111     GroupConstructor1Layout->setMargin( 11 );
112     LineEditC1A2Line = new QLineEdit( GroupConstructor1, "LineEditC1A2Line" );
113     LineEditC1A2Line->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Line->sizePolicy().hasHeightForWidth() ) );
114     GroupConstructor1Layout->addMultiCellWidget( LineEditC1A2Line, 1, 1, 2, 3 );
115     LineEditC1A1Base = new QLineEdit( GroupConstructor1, "LineEditC1A1Base" );
116     LineEditC1A1Base->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Base->sizePolicy().hasHeightForWidth() ) );
117     GroupConstructor1Layout->addMultiCellWidget( LineEditC1A1Base, 0, 0, 2, 3 );
118     SelectButtonC1A1Base = new QPushButton( GroupConstructor1, "SelectButtonC1A1Base" );
119     SelectButtonC1A1Base->setText( tr( ""  ) );
120     SelectButtonC1A1Base->setPixmap( image1 );
121     GroupConstructor1Layout->addWidget( SelectButtonC1A1Base, 0, 1 );
122     SelectButtonC1A2Line = new QPushButton( GroupConstructor1, "SelectButtonC1A2Line" );
123     SelectButtonC1A2Line->setText( tr( ""  ) );
124     SelectButtonC1A2Line->setPixmap( image1 );
125     GroupConstructor1Layout->addWidget( SelectButtonC1A2Line, 1, 1 );
126     TextLabelBase = new QLabel( GroupConstructor1, "TextLabelBase" );
127     TextLabelBase->setText( tr( "GEOM_BASE"  ) );
128     TextLabelBase->setMinimumSize( QSize( 50, 0 ) );
129     TextLabelBase->setFrameShape( QLabel::NoFrame );
130     TextLabelBase->setFrameShadow( QLabel::Plain );
131     GroupConstructor1Layout->addWidget( TextLabelBase, 0, 0 );
132     TextLabelVector = new QLabel( GroupConstructor1, "TextLabelVector" );
133     TextLabelVector->setText( tr( "GEOM_VECTOR"  ) );
134     TextLabelVector->setMinimumSize( QSize( 50, 0 ) );
135     TextLabelVector->setFrameShape( QLabel::NoFrame );
136     TextLabelVector->setFrameShadow( QLabel::Plain );
137     GroupConstructor1Layout->addWidget( TextLabelVector, 1, 0 );
138
139     SpinBox_C1A3Height = new GeometryGUI_SpinBox( GroupConstructor1, "GeomSpinBox_C1A3Height" ) ;
140     SpinBox_C1A3Height->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_C1A3Height->sizePolicy().hasHeightForWidth() ) );
141     GroupConstructor1Layout->addWidget( SpinBox_C1A3Height, 2, 3 );
142
143     CheckBoxC3A1Reverse = new QCheckBox( GroupConstructor1, "CheckBoxC3A1Reverse" );
144     CheckBoxC3A1Reverse->setText( tr( "GEOM_REVERSE"  ) );
145     GroupConstructor1Layout->addMultiCellWidget( CheckBoxC3A1Reverse, 2, 2, 0, 1 );
146     TextLabelHeight = new QLabel( GroupConstructor1, "TextLabelHeight" );
147     TextLabelHeight->setText( tr( "GEOM_HEIGHT"  ) );
148     TextLabelHeight->setMinimumSize( QSize( 50, 0 ) );
149     TextLabelHeight->setFrameShape( QLabel::NoFrame );
150     TextLabelHeight->setFrameShadow( QLabel::Plain );
151     GroupConstructor1Layout->addWidget( TextLabelHeight, 2, 2 );
152     GeometryGUI_PrismDlgLayout->addWidget( GroupConstructor1, 1, 0 );
153     
154     /**************************************************************/
155     GroupButtons = new QGroupBox( this, "GroupButtons" );
156     GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
157     GroupButtons->setTitle( tr( ""  ) );
158     GroupButtons->setColumnLayout(0, Qt::Vertical );
159     GroupButtons->layout()->setSpacing( 0 );
160     GroupButtons->layout()->setMargin( 0 );
161     GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
162     GroupButtonsLayout->setAlignment( Qt::AlignTop );
163     GroupButtonsLayout->setSpacing( 6 );
164     GroupButtonsLayout->setMargin( 11 );
165     buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
166     buttonCancel->setText( tr( "GEOM_BUT_CLOSE"  ) );
167     buttonCancel->setAutoDefault( TRUE );
168     GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
169     buttonApply = new QPushButton( GroupButtons, "buttonApply" );
170     buttonApply->setText( tr( "GEOM_BUT_APPLY"  ) );
171     buttonApply->setAutoDefault( TRUE );
172     GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
173     QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
174     GroupButtonsLayout->addItem( spacer_9, 0, 2 );
175     buttonOk = new QPushButton( GroupButtons, "buttonOk" );
176     buttonOk->setText( tr( "GEOM_BUT_OK"  ) );
177     buttonOk->setAutoDefault( TRUE );
178     buttonOk->setDefault( TRUE );
179     GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
180     GeometryGUI_PrismDlgLayout->addWidget( GroupButtons, 2, 0 );
181
182     /* Initialisation */
183     Init( Sel ) ; 
184 }
185
186
187 //=================================================================================
188 // function : ~GeometryGUI_PrismDlg()
189 // purpose  : Destroys the object and frees any allocated resources
190 //=================================================================================
191 GeometryGUI_PrismDlg::~GeometryGUI_PrismDlg()
192 {  
193   /* no need to delete child widgets, Qt does it all for us */
194 }
195
196
197
198 //=================================================================================
199 // function : Init()
200 // purpose  :
201 //=================================================================================
202 void GeometryGUI_PrismDlg::Init( SALOME_Selection* Sel )
203 {
204
205   double step ;
206   QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
207   step = St.toDouble() ;
208   
209   /* min, max, step and decimals for spin boxes */
210   SpinBox_C1A3Height->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
211   SpinBox_C1A3Height->SetValue( 100.0 ) ;   /* = myHeight */
212
213   myHeight = 100.000 ;
214   mySelection = Sel ;
215   mySimulationTopoDs.Nullify() ;
216   myBaseTopo.Nullify() ;
217   myConstructorId = 0 ;
218   myDx = myDy = myDz = 0.0 ;
219
220   myGeomGUI = GeometryGUI::GetGeometryGUI() ;
221
222   GroupConstructor1->show();
223   myConstructorId = 0 ;
224   myEditCurrentArgument = LineEditC1A1Base ;
225   Constructor1->setChecked( TRUE );
226   myOkBase = myOkLine = false ;
227
228   myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
229   
230   /* Retrieves geom component */
231   Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry");
232   myGeom = GEOM::GEOM_Gen::_narrow(comp);
233   /* Filters definition */
234   myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom );
235
236
237   // TODO first selection into selection ?
238
239   /* signals and slots connections */
240   connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
241   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
242   connect( buttonApply, SIGNAL( clicked() ),  this, SLOT(ClickOnApply() ) );
243
244   connect( GroupConstructors, SIGNAL(clicked(int) ),   this, SLOT( ConstructorsClicked(int) ) );
245   connect( SelectButtonC1A1Base, SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
246   connect( SelectButtonC1A2Line, SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
247
248   connect( LineEditC1A1Base, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
249   connect( LineEditC1A2Line, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
250
251   connect( CheckBoxC3A1Reverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseVector(int) ) ) ;
252
253   connect( SpinBox_C1A3Height, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
254
255   connect( mySelection, SIGNAL( currentSelectionChanged() ),     this, SLOT( SelectionIntoArgument() ) );
256   connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
257   /* to close dialog if study change */
258   connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
259  
260   /* Move widget on the botton right corner of main widget */
261   int x, y ;
262   myGeomGUI->DefineDlgPosition( this, x, y ) ;
263   this->move( x, y ) ;
264   this->show() ; /* Displays Dialog */ 
265
266   return ;
267 }
268
269
270
271 //=================================================================================
272 // function : ConstructorsClicked()
273 // purpose  : Radio button management
274 //=================================================================================
275 void GeometryGUI_PrismDlg::ConstructorsClicked(int constructorId)
276 {
277   myGeomGUI->EraseSimulationShape() ;
278
279   switch (constructorId)
280     {
281     case 0: /* base shape + an edge used as a vector */
282       {
283         GroupConstructor1->show();
284         myConstructorId = constructorId ;
285         myEditCurrentArgument = LineEditC1A1Base ;
286         LineEditC1A2Line->setText(tr("")) ;
287
288         SpinBox_C1A3Height->SetValue(100) ;
289         myHeight = 100.0 ;
290
291         Constructor1->setChecked( TRUE );
292         myOkBase = myOkLine = false ;
293         SelectionIntoArgument() ;
294         break;
295       }
296     }
297  return ;
298 }
299
300 //=================================================================================
301 // function : ClickOnOk()
302 // purpose  :
303 //=================================================================================
304 void GeometryGUI_PrismDlg::ClickOnOk()
305 {
306   this->ClickOnApply() ;
307   this->ClickOnCancel() ;
308
309   return ;
310 }
311
312 //=================================================================================
313 // function : ClickOnApply()
314 // purpose  :
315 //=================================================================================
316 void GeometryGUI_PrismDlg::ClickOnApply()
317 {
318   gp_Pnt P1, P2 ;
319
320   if( !myOkBase || !myOkLine )
321     return ;
322   
323   try {
324     myGeomGUI->EraseSimulationShape() ;
325     mySimulationTopoDs.Nullify() ;
326     gp_Vec Vec(myDx, myDy, myDz );
327     Vec.Normalize() ;
328     Vec *= myHeight ;
329     P1.SetCoord( 0.0, 0.0, 0.0 ) ;
330     P2.SetCoord( Vec.X(), Vec.Y(), Vec.Z() ) ;
331     switch(myConstructorId)
332       { 
333       case 0 :
334         {
335           if( myOkBase && myOkLine ) {
336             myGeomGUI->MakePrismAndDisplay( myGeomShape, P1, P2 ) ;
337           }
338           break ;
339         }
340       }
341   }
342   catch(Standard_Failure) {
343     MESSAGE("Exception intercepted in GeometryGUI_PrismDlg" << endl ) ;
344     return ;
345   }
346   
347   return ;
348 }
349
350
351 //=================================================================================
352 // function : ClickOnCancel()
353 // purpose  :
354 //=================================================================================
355 void GeometryGUI_PrismDlg::ClickOnCancel()
356 {
357   mySelection->ClearFilters() ;
358   myGeomGUI->EraseSimulationShape() ;
359   mySimulationTopoDs.Nullify() ;
360   disconnect( mySelection, 0, this, 0 );
361   myGeomGUI->ResetState() ;
362   reject() ;
363   return ;
364 }
365
366
367 //=================================================================================
368 // function : SelectionIntoArgument()
369 // purpose  : Called when selection has changed
370 //=================================================================================
371 void GeometryGUI_PrismDlg::SelectionIntoArgument()
372 {
373   myGeomGUI->EraseSimulationShape() ; 
374   mySimulationTopoDs.Nullify() ;
375
376   /* Future the name of selection */
377   QString aString = "";
378
379   int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
380   if ( nbSel != 1 ) {
381     switch (myConstructorId) 
382       {
383       case 0:
384         {
385           if ( myEditCurrentArgument == LineEditC1A1Base ) {
386             LineEditC1A1Base->setText("") ;
387             myOkBase = false ;
388           }
389           else if ( myEditCurrentArgument == LineEditC1A2Line ) {
390             LineEditC1A2Line->setText("") ;
391             myOkLine = false ;
392           }
393           break ;
394         } 
395       }
396     return ;
397   }
398
399   /*  nbSel == 1  */
400   TopoDS_Shape S; 
401   if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
402     return ;
403   
404   gp_Pnt aPoint1, aPoint2 ;
405   
406   if ( myEditCurrentArgument == LineEditC1A1Base ) {
407     Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
408     Standard_Boolean testResult ;
409     myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
410     if( !testResult)
411       return ;
412     if ( S.ShapeType() <= 2 )
413       return;
414
415     LineEditC1A1Base->setText(aString) ;
416     myBaseTopo = S ;
417     myOkBase = true ;
418   }    
419
420   else if ( myEditCurrentArgument == LineEditC1A2Line && myGeomGUI->LinearEdgeExtremities(S, aPoint1, aPoint2) ) {
421     myGeomGUI->GetBipointDxDyDz( aPoint1, aPoint2, myDx, myDy, myDz ) ;
422     myEditCurrentArgument->setText(aString) ;
423     myOkLine = true ;
424   }
425
426   if( myOkBase && myOkLine ) {
427     MakePrismSimulationAndDisplay( myBaseTopo ) ;
428   }  
429   return ; 
430 }
431
432
433
434 //=================================================================================
435 // function : MakePrismSimulationAndDisplay()
436 // purpose  :
437 //=================================================================================
438 void GeometryGUI_PrismDlg::MakePrismSimulationAndDisplay( const TopoDS_Shape& S )
439 {
440   try {
441     gp_Vec Vec(myDx, myDy, myDz );
442     Vec.Normalize() ;
443     Vec *= myHeight ;
444     mySimulationTopoDs = BRepPrimAPI_MakePrism(S, Vec, Standard_False).Shape() ;
445   }
446   catch(Standard_Failure) {
447     MESSAGE( "Exception catched in MakePrismSimulationAndDisplay" << endl ) ;
448     return ;
449   }
450   myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
451   return ;
452 }
453
454
455
456
457 //=================================================================================
458 // function : SetEditCurrentArgument()
459 // purpose  :
460 //=================================================================================
461 void GeometryGUI_PrismDlg::SetEditCurrentArgument()
462 {
463   QPushButton* send = (QPushButton*)sender();  
464   mySelection->ClearFilters() ;
465
466   switch (myConstructorId)
467     {
468     case 0: /* default constructor */
469       { 
470         if( send == SelectButtonC1A1Base ) {
471           LineEditC1A1Base->setFocus() ;
472           myEditCurrentArgument = LineEditC1A1Base ;
473         }
474         else if(send == SelectButtonC1A2Line) {
475           LineEditC1A2Line->setFocus() ;
476           myEditCurrentArgument = LineEditC1A2Line;
477           mySelection->AddFilter(myEdgeFilter) ;
478         }       
479         SelectionIntoArgument() ;
480         break;
481       }
482     }
483   return ;
484 }
485
486 //=================================================================================
487 // function : ValueChangedInSpinBox()
488 // purpose  :
489 //=================================================================================
490 void GeometryGUI_PrismDlg::ValueChangedInSpinBox( double newValue )
491 {
492   QObject* send = (QObject*)sender();
493   
494   if( send == SpinBox_C1A3Height ) {
495     myHeight = newValue ;
496     if( myOkBase && myOkLine ) {
497       myGeomGUI->EraseSimulationShape() ;
498       mySimulationTopoDs.Nullify() ;
499       MakePrismSimulationAndDisplay( myBaseTopo ) ;
500     }
501   }
502   return ;
503 }
504
505
506 //=================================================================================
507 // function : LineEditReturnPressed()
508 // purpose  :
509 //=================================================================================
510 void GeometryGUI_PrismDlg::LineEditReturnPressed()
511 {
512   QLineEdit* send = (QLineEdit*)sender();  
513   if( send == LineEditC1A1Base )
514     myEditCurrentArgument = LineEditC1A1Base ;
515   else if ( send == LineEditC1A2Line )
516     myEditCurrentArgument = LineEditC1A2Line ; 
517   else
518     return ;
519   
520   /* User name of object input management                          */
521   /* If successfull the selection is changed and signal emitted... */
522   /* so SelectionIntoArgument() is automatically called.           */
523   const QString objectUserName = myEditCurrentArgument->text() ;
524   QWidget* thisWidget = (QWidget*)this ;
525   if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
526     myEditCurrentArgument->setText( objectUserName ) ;
527   }
528   return ;
529 }
530
531
532
533 //=================================================================================
534 // function : DeactivateActiveDialog()
535 // purpose  :
536 //=================================================================================
537 void GeometryGUI_PrismDlg::DeactivateActiveDialog()
538 {
539   if ( GroupConstructors->isEnabled() ) {
540     GroupConstructors->setEnabled(false) ;
541     GroupConstructor1->setEnabled(false) ;
542     GroupButtons->setEnabled(false) ;  
543     disconnect( mySelection, 0, this, 0 );
544     myGeomGUI->EraseSimulationShape() ;
545   }
546   return ;
547 }
548
549
550
551 //=================================================================================
552 // function : closeEvent()
553 // purpose  :
554 //=================================================================================
555 void GeometryGUI_PrismDlg::closeEvent( QCloseEvent* e )
556 {
557   this->ClickOnCancel() ; /* same than click on cancel button */
558 }
559
560
561 //=================================================================================
562 // function : enterEvent()
563 // purpose  : when mouse enter onto the QWidget
564 //=================================================================================
565 void GeometryGUI_PrismDlg::enterEvent( QEvent *  )
566 {
567   if ( GroupConstructors->isEnabled() )
568     return ;  
569   ActivateThisDialog() ;
570 }
571
572
573
574 //=================================================================================
575 // function : ActivateThisDialog()
576 // purpose  :
577 //=================================================================================
578 void GeometryGUI_PrismDlg::ActivateThisDialog()
579 {
580   /* Emit a signal to deactivate any active dialog */
581   myGeomGUI->EmitSignalDeactivateDialog() ;
582   GroupConstructors->setEnabled(true) ;
583   GroupConstructor1->setEnabled(true) ;
584   GroupButtons->setEnabled(true) ;
585
586   connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
587   if( !mySimulationTopoDs.IsNull() )
588     myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
589   return ;
590 }
591
592
593 //=================================================================================
594 // function : ReverseVector()
595 // purpose  : 'state' not used here
596 //=================================================================================
597 void GeometryGUI_PrismDlg::ReverseVector(int state)
598 {
599   myDx = -myDx ;
600   myDy = -myDy ;
601   myDz = -myDz ;
602   if(myOkBase && myOkLine) {
603     myGeomGUI->EraseSimulationShape() ;
604     mySimulationTopoDs.Nullify() ;
605     MakePrismSimulationAndDisplay( myBaseTopo ) ;
606   }
607   return ;
608