2 // File : GeometryGUI_TorusDlg.cxx
4 // Author : Lucien PIGNOLONI
6 // Module : GeometryGUI
7 // Copyright : OPEN CASCADE
10 #include "GeometryGUI_TorusDlg.h"
12 #include "GeometryGUI.h"
13 #include "QAD_Application.h"
14 #include "QAD_Desktop.h"
15 #include "QAD_Config.h"
16 #include "utilities.h"
18 #include <BRepAdaptor_Curve.hxx>
20 #include <qbuttongroup.h>
21 #include <qgroupbox.h>
23 #include <qlineedit.h>
24 #include <qpushbutton.h>
25 #include <qradiobutton.h>
29 #include <qwhatsthis.h>
36 //=================================================================================
37 // class : GeometryGUI_TorusDlg()
38 // purpose : Constructs a GeometryGUI_TorusDlg which is a child of 'parent', with the
39 // name 'name' and widget flags set to 'f'.
40 // The dialog will by default be modeless, unless you set 'modal' to
41 // TRUE to construct a modal dialog.
42 //=================================================================================
43 GeometryGUI_TorusDlg::GeometryGUI_TorusDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
44 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
47 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TORUS_PV")));
48 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
49 QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TORUS_DXYZ")));
52 setName( "GeometryGUI_TorusDlg" );
54 setCaption( tr( "GEOM_TORUS_TITLE" ) );
55 setSizeGripEnabled( TRUE );
56 GeometryGUI_TorusDlgLayout = new QGridLayout( this );
57 GeometryGUI_TorusDlgLayout->setSpacing( 6 );
58 GeometryGUI_TorusDlgLayout->setMargin( 11 );
60 /***************************************************************/
61 GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
62 GroupConstructors->setTitle( tr( "GEOM_TORUS" ) );
63 GroupConstructors->setExclusive( TRUE );
64 GroupConstructors->setColumnLayout(0, Qt::Vertical );
65 GroupConstructors->layout()->setSpacing( 0 );
66 GroupConstructors->layout()->setMargin( 0 );
67 GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
68 GroupConstructorsLayout->setAlignment( Qt::AlignTop );
69 GroupConstructorsLayout->setSpacing( 6 );
70 GroupConstructorsLayout->setMargin( 11 );
71 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
72 GroupConstructorsLayout->addItem( spacer, 0, 1 );
73 Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
74 Constructor1->setText( tr( "" ) );
75 Constructor1->setPixmap( image0 );
76 Constructor1->setChecked( TRUE );
77 Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,Constructor1->sizePolicy().hasHeightForWidth() ) );
78 Constructor1->setMinimumSize( QSize( 50, 0 ) );
79 GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
80 Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
81 Constructor2->setText( tr( "" ) );
82 Constructor2->setMinimumSize( QSize( 50, 0 ) );
83 Constructor2->setPixmap( image2 );
84 Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
85 GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
86 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
87 GroupConstructorsLayout->addItem( spacer_2, 0, 2 );
88 GeometryGUI_TorusDlgLayout->addWidget( GroupConstructors, 0, 0 );
90 /***************************************************************/
91 GroupButtons = new QGroupBox( this, "GroupButtons" );
92 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
93 GroupButtons->setTitle( tr( "" ) );
94 GroupButtons->setColumnLayout(0, Qt::Vertical );
95 GroupButtons->layout()->setSpacing( 0 );
96 GroupButtons->layout()->setMargin( 0 );
97 GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
98 GroupButtonsLayout->setAlignment( Qt::AlignTop );
99 GroupButtonsLayout->setSpacing( 6 );
100 GroupButtonsLayout->setMargin( 11 );
101 buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
102 buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
103 buttonCancel->setAutoDefault( TRUE );
104 GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
105 buttonApply = new QPushButton( GroupButtons, "buttonApply" );
106 buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
107 buttonApply->setAutoDefault( TRUE );
108 GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
109 QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
110 GroupButtonsLayout->addItem( spacer_9, 0, 2 );
111 buttonOk = new QPushButton( GroupButtons, "buttonOk" );
112 buttonOk->setText( tr( "GEOM_BUT_OK" ) );
113 buttonOk->setAutoDefault( TRUE );
114 buttonOk->setDefault( TRUE );
115 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
116 GeometryGUI_TorusDlgLayout->addWidget( GroupButtons, 2, 0 );
118 /***************************************************************/
119 GroupC1 = new QGroupBox( this, "GroupC1" );
120 GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
121 GroupC1->setColumnLayout(0, Qt::Vertical );
122 GroupC1->layout()->setSpacing( 0 );
123 GroupC1->layout()->setMargin( 0 );
124 GroupC1Layout = new QGridLayout( GroupC1->layout() );
125 GroupC1Layout->setAlignment( Qt::AlignTop );
126 GroupC1Layout->setSpacing( 6 );
127 GroupC1Layout->setMargin( 11 );
128 SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
129 SelectButtonC1A1->setText( tr( "" ) );
130 SelectButtonC1A1->setPixmap( image1 );
131 GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
133 LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
134 LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
135 GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
136 TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
137 TextLabelC1A1->setText( tr( "GEOM_BASE_POINT" ) );
138 TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
139 TextLabelC1A1->setFrameShape( QLabel::NoFrame );
140 TextLabelC1A1->setFrameShadow( QLabel::Plain );
141 GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
142 SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
143 SelectButtonC1A2->setText( tr( "" ) );
144 SelectButtonC1A2->setPixmap( image1 );
145 GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
146 LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
147 LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
148 GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
149 TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
150 TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) );
151 TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
152 TextLabelC1A2->setFrameShape( QLabel::NoFrame );
153 TextLabelC1A2->setFrameShadow( QLabel::Plain );
154 GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
155 TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
156 TextLabelC1A3->setText( tr( "GEOM_RADIUS_I" ).arg("1") );
157 TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
158 TextLabelC1A3->setFrameShape( QLabel::NoFrame );
159 TextLabelC1A3->setFrameShadow( QLabel::Plain );
160 GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
162 SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ;
163 SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) );
164 GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 );
166 TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
167 TextLabelC1A4->setText( tr( "GEOM_RADIUS_I" ).arg("2") );
168 TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
169 TextLabelC1A4->setFrameShape( QLabel::NoFrame );
170 TextLabelC1A4->setFrameShadow( QLabel::Plain );
171 GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 );
173 SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ;
174 SpinBox_C1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A4->sizePolicy().hasHeightForWidth() ) );
175 GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 );
177 GeometryGUI_TorusDlgLayout->addWidget( GroupC1, 1, 0 );
178 /***************************************************************/
180 GroupC2 = new QGroupBox( this, "GroupC2" );
181 GroupC2->setTitle( tr( "GEOM_BOX_OBJ" ) );
182 GroupC2->setColumnLayout(0, Qt::Vertical );
183 GroupC2->layout()->setSpacing( 0 );
184 GroupC2->layout()->setMargin( 0 );
185 GroupC2Layout = new QGridLayout( GroupC2->layout() );
186 GroupC2Layout->setAlignment( Qt::AlignTop );
187 GroupC2Layout->setSpacing( 6 );
188 GroupC2Layout->setMargin( 11 );
189 TextLabel_Radius1 = new QLabel( GroupC2, "TextLabel_Radius1" );
190 TextLabel_Radius1->setText( tr( "GEOM_RADIUS_I" ).arg("1") );
191 GroupC2Layout->addWidget( TextLabel_Radius1, 0, 0 );
192 TextLabel_Radius2 = new QLabel( GroupC2, "TextLabel_Radius2" );
193 TextLabel_Radius2->setText( tr( "GEOM_RADIUS_I" ).arg("2") );
194 GroupC2Layout->addWidget( TextLabel_Radius2, 1, 0 );
196 SpinBox_Radius1 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius1" ) ;
197 GroupC2Layout->addWidget( SpinBox_Radius1, 0, 1 );
199 SpinBox_Radius2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius2" ) ;
200 GroupC2Layout->addWidget( SpinBox_Radius2, 1, 1 );
202 QSpacerItem* spacer1 = new QSpacerItem( 20, 62, QSizePolicy::Minimum, QSizePolicy::Fixed );
203 GroupC2Layout->addItem( spacer1 );
204 GeometryGUI_TorusDlgLayout->addWidget(GroupC2 , 1, 0 );
206 /***************************************************************/
208 /* Initialisations */
213 //=================================================================================
214 // function : ~GeometryGUI_TorusDlg()
215 // purpose : Destroys the object and frees any allocated resources
216 //=================================================================================
217 GeometryGUI_TorusDlg::~GeometryGUI_TorusDlg()
219 // no need to delete child widgets, Qt does it all for us
223 //=================================================================================
226 //=================================================================================
227 void GeometryGUI_TorusDlg::Init( SALOME_Selection* Sel )
230 /* Get setting of step value from file configuration */
232 QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
233 step = St.toDouble() ;
235 /* min, max, step and decimals for spin boxes */
236 SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
237 SpinBox_C1A4->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
238 SpinBox_Radius1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
239 SpinBox_Radius2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
243 myConstructorId = 0 ;
244 Constructor1->setChecked( TRUE );
245 myEditCurrentArgument = LineEditC1A1 ;
247 myGeomGUI = GeometryGUI::GetGeometryGUI() ;
249 SpinBox_C1A3->SetValue( 300.0 ) ;
250 SpinBox_C1A4->SetValue( 100.0 ) ;
251 SpinBox_Radius1->SetValue( 300.0 ) ;
252 SpinBox_Radius2->SetValue( 100.0 ) ;
261 mySimulationTopoDs.Nullify() ;
262 myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
264 // TODO : previous selection into argument ?
266 /* Filter definitions */
267 Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
268 myGeom = GEOM::GEOM_Gen::_narrow(comp);
269 myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
270 myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
271 /* first filter used */
272 mySelection->AddFilter(myVertexFilter) ;
274 /* signals and slots connections */
275 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
276 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
277 connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
278 connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
279 connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
280 connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
282 connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
283 connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
284 connect( SpinBox_Radius1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
285 connect( SpinBox_Radius2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
287 connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
288 connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
290 connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
291 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
292 /* to close dialog if study change */
293 connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
295 /* Move widget on the botton right corner of main widget */
297 myGeomGUI->DefineDlgPosition( this, x, y ) ;
299 this->show() ; /* displays Dialog */
305 //=================================================================================
306 // function : ConstructorsClicked()
307 // purpose : Radio button management
308 //=================================================================================
309 void GeometryGUI_TorusDlg::ConstructorsClicked(int constructorId)
311 mySelection->ClearFilters() ;
312 myGeomGUI->EraseSimulationShape() ;
314 switch(myConstructorId)
320 myConstructorId = constructorId ;
321 myOkRadius1 = myOkPoint1 = myOkRadius2 = myOkDir = true ;
323 SpinBox_C1A3->SetValue( 300.0 ) ; /* radius 1 */
324 SpinBox_C1A4->SetValue( 100.0 ) ; /* radius 2 */
328 disconnect( mySelection, 0, this, 0 );
330 myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ;
331 myDir.SetCoord( 0.0, 0.0, 1.0 ) ;
333 if( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
334 gp_Dir aDir = myDir ;
336 MakeTorusSimulationAndDisplay() ;
344 myConstructorId = constructorId ;
345 myEditCurrentArgument = LineEditC1A1 ;
346 myOkRadius1 = myOkRadius2 = true ;
347 myOkPoint1 = myOkDir = false ;
349 SpinBox_Radius1->SetValue( 300.0 ) ;
350 SpinBox_Radius2->SetValue( 100.0 ) ;
354 LineEditC1A1->setText( tr("") );
355 disconnect( mySelection, 0, this, 0 );
363 //=================================================================================
364 // function : ClickOnApply()
366 //=================================================================================
367 void GeometryGUI_TorusDlg::ClickOnApply()
369 myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
370 myGeomGUI->EraseSimulationShape() ;
371 mySimulationTopoDs.Nullify() ;
372 switch(myConstructorId)
376 if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
377 myGeomGUI->MakeTorusAndDisplay( myPoint1, myDir, myRadius1, myRadius2 ) ;
383 if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
384 myGeomGUI->MakeTorusAndDisplay( myPoint1, myDir, myRadius1, myRadius2 ) ;
393 //=================================================================================
394 // function : ClickOnOk()
396 //=================================================================================
397 void GeometryGUI_TorusDlg::ClickOnOk()
399 this->ClickOnApply() ;
400 this->ClickOnCancel() ;
405 //=================================================================================
406 // function : ClickOnCancel()
408 //=================================================================================
409 void GeometryGUI_TorusDlg::ClickOnCancel()
411 mySelection->ClearFilters() ;
412 myGeomGUI->EraseSimulationShape() ;
413 mySimulationTopoDs.Nullify() ;
414 disconnect( mySelection, 0, this, 0 );
415 myGeomGUI->ResetState() ;
421 //=================================================================================
422 // function : SelectionIntoArgument()
423 // purpose : Called when selection as changed or other case
424 //=================================================================================
425 void GeometryGUI_TorusDlg::SelectionIntoArgument()
427 myGeomGUI->EraseSimulationShape() ;
428 mySimulationTopoDs.Nullify() ;
430 QString aString = ""; /* Name of future selection */
432 int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
434 if ( myEditCurrentArgument == LineEditC1A1 ) {
435 LineEditC1A1->setText("") ;
438 else if ( myEditCurrentArgument == LineEditC1A2 ) {
439 LineEditC1A2->setText("") ;
447 if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
450 /* gp_Pnt : not used */
451 if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
452 LineEditC1A1->setText(aString) ;
455 else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) {
456 BRepAdaptor_Curve curv(TopoDS::Edge(S));
457 myDir = curv.Line().Direction();
458 LineEditC1A2->setText(aString) ;
462 if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
463 MakeTorusSimulationAndDisplay() ;
469 //=================================================================================
470 // function : SetEditCurrentArgument()
472 //=================================================================================
473 void GeometryGUI_TorusDlg::SetEditCurrentArgument()
475 QPushButton* send = (QPushButton*)sender();
476 mySelection->ClearFilters() ;
477 switch (myConstructorId)
479 case 0: /* default constructor */
481 if(send == SelectButtonC1A1) {
482 LineEditC1A1->setFocus() ;
483 myEditCurrentArgument = LineEditC1A1;
484 mySelection->AddFilter(myVertexFilter) ;
486 else if(send == SelectButtonC1A2) {
487 LineEditC1A2->setFocus() ;
488 myEditCurrentArgument = LineEditC1A2;
489 mySelection->AddFilter(myEdgeFilter) ;
491 SelectionIntoArgument() ;
504 //=================================================================================
505 // function : LineEditReturnPressed()
507 //=================================================================================
508 void GeometryGUI_TorusDlg::LineEditReturnPressed()
510 QLineEdit* send = (QLineEdit*)sender();
511 if( send == LineEditC1A1 )
512 myEditCurrentArgument = LineEditC1A1 ;
513 else if ( send == LineEditC1A2)
514 myEditCurrentArgument = LineEditC1A2;
518 /* User name of object input management */
519 /* If successfull the selection is changed and signal emitted... */
520 /* so SelectionIntoArgument() is automatically called. */
521 QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ;
522 const QString objectUserName = LE->text() ;
523 QWidget* thisWidget = (QWidget*)this ;
524 if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
525 LE->setText( objectUserName ) ;
532 //=================================================================================
533 // function : ValueChangedInSpinBox
535 //=================================================================================
536 void GeometryGUI_TorusDlg::ValueChangedInSpinBox( double newValue )
538 QObject* send = (QObject*)sender();
540 if(send == SpinBox_C1A3 ) {
541 myRadius1 = newValue ;
544 else if(send == SpinBox_C1A4 ) {
545 myRadius2 = newValue ;
548 else if(send == SpinBox_Radius1 ) {
549 myRadius1 = newValue ;
552 else if(send == SpinBox_Radius2 ) {
553 myRadius2 = newValue ;
557 if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
558 MakeTorusSimulationAndDisplay() ;
561 myGeomGUI->EraseSimulationShape() ;
562 mySimulationTopoDs.Nullify() ;
568 //=================================================================================
569 // function : DeactivateActiveDialog()
571 //=================================================================================
572 void GeometryGUI_TorusDlg::DeactivateActiveDialog()
574 if ( GroupConstructors->isEnabled() ) {
575 GroupConstructors->setEnabled(false) ;
576 GroupC1->setEnabled(false) ;
577 GroupC2->setEnabled(false) ;
578 GroupButtons->setEnabled(false) ;
579 disconnect( mySelection, 0, this, 0 );
580 myGeomGUI->EraseSimulationShape() ;
581 mySelection->ClearFilters() ;
587 //=================================================================================
588 // function : ActivateThisDialog()
590 //=================================================================================
591 void GeometryGUI_TorusDlg::ActivateThisDialog()
593 /* Emit a signal to deactivate the active dialog */
594 myGeomGUI->EmitSignalDeactivateDialog() ;
595 GroupConstructors->setEnabled(true) ;
596 GroupC1->setEnabled(true) ;
597 GroupC2->setEnabled(true) ;
598 GroupButtons->setEnabled(true) ;
599 connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
600 if( !mySimulationTopoDs.IsNull() )
601 myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
606 //=================================================================================
607 // function : enterEvent()
609 //=================================================================================
610 void GeometryGUI_TorusDlg::enterEvent(QEvent* e)
612 if ( GroupConstructors->isEnabled() )
614 ActivateThisDialog() ;
619 //=================================================================================
620 // function : closeEvent()
622 //=================================================================================
623 void GeometryGUI_TorusDlg::closeEvent( QCloseEvent* e )
625 /* same than click on cancel button */
626 this->ClickOnCancel() ;
631 //=================================================================================
632 // function : MakeTorusSimulationAndDisplay()
634 //=================================================================================
635 void GeometryGUI_TorusDlg::MakeTorusSimulationAndDisplay()
637 myGeomGUI->EraseSimulationShape() ;
638 mySimulationTopoDs.Nullify() ;
641 gp_Ax2 anAxis(this->myPoint1, this->myDir) ;
642 mySimulationTopoDs = BRepPrimAPI_MakeTorus( anAxis, this->myRadius1, this->myRadius2 ).Shape() ;
643 myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
645 catch(Standard_Failure) {
646 MESSAGE( "Exception catched in MakeTorusSimulationAndDisplay" ) ;