]> SALOME platform Git repositories - modules/geom.git/blob - src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx
Salome HOME
Additional fix of issue 0019875: to clarify the labels of the GUI panel for group...
[modules/geom.git] / src / PrimitiveGUI / PrimitiveGUI_DiskDlg.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   : PrimitiveGUI_DiskDlg.cxx
23 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
24 //
25
26 #include "PrimitiveGUI_DiskDlg.h"
27
28 #include <DlgRef.h>
29
30 #include <GeometryGUI.h>
31 #include <GEOMBase.h>
32
33 #include <SUIT_ResourceMgr.h>
34 #include <SUIT_Session.h>
35 #include <SalomeApp_Application.h>
36 #include <LightApp_SelectionMgr.h>
37
38 #include <TColStd_IndexedMapOfInteger.hxx>
39 #include <TopTools_IndexedMapOfShape.hxx>
40 #include <TopoDS_Shape.hxx>
41 #include <TopoDS_Edge.hxx>
42 #include <TopoDS.hxx>
43 #include <TopExp.hxx>
44
45 //=================================================================================
46 // class    : PrimitiveGUI_DiskDlg()
47 // purpose  : Constructs a PrimitiveGUI_DiskDlg 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 PrimitiveGUI_DiskDlg::PrimitiveGUI_DiskDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
53                                         bool modal, Qt::WindowFlags fl )
54   : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
55 {
56   QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_DISK_PNT_VEC_R" ) ) );
57   QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
58   QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_DISK_THREE_POINTS" ) ) );
59   QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_DISK_R" ) ) );
60
61   setWindowTitle( tr( "GEOM_DISK_TITLE" ) );
62
63   /***************************************************************/
64   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_DISK" ) );
65   mainFrame()->RadioButton1->setIcon( image3 );
66   mainFrame()->RadioButton2->setIcon( image0 );
67   mainFrame()->RadioButton3->setIcon( image2 );
68
69   GroupPntVecR = new DlgRef_2Sel1Spin( centralWidget() );
70   GroupPntVecR->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
71   GroupPntVecR->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) );
72   GroupPntVecR->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
73   GroupPntVecR->TextLabel3->setText( tr( "GEOM_RADIUS" ) );
74   GroupPntVecR->PushButton1->setIcon( image1 );
75   GroupPntVecR->PushButton2->setIcon( image1 );
76   GroupPntVecR->LineEdit1->setReadOnly( true );
77   GroupPntVecR->LineEdit2->setReadOnly( true );
78
79   Group3Pnts = new DlgRef_3Sel( centralWidget() );
80   Group3Pnts->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
81   Group3Pnts->TextLabel1->setText( tr( "GEOM_POINT1" ) );
82   Group3Pnts->TextLabel2->setText( tr( "GEOM_POINT2" ) );
83   Group3Pnts->TextLabel3->setText( tr( "GEOM_POINT3" ) );
84   Group3Pnts->PushButton1->setIcon( image1 );
85   Group3Pnts->PushButton2->setIcon( image1 );
86   Group3Pnts->PushButton3->setIcon( image1 );
87   Group3Pnts->LineEdit1->setReadOnly( true );
88   Group3Pnts->LineEdit2->setReadOnly( true );
89   Group3Pnts->LineEdit3->setReadOnly( true );
90
91   GroupDimensions = new DlgRef_1Spin( centralWidget() );
92   GroupDimensions->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
93   GroupDimensions->TextLabel1->setText( tr( "GEOM_RADIUS" ) );
94
95   GroupOrientation = new DlgRef_3Radio( centralWidget() );
96   GroupOrientation->GroupBox1->setTitle( tr( "GEOM_ORIENTATION" ) );
97   GroupOrientation->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) );
98   GroupOrientation->RadioButton2->setText( tr( "GEOM_WPLANE_OYZ" ) );
99   GroupOrientation->RadioButton3->setText( tr( "GEOM_WPLANE_OZX" ) );
100
101   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
102   layout->setMargin( 0 ); layout->setSpacing( 6 );
103   layout->addWidget( GroupPntVecR );
104   layout->addWidget( Group3Pnts );
105   layout->addWidget( GroupDimensions );
106   layout->addWidget( GroupOrientation );
107   /***************************************************************/
108
109   setHelpFileName( "create_disk_page.html" );
110
111   Init();
112 }
113
114
115 //=================================================================================
116 // function : ~PrimitiveGUI_DiskDlg()
117 // purpose  : Destroys the object and frees any allocated resources
118 //=================================================================================
119 PrimitiveGUI_DiskDlg::~PrimitiveGUI_DiskDlg()
120 {
121 }
122
123
124 //=================================================================================
125 // function : Init()
126 // purpose  :
127 //=================================================================================
128 void PrimitiveGUI_DiskDlg::Init()
129 {
130   /* init variables */
131   myEditCurrentArgument = GroupPntVecR->LineEdit1;
132   myOrientationType = 1;
133
134   myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
135
136   /* Get setting of step value from file configuration */
137   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
138   double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
139
140   /* min, max, step and decimals for spin boxes & initial values */
141   initSpinBox( GroupPntVecR->SpinBox_DX, 0.001, COORD_MAX, aStep, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
142   GroupPntVecR->SpinBox_DX->setValue( 100 );
143   initSpinBox( GroupDimensions->SpinBox_DX, 0.001, COORD_MAX, aStep, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
144   GroupDimensions->SpinBox_DX->setValue( 100 );
145
146   /* signals and slots connections */
147   connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
148   connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );
149   
150   connect( buttonOk(),     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
151   connect( buttonApply(),  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
152
153   connect( this,           SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
154
155   connect( GroupPntVecR->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
156   connect( GroupPntVecR->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
157   connect( GroupPntVecR->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
158   connect( GroupPntVecR->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
159
160   connect( Group3Pnts->PushButton1,   SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
161   connect( Group3Pnts->PushButton2,   SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
162   connect( Group3Pnts->PushButton3,   SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
163   connect( Group3Pnts->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
164   connect( Group3Pnts->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
165   connect( Group3Pnts->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
166
167   connect( GroupPntVecR->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT(ValueChangedInSpinBox() ) );
168   connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
169
170   connect( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
171   connect( GroupOrientation->RadioButton1, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
172   connect( GroupOrientation->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
173   connect( GroupOrientation->RadioButton3, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
174
175   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
176            this, SLOT( SelectionIntoArgument() ) );
177
178   initName( tr( "GEOM_DISK" ) );
179
180   ConstructorsClicked( 0 );
181 }
182
183 //=================================================================================
184 // function : SetDoubleSpinBoxStep()
185 // purpose  : Double spin box management
186 //=================================================================================
187 void PrimitiveGUI_DiskDlg::SetDoubleSpinBoxStep( double step )
188 {
189   GroupPntVecR->SpinBox_DX->setSingleStep(step);
190 }
191
192 //=================================================================================
193 // function : RadioBittonClicked()
194 // purpose  : Radio button management
195 //=================================================================================
196 void PrimitiveGUI_DiskDlg::RadioButtonClicked()
197 {
198   if ( GroupOrientation->RadioButton1->isChecked() )
199     myOrientationType = 1;
200   else if ( GroupOrientation->RadioButton2->isChecked() )
201     myOrientationType = 2;
202   else if ( GroupOrientation->RadioButton3->isChecked() )
203     myOrientationType = 3;
204   displayPreview();
205 }
206
207 //=================================================================================
208 // function : ConstructorsClicked()
209 // purpose  : Radio button management
210 //=================================================================================
211 void PrimitiveGUI_DiskDlg::ConstructorsClicked( int constructorId )
212 {
213   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
214
215   myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
216
217   switch ( constructorId ) {
218   case 0:
219     {
220       GroupPntVecR->hide();
221       Group3Pnts->hide();
222       GroupDimensions->show();
223       GroupOrientation->show();
224       GroupOrientation->RadioButton1->setChecked( true );
225       myOrientationType = 1;
226       break;
227     }
228   case 1:
229     {
230       Group3Pnts->hide();
231       GroupPntVecR->show();
232       GroupDimensions->hide();
233       GroupOrientation->hide();
234       myEditCurrentArgument = GroupPntVecR->LineEdit1;
235       GroupPntVecR->LineEdit1->setText( "" );
236       GroupPntVecR->LineEdit2->setText( "" );
237       break;
238     }
239   case 2:
240     {
241       GroupPntVecR->hide();
242       Group3Pnts->show();
243       GroupDimensions->hide();
244       GroupOrientation->hide();
245       myEditCurrentArgument = Group3Pnts->LineEdit1;
246       Group3Pnts->LineEdit1->setText( "" );
247       Group3Pnts->LineEdit2->setText( "" );
248       Group3Pnts->LineEdit3->setText( "" );
249       break;
250     }
251   }
252   
253   qApp->processEvents();
254   updateGeometry();
255   resize( minimumSize() );
256
257   myEditCurrentArgument->setFocus();
258   globalSelection(); // close local contexts, if any
259   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
260
261   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
262            this, SLOT( SelectionIntoArgument() ) );
263   displayPreview();
264 }
265
266 //=================================================================================
267 // function : ClickOnOk()
268 // purpose  :
269 //=================================================================================
270 void PrimitiveGUI_DiskDlg::ClickOnOk()
271 {
272   if ( ClickOnApply() )
273     ClickOnCancel();
274 }
275
276 //=================================================================================
277 // function : ClickOnApply()
278 // purpose  :
279 //=================================================================================
280 bool PrimitiveGUI_DiskDlg::ClickOnApply()
281 {
282   if ( !onAccept() )
283     return false;
284
285   initName();
286   ConstructorsClicked( getConstructorId() );
287   return true;
288 }
289
290 //=================================================================================
291 // function : SelectionIntoArgument()
292 // purpose  : Called when selection as changed or other case
293 //=================================================================================
294 void PrimitiveGUI_DiskDlg::SelectionIntoArgument()
295 {
296   if (getConstructorId() == 0) {
297     displayPreview();
298     return;
299   }
300
301   myEditCurrentArgument->setText( "" );
302   
303   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
304   SALOME_ListIO aList;
305   aSelMgr->selectedObjects( aList );
306
307   if ( aList.Extent() != 1 ) {
308     if      ( myEditCurrentArgument == GroupPntVecR->LineEdit1 )     myPoint  = GEOM::GEOM_Object::_nil();
309     else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )     myDir    = GEOM::GEOM_Object::_nil();
310     else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )       myPoint1 = GEOM::GEOM_Object::_nil();
311     else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )       myPoint2 = GEOM::GEOM_Object::_nil();
312     else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )       myPoint3 = GEOM::GEOM_Object::_nil();
313     return;
314   }
315
316   // nbSel == 1
317   Handle(SALOME_InteractiveObject) anIO = aList.First();
318
319   Standard_Boolean aRes = Standard_False;
320   GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
321   if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
322     QString aName = GEOMBase::GetName( aSelectedObject );
323
324     // If selected Vertex or Edge on the some Shape Get selection Subshape
325     TopoDS_Shape aShape;
326     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
327       TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
328       if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )
329         aNeedType = TopAbs_EDGE;
330
331       TColStd_IndexedMapOfInteger aMap;
332       aSelMgr->GetIndexes(anIO, aMap);
333       if ( aMap.Extent() == 1 ) { // Local Selection
334         int anIndex = aMap(1);
335         if ( aNeedType == TopAbs_EDGE )
336           aName += QString( ":edge_%1" ).arg( anIndex );
337         else
338           aName += QString( ":vertex_%1" ).arg( anIndex );
339
340         //Find SubShape Object in Father
341         GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
342
343         if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
344           GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
345           aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
346         }
347         else {
348           aSelectedObject = aFindedObject; // get Object from study
349         }
350       }
351       else { // Global Selection
352         if ( aShape.ShapeType() != aNeedType ) {
353           aSelectedObject = GEOM::GEOM_Object::_nil();
354           aName = "";
355         }
356       }
357     }
358     
359     myEditCurrentArgument->setText( aName );
360
361     if      ( myEditCurrentArgument == GroupPntVecR->LineEdit1 )     myPoint  = aSelectedObject;
362     else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )     myDir    = aSelectedObject;
363     else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )       myPoint1 = aSelectedObject;
364     else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )       myPoint2 = aSelectedObject;
365     else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )       myPoint3 = aSelectedObject;
366   }
367
368   displayPreview();
369 }
370
371
372 //=================================================================================
373 // function : SetEditCurrentArgument()
374 // purpose  :
375 //=================================================================================
376 void PrimitiveGUI_DiskDlg::SetEditCurrentArgument()
377 {
378   QPushButton* send = (QPushButton*)sender();
379
380   if ( send == GroupPntVecR->PushButton1 )          myEditCurrentArgument = GroupPntVecR->LineEdit1;
381   else if ( send == GroupPntVecR->PushButton2 )     myEditCurrentArgument = GroupPntVecR->LineEdit2;
382   else if ( send == Group3Pnts->PushButton1 )       myEditCurrentArgument = Group3Pnts->LineEdit1;
383   else if ( send == Group3Pnts->PushButton2 )       myEditCurrentArgument = Group3Pnts->LineEdit2;
384   else if ( send == Group3Pnts->PushButton3 )       myEditCurrentArgument = Group3Pnts->LineEdit3;
385   
386   myEditCurrentArgument->setFocus();
387
388   if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) {
389     globalSelection(); // close local contexts, if any
390     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
391   }
392   else {
393     globalSelection(); // close local contexts, if any
394     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
395   }
396
397   SelectionIntoArgument();
398 }
399
400 //=================================================================================
401 // function : LineEditReturnPressed()
402 // purpose  :
403 //=================================================================================
404 void PrimitiveGUI_DiskDlg::LineEditReturnPressed()
405 {
406   QLineEdit* send = (QLineEdit*)sender();
407   if ( send == GroupPntVecR->LineEdit1 ||
408        send == GroupPntVecR->LineEdit2 ||
409        send == Group3Pnts->LineEdit1 ||
410        send == Group3Pnts->LineEdit2 ||
411        send == Group3Pnts->LineEdit3 ) {
412     myEditCurrentArgument = send;
413     GEOMBase_Skeleton::LineEditReturnPressed();
414   }
415 }
416
417
418 //=================================================================================
419 // function : ActivateThisDialog()
420 // purpose  :
421 //=================================================================================
422 void PrimitiveGUI_DiskDlg::ActivateThisDialog()
423 {
424   GEOMBase_Skeleton::ActivateThisDialog();
425
426   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
427            this, SLOT( SelectionIntoArgument() ) );
428
429   ConstructorsClicked( getConstructorId() );
430 }
431
432
433 //=================================================================================
434 // function : enterEvent()
435 // purpose  :
436 //=================================================================================
437 void PrimitiveGUI_DiskDlg::enterEvent( QEvent* )
438 {
439   if ( !mainFrame()->GroupConstructors->isEnabled() )
440     ActivateThisDialog();
441 }
442
443 //=================================================================================
444 // function : DeactivateActiveDialog()
445 // purpose  : public slot to deactivate if active
446 //=================================================================================
447 void PrimitiveGUI_DiskDlg::DeactivateActiveDialog()
448 {
449   // myGeomGUI->SetState( -1 );
450   GEOMBase_Skeleton::DeactivateActiveDialog();
451 }
452
453 //=================================================================================
454 // function : ValueChangedInSpinBox()
455 // purpose  :
456 //=================================================================================
457 void PrimitiveGUI_DiskDlg::ValueChangedInSpinBox()
458 {
459   displayPreview();
460 }
461
462 //=================================================================================
463 // function : getRadius()
464 // purpose  :
465 //=================================================================================
466 double PrimitiveGUI_DiskDlg::getRadius() const
467 {
468   double r = 0.;
469   switch ( getConstructorId() ) {
470   case 0:
471     r = GroupDimensions->SpinBox_DX->value(); break;
472   case 1:
473     r = GroupPntVecR->SpinBox_DX->value(); break;
474   }
475   return r;
476 }
477
478 //=================================================================================
479 // function : createOperation
480 // purpose  :
481 //=================================================================================
482 GEOM::GEOM_IOperations_ptr PrimitiveGUI_DiskDlg::createOperation()
483 {
484   return myGeomGUI->GetGeomGen()->GetI3DPrimOperations( getStudyId() );
485 }
486
487 //=================================================================================
488 // function : isEqual
489 // purpose  : it may also be needed to check for min distance between gp_Pnt-s...
490 //=================================================================================
491 static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 )
492 {
493   return thePnt1->_is_equivalent( thePnt2 );
494 }
495
496 //=================================================================================
497 // function : isValid
498 // purpose  :
499 //=================================================================================
500 bool PrimitiveGUI_DiskDlg::isValid( QString& msg )
501 {
502   const int id = getConstructorId();
503   if ( id == 0 )
504     return true;
505   else if ( id == 1 )
506     return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
507   else if ( id == 2 )
508     return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
509       !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
510   return false;
511 }
512
513 //=================================================================================
514 // function : execute
515 // purpose  :
516 //=================================================================================
517 bool PrimitiveGUI_DiskDlg::execute( ObjectList& objects )
518 {
519   bool res = false;
520   
521   GEOM::GEOM_Object_var anObj;
522   
523   switch ( getConstructorId() ) {
524   case 0 :
525     anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskR( getRadius(), myOrientationType );
526     res = true;
527     break;
528   case 1 :
529     anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskPntVecR( myPoint, myDir, getRadius() );
530     res = true;
531     break;
532   case 2 :
533     anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskThreePnt( myPoint1, myPoint2, myPoint3 );
534     res = true;
535     break;
536   }
537   
538   if ( !anObj->_is_nil() )
539     objects.push_back( anObj._retn() );
540   else {
541     MESSAGE( "Execute Object is NULL!" );
542   }
543   
544   return res;
545 }
546
547 //=================================================================================
548 // function : addSubshapeToStudy
549 // purpose  : virtual method to add new SubObjects if local selection
550 //=================================================================================
551 void PrimitiveGUI_DiskDlg::addSubshapesToStudy()
552 {
553   QMap<QString, GEOM::GEOM_Object_var> objMap;
554
555   switch ( getConstructorId() ) {
556   case 1:
557     objMap[GroupPntVecR->LineEdit1->text()] = myPoint;
558     objMap[GroupPntVecR->LineEdit2->text()] = myDir;
559     break;
560   case 2:
561     objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
562     objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
563     objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
564     break;
565   }
566   addSubshapesToFather( objMap );
567 }