Salome HOME
5d9ff083a648c015062159c44171a2bcd85d49c2
[modules/geom.git] / src / OperationGUI / OperationGUI_ChamferDlg.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_ChamferDlg.cxx
23 // Author : Damien COQUERET, Open CASCADE S.A.S.
24 //
25
26 #include "OperationGUI_ChamferDlg.h"
27
28 #include <GEOM_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
43 #include <GEOMImpl_Types.hxx>
44
45 //=================================================================================
46 // class    : OperationGUI_ChamferDlg()
47 // purpose  : Constructs a OperationGUI_ChamferDlg which is a child of 'parent', with the
48 //            name 'name' and widget flags set to 'f'.
49 //            The dialog will by default be modeless, unless you set 'modal' to
50 //            TRUE to construct a modal dialog.
51 //=================================================================================
52 OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
53   : GEOMBase_Skeleton( theGeometryGUI, parent, false )
54 {
55   QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_ALL" ) ) );
56   QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_EDGE" ) ) );
57   QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_FACE" ) ) );
58   QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
59
60   setWindowTitle( tr( "GEOM_CHAMFER_TITLE" ) );
61
62   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) );
63
64   mainFrame()->RadioButton1->setIcon( image1 );
65   mainFrame()->RadioButton2->setIcon( image2 );
66   mainFrame()->RadioButton3->setIcon( image3 );
67
68   // Create first group
69
70   myGrp1 = new QGroupBox( tr( "GEOM_CHAMFER_ALL" ), centralWidget() );
71
72   QGridLayout* aLayout = new QGridLayout( myGrp1 );
73   aLayout->setMargin( 9 ); aLayout->setSpacing( 6 );
74
75   createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, myGrp1, aLayout, MainObj1 );
76
77   int row = aLayout->rowCount();
78   aLayout->addWidget( new QLabel( tr( "D" ), myGrp1 ), row, 0 );
79   aLayout->addWidget( ( mySpinBox[ SpinBox1 ] = new QDoubleSpinBox( myGrp1 ) ), row++, 2 );
80   aLayout->setRowStretch( row, 10 );
81
82   // Create second group
83
84   myGrp2 = new QGroupBox( tr( "GEOM_CHAMFER_EDGES" ), centralWidget() );
85
86   aLayout = new QGridLayout( myGrp2 );
87   aLayout->setMargin( 9 ); aLayout->setSpacing( 6 );
88
89   createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, myGrp2, aLayout, MainObj2 );
90   createSelWg( tr( "FACE_1" ),           iconSelect, myGrp2, aLayout, Face1 );
91   createSelWg( tr( "FACE_2" ),           iconSelect, myGrp2, aLayout, Face2 );
92
93   row = aLayout->rowCount();
94
95   aLayout->addWidget( new QLabel( tr( "GEOM_D1" ), myGrp2 ), row, 0 );
96   aLayout->addWidget( ( mySpinBox[ SpinBox21 ] = new QDoubleSpinBox( myGrp2 ) ), row++, 2 );
97   aLayout->addWidget( new QLabel( tr( "GEOM_D2" ), myGrp2 ), row, 0 );
98   aLayout->addWidget( ( mySpinBox[ SpinBox22 ] = new QDoubleSpinBox( myGrp2 ) ), row++, 2 );
99   aLayout->setRowStretch( row, 10 );
100
101   // Create third group
102
103   myGrp3 = new QGroupBox( tr( "GEOM_CHAMFER_FACES" ), centralWidget() );
104
105   aLayout = new QGridLayout( myGrp3 );
106   aLayout->setMargin( 9 ); aLayout->setSpacing( 6 );
107
108   createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, myGrp3, aLayout, MainObj3 );
109   createSelWg( tr( "SELECTED_FACES" ),   iconSelect, myGrp3, aLayout, Faces );
110
111   row = aLayout->rowCount();
112
113   aLayout->addWidget( new QLabel( tr( "GEOM_D1" ), myGrp3 ), row, 0 );
114   aLayout->addWidget( ( mySpinBox[ SpinBox31 ] = new QDoubleSpinBox( myGrp3 ) ), row++, 2 );
115   aLayout->addWidget( new QLabel( tr( "GEOM_D2" ), myGrp3 ), row, 0 );
116   aLayout->addWidget( ( mySpinBox[ SpinBox32 ] = new QDoubleSpinBox( myGrp3 ) ), row++, 2 );
117   aLayout->setRowStretch( row, 10 );
118
119   // Add groups to layout
120
121   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
122   layout->setMargin( 0 ); layout->setSpacing( 6 );
123   layout->addWidget( myGrp1 );
124   layout->addWidget( myGrp2 );
125   layout->addWidget( myGrp3 );
126
127   // Set range of spinboxes
128
129   double SpecificStep = 10.0;
130   QMap< int, QDoubleSpinBox* >::iterator anIter;
131   for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )
132     initSpinBox( anIter.value(), 0.001, COORD_MAX, SpecificStep, 3 );
133
134   setHelpFileName( "chamfer.htm" );
135
136   /* Initialisations */
137   Init();
138 }
139
140
141 //=================================================================================
142 // function : ~OperationGUI_ChamferDlg()
143 // purpose  : Destroys the object and frees any allocated resources
144 //=================================================================================
145 OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg()
146 {
147 }
148
149
150 //=================================================================================
151 // function : Init()
152 // purpose  :
153 //=================================================================================
154 void OperationGUI_ChamferDlg::Init()
155 {
156   myConstructorId = -1;
157   reset();
158
159   /* signals and slots connections */
160
161   // main buttons
162   connect( buttonOk(),    SIGNAL( clicked() ), this, SLOT( ClickOnOk()    ) );
163   connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
164
165   // group box
166   connect( this,          SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
167
168   // push buttons
169   QMap< int, QPushButton* >::iterator anIterBtn;
170   for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )
171     connect( anIterBtn.value(), SIGNAL( clicked() ),
172              this, SLOT( SetEditCurrentArgument() ) );
173
174   // line edits
175   QMap< int, QLineEdit* >::iterator anIterLE2;
176   for ( anIterLE2 = mySelName.begin(); anIterLE2 != mySelName.end(); ++anIterLE2 )
177     connect( anIterLE2.value(), SIGNAL( returnPressed() ),
178              this, SLOT( LineEditReturnPressed() ) );
179
180   // spin boxes
181   QMap< int, QDoubleSpinBox* >::iterator anIterSpin;
182   for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin )
183     connect( anIterSpin.value(), SIGNAL( valueChanged( double ) ),
184              this, SLOT( ValueChangedInSpinBox( double ) ) );
185
186   // selection
187   connect( myGeomGUI->getApp()->selectionMgr(), 
188            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
189
190   initName( tr( "GEOM_CHAMFER" ) );
191
192   ConstructorsClicked( 0 );
193 }
194
195
196 //=================================================================================
197 // function : ConstructorsClicked()
198 // purpose  : Radio button management
199 //=================================================================================
200 void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId )
201 {
202    // Activate next widget
203   if ( myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType() 
204        != OCCViewer_Viewer::Type() ) {
205     mainFrame()->RadioButton1->setChecked( true );
206     return;
207   }
208
209   if ( myConstructorId == constructorId )
210     return;
211
212   // Get values from previous widget
213   double D1 = 5, D2 = 5;
214   if ( myConstructorId == 0 )
215     D1 = D2 = mySpinBox[ SpinBox1 ]->value();
216   else if ( myConstructorId == 1 ) {
217     D1 = mySpinBox[ SpinBox21 ]->value();
218     D2 = mySpinBox[ SpinBox22 ]->value();
219   }
220   else if ( myConstructorId == 2 ) {
221     D1 = mySpinBox[ SpinBox31 ]->value();
222     D2 = mySpinBox[ SpinBox32 ]->value();
223   }
224
225   myConstructorId = constructorId;
226
227   switch ( constructorId ) {
228   case 0:
229     myGrp2->hide();
230     myGrp3->hide();
231     myGrp1->show();
232     mySpinBox[ SpinBox1 ]->setValue( D1 );
233     break;
234   case 1:
235     myGrp1->hide();
236     myGrp3->hide();
237     myGrp2->show();
238     mySpinBox[ SpinBox21 ]->setValue( D1 );
239     mySpinBox[ SpinBox22 ]->setValue( D2 );
240     break;
241   case 2:
242     myGrp1->hide();
243     myGrp2->hide();
244     myGrp3->show();
245     mySpinBox[ SpinBox31 ]->setValue( D1 );
246     mySpinBox[ SpinBox32 ]->setValue( D2 );        
247     break;
248   default:
249     break;
250   }
251   
252   if      ( constructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];
253   else if ( constructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];
254   else                           myEditCurrentArgument = mySelName[ MainObj3 ];
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   qApp->processEvents();
268   updateGeometry();
269   resize( minimumSize() );
270
271   displayPreview();
272 }
273
274
275 //=================================================================================
276 // function : ClickOnOk()
277 // purpose  :
278 //=================================================================================
279 void OperationGUI_ChamferDlg::ClickOnOk()
280 {
281   if ( ClickOnApply() )
282     ClickOnCancel();
283 }
284
285 //=================================================================================
286 // function : ClickOnApply()
287 // purpose  :
288 //=================================================================================
289 bool OperationGUI_ChamferDlg::ClickOnApply()
290 {
291   if ( !onAccept() )
292     return false;
293
294   initName();
295   return true;
296 }
297
298
299 //=================================================================================
300 // function : SelectionIntoArgument()
301 // purpose  : Called when selection has changed
302 //=================================================================================
303 void OperationGUI_ChamferDlg::SelectionIntoArgument()
304 {
305   erasePreview();
306   myEditCurrentArgument->setText( "" );
307
308   // Get index of current selection focus
309   int aCurrFocus = -1;
310   QMap< int, QLineEdit* >::iterator anIter;
311   for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) {
312     if ( myEditCurrentArgument == anIter.value() ) {
313       aCurrFocus = anIter.key();
314       break;
315     }
316   }
317
318   // If selection of main object is activated
319   if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 ) {
320     if ( IObjectCount() == 1 ) {
321       Standard_Boolean aResult = Standard_False;
322       GEOM::GEOM_Object_var anObj =
323         GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
324
325       if ( aResult && !anObj->_is_nil() ) {
326         myShape = anObj;
327         mySelName[ aCurrFocus ]->setText( GEOMBase::GetName( anObj ) );
328         displayPreview();
329         enableWidgets();
330         return;
331       }
332     }
333
334     myShape = GEOM::GEOM_Object::_nil();
335     enableWidgets();
336   }
337   // If face selection of second tab is activated
338   else if ( aCurrFocus == Face1 || aCurrFocus == Face2 ) {
339     if ( IObjectCount() == 1 ) {
340       Standard_Boolean aResult = Standard_False;
341       GEOM::GEOM_Object_var anObj =
342         GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
343
344       if ( aResult && !anObj->_is_nil() ) {
345          TColStd_IndexedMapOfInteger anIndexes;
346          ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( firstIObject(), anIndexes );
347
348          if ( anIndexes.Extent() == 1 ) {
349             int anIndex = anIndexes( 1 );
350             QString aFaceName = QString( GEOMBase::GetName( anObj ) ) + ":%1";
351             myEditCurrentArgument->setText( aFaceName.arg( anIndex ) );
352             myFace[ aCurrFocus ] = anIndex;
353             displayPreview();
354             return;
355          }
356       }
357     }
358
359     myFace[ aCurrFocus ] = -1;
360   }
361   // If face selection of third tab is activated
362   else if ( aCurrFocus == Faces ) {
363     if ( IObjectCount() == 1 ) {
364       Standard_Boolean aResult = Standard_False;
365       GEOM::GEOM_Object_var anObj =
366         GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
367       
368       if ( aResult && !anObj->_is_nil() ) {
369         TColStd_IndexedMapOfInteger anIndexes;
370         ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( firstIObject(), anIndexes );
371         
372         if ( anIndexes.Extent() > 0 ) {
373           QString aFaceName;
374           if ( anIndexes.Extent() == 1 ) {
375             int anIndex = anIndexes( 1 );
376             
377             aFaceName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex );
378           }
379           else {
380             aFaceName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() );
381           }
382           
383           myEditCurrentArgument->setText( aFaceName );
384           myFaces = anIndexes;
385           displayPreview();
386           return;
387         }
388       }
389     }
390     myFaces.Clear();
391   }
392 }
393
394
395 //=================================================================================
396 // function : LineEditReturnPressed()
397 // purpose  :
398 //=================================================================================
399 void OperationGUI_ChamferDlg::LineEditReturnPressed()
400 {
401   QLineEdit* aSender = ( QLineEdit* )sender();
402
403   QMap< int, QLineEdit* >::iterator anIterLE;
404   for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
405     if ( anIterLE.value() == aSender )
406       myEditCurrentArgument = anIterLE.value();
407
408   GEOMBase_Skeleton::LineEditReturnPressed();
409 }
410
411
412 //=================================================================================
413 // function : SetEditCurrentArgument()
414 // purpose  :
415 //=================================================================================
416 void OperationGUI_ChamferDlg::SetEditCurrentArgument()
417 {
418   QPushButton* aSender = ( QPushButton* )sender();
419
420   QMap< int, QPushButton* >::iterator anIter;
421   for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) {
422     if ( anIter.value() == aSender ) {
423       mySelName[ anIter.key() ]->setFocus();
424       myEditCurrentArgument = mySelName[ anIter.key() ];
425     }
426   }
427
428   activateSelection();
429 }
430
431
432 //=================================================================================
433 // function : ActivateThisDialog()
434 // purpose  :
435 //=================================================================================
436 void OperationGUI_ChamferDlg::ActivateThisDialog()
437 {
438   GEOMBase_Skeleton::ActivateThisDialog();
439
440   connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->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_ChamferDlg::enterEvent( QEvent* )
453 {
454   if ( !mainFrame()->GroupConstructors->isEnabled() )
455     this->ActivateThisDialog();
456 }
457
458
459 //=================================================================================
460 // function : ValueChangedInSpinBox()
461 // purpose  :
462 //=================================================================================
463 void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double )
464 {
465   displayPreview();
466 }
467
468
469 //=================================================================================
470 // function : createSelWg()
471 // purpose  :
472 //=================================================================================
473 void OperationGUI_ChamferDlg::createSelWg( const QString& theLbl,
474                                            QPixmap&       thePix,
475                                            QWidget*       theParent,
476                                            QGridLayout*   theLayout,
477                                            const int      theId )
478 {
479   QLabel* lab = new QLabel( theLbl, theParent );
480   mySelBtn[ theId ] = new QPushButton( theParent );
481   mySelBtn[ theId ]->setIcon( thePix );
482   mySelName[ theId ] = new QLineEdit( theParent );
483   mySelName[ theId ]->setReadOnly( true );
484   int row = theLayout->rowCount();
485   theLayout->addWidget( lab,                row, 0 );
486   theLayout->addWidget( mySelBtn[ theId ],  row, 1 );
487   theLayout->addWidget( mySelName[ theId ], row, 2 );
488 }
489
490 //=================================================================================
491 // function : reset()
492 // purpose  :
493 //=================================================================================
494 void OperationGUI_ChamferDlg::reset()
495 {
496   // Set Initial values of spinboxes
497   QMap< int, QDoubleSpinBox* >::iterator anIter;
498   for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )
499     anIter.value()->setValue( 5 );
500
501   // clear line edits
502   QMap< int, QLineEdit* >::iterator anIterLE;
503   for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
504     anIterLE.value()->setText( "" );
505
506   // constructor id
507   int aConstructorId = getConstructorId();
508
509   if      ( aConstructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];
510   else if ( aConstructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];
511   else                            myEditCurrentArgument = mySelName[ MainObj3 ];
512
513   myShape = GEOM::GEOM_Object::_nil();
514
515   myFaces.Clear();
516   myFace[ Face1 ] = -1;
517   myFace[ Face2 ] = -1;
518
519   erasePreview( true );
520
521   activateSelection();
522
523   enableWidgets();
524 }
525
526 //=================================================================================
527 // function : activateSelection
528 // purpose  : Activate selection in accordance with myEditCurrentArgument
529 //=================================================================================
530 void OperationGUI_ChamferDlg::activateSelection()
531 {
532   if (  !myShape->_is_nil() &&
533        ( myEditCurrentArgument == mySelName[ Face1 ] ||
534          myEditCurrentArgument == mySelName[ Face2 ] ||
535          myEditCurrentArgument == mySelName[ Faces ] ) )
536     localSelection( myShape, TopAbs_FACE );
537   else
538   {
539     TColStd_MapOfInteger aMap;
540     aMap.Add( GEOM_SHELL );
541     aMap.Add( GEOM_SOLID );
542     aMap.Add( GEOM_COMPOUND );
543     globalSelection( aMap );
544   }
545
546   SelectionIntoArgument();
547 }
548
549 //=================================================================================
550 // function : enableWidgets
551 // purpose  : Enable widgets of faces in accordance with value of main object
552 //=================================================================================
553 void OperationGUI_ChamferDlg::enableWidgets()
554 {
555   int anId = getConstructorId();
556
557   bool toEnable = !myShape->_is_nil();
558   
559   if ( anId == 1 )
560   {
561     mySelName[ Face1 ]->setEnabled( toEnable );
562     mySelName[ Face2 ]->setEnabled( toEnable );
563     mySelBtn[ Face1 ]->setEnabled( toEnable );
564     mySelBtn[ Face2 ]->setEnabled( toEnable );
565
566     if ( !toEnable )
567     {
568       mySelName[ Face1 ]->setText( "" );
569       mySelName[ Face2 ]->setText( "" );
570       myFace[ Face1 ] = -1;
571       myFace[ Face2 ] = -1;
572     }
573   }
574   else if ( anId == 2 )
575   {
576     mySelName[ Faces ]->setEnabled( toEnable );
577
578     if ( !toEnable )
579       myFaces.Clear();
580   }
581 }
582
583 //=================================================================================
584 // function : createOperation
585 // purpose  :
586 //=================================================================================
587 GEOM::GEOM_IOperations_ptr OperationGUI_ChamferDlg::createOperation()
588 {
589   return getGeomEngine()->GetILocalOperations( getStudyId() );
590 }
591
592 //=================================================================================
593 // function : ClickOnApply()
594 // purpose  : Verify validity of input data
595 //=================================================================================
596 bool OperationGUI_ChamferDlg::isValid( QString& )
597 {
598   switch ( getConstructorId() )
599   {
600     case 0: return !myShape->_is_nil();
601     case 1: return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0;
602     case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;
603     default: return false;
604   }
605 }
606
607 //=================================================================================
608 // function : execute
609 // purpose  :
610 //=================================================================================
611 bool OperationGUI_ChamferDlg::execute( ObjectList& objects )
612 {
613   GEOM::GEOM_Object_var anObj;
614
615   int anId = getConstructorId();
616   if ( anId == 0 )
617     anObj = GEOM::GEOM_ILocalOperations::_narrow(
618       getOperation() )->MakeChamferAll( myShape,
619                                         mySpinBox[ SpinBox1 ]->value() );
620   else if ( anId == 1 )
621     anObj = GEOM::GEOM_ILocalOperations::_narrow(
622       getOperation() )->MakeChamferEdge( myShape,
623                                          mySpinBox[ SpinBox21 ]->value(),
624                                          mySpinBox[ SpinBox22 ]->value(),
625                                          myFace[ Face1 ],
626                                          myFace[ Face2 ] );
627   else if ( anId == 2 )
628   {
629     GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
630     anArray->length( myFaces.Extent() );
631
632
633     for ( int i = 1, n = myFaces.Extent(); i <= n; i++ )
634       anArray[ i - 1 ] = myFaces( i );             
635     
636     anObj = GEOM::GEOM_ILocalOperations::_narrow(
637       getOperation() )->MakeChamferFaces( myShape,
638                                           mySpinBox[ SpinBox31 ]->value(),
639                                           mySpinBox[ SpinBox32 ]->value(),
640                                           anArray );
641   }
642
643
644   if ( !anObj->_is_nil() )
645     objects.push_back( anObj._retn() );
646
647   return true;
648 }
649
650
651
652
653
654
655
656
657