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