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