]> SALOME platform Git repositories - modules/geom.git/blob - src/OperationGUI/OperationGUI_FilletDlg.cxx
Salome HOME
Remove some methods of GEOMBase_Helper (IObjectCount(), firstIObject(), lastIObject...
[modules/geom.git] / src / OperationGUI / OperationGUI_FilletDlg.cxx
1 // GEOM GEOMGUI : GUI for Geometry component
2 //
3 // Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 // This library is free software; you can redistribute it and/or 
7 // modify it under the terms of the GNU Lesser General Public 
8 // License as published by the Free Software Foundation; either 
9 // version 2.1 of the License. 
10 // 
11 // This library is distributed in the hope that it will be useful, 
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 // Lesser General Public License for more details. 
15 // 
16 // You should have received a copy of the GNU Lesser General Public 
17 // License along with this library; if not, write to the Free Software 
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : OperationGUI_FilletDlg.cxx
23 // Author : Damien COQUERET, Open CASCADE S.A.S.
24 //
25
26 #include "OperationGUI_FilletDlg.h"
27
28 #include <DlgRef.h>
29 #include <GeometryGUI.h>
30 #include <GEOMBase.h>
31
32 #include <SUIT_Desktop.h>
33 #include <SUIT_Session.h>
34 #include <SUIT_ResourceMgr.h>
35 #include <SUIT_ViewWindow.h>
36 #include <SUIT_ViewManager.h>
37 #include <SalomeApp_Application.h>
38 #include <LightApp_SelectionMgr.h>
39 #include <OCCViewer_ViewModel.h>
40
41 #include <TColStd_MapOfInteger.hxx>
42 #include <TColStd_IndexedMapOfInteger.hxx>
43
44 #include <GEOMImpl_Types.hxx>
45
46 //=================================================================================
47 // class    : OperationGUI_FilletDlg()
48 // purpose  : Constructs a OperationGUI_FilletDlg which is a child of 'parent', with the 
49 //            name 'name' and widget flags set to 'f'.
50 //            The dialog will by default be modeless, unless you set 'modal' to
51 //            TRUE to construct a modal dialog.
52 //=================================================================================
53 OperationGUI_FilletDlg::OperationGUI_FilletDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
54   : GEOMBase_Skeleton( theGeometryGUI, parent, false )
55 {
56   SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
57   QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_ALL" ) ) );
58   QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_EDGE" ) ) );
59   QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_FACE" ) ) );
60
61   QPixmap iconSelect( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
62
63   setWindowTitle( tr( "GEOM_FILLET_TITLE" ) );
64
65   /***************************************************************/
66   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_FILLET" ) );
67   mainFrame()->RadioButton1->setIcon( image0 );
68   mainFrame()->RadioButton2->setIcon( image1 );
69   mainFrame()->RadioButton3->setIcon( image2 );
70
71   Group1 = new DlgRef_1Sel1Spin( centralWidget() );
72   Group1->GroupBox1->setTitle( tr( "GEOM_FILLET_ALL" ) );
73   Group1->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
74   Group1->TextLabel2->setText( tr( "GEOM_RADIUS" ) );
75   Group1->PushButton1->setIcon( iconSelect );
76   Group1->LineEdit1->setReadOnly( true );
77
78   Group2 = new DlgRef_2Sel3Spin2Rb( centralWidget() );
79   Group2->GroupBox1->setTitle( tr( "GEOM_FILLET_EDGES" ) );
80   Group2->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
81   Group2->TextLabel2->setText( tr( "SELECTED_EDGES" ) );
82   Group2->TextLabel3->setText( tr( "GEOM_RADIUS" ) );
83   Group2->TextLabel4->setText( tr( "GEOM_R1" ) );
84   Group2->TextLabel5->setText( tr( "GEOM_R2" ) );
85   Group2->PushButton1->setIcon( iconSelect );
86   Group2->PushButton2->setIcon( iconSelect );
87   Group2->LineEdit1->setReadOnly( true );
88   Group2->LineEdit2->setReadOnly( true );
89
90   Group3 = new DlgRef_2Sel3Spin2Rb( centralWidget() );
91   Group3->GroupBox1->setTitle( tr( "GEOM_FILLET_FACES" ) );
92   Group3->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
93   Group3->TextLabel2->setText( tr( "SELECTED_FACES" ) );
94   Group3->TextLabel3->setText( tr( "GEOM_RADIUS" ) );
95   Group3->TextLabel4->setText( tr( "GEOM_R1" ) );
96   Group3->TextLabel5->setText( tr( "GEOM_R2" ) );
97   Group3->PushButton1->setIcon( iconSelect );
98   Group3->PushButton2->setIcon( iconSelect );
99   Group3->LineEdit1->setReadOnly( true );
100   Group3->LineEdit2->setReadOnly( true );
101
102   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
103   layout->setMargin( 0 ); layout->setSpacing( 6 );
104   layout->addWidget( Group1 );
105   layout->addWidget( Group2 );
106   layout->addWidget( Group3 );
107   /***************************************************************/
108
109   double SpecificStep = 10.0;
110   initSpinBox( Group1->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
111   initSpinBox( Group2->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
112   initSpinBox( Group2->SpinBox_DY, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
113   initSpinBox( Group2->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
114   initSpinBox( Group3->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
115   initSpinBox( Group3->SpinBox_DY, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
116   initSpinBox( Group3->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
117   
118   setHelpFileName( "fillet_operation_page.html" );
119
120   /* Initialisations */
121   Init();
122 }
123
124
125 //=================================================================================
126 // function : ~OperationGUI_FilletDlg()
127 // purpose  : Destroys the object and frees any allocated resources
128 //=================================================================================
129 OperationGUI_FilletDlg::~OperationGUI_FilletDlg()
130 {  
131 }
132
133
134 //=================================================================================
135 // function : Init()
136 // purpose  :
137 //=================================================================================
138 void OperationGUI_FilletDlg::Init()
139 {
140   myConstructorId = -1;
141   reset();
142
143   // main buttons
144   connect( buttonOk(),    SIGNAL( clicked() ), this, SLOT( ClickOnOk()    ) );
145   connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
146
147   // group box
148   connect( this,          SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
149
150   // push buttons
151   connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
152   connect( Group2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
153   connect( Group3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
154   connect( Group2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
155   connect( Group3->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
156
157   // line edits
158   connect( Group1->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
159   connect( Group2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
160   connect( Group3->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
161
162   // spin boxes  
163   connect( Group1->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
164   connect( Group2->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
165   connect( Group2->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
166   connect( Group2->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
167   connect( Group3->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
168   connect( Group3->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
169   connect( Group3->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
170
171   // radio buttons
172   connect( Group2->RadioButton1, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
173   connect( Group2->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
174   connect( Group3->RadioButton1, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
175   connect( Group3->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
176
177   // selection
178   connect( myGeomGUI->getApp()->selectionMgr(), 
179            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
180
181   initName( tr( "GEOM_FILLET" ) );
182
183   ConstructorsClicked( 0 );
184 }
185
186
187 //=================================================================================
188 // function : ConstructorsClicked()
189 // purpose  : Radio button management
190 //=================================================================================
191 void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId )
192 {
193   if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() 
194        != OCCViewer_Viewer::Type() ) {
195     mainFrame()->RadioButton1->setChecked( true );
196     return;
197   }
198
199   if ( myConstructorId == constructorId )
200     return;
201
202   // Get radius from previous widget
203   double R = 5, R1 = 5, R2 = 5;
204   if      ( myConstructorId == 0 ) { 
205     R = Group1->SpinBox_DX->value();
206   }
207   else if ( myConstructorId == 1 ) {
208     R = Group2->SpinBox_DX->value();
209     R1 = Group2->SpinBox_DY->value();
210     R2 = Group2->SpinBox_DZ->value();
211   }
212   else {
213     R = Group3->SpinBox_DX->value();
214     R1 = Group3->SpinBox_DY->value();
215     R2 = Group3->SpinBox_DZ->value();
216   }
217
218   myConstructorId = constructorId;
219
220   switch ( constructorId ) {
221   case 0:
222     Group2->hide();
223     Group3->hide();
224     Group1->show();
225     Group1->SpinBox_DX->setValue( R );
226     break;
227   case 1:
228     Group1->hide();
229     Group3->hide();
230     Group2->show();
231     Group2->SpinBox_DX->setValue( R );
232     Group2->SpinBox_DY->setValue( R1 );
233     Group2->SpinBox_DZ->setValue( R2 );
234     break;
235   case 2:
236     Group1->hide();
237     Group2->hide();
238     Group3->show();
239     Group3->SpinBox_DX->setValue( R );
240     Group3->SpinBox_DY->setValue( R1 );
241     Group3->SpinBox_DZ->setValue( R2 );
242     break;
243   default:
244     break;
245   }
246
247   if      ( constructorId == 0 ) myEditCurrentArgument = Group1->LineEdit1;
248   else if ( constructorId == 1 ) myEditCurrentArgument = Group2->LineEdit1;
249   else                           myEditCurrentArgument = Group3->LineEdit1;
250
251   activateSelection();
252   enableWidgets();
253
254   if ( !myShape->_is_nil() ) {
255     myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) );
256     GEOMBase_Skeleton::LineEditReturnPressed();
257   }
258   else
259     myEditCurrentArgument->setText( "" );
260
261   qApp->processEvents();
262   updateGeometry();
263   resize( minimumSize() );
264
265   displayPreview();  
266 }
267
268
269 //=================================================================================
270 // function : ClickOnOk()
271 // purpose  :
272 //=================================================================================
273 void OperationGUI_FilletDlg::ClickOnOk()
274 {
275   if ( ClickOnApply() )
276     ClickOnCancel();
277 }
278
279
280 //=================================================================================
281 // function : ClickOnApply()
282 // purpose  :
283 //=================================================================================
284 bool OperationGUI_FilletDlg::ClickOnApply()
285 {
286   if ( !onAccept() )
287     return false;
288
289   initName();
290   return true;
291 }
292
293 //=================================================================================
294 // function : SelectionIntoArgument()
295 // purpose  : Called when selection has changed
296 //=================================================================================
297 void OperationGUI_FilletDlg::SelectionIntoArgument()
298 {
299   erasePreview();
300   myEditCurrentArgument->setText( "" );
301
302   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
303   SALOME_ListIO aSelList;
304   aSelMgr->selectedObjects(aSelList);
305
306   // If selection of main object is activated
307   if (myEditCurrentArgument == Group1->LineEdit1 ||
308       myEditCurrentArgument == Group2->LineEdit1 ||
309       myEditCurrentArgument == Group3->LineEdit1)
310   {
311     if (aSelList.Extent() == 1) {
312       Standard_Boolean aResult = Standard_False;
313       GEOM::GEOM_Object_var anObj =
314         GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
315
316       if (aResult && !anObj->_is_nil()) {
317         myShape = anObj;
318         myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
319         displayPreview();
320         enableWidgets();
321         return;
322       }
323     }
324
325     myShape = GEOM::GEOM_Object::_nil();
326     enableWidgets();
327   }
328   // If face or edge selection is activated
329   else if (myEditCurrentArgument == Group2->LineEdit2 ||
330            myEditCurrentArgument == Group3->LineEdit2)
331   {
332     if (aSelList.Extent() == 1) {
333       Standard_Boolean aResult = Standard_False;
334       GEOM::GEOM_Object_var anObj =
335         GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
336
337       if (aResult && !anObj->_is_nil()) {
338         TColStd_IndexedMapOfInteger anIndexes;
339         aSelMgr->GetIndexes(aSelList.First(), anIndexes);
340
341         if (anIndexes.Extent() > 0) {
342           QString aName;
343           if (anIndexes.Extent() == 1) {
344             int anIndex = anIndexes(1);
345
346             aName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex );
347           }
348           else
349             aName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() );
350
351           myEditCurrentArgument->setText( aName );
352
353           if ( myConstructorId == 1 )
354             myEdges = anIndexes;
355           else
356             myFaces = anIndexes;
357
358           displayPreview();
359           return;
360         }
361       }
362     }
363     myFaces.Clear();
364   }
365 }
366
367 //=================================================================================
368 // function : LineEditReturnPressed()
369 // purpose  :
370 //=================================================================================
371 void OperationGUI_FilletDlg::LineEditReturnPressed()
372 {
373   QLineEdit* send = ( QLineEdit* )sender();
374   
375   if ( send == Group1->LineEdit1 )
376     myEditCurrentArgument = Group1->LineEdit1;
377   else if ( send == Group2->LineEdit1 )
378     myEditCurrentArgument = Group2->LineEdit1;
379   else if ( send == Group3->LineEdit1 )
380     myEditCurrentArgument = Group3->LineEdit1;
381   else
382     return;
383
384   GEOMBase_Skeleton::LineEditReturnPressed();
385 }
386
387
388 //=================================================================================
389 // function : SetEditCurrentArgument()
390 // purpose  :
391 //=================================================================================
392 void OperationGUI_FilletDlg::SetEditCurrentArgument()
393 {
394   QPushButton* send = (QPushButton*)sender();
395
396   if ( send == Group1->PushButton1 ) {
397     Group1->LineEdit1->setFocus();
398     myEditCurrentArgument = Group1->LineEdit1;
399   }
400   else if ( send == Group2->PushButton1 ) {
401     Group2->LineEdit1->setFocus();
402     myEditCurrentArgument = Group2->LineEdit1;
403   }
404   else if ( send == Group2->PushButton2 ) {
405     Group2->LineEdit2->setFocus();
406     myEditCurrentArgument = Group2->LineEdit2;
407   }
408   else if ( send == Group3->PushButton1 ) {
409     Group3->LineEdit1->setFocus();
410     myEditCurrentArgument = Group3->LineEdit1;
411   }
412   else if ( send == Group3->PushButton2 ) {
413     Group3->LineEdit1->setFocus();
414     myEditCurrentArgument = Group3->LineEdit2;
415   }
416
417   activateSelection();
418 }
419
420
421 //=================================================================================
422 // function : ActivateThisDialog()
423 // purpose  :
424 //=================================================================================
425 void OperationGUI_FilletDlg::ActivateThisDialog()
426 {
427   GEOMBase_Skeleton::ActivateThisDialog();
428
429   connect( myGeomGUI->getApp()->selectionMgr(), 
430            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
431
432   activateSelection();
433   displayPreview();
434 }
435
436
437 //=================================================================================
438 // function : enterEvent()
439 // purpose  :
440 //=================================================================================
441 void OperationGUI_FilletDlg::enterEvent( QEvent* )
442 {
443   if ( !mainFrame()->GroupConstructors->isEnabled() )
444     this->ActivateThisDialog();
445 }
446
447 //=================================================================================
448 // function : ValueChangedInSpinBox()
449 // purpose  :
450 //=================================================================================
451 void OperationGUI_FilletDlg::ValueChangedInSpinBox( double )
452 {
453   displayPreview();
454 }
455
456 //=================================================================================
457 // function : reset()
458 // purpose  :
459 //=================================================================================
460 void OperationGUI_FilletDlg::reset()
461 {
462   // Set Initial values of spinboxes
463   Group1->SpinBox_DX->setValue( 5 );
464   Group2->SpinBox_DX->setValue( 5 );
465   Group2->SpinBox_DY->setValue( 5 );
466   Group2->SpinBox_DZ->setValue( 5 );
467   Group3->SpinBox_DX->setValue( 5 );
468   Group3->SpinBox_DY->setValue( 5 );
469   Group3->SpinBox_DZ->setValue( 5 );
470
471   Group1->LineEdit1->setText( "" );
472   Group2->LineEdit1->setText( "" );
473   Group2->LineEdit2->setText( "" );
474   Group3->LineEdit1->setText( "" );
475   Group3->LineEdit2->setText( "" );
476
477   // constructor id
478   int aConstructorId = getConstructorId();
479
480   if      ( aConstructorId == 0 ) myEditCurrentArgument = Group1->LineEdit1;
481   else if ( aConstructorId == 1 ) myEditCurrentArgument = Group2->LineEdit1;
482   else                            myEditCurrentArgument = Group3->LineEdit1;
483
484   myShape = GEOM::GEOM_Object::_nil();
485
486   myFaces.Clear();
487   myEdges.Clear();
488
489   erasePreview( true );
490
491   activateSelection();
492
493   enableWidgets();
494 }
495
496 //=================================================================================
497 // function : activateSelection
498 // purpose  : Activate selection in accordance with myEditCurrentArgument
499 //=================================================================================
500 void OperationGUI_FilletDlg::activateSelection()
501 {
502
503   if ( !myShape->_is_nil() && myEditCurrentArgument == Group2->LineEdit2 )
504     localSelection( myShape, TopAbs_EDGE );
505   else if ( !myShape->_is_nil() && myEditCurrentArgument == Group3->LineEdit2 )
506     localSelection( myShape, TopAbs_FACE );
507   else {
508     TColStd_MapOfInteger aMap;
509     aMap.Add( GEOM_SHELL );
510     aMap.Add( GEOM_SOLID );
511     aMap.Add( GEOM_COMPOUND );
512     globalSelection( aMap );
513   }
514
515   SelectionIntoArgument();
516 }
517
518 //=================================================================================
519 // function : enableWidgets
520 // purpose  : Enable widgets of faces in accordance with value of main object
521 //=================================================================================
522 void OperationGUI_FilletDlg::enableWidgets()
523 {
524   int anId = getConstructorId();
525
526   bool toEnable = !myShape->_is_nil();
527
528   if ( anId == 1 ) {
529     Group2->LineEdit2->setEnabled( toEnable );
530     Group2->PushButton2->setEnabled( toEnable );
531     
532     if ( !toEnable ) {
533       Group2->LineEdit2->setText( "" );
534       myEdges.Clear();
535     }
536   }
537   else if ( anId == 2 ) {
538     Group3->LineEdit2->setEnabled( toEnable );
539     Group3->PushButton2->setEnabled( toEnable );
540
541     if ( !toEnable ) {
542       Group3->LineEdit2->setText( "" );
543       myFaces.Clear();
544     }
545   }
546 }
547
548 //=================================================================================
549 // function : createOperation
550 // purpose  :
551 //=================================================================================
552 GEOM::GEOM_IOperations_ptr OperationGUI_FilletDlg::createOperation()
553 {
554   return getGeomEngine()->GetILocalOperations( getStudyId() );
555 }
556
557 //=================================================================================
558 // function : ClickOnApply()
559 // purpose  : Verify validity of input data
560 //=================================================================================
561 bool OperationGUI_FilletDlg::isValid( QString& )
562 {
563   switch ( getConstructorId() )
564   {
565     case 0: return !myShape->_is_nil();
566     case 1: return !myShape->_is_nil() && myEdges.Extent() > 0;
567     case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;
568     default: return false;
569   }
570 }
571
572 //=================================================================================
573 // function : execute
574 // purpose  :
575 //=================================================================================
576 bool OperationGUI_FilletDlg::execute( ObjectList& objects )
577 {
578   GEOM::GEOM_Object_var anObj;
579
580   int anId = getConstructorId();
581   if ( anId == 0 )
582     anObj = GEOM::GEOM_ILocalOperations::_narrow(
583       getOperation() )->MakeFilletAll( myShape, getRadius() );
584   else if ( anId == 1 ) {
585     GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
586     aList->length( myEdges.Extent() );
587
588     for ( int i = 1, n = myEdges.Extent(); i <= n; i++ )
589       aList[ i - 1 ] = myEdges( i );
590
591     if ( Group2->RadioButton1->isChecked() )
592       anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
593         MakeFilletEdges( myShape, getRadius(), aList );
594     else
595       anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
596         MakeFilletEdgesR1R2( myShape,
597                              Group2->SpinBox_DY->value(),
598                              Group2->SpinBox_DZ->value(),
599                              aList );
600   }
601   else if ( anId == 2 ) {
602     GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
603     aList->length( myFaces.Extent() );
604
605     for ( int i = 1, n = myFaces.Extent(); i <= n; i++ )
606       aList[ i - 1 ] = myFaces( i );
607
608     if ( Group3->RadioButton1->isChecked() ) {
609       anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
610         MakeFilletFaces( myShape, getRadius(), aList );
611     }
612     else {
613       anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
614         MakeFilletFacesR1R2( myShape, 
615                              Group3->SpinBox_DY->value(),
616                              Group3->SpinBox_DZ->value(), aList );
617     }
618   }
619
620   if ( !anObj->_is_nil() )
621     objects.push_back( anObj._retn() );
622
623   return true;
624 }
625
626 //=================================================================================
627 // function : getRadius
628 // purpose  : Get radius     
629 //=================================================================================
630 double OperationGUI_FilletDlg::getRadius() const
631 {
632   int anId = getConstructorId();
633   if      ( anId == 0 ) return Group1->SpinBox_DX->value();
634   else if ( anId == 1 ) return Group2->SpinBox_DX->value();
635   else                  return Group3->SpinBox_DX->value();
636 }
637
638 //=================================================================================
639 // function : RadiobuttonClicked
640 // purpose  :
641 //=================================================================================
642
643 void OperationGUI_FilletDlg::RadioButtonClicked()
644 {
645   const QObject* s = sender();
646
647   bool flag = s == Group2->RadioButton1 || s == Group3->RadioButton1;
648     
649   Group2->RadioButton1->blockSignals( true );
650   Group2->RadioButton2->blockSignals( true );
651   Group3->RadioButton1->blockSignals( true );
652   Group3->RadioButton2->blockSignals( true );
653   
654   Group2->SpinBox_DX->setEnabled( flag );
655   Group2->SpinBox_DY->setEnabled( !flag );
656   Group2->SpinBox_DZ->setEnabled( !flag );
657   Group2->RadioButton1->setChecked( flag );
658   Group2->RadioButton2->setChecked( !flag );
659   Group3->SpinBox_DX->setEnabled( flag );
660   Group3->SpinBox_DY->setEnabled( !flag );
661   Group3->SpinBox_DZ->setEnabled( !flag );
662   Group3->RadioButton1->setChecked( flag );
663   Group3->RadioButton2->setChecked( !flag );
664
665   Group2->RadioButton1->blockSignals( false );
666   Group2->RadioButton2->blockSignals( false );
667   Group3->RadioButton1->blockSignals( false );
668   Group3->RadioButton2->blockSignals( false );
669
670   displayPreview();  
671 }