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