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