Salome HOME
99ebcd1bcbfb83d9d1baca8a8741fe65e7395be8
[modules/geom.git] / src / BasicGUI / BasicGUI_ArcDlg.cxx
1 // Copyright (C) 2007-2023  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, or (at your option) any later version.
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 // GEOM GEOMGUI : GUI for Geometry component
24 // File   : BasicGUI_ArcDlg.cxx
25 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
26 //
27 #include "BasicGUI_ArcDlg.h"
28
29 #include <DlgRef.h>
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 <TopTools_IndexedMapOfShape.hxx>
39 #include <TopoDS_Shape.hxx>
40 #include <TopoDS_Edge.hxx>
41 #include <TopoDS.hxx>
42 #include <TopExp.hxx>
43
44 #include <GEOMImpl_Types.hxx>
45
46 //=================================================================================
47 // class    : BasicGUI_ArcDlg()
48 // purpose  : Constructs a BasicGUI_ArcDlg which is a child of 'parent', with the
49 //            name 'name' and widget flags set to 'f'.
50 //            The dialog will by default be modeless, unless you set 'modal' to
51 //            TRUE to construct a modal dialog.
52 //=================================================================================
53 BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
54                                   bool modal, Qt::WindowFlags fl )
55   : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
56 {
57   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
58   QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC" ) ) );
59   QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_CENTER" ) ) );
60   QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
61   QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_OF_ELLIPSE" ) ) );
62
63   setWindowTitle( tr( "GEOM_ARC_TITLE" ) );
64
65   /***************************************************************/
66   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ARC" ) );
67   mainFrame()->RadioButton1->setIcon( image0 );
68   mainFrame()->RadioButton2->setIcon( image1 );
69   mainFrame()->RadioButton3->setIcon( image3 );
70
71   Group3Pnts = new DlgRef_3Sel( centralWidget() );
72
73   Group3Pnts->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
74   Group3Pnts->TextLabel1->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
75   Group3Pnts->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
76   Group3Pnts->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 3 ) );
77
78   Group3Pnts->LineEdit1->setReadOnly( true );
79   Group3Pnts->LineEdit2->setReadOnly( true );
80   Group3Pnts->LineEdit3->setReadOnly( true );
81
82   Group3Pnts->LineEdit1->setEnabled(true);
83   Group3Pnts->LineEdit2->setEnabled(false);
84   Group3Pnts->LineEdit3->setEnabled(false);
85
86   Group3Pnts->PushButton1->setIcon(image2);
87   Group3Pnts->PushButton2->setIcon(image2);
88   Group3Pnts->PushButton3->setIcon(image2);
89
90
91   Group3Pnts2 = new DlgRef_3Sel1Check( centralWidget() );
92
93   Group3Pnts2->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
94   Group3Pnts2->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) );
95   Group3Pnts2->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( "Start" ) );
96   Group3Pnts2->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( "End" ) );
97
98   Group3Pnts2->LineEdit1->setReadOnly( true );
99   Group3Pnts2->LineEdit2->setReadOnly( true );
100   Group3Pnts2->LineEdit3->setReadOnly( true );
101
102   Group3Pnts2->LineEdit1->setEnabled(true);
103   Group3Pnts2->LineEdit2->setEnabled(false);
104   Group3Pnts2->LineEdit3->setEnabled(false);
105
106   Group3Pnts2->PushButton1->setIcon( image2 );
107   Group3Pnts2->PushButton2->setIcon( image2 );
108   Group3Pnts2->PushButton3->setIcon( image2 );
109   
110   Group3Pnts2->CheckButton1->setText( tr( "GEOM_REVERSE" ) );
111
112   Group3Pnts3 = new DlgRef_3Sel( centralWidget() );
113
114   Group3Pnts3->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
115   Group3Pnts3->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) );
116   Group3Pnts3->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
117   Group3Pnts3->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
118
119   Group3Pnts3->LineEdit1->setReadOnly( true );
120   Group3Pnts3->LineEdit2->setReadOnly( true );
121   Group3Pnts3->LineEdit3->setReadOnly( true );
122
123   Group3Pnts3->LineEdit1->setEnabled(true);
124   Group3Pnts3->LineEdit2->setEnabled(false);
125   Group3Pnts3->LineEdit3->setEnabled(false);
126
127   Group3Pnts3->PushButton1->setIcon(image2);
128   Group3Pnts3->PushButton2->setIcon(image2);
129   Group3Pnts3->PushButton3->setIcon(image2);
130
131   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
132   layout->setMargin( 0 ); layout->setSpacing( 6 );
133   layout->addWidget( Group3Pnts );
134   layout->addWidget( Group3Pnts2 );
135   layout->addWidget( Group3Pnts3 );
136
137   setHelpFileName( "create_arc_page.html" );
138
139   Init();
140 }
141
142
143 //=================================================================================
144 // function : ~BasicGUI_ArcDlg()
145 // purpose  : Destroys the object and frees any allocated resources
146 //=================================================================================
147 BasicGUI_ArcDlg::~BasicGUI_ArcDlg()
148 {
149 }
150
151
152 //=================================================================================
153 // function : Init()
154 // purpose  :
155 //=================================================================================
156 void BasicGUI_ArcDlg::Init()
157 {
158   /* init variables */
159   myEditCurrentArgument = Group3Pnts->LineEdit1;
160
161   myPoint1.nullify();
162   myPoint2.nullify();
163   myPoint3.nullify();
164   Group3Pnts2->CheckButton1->setChecked( false );
165   Group3Pnts->PushButton1->setDown(true);
166
167   /* signals and slots connections */
168   connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
169   connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );
170  
171   connect( this,           SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
172  
173   connect( buttonOk(),     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
174   connect( buttonApply(),  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
175
176   connect( Group3Pnts->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
177   connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
178   connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
179
180   connect( Group3Pnts2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
181   connect( Group3Pnts2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
182   connect( Group3Pnts2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
183
184   connect( Group3Pnts2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseSense() ) );
185
186   connect( Group3Pnts3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
187   connect( Group3Pnts3->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
188   connect( Group3Pnts3->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
189
190   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
191            this, SLOT( SelectionIntoArgument() ) );
192
193   initName( tr( "GEOM_ARC" ) ); 
194   
195
196   ConstructorsClicked( 0 );
197 }
198
199
200 //=================================================================================
201 // function : ClickOnOk()
202 // purpose  :
203 //=================================================================================
204 void BasicGUI_ArcDlg::ClickOnOk()
205 {
206   setIsApplyAndClose( true );
207   if ( ClickOnApply() )
208     ClickOnCancel();
209 }
210
211 //=================================================================================
212 // function : ClickOnApply()
213 // purpose  :
214 //=================================================================================
215 bool BasicGUI_ArcDlg::ClickOnApply()
216 {
217   if ( !onAccept() )
218     return false;
219
220   initName();
221   ConstructorsClicked( getConstructorId() );
222
223   return true;
224 }
225
226
227 //=================================================================================
228 // function : SelectionIntoArgument()
229 // purpose  : Called when selection as changed or other case
230 //=================================================================================
231 void BasicGUI_ArcDlg::SelectionIntoArgument()
232 {
233   myEditCurrentArgument->setText( "" );
234
235   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
236   SALOME_ListIO aSelList;
237   aSelMgr->selectedObjects(aSelList);
238
239   if (aSelList.Extent() != 1) {
240     switch (getConstructorId()) {
241     case 0:
242       if      ( myEditCurrentArgument == Group3Pnts->LineEdit1 )   myPoint1.nullify();
243       else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )   myPoint2.nullify();
244       else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )   myPoint3.nullify();
245       break;
246     case 1:
247       if      ( myEditCurrentArgument == Group3Pnts2->LineEdit1 )   myPoint1.nullify();
248       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 )   myPoint2.nullify();
249       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 )   myPoint3.nullify();
250       break;
251     case 2:
252       if      ( myEditCurrentArgument == Group3Pnts3->LineEdit1 )   myPoint1.nullify();
253       else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 )   myPoint2.nullify();
254       else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 )   myPoint3.nullify();
255       break;
256     default:
257       break;
258     }
259     return;
260   }   
261
262   GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX );
263   TopoDS_Shape aShape;
264   if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
265     QString aName = GEOMBase::GetName( aSelectedObject.get() );
266     myEditCurrentArgument->setText(aName);
267     switch ( getConstructorId() ) {
268     case 0:
269       if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) {
270         myPoint1 = aSelectedObject;
271         if ( myPoint1 && !myPoint2 )
272           Group3Pnts->PushButton2->click();
273       }
274       else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) {
275         myPoint2 = aSelectedObject;
276         if ( myPoint2 && !myPoint3 )
277           Group3Pnts->PushButton3->click();
278       }
279       else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) {
280         myPoint3 = aSelectedObject;
281         if ( myPoint3 && !myPoint1 )
282           Group3Pnts->PushButton1->click();
283       }
284       break;
285     case 1:
286       if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) {
287         myPoint1 = aSelectedObject;
288         if ( myPoint1 && !myPoint2 )
289           Group3Pnts2->PushButton2->click();
290       }
291       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) {
292         myPoint2 = aSelectedObject;
293         if ( myPoint2 && !myPoint3 )
294           Group3Pnts2->PushButton3->click();
295       }
296       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) {
297         myPoint3 = aSelectedObject;
298         if ( myPoint3 && !myPoint1 )
299           Group3Pnts2->PushButton1->click();
300       }
301       break;
302     case 2:
303       if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) {
304         myPoint1 = aSelectedObject;
305         if ( myPoint1 && !myPoint2 )
306           Group3Pnts3->PushButton2->click();
307       }
308       else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) {
309         myPoint2 = aSelectedObject;
310         if ( myPoint2 && !myPoint3 )
311           Group3Pnts3->PushButton3->click();
312       }
313       else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) {
314         myPoint3 = aSelectedObject;
315         if ( myPoint3 && !myPoint1 )
316           Group3Pnts3->PushButton1->click();
317       }
318       break;
319     }
320   }
321
322   displayPreview(true);
323 }
324
325
326 //=================================================================================
327 // function : SetEditCurrentArgument()
328 // purpose  :
329 //=================================================================================
330 void BasicGUI_ArcDlg::SetEditCurrentArgument()
331 {
332   globalSelection(); // close local selection to clear it
333   localSelection( TopAbs_VERTEX );
334
335   QPushButton* send = (QPushButton*)sender();
336   switch ( getConstructorId() ) {
337   case 0:
338     if      ( send == Group3Pnts->PushButton1 ) {
339       myEditCurrentArgument = Group3Pnts->LineEdit1;
340       Group3Pnts->PushButton2->setDown(false);
341       Group3Pnts->PushButton3->setDown(false);
342       Group3Pnts->LineEdit1->setEnabled(true);
343       Group3Pnts->LineEdit2->setEnabled(false);
344       Group3Pnts->LineEdit3->setEnabled(false);
345     }
346     else if ( send == Group3Pnts->PushButton2 ) {
347       myEditCurrentArgument = Group3Pnts->LineEdit2;
348       Group3Pnts->PushButton1->setDown(false);
349       Group3Pnts->PushButton3->setDown(false);
350       Group3Pnts->LineEdit1->setEnabled(false);
351       Group3Pnts->LineEdit2->setEnabled(true);
352       Group3Pnts->LineEdit3->setEnabled(false);
353     }
354     else if ( send == Group3Pnts->PushButton3 ) {
355       myEditCurrentArgument = Group3Pnts->LineEdit3;
356       Group3Pnts->PushButton1->setDown(false);
357       Group3Pnts->PushButton2->setDown(false);
358       Group3Pnts->LineEdit1->setEnabled(false);
359       Group3Pnts->LineEdit2->setEnabled(false);
360       Group3Pnts->LineEdit3->setEnabled(true);
361     }
362     break;
363   case 1:
364     if      ( send == Group3Pnts2->PushButton1 ) {
365       myEditCurrentArgument = Group3Pnts2->LineEdit1;
366       Group3Pnts2->PushButton2->setDown(false);
367       Group3Pnts2->PushButton3->setDown(false);
368       Group3Pnts2->LineEdit1->setEnabled(true);
369       Group3Pnts2->LineEdit2->setEnabled(false);
370       Group3Pnts2->LineEdit3->setEnabled(false);
371     }
372     else if ( send == Group3Pnts2->PushButton2 ) {
373       myEditCurrentArgument = Group3Pnts2->LineEdit2;
374       Group3Pnts2->PushButton1->setDown(false);
375       Group3Pnts2->PushButton3->setDown(false);
376       Group3Pnts2->LineEdit1->setEnabled(false);
377       Group3Pnts2->LineEdit2->setEnabled(true);
378       Group3Pnts2->LineEdit3->setEnabled(false);
379     }
380     else if ( send == Group3Pnts2->PushButton3 ) {
381       myEditCurrentArgument = Group3Pnts2->LineEdit3;
382       Group3Pnts2->PushButton1->setDown(false);
383       Group3Pnts2->PushButton2->setDown(false);
384       Group3Pnts2->LineEdit1->setEnabled(false);
385       Group3Pnts2->LineEdit2->setEnabled(false);
386       Group3Pnts2->LineEdit3->setEnabled(true);
387     }
388     break;
389   case 2:
390     if ( send == Group3Pnts3->PushButton1 ) {
391       myEditCurrentArgument = Group3Pnts3->LineEdit1;
392       Group3Pnts3->PushButton2->setDown(false);
393       Group3Pnts3->PushButton3->setDown(false);
394       Group3Pnts3->LineEdit1->setEnabled(true);
395       Group3Pnts3->LineEdit2->setEnabled(false);
396       Group3Pnts3->LineEdit3->setEnabled(false);
397     }
398     else if ( send == Group3Pnts3->PushButton2 ) {
399       myEditCurrentArgument = Group3Pnts3->LineEdit2;
400       Group3Pnts3->PushButton1->setDown(false);
401       Group3Pnts3->PushButton3->setDown(false);
402       Group3Pnts3->LineEdit1->setEnabled(false);
403       Group3Pnts3->LineEdit2->setEnabled(true);
404       Group3Pnts3->LineEdit3->setEnabled(false);
405     }
406     else if ( send == Group3Pnts3->PushButton3 ) {
407       myEditCurrentArgument = Group3Pnts3->LineEdit3;
408       Group3Pnts3->PushButton1->setDown(false);
409       Group3Pnts3->PushButton2->setDown(false);
410       Group3Pnts3->LineEdit1->setEnabled(false);
411       Group3Pnts3->LineEdit2->setEnabled(false);
412       Group3Pnts3->LineEdit3->setEnabled(true);
413     }
414     break;
415   }
416   myEditCurrentArgument->setFocus();
417   //  SelectionIntoArgument();
418   send->setDown(true);
419   displayPreview(true);
420 }
421
422
423 //=================================================================================
424 // function : ActivateThisDialog()
425 // purpose  :
426 //=================================================================================
427 void BasicGUI_ArcDlg::ActivateThisDialog()
428 {
429   GEOMBase_Skeleton::ActivateThisDialog();
430
431   connect( myGeomGUI->getApp()->selectionMgr(),
432            SIGNAL( currentSelectionChanged() ),
433            this,
434            SLOT(SelectionIntoArgument() ) );
435
436   ConstructorsClicked( getConstructorId() );
437 }
438
439 //=================================================================================
440 // function : enterEvent()
441 // purpose  :
442 //=================================================================================
443 void BasicGUI_ArcDlg::enterEvent( QEvent* )
444 {
445   if ( !mainFrame()->GroupConstructors->isEnabled() )
446     ActivateThisDialog();
447 }
448
449 //=================================================================================
450 // function : createOperation
451 // purpose  :
452 //=================================================================================
453 GEOM::GEOM_IOperations_ptr BasicGUI_ArcDlg::createOperation()
454 {
455   return myGeomGUI->GetGeomGen()->GetICurvesOperations();
456 }
457
458 //=================================================================================
459 // function : isValid
460 // purpose  :
461 //=================================================================================
462 bool BasicGUI_ArcDlg::isValid( QString& /*msg*/ )
463 {
464   bool ok = myPoint1 && myPoint2 && myPoint3 &&
465     myPoint1 != myPoint2 && myPoint1 != myPoint3 && myPoint2 != myPoint3;
466   return ok;
467 }
468
469 //=================================================================================
470 // function : execute
471 // purpose  :
472 //=================================================================================
473 bool BasicGUI_ArcDlg::execute( ObjectList& objects )
474 {
475   bool res = false;
476   GEOM::GEOM_Object_var anObj;
477
478   GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() );
479
480   switch ( getConstructorId() ) {
481   case 0:
482     {
483       if ( myPoint1 && myPoint2 && myPoint3 ) {
484         anObj = anOper->MakeArc( myPoint1.get(), myPoint2.get(), myPoint3.get() );
485         res = true;
486       }
487       break;
488     }
489   case 1:
490     {
491       bool Sense = Group3Pnts2->CheckButton1->isChecked();
492       if ( myPoint1 && myPoint2 && myPoint3 ) {
493         anObj = anOper->MakeArcCenter( myPoint1.get(), myPoint2.get(), myPoint3.get(), Sense );
494         res = true;
495       }
496       break;
497     }
498   case 2:
499     {
500       if ( myPoint1 && myPoint2 && myPoint3 ) {
501         anObj = anOper->MakeArcOfEllipse( myPoint1.get(), myPoint2.get(), myPoint3.get() );
502         res = true;
503       }
504       break;
505     }
506   }
507   if ( !anObj->_is_nil() ) {
508     objects.push_back( anObj._retn() );
509   }
510   return res;
511 }
512
513 //=================================================================================
514 // function : ConstructorsClicked()
515 // purpose  : Radio button management
516 //=================================================================================
517 void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
518 {
519   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
520
521   myPoint1.nullify();
522   myPoint2.nullify();
523   myPoint3.nullify();
524   
525   switch ( constructorId ) {
526   case 0:
527     {
528       Group3Pnts->show();
529       Group3Pnts2->hide();
530       Group3Pnts3->hide();
531       Group3Pnts->PushButton1->setDown(true);
532       Group3Pnts->PushButton2->setDown(false);
533       Group3Pnts->PushButton3->setDown(false);
534       Group3Pnts->LineEdit1->setText( "" );
535       Group3Pnts->LineEdit2->setText( "" );
536       Group3Pnts->LineEdit3->setText( "" );
537       Group3Pnts->LineEdit1->setEnabled(true);
538       Group3Pnts->LineEdit2->setEnabled(false);
539       Group3Pnts->LineEdit3->setEnabled(false);
540
541       myEditCurrentArgument = Group3Pnts->LineEdit1;
542       break;
543     }
544   case 1:
545     {
546       Group3Pnts->hide();
547       Group3Pnts2->show();
548       Group3Pnts3->hide();
549       Group3Pnts2->PushButton1->setDown(true);
550       Group3Pnts2->PushButton2->setDown(false);
551       Group3Pnts2->PushButton3->setDown(false);
552       Group3Pnts2->LineEdit1->setText( "" );
553       Group3Pnts2->LineEdit2->setText( "" );
554       Group3Pnts2->LineEdit3->setText( "" );
555       Group3Pnts2->LineEdit1->setEnabled(true);
556       Group3Pnts2->LineEdit2->setEnabled(false);
557       Group3Pnts2->LineEdit3->setEnabled(false);
558       
559       myEditCurrentArgument = Group3Pnts2->LineEdit1;
560       break;
561     }
562   case 2:
563     {
564       Group3Pnts->hide();
565       Group3Pnts2->hide();
566       Group3Pnts3->show();
567       Group3Pnts3->PushButton1->setDown(true);
568       Group3Pnts3->PushButton2->setDown(false);
569       Group3Pnts3->PushButton3->setDown(false);
570       Group3Pnts3->LineEdit1->setText( "" );
571       Group3Pnts3->LineEdit2->setText( "" );
572       Group3Pnts3->LineEdit3->setText( "" );
573       Group3Pnts3->LineEdit1->setEnabled(true);
574       Group3Pnts3->LineEdit2->setEnabled(false);
575       Group3Pnts3->LineEdit3->setEnabled(false);
576
577       myEditCurrentArgument = Group3Pnts3->LineEdit1;
578       break;
579     }
580   }
581
582   globalSelection(); // close local contexts, if any
583   localSelection( TopAbs_VERTEX ); //Select Vertex on All Shapes
584   
585   qApp->processEvents();
586   updateGeometry();
587   resize( minimumSizeHint() );
588
589   myEditCurrentArgument->setFocus();
590   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
591            this, SLOT( SelectionIntoArgument() ) );
592
593   SelectionIntoArgument();
594
595   displayPreview(true);
596 }
597
598 //=================================================================================
599 // function : ReverseSense()
600 // purpose  : Orientation of the arc
601 //=================================================================================
602 void BasicGUI_ArcDlg::ReverseSense()
603 {
604   displayPreview(true);
605 }
606
607 //=================================================================================
608 // function : addSubshapeToStudy
609 // purpose  : virtual method to add new SubObjects if local selection
610 //=================================================================================
611 void BasicGUI_ArcDlg::addSubshapesToStudy()
612 {
613   switch ( getConstructorId() ) {
614   case 0:
615   case 1:
616   case 2:
617     GEOMBase::PublishSubObject( myPoint1.get() );
618     GEOMBase::PublishSubObject( myPoint2.get() );
619     GEOMBase::PublishSubObject( myPoint3.get() );
620     break;
621   default:
622     break;
623   }
624 }
625
626 //=================================================================================
627 // function : getSourceObjects
628 // purpose  : virtual method to get source objects
629 //=================================================================================
630 QList<GEOM::GeomObjPtr> BasicGUI_ArcDlg::getSourceObjects()
631 {
632   QList<GEOM::GeomObjPtr> res;
633   res << myPoint1 << myPoint2 << myPoint3;
634   return res;
635 }