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