1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : GeometryGUI_BoxDlg.cxx
25 // Author : Lucien PIGNOLONI
30 #include "GeometryGUI_BoxDlg.h"
31 #include "GeometryGUI_SpinBox.h"
33 #include "GeometryGUI.h"
34 #include "QAD_Application.h"
35 #include "QAD_Desktop.h"
36 #include "QAD_Config.h"
37 #include "utilities.h"
39 #include <qbuttongroup.h>
41 #include <qgroupbox.h>
42 #include <qlineedit.h>
43 #include <qpushbutton.h>
44 #include <qradiobutton.h>
48 #include <qwhatsthis.h>
52 #include <qvalidator.h>
54 #include <qmessagebox.h>
58 //=================================================================================
59 // class : GeometryGUI_BoxDlg()
60 // purpose : Constructs a GeometryGUI_BoxDlg 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_BoxDlg::GeometryGUI_BoxDlg( 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 )
68 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BOX_2P")));
69 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
70 QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BOX_DXYZ")));
73 setName( "GeometryGUI_BoxDlg" );
75 setCaption( tr( "GEOM_BOX_TITLE" ) );
76 setSizeGripEnabled( TRUE );
77 GeometryGUI_BoxDlgLayout = new QGridLayout( this );
78 GeometryGUI_BoxDlgLayout->setSpacing( 6 );
79 GeometryGUI_BoxDlgLayout->setMargin( 11 );
81 /***************************************************************/
82 GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
83 GroupConstructors->setTitle( tr( "GEOM_BOX" ) );
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 QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
93 GroupConstructorsLayout->addItem( spacer_1, 0, 3 );
94 Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
95 Constructor1->setText( tr( "" ) );
96 Constructor1->setPixmap( image0 );
97 Constructor1->setChecked( TRUE );
98 Constructor1->setMinimumSize( QSize( 50, 0 ) );
99 GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
100 Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
101 Constructor2->setText( tr( "" ) );
102 Constructor2->setPixmap( image2 );
103 Constructor2->setMinimumSize( QSize( 50, 0 ) );
104 GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
105 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
106 GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
107 GeometryGUI_BoxDlgLayout->addWidget( GroupConstructors, 0, 0 );
109 /***************************************************************/
110 GroupButtons = new QGroupBox( this, "GroupButtons" );
111 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
112 GroupButtons->setTitle( tr( "" ) );
113 GroupButtons->setColumnLayout(0, Qt::Vertical );
114 GroupButtons->layout()->setSpacing( 0 );
115 GroupButtons->layout()->setMargin( 0 );
116 GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
117 GroupButtonsLayout->setAlignment( Qt::AlignTop );
118 GroupButtonsLayout->setSpacing( 6 );
119 GroupButtonsLayout->setMargin( 11 );
120 buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
121 buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
122 buttonCancel->setAutoDefault( TRUE );
123 GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
124 buttonApply = new QPushButton( GroupButtons, "buttonApply" );
125 buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
126 buttonApply->setAutoDefault( TRUE );
127 GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
128 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
129 GroupButtonsLayout->addItem( spacer, 0, 2 );
130 buttonOk = new QPushButton( GroupButtons, "buttonOk" );
131 buttonOk->setText( tr( "GEOM_BUT_OK" ) );
132 buttonOk->setAutoDefault( TRUE );
133 buttonOk->setDefault( TRUE );
134 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
135 GeometryGUI_BoxDlgLayout->addWidget( GroupButtons, 2, 0 );
137 /***************************************************************/
138 GroupPoints = new QGroupBox( this, "GroupPoints" );
139 GroupPoints->setGeometry( QRect( 10, 10, 280, 90 ) );
140 GroupPoints->setTitle( tr( "GEOM_DIAGONAL_POINTS" ) );
141 GroupPoints->setFrameShape( QGroupBox::Box );
142 GroupPoints->setFrameShadow( QGroupBox::Sunken );
143 GroupPoints->setColumnLayout(0, Qt::Vertical );
144 GroupPoints->layout()->setSpacing( 0 );
145 GroupPoints->layout()->setMargin( 0 );
146 GroupPointsLayout = new QGridLayout( GroupPoints->layout() );
147 GroupPointsLayout->setAlignment( Qt::AlignTop );
148 GroupPointsLayout->setSpacing( 6 );
149 GroupPointsLayout->setMargin( 11 );
150 SelectButtonPt2 = new QPushButton( GroupPoints, "SelectButtonPt2" );
151 SelectButtonPt2->setText( tr( "" ) );
152 SelectButtonPt2->setPixmap( image1 );
153 GroupPointsLayout->addWidget( SelectButtonPt2, 1, 1 );
154 LineEditPt1 = new QLineEdit( GroupPoints, "LineEditPt1" );
155 GroupPointsLayout->addWidget( LineEditPt1, 0, 2 );
156 LineEditPt2 = new QLineEdit( GroupPoints, "LineEditPt2" );
157 GroupPointsLayout->addWidget( LineEditPt2, 1, 2 );
158 SelectButtonPt1 = new QPushButton( GroupPoints, "SelectButtonPt1" );
159 SelectButtonPt1->setText( tr( "" ) );
160 SelectButtonPt1->setPixmap( image1 );
161 SelectButtonPt1->setToggleButton( FALSE );
162 GroupPointsLayout->addWidget( SelectButtonPt1, 0, 1 );
163 TextLabelPt1 = new QLabel( GroupPoints, "TextLabelPt1" );
164 TextLabelPt1->setText( tr( "GEOM_POINT_I" ).arg("1") );
165 TextLabelPt1->setMinimumSize( QSize( 50, 0 ) );
166 TextLabelPt1->setFrameShape( QLabel::NoFrame );
167 TextLabelPt1->setFrameShadow( QLabel::Plain );
168 GroupPointsLayout->addWidget( TextLabelPt1, 0, 0 );
169 TextLabelPt2 = new QLabel( GroupPoints, "TextLabelPt2" );
170 TextLabelPt2->setText( tr( "GEOM_POINT_I" ).arg("2") );
171 TextLabelPt2->setMinimumSize( QSize( 50, 0 ) );
172 GroupPointsLayout->addWidget( TextLabelPt2, 1, 0 );
173 GeometryGUI_BoxDlgLayout->addWidget( GroupPoints, 1, 0 );
175 /***************************************************************/
176 GroupDimensions = new QGroupBox( this, "GroupDimensions" );
177 GroupDimensions->setGeometry( QRect( 11, 75, 310, 80 ) );
178 GroupDimensions->setTitle( tr( "GEOM_BOX_OBJ" ) );
179 GroupDimensions->setColumnLayout(0, Qt::Vertical );
180 GroupDimensions->setMinimumSize( QSize( 0, 90 ) );
181 GroupDimensions->layout()->setSpacing( 0 );
182 GroupDimensions->layout()->setMargin( 0 );
183 GroupDimensionsLayout = new QGridLayout( GroupDimensions->layout() );
184 GroupDimensionsLayout->setAlignment( Qt::AlignTop );
185 GroupDimensionsLayout->setSpacing( 6 );
186 GroupDimensionsLayout->setMargin( 11 );
188 TextLabel_DZ = new QLabel( GroupDimensions, "TextLabel_DZ" );
189 TextLabel_DZ->setText( tr( "GEOM_DZ" ) );
190 GroupDimensionsLayout->addWidget( TextLabel_DZ, 0, 4 );
191 TextLabel_DY = new QLabel( GroupDimensions, "TextLabel_DY" );
192 TextLabel_DY->setText( tr( "GEOM_DY" ) );
193 GroupDimensionsLayout->addWidget( TextLabel_DY, 0, 2 );
194 TextLabel_DX = new QLabel( GroupDimensions, "TextLabel_DX" );
195 TextLabel_DX->setText( tr( "GEOM_DX" ) );
196 GroupDimensionsLayout->addWidget( TextLabel_DX, 0, 0 );
198 /* Spin boxes construction */
199 SpinBox_DX = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DX" ) ;
200 GroupDimensionsLayout->addWidget( SpinBox_DX, 0, 1 );
201 SpinBox_DY = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DY" ) ;
202 GroupDimensionsLayout->addWidget( SpinBox_DY, 0, 3 );
203 SpinBox_DZ = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DZ" ) ;
204 GroupDimensionsLayout->addWidget( SpinBox_DZ, 0, 5 );
206 QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed );
207 GroupDimensionsLayout->addItem( spacer1, 1, 3 );
209 GeometryGUI_BoxDlgLayout->addWidget( GroupDimensions, 1, 0 );
211 /* Initialisations */
216 //=================================================================================
217 // function : ~DialogBox_Box()
218 // purpose : Destroys the object and frees any allocated resources
219 //=================================================================================
220 GeometryGUI_BoxDlg::~GeometryGUI_BoxDlg()
222 // no need to delete child widgets, Qt does it all for us
223 this->destroy(TRUE, TRUE) ;
227 //=================================================================================
230 //=================================================================================
231 void GeometryGUI_BoxDlg::Init(SALOME_Selection *Sel)
235 /* Get setting of step value from file configuration */
237 QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
238 step = St.toDouble() ;
240 /* min, max, step and decimals for spin boxes */
241 SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
242 SpinBox_DX->SetValue( 200.0 ) ;
243 SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
244 SpinBox_DY->SetValue( 200.0 ) ;
245 SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
246 SpinBox_DZ->SetValue( 200.0 ) ;
249 GroupDimensions->hide() ;
250 myConstructorId = 0 ;
251 Constructor1->setChecked( TRUE );
252 myEditCurrentArgument = LineEditPt1 ;
254 myGeomGUI = GeometryGUI::GetGeometryGUI() ;
255 myPoint1.SetCoord( 0.0, 0.0, 0.0 );
256 myPoint2.SetCoord( 0.0, 0.0, 0.0 );
257 myOkPoint1 = myOkPoint2 = false ;
258 mySimulationTopoDs.Nullify() ;
260 myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
262 // TODO previous selection into argument ?
264 /* Vertices Filter for all arguments */
265 Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
266 myGeom = GEOM::GEOM_Gen::_narrow(comp);
267 myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
268 mySelection->AddFilter( myVertexFilter ); /* filter for next selection */
270 /* signals and slots connections */
271 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ) ;
272 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
273 connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ) ;
274 connect( GroupConstructors, SIGNAL(clicked(int) ), this, SLOT( ConstructorsClicked(int) ) ) ;
275 connect( SelectButtonPt1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
276 connect( SelectButtonPt2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
278 connect( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
279 connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
280 connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
282 connect( LineEditPt1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
283 connect( LineEditPt2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
285 connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
286 connect( mySelection, SIGNAL ( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ;
287 /* To close dialog if study change */
288 connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
290 /* Move widget on the botton right corner of main widget */
292 myGeomGUI->DefineDlgPosition( this, x, y ) ;
295 this->show() ; /* displays Dialog */
300 //=================================================================================
301 // function : ConstructorsClicked()
302 // purpose : Radio button management
303 //=================================================================================
304 void GeometryGUI_BoxDlg::ConstructorsClicked(int constructorId)
307 mySelection->ClearFilters() ;
308 myGeomGUI->EraseSimulationShape() ;
310 switch (constructorId)
315 GroupDimensions->hide() ;
316 myConstructorId = constructorId ;
317 myEditCurrentArgument = LineEditPt1 ;
318 Constructor1->setChecked( TRUE );
319 LineEditPt1->setText("") ;
320 LineEditPt2->setText("") ;
321 myOkPoint1 = myOkPoint2 = false ;
323 /* filter for next selection */
324 mySelection->AddFilter( myVertexFilter );
325 connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
331 GroupDimensions->show();
332 myConstructorId = constructorId ;
333 myOkPoint1 = myOkPoint2 = false ;
335 disconnect( mySelection, 0, this, 0 );
337 double initValue = 200.0 ;
338 SpinBox_DX->SetValue( initValue ) ;
339 SpinBox_DY->SetValue( initValue ) ;
340 SpinBox_DZ->SetValue( initValue ) ;
342 myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ;
343 myPoint2.SetCoord( initValue, initValue,initValue ) ;
345 mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape();
346 myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
353 //=================================================================================
354 // function : ClickOnOk()
356 //=================================================================================
357 void GeometryGUI_BoxDlg::ClickOnOk()
359 this->ClickOnApply() ;
360 this->ClickOnCancel() ;
364 //=================================================================================
365 // function : ClickOnApply()
367 //=================================================================================
368 void GeometryGUI_BoxDlg::ClickOnApply()
370 //NRI+ : 02/12/2202 - BugID 1065
371 // if (mySimulationTopoDs.IsNull())
373 myGeomGUI->EraseSimulationShape() ;
374 mySimulationTopoDs.Nullify() ;
375 myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
377 switch(myConstructorId)
381 //NRI+ : 02/12/2202 - BugID 1065 mySelection->ClearFilters() ;
382 if(myOkPoint1 && myOkPoint2)
383 myGeomGUI->MakeBoxAndDisplay( myPoint1, myPoint2 ) ;
388 /* Recup args and call method */
389 double vx = SpinBox_DX->GetValue() ;
390 double vy = SpinBox_DY->GetValue() ;
391 double vz = SpinBox_DZ->GetValue() ;
392 myPoint1.SetCoord(0.0, 0.0, 0.0) ;
393 myPoint2.SetCoord(vx, vy, vz) ;
394 myGeomGUI->MakeBoxAndDisplay( myPoint1, myPoint2 ) ;
402 //=================================================================================
403 // function : ClickOnCancel()
405 //=================================================================================
406 void GeometryGUI_BoxDlg::ClickOnCancel()
408 mySelection->ClearFilters() ;
409 myGeomGUI->EraseSimulationShape() ;
410 mySimulationTopoDs.Nullify() ;
411 disconnect( mySelection, 0, this, 0 );
412 myGeomGUI->ResetState() ;
418 //=================================================================================
419 // function : SelectionIntoArgument()
420 // purpose : Called when selection as changed
421 //=================================================================================
422 void GeometryGUI_BoxDlg::SelectionIntoArgument()
424 myEditCurrentArgument->setText("") ;
425 myGeomGUI->EraseSimulationShape() ;
426 mySimulationTopoDs.Nullify() ;
428 QString aString = "" ; /* name of selection */
430 int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
432 if ( myEditCurrentArgument == LineEditPt1 ) {
435 else if ( myEditCurrentArgument == LineEditPt2 ) {
443 if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
446 if ( myEditCurrentArgument == LineEditPt1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
447 myEditCurrentArgument->setText( aString ) ;
450 else if ( myEditCurrentArgument == LineEditPt2 && myGeomGUI->VertexToPoint(S, myPoint2) ) {
451 myEditCurrentArgument->setText( aString ) ;
455 if( myOkPoint1 && myOkPoint2 && TestBoxDimensions( myPoint1, myPoint2 ) ) {
456 mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape();
457 myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
463 //=================================================================================
464 // function : SetEditCurrentArgument()
466 //=================================================================================
467 void GeometryGUI_BoxDlg::SetEditCurrentArgument()
469 QPushButton* send = (QPushButton*)sender();
470 switch (myConstructorId)
472 case 0: // default constructor
474 if(send == SelectButtonPt1) {
475 LineEditPt1->setFocus() ;
476 myEditCurrentArgument = LineEditPt1;
478 else if(send == SelectButtonPt2) {
479 LineEditPt2->setFocus() ;
480 myEditCurrentArgument = LineEditPt2;
482 mySelection->AddFilter(myVertexFilter) ;
483 SelectionIntoArgument() ;
488 /* nothing to do here */
495 //=================================================================================
496 // function : ValueChangedInSpinBox()
498 //=================================================================================
499 void GeometryGUI_BoxDlg::ValueChangedInSpinBox( double newValue )
501 if(myConstructorId != 1)
504 myGeomGUI->EraseSimulationShape() ;
505 mySimulationTopoDs.Nullify() ;
507 QObject* send = (QObject*)sender() ;
510 if( send == SpinBox_DX ) {
512 vy = SpinBox_DY->GetValue() ;
513 vz = SpinBox_DZ->GetValue() ;
514 } else if ( send == SpinBox_DY ) {
515 vx = SpinBox_DX->GetValue() ;
517 vz = SpinBox_DZ->GetValue() ;
518 } else if (send == SpinBox_DZ ) {
519 vx = SpinBox_DX->GetValue() ;
520 vy = SpinBox_DY->GetValue() ;
524 myPoint1.SetCoord(0.0, 0.0, 0.0) ;
525 myPoint2.SetCoord(vx, vy, vz) ;
527 if ( TestBoxDimensions( myPoint1, myPoint2 ) ) {
528 mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape();
529 myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
535 //=================================================================================
536 // function : LineEditReturnPressed()
538 //=================================================================================
539 void GeometryGUI_BoxDlg::LineEditReturnPressed()
541 QLineEdit* send = (QLineEdit*)sender();
542 if( send == LineEditPt1 )
543 myEditCurrentArgument = LineEditPt1 ;
544 else if ( send == LineEditPt2 )
545 myEditCurrentArgument = LineEditPt2 ;
549 /* User name of object input management */
550 /* If successfull the selection is changed and signal emitted... */
551 /* so SelectionIntoArgument() is automatically called. */
552 const QString objectUserName = myEditCurrentArgument->text() ;
553 QWidget* thisWidget = (QWidget*)this ;
554 if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
555 myEditCurrentArgument->setText( objectUserName ) ;
561 //=================================================================================
562 // function : DeactivateActiveDialog()
564 //=================================================================================
565 void GeometryGUI_BoxDlg::DeactivateActiveDialog()
567 if ( GroupConstructors->isEnabled() ) {
569 GroupConstructors->setEnabled(false) ;
570 GroupDimensions->setEnabled(false) ;
571 GroupButtons->setEnabled(false) ;
572 GroupPoints->setEnabled(false) ;
574 mySelection->ClearFilters() ;
575 disconnect( mySelection, 0, this, 0 );
576 myGeomGUI->SetActiveDialogBox(0) ;
577 myGeomGUI->EraseSimulationShape() ;
583 //=================================================================================
584 // function : ActivateThisDialog()
586 //=================================================================================
587 void GeometryGUI_BoxDlg::ActivateThisDialog()
590 /* Emit a signal to deactivate the active dialog */
591 myGeomGUI->EmitSignalDeactivateDialog() ;
593 GroupConstructors->setEnabled(true) ;
594 GroupDimensions->setEnabled(true) ;
595 GroupButtons->setEnabled(true) ;
596 GroupPoints->setEnabled(true) ;
598 connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
599 myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
600 if( !mySimulationTopoDs.IsNull() )
601 myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
606 //=================================================================================
607 // function : enterEvent [REDEFINED]
609 //=================================================================================
610 void GeometryGUI_BoxDlg::enterEvent(QEvent* e)
612 if ( GroupConstructors->isEnabled() )
614 ActivateThisDialog() ;
618 //=================================================================================
619 // function : closeEvent()
621 //=================================================================================
622 void GeometryGUI_BoxDlg::closeEvent( QCloseEvent* e )
624 this->ClickOnCancel() ; /* same than click on cancel button */
628 //=================================================================================
629 // function : TestBoxDimensions()
631 //=================================================================================
632 bool GeometryGUI_BoxDlg::TestBoxDimensions(gp_Pnt P1, gp_Pnt P2)
634 if ( ( fabs( P1.X() - P2.X() ) > Precision::Confusion() ) &&
635 ( fabs( P1.Y() - P2.Y() ) > Precision::Confusion() ) &&
636 ( fabs( P1.Z() - P2.Z() ) > Precision::Confusion() ) )