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_FillingDlg.cxx
25 // Author : Lucien PIGNOLONI
30 #include "GeometryGUI_FillingDlg.h"
32 #include "GeometryGUI.h"
33 #include "GEOM_ShapeTypeFilter.hxx"
35 #include <qbuttongroup.h>
36 #include <qgroupbox.h>
38 #include <qlineedit.h>
39 #include <qpushbutton.h>
40 #include <qradiobutton.h>
45 #include <qwhatsthis.h>
46 #include <qvalidator.h>
52 //=================================================================================
53 // class : GeometryGUI_FillingDlg()
54 // purpose : Constructs a GeometryGUI_FillingDlg which is a child of 'parent', with the
55 // name 'name' and widget flags set to 'f'.
56 // The dialog will by default be modeless, unless you set 'modal' to
57 // TRUE to construct a modal dialog.
58 //=================================================================================
59 GeometryGUI_FillingDlg::GeometryGUI_FillingDlg( QWidget* parent,
61 SALOME_Selection* Sel,
64 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
67 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FILLING")));
68 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
71 setName( "GeometryGUI_FillingDlg" );
73 setCaption( tr( "GEOM_FILLING_TITLE" ) );
74 setSizeGripEnabled( TRUE );
75 GeometryGUI_FillingDlgLayout = new QGridLayout( this );
76 GeometryGUI_FillingDlgLayout->setSpacing( 6 );
77 GeometryGUI_FillingDlgLayout->setMargin( 11 );
80 GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
81 GroupConstructors->setTitle( tr( "GEOM_FILLING" ) );
82 GroupConstructors->setExclusive( TRUE );
83 GroupConstructors->setColumnLayout(0, Qt::Vertical );
84 GroupConstructors->layout()->setSpacing( 0 );
85 GroupConstructors->layout()->setMargin( 0 );
86 GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
87 GroupConstructorsLayout->setAlignment( Qt::AlignTop );
88 GroupConstructorsLayout->setSpacing( 6 );
89 GroupConstructorsLayout->setMargin( 11 );
91 Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
92 Constructor1->setText( tr( "" ) );
93 Constructor1->setPixmap( image0 );
94 Constructor1->setChecked( TRUE );
95 Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
96 Constructor1->setMinimumSize( QSize( 50, 0 ) );
98 GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
99 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
100 GroupConstructorsLayout->addItem( spacer, 0, 1 );
102 GeometryGUI_FillingDlgLayout->addWidget( GroupConstructors, 0, 0 );
104 GroupButtons = new QGroupBox( this, "GroupButtons" );
105 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
106 GroupButtons->setTitle( tr( "" ) );
107 GroupButtons->setColumnLayout(0, Qt::Vertical );
108 GroupButtons->layout()->setSpacing( 0 );
109 GroupButtons->layout()->setMargin( 0 );
110 GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
111 GroupButtonsLayout->setAlignment( Qt::AlignTop );
112 GroupButtonsLayout->setSpacing( 6 );
113 GroupButtonsLayout->setMargin( 11 );
114 buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
115 buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
116 buttonCancel->setAutoDefault( TRUE );
117 GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
118 buttonApply = new QPushButton( GroupButtons, "buttonApply" );
119 buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
120 buttonApply->setAutoDefault( TRUE );
121 GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
122 QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
123 GroupButtonsLayout->addItem( spacer_9, 0, 2 );
124 buttonOk = new QPushButton( GroupButtons, "buttonOk" );
125 buttonOk->setText( tr( "GEOM_BUT_OK" ) );
126 buttonOk->setAutoDefault( TRUE );
127 buttonOk->setDefault( TRUE );
128 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
130 GeometryGUI_FillingDlgLayout->addWidget( GroupButtons, 2, 0 );
132 // GroupC1 = new QGroupBox( this, "GroupC1" );
133 // GroupC1->setTitle( tr( "GEOM_FILLING_ARG" ) );
134 // GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) );
135 // GroupC1->setColumnLayout(0, Qt::Vertical );
136 // GroupC1->layout()->setSpacing( 0 );
137 // GroupC1->layout()->setMargin( 0 );
138 // GroupC1Layout = new QGridLayout( GroupC1->layout() );
139 // GroupC1Layout->setAlignment( Qt::AlignTop );
140 // GroupC1Layout->setSpacing( 6 );
141 // GroupC1Layout->setMargin( 11 );
143 // LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
144 // LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
146 // GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 3, 5 );
148 // TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
149 // TextLabelC1A2->setText( tr( "GEOM_FILLING_MIN_DEG" ) );
150 // TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
151 // TextLabelC1A2->setFrameShape( QLabel::NoFrame );
152 // TextLabelC1A2->setFrameShadow( QLabel::Plain );
154 // GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
156 // LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
157 // LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
158 // LineEditC1A2->setMinimumSize( QSize( 40, 0 ) );
160 // GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 1, 2 );
162 // TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
163 // TextLabelC1A3->setText( tr( "GEOM_FILLING_MAX_DEG" ) );
164 // TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
165 // TextLabelC1A3->setFrameShape( QLabel::NoFrame );
166 // TextLabelC1A3->setFrameShadow( QLabel::Plain );
168 // GroupC1Layout->addWidget( TextLabelC1A3, 1, 4 );
170 // TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" );
171 // TextLabelC1A5->setText( tr( "GEOM_FILLING_TOL_2D" ) );
172 // TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) );
173 // TextLabelC1A5->setFrameShape( QLabel::NoFrame );
174 // TextLabelC1A5->setFrameShadow( QLabel::Plain );
176 // GroupC1Layout->addWidget( TextLabelC1A5, 2, 4 );
178 // LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" );
179 // LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) );
180 // LineEditC1A3->setMinimumSize( QSize( 40, 0 ) );
182 // GroupC1Layout->addWidget( LineEditC1A3, 1, 5 );
184 // LineEditC1A5 = new QLineEdit( GroupC1, "LineEditC1A5" );
185 // LineEditC1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A5->sizePolicy().hasHeightForWidth() ) );
186 // LineEditC1A5->setMinimumSize( QSize( 40, 0 ) );
188 // GroupC1Layout->addWidget( LineEditC1A5, 2, 5 );
190 // TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
191 // TextLabelC1A1->setText( tr( "GEOM_FILLING_COMPOUND" ) );
192 // TextLabelC1A1->setMinimumSize( QSize( 90, 0 ) );
193 // TextLabelC1A1->setFrameShape( QLabel::NoFrame );
194 // TextLabelC1A1->setFrameShadow( QLabel::Plain );
196 // GroupC1Layout->addMultiCellWidget( TextLabelC1A1, 0, 0, 0, 1 );
198 // SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
199 // SelectButtonC1A1->setText( tr( "" ) );
200 // SelectButtonC1A1->setPixmap( image1 );
202 // GroupC1Layout->addWidget( SelectButtonC1A1, 0, 2 );
204 // TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
205 // TextLabelC1A4->setText( tr( "GEOM_FILLING_TOL_3D" ) );
206 // TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
207 // TextLabelC1A4->setFrameShape( QLabel::NoFrame );
208 // TextLabelC1A4->setFrameShadow( QLabel::Plain );
210 // GroupC1Layout->addWidget( TextLabelC1A4, 2, 0 );
212 // TextLabelC1A6 = new QLabel( GroupC1, "TextLabelC1A6" );
213 // TextLabelC1A6->setText( tr( "GEOM_FILLING_NB_ITER" ) );
214 // TextLabelC1A6->setMinimumSize( QSize( 50, 0 ) );
215 // TextLabelC1A6->setFrameShape( QLabel::NoFrame );
216 // TextLabelC1A6->setFrameShadow( QLabel::Plain );
218 // GroupC1Layout->addWidget( TextLabelC1A6, 3, 0 );
220 // LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" );
221 // LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) );
222 // LineEditC1A4->setMinimumSize( QSize( 40, 0 ) );
224 // GroupC1Layout->addMultiCellWidget( LineEditC1A4, 2, 2, 1, 2 );
226 // LineEditC1A6 = new QLineEdit( GroupC1, "LineEditC1A6" );
227 // LineEditC1A6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A6->sizePolicy().hasHeightForWidth() ) );
228 // LineEditC1A6->setMinimumSize( QSize( 40, 0 ) );
230 // GroupC1Layout->addMultiCellWidget( LineEditC1A6, 3, 3, 1, 2 );
231 // QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
232 // GroupC1Layout->addItem( spacer_3, 1, 3 );
233 // QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
234 // GroupC1Layout->addItem( spacer_4, 2, 3 );
235 // QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
236 // GroupC1Layout->addMultiCell( spacer_5, 3, 3, 3, 5 );
238 // GeometryGUI_FillingDlgLayout->addWidget( GroupC1, 1, 0 );
240 GroupC1 = new QGroupBox( this, "GroupC1" );
241 GroupC1->setMinimumSize( QSize( 0, 0 ) );
242 GroupC1->setFrameShape( QGroupBox::Box );
243 GroupC1->setFrameShadow( QGroupBox::Sunken );
244 GroupC1->setTitle( tr( "GEOM_FILLING_ARG" ) );
245 GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) );
246 GroupC1->setColumnLayout(0, Qt::Vertical );
247 GroupC1->layout()->setSpacing( 0 );
248 GroupC1->layout()->setMargin( 0 );
249 GroupC1Layout = new QGridLayout( GroupC1->layout() );
250 GroupC1Layout->setAlignment( Qt::AlignTop );
251 GroupC1Layout->setSpacing( 6 );
252 GroupC1Layout->setMargin( 11 );
254 LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
255 LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
257 GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 3, 6 );
259 TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
260 TextLabelC1A2->setText( tr( "GEOM_FILLING_MIN_DEG" ) );
261 TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
262 TextLabelC1A2->setFrameShape( QLabel::NoFrame );
263 TextLabelC1A2->setFrameShadow( QLabel::Plain );
265 GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
267 TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" );
268 TextLabelC1A5->setText( tr( "GEOM_FILLING_TOL_2D" ) );
269 TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) );
270 TextLabelC1A5->setFrameShape( QLabel::NoFrame );
271 TextLabelC1A5->setFrameShadow( QLabel::Plain );
273 GroupC1Layout->addWidget( TextLabelC1A5, 2, 5 );
275 LineEditC1A5 = new QLineEdit( GroupC1, "LineEditC1A5" );
276 LineEditC1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A5->sizePolicy().hasHeightForWidth() ) );
277 LineEditC1A5->setMinimumSize( QSize( 40, 0 ) );
279 GroupC1Layout->addWidget( LineEditC1A5, 2, 6 );
281 TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
282 TextLabelC1A1->setText( tr( "GEOM_FILLING_COMPOUND" ) );
283 TextLabelC1A1->setMinimumSize( QSize( 90, 0 ) );
284 TextLabelC1A1->setFrameShape( QLabel::NoFrame );
285 TextLabelC1A1->setFrameShadow( QLabel::Plain );
287 GroupC1Layout->addMultiCellWidget( TextLabelC1A1, 0, 0, 0, 1 );
289 SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
290 SelectButtonC1A1->setText( tr( "" ) );
291 SelectButtonC1A1->setPixmap( image1 );
292 SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) );
294 GroupC1Layout->addWidget( SelectButtonC1A1, 0, 2 );
296 TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
297 TextLabelC1A4->setText( tr( "GEOM_FILLING_TOL_3D" ) );
298 TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
299 TextLabelC1A4->setFrameShape( QLabel::NoFrame );
300 TextLabelC1A4->setFrameShadow( QLabel::Plain );
302 GroupC1Layout->addWidget( TextLabelC1A4, 2, 0 );
304 TextLabelC1A6 = new QLabel( GroupC1, "TextLabelC1A6" );
305 TextLabelC1A6->setText( tr( "GEOM_FILLING_NB_ITER" ) );
306 TextLabelC1A6->setMinimumSize( QSize( 50, 0 ) );
307 TextLabelC1A6->setFrameShape( QLabel::NoFrame );
308 TextLabelC1A6->setFrameShadow( QLabel::Plain );
310 GroupC1Layout->addWidget( TextLabelC1A6, 3, 0 );
311 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
312 GroupC1Layout->addItem( spacer_3, 1, 3 );
313 QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
314 GroupC1Layout->addMultiCell( spacer_4, 2, 2, 3, 4 );
315 QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
316 GroupC1Layout->addMultiCell( spacer_5, 3, 3, 3, 6 );
318 SpinBox_C1A2 = new QSpinBox( GroupC1, "SpinBox_C1A2" );
319 SpinBox_C1A2->setMinValue( 1 );
320 SpinBox_C1A2->setMaxValue( 15 );
321 SpinBox_C1A2->setWrapping( TRUE );
323 GroupC1Layout->addMultiCellWidget( SpinBox_C1A2, 1, 1, 1, 2 );
325 LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" );
326 LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) );
327 LineEditC1A4->setMinimumSize( QSize( 40, 0 ) );
329 GroupC1Layout->addMultiCellWidget( LineEditC1A4, 2, 2, 1, 2 );
331 TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
332 TextLabelC1A3->setText( tr( "GEOM_FILLING_MAX_DEG" ) );
333 TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
334 TextLabelC1A3->setFrameShape( QLabel::NoFrame );
335 TextLabelC1A3->setFrameShadow( QLabel::Plain );
337 GroupC1Layout->addMultiCellWidget( TextLabelC1A3, 1, 1, 4, 5 );
339 SpinBox_C1A3 = new QSpinBox( GroupC1, "SpinBox_C1A3" );
340 SpinBox_C1A3->setMinValue( 1 );
341 SpinBox_C1A3->setMaxValue( 15 );
342 SpinBox_C1A3->setWrapping( TRUE );
344 GroupC1Layout->addWidget( SpinBox_C1A3, 1, 6 );
346 SpinBox_C1A6 = new QSpinBox( GroupC1, "SpinBox_C1A6" );
347 SpinBox_C1A6->setMinValue( 1 );
348 SpinBox_C1A6->setMaxValue( 30 );
349 SpinBox_C1A6->setWrapping( TRUE );
351 GroupC1Layout->addMultiCellWidget( SpinBox_C1A6, 3, 3, 1, 2 );
353 GeometryGUI_FillingDlgLayout->addWidget( GroupC1, 1, 0 );
355 /* Initialisations */
360 //=================================================================================
361 // function : ~GeometryGUI_FillingDlg()
362 // purpose : Destroys the object and frees any allocated resources
363 //=================================================================================
364 GeometryGUI_FillingDlg::~GeometryGUI_FillingDlg()
366 // no need to delete child widgets, Qt does it all for us
371 //=================================================================================
374 //=================================================================================
375 void GeometryGUI_FillingDlg::Init( SALOME_Selection* Sel )
378 LineEditC1A4->setMaxLength( 10 ); /* myTol3D */
379 LineEditC1A5->setMaxLength( 10 ); /* myTol2D */
380 QDoubleValidator *Vc = new QDoubleValidator( 0.00001, +10000.0, 3, LineEditC1A4 ) ;
381 QDoubleValidator *Vd = new QDoubleValidator( 0.00001, +10000.0, 3, LineEditC1A5 ) ;
382 LineEditC1A4->setValidator( Vc) ;
383 LineEditC1A5->setValidator( Vd) ;
386 myConstructorId = 0 ;
387 Constructor1->setChecked( TRUE );
388 myEditCurrentArgument = LineEditC1A1 ;
390 myGeomGUI = GeometryGUI::GetGeometryGUI() ;
392 SpinBox_C1A2->setValue(2) ; /* myMinDeg */
393 SpinBox_C1A3->setValue(5) ; /* myMaxDeg */
394 LineEditC1A4->setText("0.0001") ; /* myTol3D */
395 LineEditC1A5->setText("0.0001") ; /* myTol2D */
396 SpinBox_C1A6->setValue(5) ; /* myNbIter */
400 this->myTol3D = 0.0001 ;
401 this->myTol2D = 0.0001 ;
404 myOkSectionShape = false ;
405 mySectionShape.Nullify() ;
406 myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
408 // TODO previous selection into argument ?
410 /* Filter definitions */
411 Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
412 myGeom = GEOM::GEOM_Gen::_narrow(comp);
413 myCompoundFilter = new GEOM_ShapeTypeFilter( TopAbs_COMPOUND, myGeom );
414 /* first filter used */
415 mySelection->AddFilter(myCompoundFilter) ;
417 /* signals and slots connections */
418 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
419 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
420 connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
421 connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
422 connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
424 connect( LineEditC1A1, SIGNAL (returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
426 connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
427 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
428 /* to close dialog if study change */
429 connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
431 /* Move widget on the botton right corner of main widget */
433 myGeomGUI->DefineDlgPosition( this, x, y ) ;
435 /* Displays Dialog */
443 //=================================================================================
444 // function : ConstructorsClicked()
445 // purpose : Radio button management
446 //=================================================================================
447 void GeometryGUI_FillingDlg::ConstructorsClicked(int constructorId)
452 //=================================================================================
453 // function : ClickOnOk()
455 //=================================================================================
456 void GeometryGUI_FillingDlg::ClickOnOk()
458 this->ClickOnApply() ;
459 this->ClickOnCancel() ;
464 //=================================================================================
465 // function : ClickOnApply()
467 //=================================================================================
468 void GeometryGUI_FillingDlg::ClickOnApply()
470 switch(myConstructorId)
474 this->myMinDeg = SpinBox_C1A2->value() ;
475 this->myMaxDeg = SpinBox_C1A3->value() ;
476 this->myTol3D = LineEditC1A4->text().toDouble();
477 this->myTol2D = LineEditC1A5->text().toDouble();
478 this->myNbIter = SpinBox_C1A6->value() ;
479 if(myOkSectionShape) {
480 myGeomGUI->MakeFillingAndDisplay( myGeomShape, myMinDeg, myMaxDeg, myTol3D, myTol2D, myNbIter) ;
489 //=================================================================================
490 // function : ClickOnCancel()
492 //=================================================================================
493 void GeometryGUI_FillingDlg::ClickOnCancel()
495 mySelection->ClearFilters() ;
496 disconnect( mySelection, 0, this, 0 );
497 myGeomGUI->ResetState() ;
503 //=================================================================================
504 // function : SelectionIntoArgument()
505 // purpose : Called when selection as changed or other case
506 //=================================================================================
507 void GeometryGUI_FillingDlg::SelectionIntoArgument()
509 myEditCurrentArgument->setText("") ;
510 QString aString = ""; /* name of selection */
512 int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
514 if ( myEditCurrentArgument == LineEditC1A1 ) {
515 myOkSectionShape = false ;
522 Standard_Boolean testResult ;
523 Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
524 if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
527 if ( myEditCurrentArgument == LineEditC1A1 && S.ShapeType() == TopAbs_COMPOUND ) {
528 myEditCurrentArgument->setText(aString) ;
529 myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
532 myOkSectionShape = true ;
539 //=================================================================================
540 // function : SetEditCurrentArgument()
542 //=================================================================================
543 void GeometryGUI_FillingDlg::SetEditCurrentArgument()
545 QPushButton* send = (QPushButton*)sender();
546 mySelection->ClearFilters() ;
547 switch (myConstructorId)
549 case 0: /* default constructor */
551 if(send == SelectButtonC1A1) {
552 LineEditC1A1->setFocus() ;
553 myEditCurrentArgument = LineEditC1A1;
554 mySelection->AddFilter(myCompoundFilter) ;
556 SelectionIntoArgument() ;
565 //=================================================================================
566 // function : LineEditReturnPressed()
568 //=================================================================================
569 void GeometryGUI_FillingDlg::LineEditReturnPressed()
571 QLineEdit* send = (QLineEdit*)sender();
572 if( send == LineEditC1A1 )
573 myEditCurrentArgument = LineEditC1A1 ;
577 /* User name of object input management */
578 /* If successfull the selection is changed and signal emitted... */
579 /* so SelectionIntoArgument() is automatically called. */
580 const QString objectUserName = myEditCurrentArgument->text() ;
581 QWidget* thisWidget = (QWidget*)this ;
582 if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
583 myEditCurrentArgument->setText( objectUserName ) ;
589 //=================================================================================
590 // function : DeactivateActiveDialog()
592 //=================================================================================
593 void GeometryGUI_FillingDlg::DeactivateActiveDialog()
595 if ( GroupConstructors->isEnabled() ) {
596 GroupConstructors->setEnabled(false) ;
597 GroupC1->setEnabled(false) ;
598 GroupButtons->setEnabled(false) ;
599 disconnect( mySelection, 0, this, 0 );
600 mySelection->ClearFilters() ;
606 //=================================================================================
607 // function : ActivateThisDialog()
609 //=================================================================================
610 void GeometryGUI_FillingDlg::ActivateThisDialog()
612 /* Emit a signal to deactivate the active dialog */
613 myGeomGUI->EmitSignalDeactivateDialog() ;
614 GroupConstructors->setEnabled(true) ;
615 GroupC1->setEnabled(true) ;
616 GroupButtons->setEnabled(true) ;
617 connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
622 //=================================================================================
623 // function : enterEvent()
625 //=================================================================================
626 void GeometryGUI_FillingDlg::enterEvent(QEvent* e)
628 if ( GroupConstructors->isEnabled() )
630 ActivateThisDialog() ;
635 //=================================================================================
636 // function : closeEvent()
638 //=================================================================================
639 void GeometryGUI_FillingDlg::closeEvent( QCloseEvent* e )
641 /* same than click on cancel button */
642 this->ClickOnCancel() ;