2 // File : GeometryGUI_FillingDlg.cxx
4 // Author : Lucien PIGNOLONI
6 // Module : GeometryGUI
7 // Copyright : OPEN CASCADE
11 #include "GeometryGUI_FillingDlg.h"
13 #include "GeometryGUI.h"
14 #include "GEOM_ShapeTypeFilter.hxx"
16 #include <qbuttongroup.h>
17 #include <qgroupbox.h>
19 #include <qlineedit.h>
20 #include <qpushbutton.h>
21 #include <qradiobutton.h>
26 #include <qwhatsthis.h>
27 #include <qvalidator.h>
33 //=================================================================================
34 // class : GeometryGUI_FillingDlg()
35 // purpose : Constructs a GeometryGUI_FillingDlg which is a child of 'parent', with the
36 // name 'name' and widget flags set to 'f'.
37 // The dialog will by default be modeless, unless you set 'modal' to
38 // TRUE to construct a modal dialog.
39 //=================================================================================
40 GeometryGUI_FillingDlg::GeometryGUI_FillingDlg( QWidget* parent,
42 SALOME_Selection* Sel,
45 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
48 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FILLING")));
49 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
52 setName( "GeometryGUI_FillingDlg" );
54 setCaption( tr( "GEOM_FILLING_TITLE" ) );
55 setSizeGripEnabled( TRUE );
56 GeometryGUI_FillingDlgLayout = new QGridLayout( this );
57 GeometryGUI_FillingDlgLayout->setSpacing( 6 );
58 GeometryGUI_FillingDlgLayout->setMargin( 11 );
61 GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
62 GroupConstructors->setTitle( tr( "GEOM_FILLING" ) );
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 );
72 Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
73 Constructor1->setText( tr( "" ) );
74 Constructor1->setPixmap( image0 );
75 Constructor1->setChecked( TRUE );
76 Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
77 Constructor1->setMinimumSize( QSize( 50, 0 ) );
79 GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
80 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
81 GroupConstructorsLayout->addItem( spacer, 0, 1 );
83 GeometryGUI_FillingDlgLayout->addWidget( GroupConstructors, 0, 0 );
85 GroupButtons = new QGroupBox( this, "GroupButtons" );
86 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
87 GroupButtons->setTitle( tr( "" ) );
88 GroupButtons->setColumnLayout(0, Qt::Vertical );
89 GroupButtons->layout()->setSpacing( 0 );
90 GroupButtons->layout()->setMargin( 0 );
91 GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
92 GroupButtonsLayout->setAlignment( Qt::AlignTop );
93 GroupButtonsLayout->setSpacing( 6 );
94 GroupButtonsLayout->setMargin( 11 );
95 buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
96 buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
97 buttonCancel->setAutoDefault( TRUE );
98 GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
99 buttonApply = new QPushButton( GroupButtons, "buttonApply" );
100 buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
101 buttonApply->setAutoDefault( TRUE );
102 GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
103 QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
104 GroupButtonsLayout->addItem( spacer_9, 0, 2 );
105 buttonOk = new QPushButton( GroupButtons, "buttonOk" );
106 buttonOk->setText( tr( "GEOM_BUT_OK" ) );
107 buttonOk->setAutoDefault( TRUE );
108 buttonOk->setDefault( TRUE );
109 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
111 GeometryGUI_FillingDlgLayout->addWidget( GroupButtons, 2, 0 );
113 // GroupC1 = new QGroupBox( this, "GroupC1" );
114 // GroupC1->setTitle( tr( "GEOM_FILLING_ARG" ) );
115 // GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) );
116 // GroupC1->setColumnLayout(0, Qt::Vertical );
117 // GroupC1->layout()->setSpacing( 0 );
118 // GroupC1->layout()->setMargin( 0 );
119 // GroupC1Layout = new QGridLayout( GroupC1->layout() );
120 // GroupC1Layout->setAlignment( Qt::AlignTop );
121 // GroupC1Layout->setSpacing( 6 );
122 // GroupC1Layout->setMargin( 11 );
124 // LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
125 // LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
127 // GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 3, 5 );
129 // TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
130 // TextLabelC1A2->setText( tr( "GEOM_FILLING_MIN_DEG" ) );
131 // TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
132 // TextLabelC1A2->setFrameShape( QLabel::NoFrame );
133 // TextLabelC1A2->setFrameShadow( QLabel::Plain );
135 // GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
137 // LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
138 // LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
139 // LineEditC1A2->setMinimumSize( QSize( 40, 0 ) );
141 // GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 1, 2 );
143 // TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
144 // TextLabelC1A3->setText( tr( "GEOM_FILLING_MAX_DEG" ) );
145 // TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
146 // TextLabelC1A3->setFrameShape( QLabel::NoFrame );
147 // TextLabelC1A3->setFrameShadow( QLabel::Plain );
149 // GroupC1Layout->addWidget( TextLabelC1A3, 1, 4 );
151 // TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" );
152 // TextLabelC1A5->setText( tr( "GEOM_FILLING_TOL_2D" ) );
153 // TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) );
154 // TextLabelC1A5->setFrameShape( QLabel::NoFrame );
155 // TextLabelC1A5->setFrameShadow( QLabel::Plain );
157 // GroupC1Layout->addWidget( TextLabelC1A5, 2, 4 );
159 // LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" );
160 // LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) );
161 // LineEditC1A3->setMinimumSize( QSize( 40, 0 ) );
163 // GroupC1Layout->addWidget( LineEditC1A3, 1, 5 );
165 // LineEditC1A5 = new QLineEdit( GroupC1, "LineEditC1A5" );
166 // LineEditC1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A5->sizePolicy().hasHeightForWidth() ) );
167 // LineEditC1A5->setMinimumSize( QSize( 40, 0 ) );
169 // GroupC1Layout->addWidget( LineEditC1A5, 2, 5 );
171 // TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
172 // TextLabelC1A1->setText( tr( "GEOM_FILLING_COMPOUND" ) );
173 // TextLabelC1A1->setMinimumSize( QSize( 90, 0 ) );
174 // TextLabelC1A1->setFrameShape( QLabel::NoFrame );
175 // TextLabelC1A1->setFrameShadow( QLabel::Plain );
177 // GroupC1Layout->addMultiCellWidget( TextLabelC1A1, 0, 0, 0, 1 );
179 // SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
180 // SelectButtonC1A1->setText( tr( "" ) );
181 // SelectButtonC1A1->setPixmap( image1 );
183 // GroupC1Layout->addWidget( SelectButtonC1A1, 0, 2 );
185 // TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
186 // TextLabelC1A4->setText( tr( "GEOM_FILLING_TOL_3D" ) );
187 // TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
188 // TextLabelC1A4->setFrameShape( QLabel::NoFrame );
189 // TextLabelC1A4->setFrameShadow( QLabel::Plain );
191 // GroupC1Layout->addWidget( TextLabelC1A4, 2, 0 );
193 // TextLabelC1A6 = new QLabel( GroupC1, "TextLabelC1A6" );
194 // TextLabelC1A6->setText( tr( "GEOM_FILLING_NB_ITER" ) );
195 // TextLabelC1A6->setMinimumSize( QSize( 50, 0 ) );
196 // TextLabelC1A6->setFrameShape( QLabel::NoFrame );
197 // TextLabelC1A6->setFrameShadow( QLabel::Plain );
199 // GroupC1Layout->addWidget( TextLabelC1A6, 3, 0 );
201 // LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" );
202 // LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) );
203 // LineEditC1A4->setMinimumSize( QSize( 40, 0 ) );
205 // GroupC1Layout->addMultiCellWidget( LineEditC1A4, 2, 2, 1, 2 );
207 // LineEditC1A6 = new QLineEdit( GroupC1, "LineEditC1A6" );
208 // LineEditC1A6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A6->sizePolicy().hasHeightForWidth() ) );
209 // LineEditC1A6->setMinimumSize( QSize( 40, 0 ) );
211 // GroupC1Layout->addMultiCellWidget( LineEditC1A6, 3, 3, 1, 2 );
212 // QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
213 // GroupC1Layout->addItem( spacer_3, 1, 3 );
214 // QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
215 // GroupC1Layout->addItem( spacer_4, 2, 3 );
216 // QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
217 // GroupC1Layout->addMultiCell( spacer_5, 3, 3, 3, 5 );
219 // GeometryGUI_FillingDlgLayout->addWidget( GroupC1, 1, 0 );
221 GroupC1 = new QGroupBox( this, "GroupC1" );
222 GroupC1->setMinimumSize( QSize( 0, 0 ) );
223 GroupC1->setFrameShape( QGroupBox::Box );
224 GroupC1->setFrameShadow( QGroupBox::Sunken );
225 GroupC1->setTitle( tr( "GEOM_FILLING_ARG" ) );
226 GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) );
227 GroupC1->setColumnLayout(0, Qt::Vertical );
228 GroupC1->layout()->setSpacing( 0 );
229 GroupC1->layout()->setMargin( 0 );
230 GroupC1Layout = new QGridLayout( GroupC1->layout() );
231 GroupC1Layout->setAlignment( Qt::AlignTop );
232 GroupC1Layout->setSpacing( 6 );
233 GroupC1Layout->setMargin( 11 );
235 LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
236 LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
238 GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 3, 6 );
240 TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
241 TextLabelC1A2->setText( tr( "GEOM_FILLING_MIN_DEG" ) );
242 TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
243 TextLabelC1A2->setFrameShape( QLabel::NoFrame );
244 TextLabelC1A2->setFrameShadow( QLabel::Plain );
246 GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
248 TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" );
249 TextLabelC1A5->setText( tr( "GEOM_FILLING_TOL_2D" ) );
250 TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) );
251 TextLabelC1A5->setFrameShape( QLabel::NoFrame );
252 TextLabelC1A5->setFrameShadow( QLabel::Plain );
254 GroupC1Layout->addWidget( TextLabelC1A5, 2, 5 );
256 LineEditC1A5 = new QLineEdit( GroupC1, "LineEditC1A5" );
257 LineEditC1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A5->sizePolicy().hasHeightForWidth() ) );
258 LineEditC1A5->setMinimumSize( QSize( 40, 0 ) );
260 GroupC1Layout->addWidget( LineEditC1A5, 2, 6 );
262 TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
263 TextLabelC1A1->setText( tr( "GEOM_FILLING_COMPOUND" ) );
264 TextLabelC1A1->setMinimumSize( QSize( 90, 0 ) );
265 TextLabelC1A1->setFrameShape( QLabel::NoFrame );
266 TextLabelC1A1->setFrameShadow( QLabel::Plain );
268 GroupC1Layout->addMultiCellWidget( TextLabelC1A1, 0, 0, 0, 1 );
270 SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
271 SelectButtonC1A1->setText( tr( "" ) );
272 SelectButtonC1A1->setPixmap( image1 );
273 SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) );
275 GroupC1Layout->addWidget( SelectButtonC1A1, 0, 2 );
277 TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
278 TextLabelC1A4->setText( tr( "GEOM_FILLING_TOL_3D" ) );
279 TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
280 TextLabelC1A4->setFrameShape( QLabel::NoFrame );
281 TextLabelC1A4->setFrameShadow( QLabel::Plain );
283 GroupC1Layout->addWidget( TextLabelC1A4, 2, 0 );
285 TextLabelC1A6 = new QLabel( GroupC1, "TextLabelC1A6" );
286 TextLabelC1A6->setText( tr( "GEOM_FILLING_NB_ITER" ) );
287 TextLabelC1A6->setMinimumSize( QSize( 50, 0 ) );
288 TextLabelC1A6->setFrameShape( QLabel::NoFrame );
289 TextLabelC1A6->setFrameShadow( QLabel::Plain );
291 GroupC1Layout->addWidget( TextLabelC1A6, 3, 0 );
292 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
293 GroupC1Layout->addItem( spacer_3, 1, 3 );
294 QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
295 GroupC1Layout->addMultiCell( spacer_4, 2, 2, 3, 4 );
296 QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
297 GroupC1Layout->addMultiCell( spacer_5, 3, 3, 3, 6 );
299 SpinBox_C1A2 = new QSpinBox( GroupC1, "SpinBox_C1A2" );
300 SpinBox_C1A2->setMinValue( 1 );
301 SpinBox_C1A2->setMaxValue( 15 );
302 SpinBox_C1A2->setWrapping( TRUE );
304 GroupC1Layout->addMultiCellWidget( SpinBox_C1A2, 1, 1, 1, 2 );
306 LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" );
307 LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) );
308 LineEditC1A4->setMinimumSize( QSize( 40, 0 ) );
310 GroupC1Layout->addMultiCellWidget( LineEditC1A4, 2, 2, 1, 2 );
312 TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
313 TextLabelC1A3->setText( tr( "GEOM_FILLING_MAX_DEG" ) );
314 TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
315 TextLabelC1A3->setFrameShape( QLabel::NoFrame );
316 TextLabelC1A3->setFrameShadow( QLabel::Plain );
318 GroupC1Layout->addMultiCellWidget( TextLabelC1A3, 1, 1, 4, 5 );
320 SpinBox_C1A3 = new QSpinBox( GroupC1, "SpinBox_C1A3" );
321 SpinBox_C1A3->setMinValue( 1 );
322 SpinBox_C1A3->setMaxValue( 15 );
323 SpinBox_C1A3->setWrapping( TRUE );
325 GroupC1Layout->addWidget( SpinBox_C1A3, 1, 6 );
327 SpinBox_C1A6 = new QSpinBox( GroupC1, "SpinBox_C1A6" );
328 SpinBox_C1A6->setMinValue( 1 );
329 SpinBox_C1A6->setMaxValue( 30 );
330 SpinBox_C1A6->setWrapping( TRUE );
332 GroupC1Layout->addMultiCellWidget( SpinBox_C1A6, 3, 3, 1, 2 );
334 GeometryGUI_FillingDlgLayout->addWidget( GroupC1, 1, 0 );
336 /* Initialisations */
341 //=================================================================================
342 // function : ~GeometryGUI_FillingDlg()
343 // purpose : Destroys the object and frees any allocated resources
344 //=================================================================================
345 GeometryGUI_FillingDlg::~GeometryGUI_FillingDlg()
347 // no need to delete child widgets, Qt does it all for us
352 //=================================================================================
355 //=================================================================================
356 void GeometryGUI_FillingDlg::Init( SALOME_Selection* Sel )
359 LineEditC1A4->setMaxLength( 10 ); /* myTol3D */
360 LineEditC1A5->setMaxLength( 10 ); /* myTol2D */
361 QDoubleValidator *Vc = new QDoubleValidator( 0.00001, +10000.0, 3, LineEditC1A4 ) ;
362 QDoubleValidator *Vd = new QDoubleValidator( 0.00001, +10000.0, 3, LineEditC1A5 ) ;
363 LineEditC1A4->setValidator( Vc) ;
364 LineEditC1A5->setValidator( Vd) ;
367 myConstructorId = 0 ;
368 Constructor1->setChecked( TRUE );
369 myEditCurrentArgument = LineEditC1A1 ;
371 myGeomGUI = GeometryGUI::GetGeometryGUI() ;
373 SpinBox_C1A2->setValue(2) ; /* myMinDeg */
374 SpinBox_C1A3->setValue(5) ; /* myMaxDeg */
375 LineEditC1A4->setText("0.0001") ; /* myTol3D */
376 LineEditC1A5->setText("0.0001") ; /* myTol2D */
377 SpinBox_C1A6->setValue(5) ; /* myNbIter */
381 this->myTol3D = 0.0001 ;
382 this->myTol2D = 0.0001 ;
385 myOkSectionShape = false ;
386 mySectionShape.Nullify() ;
387 myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
389 // TODO previous selection into argument ?
391 /* Filter definitions */
392 Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
393 myGeom = GEOM::GEOM_Gen::_narrow(comp);
394 myCompoundFilter = new GEOM_ShapeTypeFilter( TopAbs_COMPOUND, myGeom );
395 /* first filter used */
396 mySelection->AddFilter(myCompoundFilter) ;
398 /* signals and slots connections */
399 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
400 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
401 connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
402 connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
403 connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
405 connect( LineEditC1A1, SIGNAL (returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
407 connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
408 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
409 /* to close dialog if study change */
410 connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
412 /* Move widget on the botton right corner of main widget */
414 myGeomGUI->DefineDlgPosition( this, x, y ) ;
416 /* Displays Dialog */
424 //=================================================================================
425 // function : ConstructorsClicked()
426 // purpose : Radio button management
427 //=================================================================================
428 void GeometryGUI_FillingDlg::ConstructorsClicked(int constructorId)
433 //=================================================================================
434 // function : ClickOnOk()
436 //=================================================================================
437 void GeometryGUI_FillingDlg::ClickOnOk()
439 this->ClickOnApply() ;
440 this->ClickOnCancel() ;
445 //=================================================================================
446 // function : ClickOnApply()
448 //=================================================================================
449 void GeometryGUI_FillingDlg::ClickOnApply()
451 switch(myConstructorId)
455 this->myMinDeg = SpinBox_C1A2->value() ;
456 this->myMaxDeg = SpinBox_C1A3->value() ;
457 this->myTol3D = LineEditC1A4->text().toDouble();
458 this->myTol2D = LineEditC1A5->text().toDouble();
459 this->myNbIter = SpinBox_C1A6->value() ;
460 if(myOkSectionShape) {
461 myGeomGUI->MakeFillingAndDisplay( myGeomShape, myMinDeg, myMaxDeg, myTol3D, myTol2D, myNbIter) ;
470 //=================================================================================
471 // function : ClickOnCancel()
473 //=================================================================================
474 void GeometryGUI_FillingDlg::ClickOnCancel()
476 mySelection->ClearFilters() ;
477 disconnect( mySelection, 0, this, 0 );
478 myGeomGUI->ResetState() ;
484 //=================================================================================
485 // function : SelectionIntoArgument()
486 // purpose : Called when selection as changed or other case
487 //=================================================================================
488 void GeometryGUI_FillingDlg::SelectionIntoArgument()
490 myEditCurrentArgument->setText("") ;
491 QString aString = ""; /* name of selection */
493 int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
495 if ( myEditCurrentArgument == LineEditC1A1 ) {
496 myOkSectionShape = false ;
503 Standard_Boolean testResult ;
504 Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
505 if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
508 if ( myEditCurrentArgument == LineEditC1A1 && S.ShapeType() == TopAbs_COMPOUND ) {
509 myEditCurrentArgument->setText(aString) ;
510 myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
513 myOkSectionShape = true ;
520 //=================================================================================
521 // function : SetEditCurrentArgument()
523 //=================================================================================
524 void GeometryGUI_FillingDlg::SetEditCurrentArgument()
526 QPushButton* send = (QPushButton*)sender();
527 mySelection->ClearFilters() ;
528 switch (myConstructorId)
530 case 0: /* default constructor */
532 if(send == SelectButtonC1A1) {
533 LineEditC1A1->setFocus() ;
534 myEditCurrentArgument = LineEditC1A1;
535 mySelection->AddFilter(myCompoundFilter) ;
537 SelectionIntoArgument() ;
546 //=================================================================================
547 // function : LineEditReturnPressed()
549 //=================================================================================
550 void GeometryGUI_FillingDlg::LineEditReturnPressed()
552 QLineEdit* send = (QLineEdit*)sender();
553 if( send == LineEditC1A1 )
554 myEditCurrentArgument = LineEditC1A1 ;
558 /* User name of object input management */
559 /* If successfull the selection is changed and signal emitted... */
560 /* so SelectionIntoArgument() is automatically called. */
561 const QString objectUserName = myEditCurrentArgument->text() ;
562 QWidget* thisWidget = (QWidget*)this ;
563 if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
564 myEditCurrentArgument->setText( objectUserName ) ;
570 //=================================================================================
571 // function : DeactivateActiveDialog()
573 //=================================================================================
574 void GeometryGUI_FillingDlg::DeactivateActiveDialog()
576 if ( GroupConstructors->isEnabled() ) {
577 GroupConstructors->setEnabled(false) ;
578 GroupC1->setEnabled(false) ;
579 GroupButtons->setEnabled(false) ;
580 disconnect( mySelection, 0, this, 0 );
581 mySelection->ClearFilters() ;
587 //=================================================================================
588 // function : ActivateThisDialog()
590 //=================================================================================
591 void GeometryGUI_FillingDlg::ActivateThisDialog()
593 /* Emit a signal to deactivate the active dialog */
594 myGeomGUI->EmitSignalDeactivateDialog() ;
595 GroupConstructors->setEnabled(true) ;
596 GroupC1->setEnabled(true) ;
597 GroupButtons->setEnabled(true) ;
598 connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
603 //=================================================================================
604 // function : enterEvent()
606 //=================================================================================
607 void GeometryGUI_FillingDlg::enterEvent(QEvent* e)
609 if ( GroupConstructors->isEnabled() )
611 ActivateThisDialog() ;
616 //=================================================================================
617 // function : closeEvent()
619 //=================================================================================
620 void GeometryGUI_FillingDlg::closeEvent( QCloseEvent* e )
622 /* same than click on cancel button */
623 this->ClickOnCancel() ;