Salome HOME
PAL18573: geometric entities are created with incorrect name
[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   // If selection of main object is activated
303   if ( myEditCurrentArgument == Group1->LineEdit1 ||
304        myEditCurrentArgument == Group2->LineEdit1 ||
305        myEditCurrentArgument == Group3->LineEdit1 ) {
306     if ( IObjectCount() == 1 ) {
307       Standard_Boolean aResult = Standard_False;
308       GEOM::GEOM_Object_var anObj =
309         GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
310       
311       if ( aResult && !anObj->_is_nil() ) {
312         myShape = anObj;
313         myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) );
314         displayPreview();
315         enableWidgets();
316         return;
317       }
318     }
319
320     myShape = GEOM::GEOM_Object::_nil();
321     enableWidgets();
322   }
323   // If face or edge selection is activated
324   else if ( myEditCurrentArgument == Group2->LineEdit2 ||
325             myEditCurrentArgument == Group3->LineEdit2 ) {
326     if ( IObjectCount() == 1 ) {
327       Standard_Boolean aResult = Standard_False;
328       GEOM::GEOM_Object_var anObj =
329         GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
330
331       if ( aResult && !anObj->_is_nil() ) {
332         TColStd_IndexedMapOfInteger anIndexes;
333         myGeomGUI->getApp()->selectionMgr()->GetIndexes( firstIObject(), anIndexes );
334
335         if ( anIndexes.Extent() > 0 ) {
336           QString aName;
337           if ( anIndexes.Extent() == 1 ) {
338             int anIndex = anIndexes( 1 );
339
340             aName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex );
341           }
342           else
343             aName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() );
344
345           myEditCurrentArgument->setText( aName );
346
347           if ( myConstructorId == 1 )
348             myEdges = anIndexes;
349           else
350             myFaces = anIndexes;
351
352           displayPreview();
353           return;
354         }
355       }
356     }
357     myFaces.Clear();
358   }
359 }
360
361
362 //=================================================================================
363 // function : LineEditReturnPressed()
364 // purpose  :
365 //=================================================================================
366 void OperationGUI_FilletDlg::LineEditReturnPressed()
367 {
368   QLineEdit* send = ( QLineEdit* )sender();
369   
370   if ( send == Group1->LineEdit1 )
371     myEditCurrentArgument = Group1->LineEdit1;
372   else if ( send == Group2->LineEdit1 )
373     myEditCurrentArgument = Group2->LineEdit1;
374   else if ( send == Group3->LineEdit1 )
375     myEditCurrentArgument = Group3->LineEdit1;
376   else
377     return;
378
379   GEOMBase_Skeleton::LineEditReturnPressed();
380 }
381
382
383 //=================================================================================
384 // function : SetEditCurrentArgument()
385 // purpose  :
386 //=================================================================================
387 void OperationGUI_FilletDlg::SetEditCurrentArgument()
388 {
389   QPushButton* send = (QPushButton*)sender();
390
391   if ( send == Group1->PushButton1 ) {
392     Group1->LineEdit1->setFocus();
393     myEditCurrentArgument = Group1->LineEdit1;
394   }
395   else if ( send == Group2->PushButton1 ) {
396     Group2->LineEdit1->setFocus();
397     myEditCurrentArgument = Group2->LineEdit1;
398   }
399   else if ( send == Group2->PushButton2 ) {
400     Group2->LineEdit2->setFocus();
401     myEditCurrentArgument = Group2->LineEdit2;
402   }
403   else if ( send == Group3->PushButton1 ) {
404     Group3->LineEdit1->setFocus();
405     myEditCurrentArgument = Group3->LineEdit1;
406   }
407   else if ( send == Group3->PushButton2 ) {
408     Group3->LineEdit1->setFocus();
409     myEditCurrentArgument = Group3->LineEdit2;
410   }
411
412   activateSelection();
413 }
414
415
416 //=================================================================================
417 // function : ActivateThisDialog()
418 // purpose  :
419 //=================================================================================
420 void OperationGUI_FilletDlg::ActivateThisDialog()
421 {
422   GEOMBase_Skeleton::ActivateThisDialog();
423
424   connect( myGeomGUI->getApp()->selectionMgr(), 
425            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
426
427   activateSelection();
428   displayPreview();
429 }
430
431
432 //=================================================================================
433 // function : enterEvent()
434 // purpose  :
435 //=================================================================================
436 void OperationGUI_FilletDlg::enterEvent( QEvent* )
437 {
438   if ( !mainFrame()->GroupConstructors->isEnabled() )
439     this->ActivateThisDialog();
440 }
441
442 //=================================================================================
443 // function : ValueChangedInSpinBox()
444 // purpose  :
445 //=================================================================================
446 void OperationGUI_FilletDlg::ValueChangedInSpinBox( double )
447 {
448   displayPreview();
449 }
450
451 //=================================================================================
452 // function : reset()
453 // purpose  :
454 //=================================================================================
455 void OperationGUI_FilletDlg::reset()
456 {
457   // Set Initial values of spinboxes
458   Group1->SpinBox_DX->setValue( 5 );
459   Group2->SpinBox_DX->setValue( 5 );
460   Group2->SpinBox_DY->setValue( 5 );
461   Group2->SpinBox_DZ->setValue( 5 );
462   Group3->SpinBox_DX->setValue( 5 );
463   Group3->SpinBox_DY->setValue( 5 );
464   Group3->SpinBox_DZ->setValue( 5 );
465
466   Group1->LineEdit1->setText( "" );
467   Group2->LineEdit1->setText( "" );
468   Group2->LineEdit2->setText( "" );
469   Group3->LineEdit1->setText( "" );
470   Group3->LineEdit2->setText( "" );
471
472   // constructor id
473   int aConstructorId = getConstructorId();
474
475   if      ( aConstructorId == 0 ) myEditCurrentArgument = Group1->LineEdit1;
476   else if ( aConstructorId == 1 ) myEditCurrentArgument = Group2->LineEdit1;
477   else                            myEditCurrentArgument = Group3->LineEdit1;
478
479   myShape = GEOM::GEOM_Object::_nil();
480
481   myFaces.Clear();
482   myEdges.Clear();
483
484   erasePreview( true );
485
486   activateSelection();
487
488   enableWidgets();
489 }
490
491 //=================================================================================
492 // function : activateSelection
493 // purpose  : Activate selection in accordance with myEditCurrentArgument
494 //=================================================================================
495 void OperationGUI_FilletDlg::activateSelection()
496 {
497
498   if ( !myShape->_is_nil() && myEditCurrentArgument == Group2->LineEdit2 )
499     localSelection( myShape, TopAbs_EDGE );
500   else if ( !myShape->_is_nil() && myEditCurrentArgument == Group3->LineEdit2 )
501     localSelection( myShape, TopAbs_FACE );
502   else {
503     TColStd_MapOfInteger aMap;
504     aMap.Add( GEOM_SHELL );
505     aMap.Add( GEOM_SOLID );
506     aMap.Add( GEOM_COMPOUND );
507     globalSelection( aMap );
508   }
509
510   SelectionIntoArgument();
511 }
512
513 //=================================================================================
514 // function : enableWidgets
515 // purpose  : Enable widgets of faces in accordance with value of main object
516 //=================================================================================
517 void OperationGUI_FilletDlg::enableWidgets()
518 {
519   int anId = getConstructorId();
520
521   bool toEnable = !myShape->_is_nil();
522
523   if ( anId == 1 ) {
524     Group2->LineEdit2->setEnabled( toEnable );
525     Group2->PushButton2->setEnabled( toEnable );
526     
527     if ( !toEnable ) {
528       Group2->LineEdit2->setText( "" );
529       myEdges.Clear();
530     }
531   }
532   else if ( anId == 2 ) {
533     Group3->LineEdit2->setEnabled( toEnable );
534     Group3->PushButton2->setEnabled( toEnable );
535
536     if ( !toEnable ) {
537       Group3->LineEdit2->setText( "" );
538       myFaces.Clear();
539     }
540   }
541 }
542
543 //=================================================================================
544 // function : createOperation
545 // purpose  :
546 //=================================================================================
547 GEOM::GEOM_IOperations_ptr OperationGUI_FilletDlg::createOperation()
548 {
549   return getGeomEngine()->GetILocalOperations( getStudyId() );
550 }
551
552 //=================================================================================
553 // function : ClickOnApply()
554 // purpose  : Verify validity of input data
555 //=================================================================================
556 bool OperationGUI_FilletDlg::isValid( QString& )
557 {
558   switch ( getConstructorId() )
559   {
560     case 0: return !myShape->_is_nil();
561     case 1: return !myShape->_is_nil() && myEdges.Extent() > 0;
562     case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;
563     default: return false;
564   }
565 }
566
567 //=================================================================================
568 // function : execute
569 // purpose  :
570 //=================================================================================
571 bool OperationGUI_FilletDlg::execute( ObjectList& objects )
572 {
573   GEOM::GEOM_Object_var anObj;
574
575   int anId = getConstructorId();
576   if ( anId == 0 )
577     anObj = GEOM::GEOM_ILocalOperations::_narrow(
578       getOperation() )->MakeFilletAll( myShape, getRadius() );
579   else if ( anId == 1 ) {
580     GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
581     aList->length( myEdges.Extent() );
582
583     for ( int i = 1, n = myEdges.Extent(); i <= n; i++ )
584       aList[ i - 1 ] = myEdges( i );
585
586     if ( Group2->RadioButton1->isChecked() )
587       anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
588         MakeFilletEdges( myShape, getRadius(), aList );
589     else
590       anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
591         MakeFilletEdgesR1R2( myShape,
592                              Group2->SpinBox_DY->value(),
593                              Group2->SpinBox_DZ->value(),
594                              aList );
595   }
596   else if ( anId == 2 ) {
597     GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
598     aList->length( myFaces.Extent() );
599
600     for ( int i = 1, n = myFaces.Extent(); i <= n; i++ )
601       aList[ i - 1 ] = myFaces( i );
602
603     if ( Group3->RadioButton1->isChecked() ) {
604       anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
605         MakeFilletFaces( myShape, getRadius(), aList );
606     }
607     else {
608       anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
609         MakeFilletFacesR1R2( myShape, 
610                              Group3->SpinBox_DY->value(),
611                              Group3->SpinBox_DZ->value(), aList );
612     }
613   }
614
615   if ( !anObj->_is_nil() )
616     objects.push_back( anObj._retn() );
617
618   return true;
619 }
620
621 //=================================================================================
622 // function : getRadius
623 // purpose  : Get radius     
624 //=================================================================================
625 double OperationGUI_FilletDlg::getRadius() const
626 {
627   int anId = getConstructorId();
628   if      ( anId == 0 ) return Group1->SpinBox_DX->value();
629   else if ( anId == 1 ) return Group2->SpinBox_DX->value();
630   else                  return Group3->SpinBox_DX->value();
631 }
632
633 //=================================================================================
634 // function : RadiobuttonClicked
635 // purpose  :
636 //=================================================================================
637
638 void OperationGUI_FilletDlg::RadioButtonClicked()
639 {
640   const QObject* s = sender();
641
642   bool flag = s == Group2->RadioButton1 || s == Group3->RadioButton1;
643     
644   Group2->RadioButton1->blockSignals( true );
645   Group2->RadioButton2->blockSignals( true );
646   Group3->RadioButton1->blockSignals( true );
647   Group3->RadioButton2->blockSignals( true );
648   
649   Group2->SpinBox_DX->setEnabled( flag );
650   Group2->SpinBox_DY->setEnabled( !flag );
651   Group2->SpinBox_DZ->setEnabled( !flag );
652   Group2->RadioButton1->setChecked( flag );
653   Group2->RadioButton2->setChecked( !flag );
654   Group3->SpinBox_DX->setEnabled( flag );
655   Group3->SpinBox_DY->setEnabled( !flag );
656   Group3->SpinBox_DZ->setEnabled( !flag );
657   Group3->RadioButton1->setChecked( flag );
658   Group3->RadioButton2->setChecked( !flag );
659
660   Group2->RadioButton1->blockSignals( false );
661   Group2->RadioButton2->blockSignals( false );
662   Group3->RadioButton1->blockSignals( false );
663   Group3->RadioButton2->blockSignals( false );
664
665   displayPreview();  
666 }