Salome HOME
0019050: EDF 521 (For GEOM/BasicGUI): Improve selection process in the dialogs
[modules/geom.git] / src / BasicGUI / BasicGUI_ArcDlg.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_ArcDlg.cxx
23 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
24 //
25
26 #include "BasicGUI_ArcDlg.h"
27
28 #include <DlgRef.h>
29 #include <GeometryGUI.h>
30 #include <GEOMBase.h>
31
32 #include <SUIT_ResourceMgr.h>
33 #include <SUIT_Session.h>
34 #include <SalomeApp_Application.h>
35 #include <LightApp_SelectionMgr.h>
36
37 #include <TColStd_IndexedMapOfInteger.hxx>
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
62   setWindowTitle( tr( "GEOM_ARC_TITLE" ) );
63
64   /***************************************************************/
65   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ARC" ) );
66   mainFrame()->RadioButton1->setIcon( image0 );
67   mainFrame()->RadioButton2->setIcon( image1 );
68   mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
69   mainFrame()->RadioButton3->close();
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   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
113   layout->setMargin( 0 ); layout->setSpacing( 6 );
114   layout->addWidget( Group3Pnts );
115   layout->addWidget( Group3Pnts2 );
116
117   setHelpFileName( "create_arc_page.html" );
118
119   Init();
120 }
121
122
123 //=================================================================================
124 // function : ~BasicGUI_ArcDlg()
125 // purpose  : Destroys the object and frees any allocated resources
126 //=================================================================================
127 BasicGUI_ArcDlg::~BasicGUI_ArcDlg()
128 {
129 }
130
131
132 //=================================================================================
133 // function : Init()
134 // purpose  :
135 //=================================================================================
136 void BasicGUI_ArcDlg::Init()
137 {
138   /* init variables */
139   myEditCurrentArgument = Group3Pnts->LineEdit1;
140
141   myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
142   Group3Pnts2->CheckButton1->setChecked( false );
143   Group3Pnts->PushButton1->setDown(true);
144
145   /* signals and slots connections */
146   connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
147   connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );
148  
149   connect( this,           SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
150  
151   connect( buttonOk(),     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
152   connect( buttonApply(),  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
153
154   connect( Group3Pnts->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
155   connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
156   connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
157
158   connect( Group3Pnts->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
159   connect( Group3Pnts->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
160   connect( Group3Pnts->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
161   
162   connect( Group3Pnts2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
163   connect( Group3Pnts2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
164   connect( Group3Pnts2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
165
166   connect( Group3Pnts2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
167   connect( Group3Pnts2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
168   connect( Group3Pnts2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
169   
170   connect( Group3Pnts2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseSense() ) );
171
172   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
173            this, SLOT( SelectionIntoArgument() ) );
174
175   initName( tr( "GEOM_ARC" ) ); 
176   
177
178   ConstructorsClicked( 0 );
179 }
180
181
182 //=================================================================================
183 // function : ClickOnOk()
184 // purpose  :
185 //=================================================================================
186 void BasicGUI_ArcDlg::ClickOnOk()
187 {
188   if ( ClickOnApply() )
189     ClickOnCancel();
190 }
191
192 //=================================================================================
193 // function : ClickOnApply()
194 // purpose  :
195 //=================================================================================
196 bool BasicGUI_ArcDlg::ClickOnApply()
197 {
198   if ( !onAccept() )
199     return false;
200
201   initName();
202   ConstructorsClicked( getConstructorId() );
203
204   return true;
205 }
206
207
208 //=================================================================================
209 // function : SelectionIntoArgument()
210 // purpose  : Called when selection as changed or other case
211 //=================================================================================
212 void BasicGUI_ArcDlg::SelectionIntoArgument()
213 {
214   if ( getConstructorId() != 0 && getConstructorId() != 1 )
215     return;
216   
217   myEditCurrentArgument->setText( "" );
218   if ( IObjectCount() != 1 ) {
219     switch ( getConstructorId() ) {
220     case 0:
221       if      ( myEditCurrentArgument == Group3Pnts->LineEdit1 )   myPoint1 = GEOM::GEOM_Object::_nil();
222       else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )   myPoint2 = GEOM::GEOM_Object::_nil();
223       else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )   myPoint3 = GEOM::GEOM_Object::_nil();
224       return;
225       break;
226     case 1:
227       if      ( myEditCurrentArgument == Group3Pnts2->LineEdit1 )   myPoint1 = GEOM::GEOM_Object::_nil();
228       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 )   myPoint2 = GEOM::GEOM_Object::_nil();
229       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 )   myPoint3 = GEOM::GEOM_Object::_nil();
230       return;
231       break;
232     }
233   }   
234   // nbSel == 1
235   Standard_Boolean aRes = Standard_False;
236   GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
237   if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
238     QString aName = GEOMBase::GetName(aSelectedObject);
239
240     // Get Selected object if selected subshape
241     TopoDS_Shape aShape;
242     if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
243     {
244       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
245       TColStd_IndexedMapOfInteger aMap;
246       aSelMgr->GetIndexes(firstIObject(), aMap);
247       if (aMap.Extent() == 1) // Local Selection
248       {
249         int anIndex = aMap(1);
250         aName += QString(":vertex_%1").arg(anIndex);
251
252         //Find SubShape Object in Father
253         GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
254
255         if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
256           GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
257           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
258         }
259         else
260           aSelectedObject = aFindedObject; // get Object from study
261       }
262       else // Global Selection
263       {
264         if (aShape.ShapeType() != TopAbs_VERTEX) {
265           aSelectedObject = GEOM::GEOM_Object::_nil();
266           aName = "";
267         }
268       }
269     }
270
271     myEditCurrentArgument->setText(aName);
272
273     if (!aSelectedObject->_is_nil()) { // clear selection if something selected
274       globalSelection();
275       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );      
276     }
277
278     switch ( getConstructorId() ) {
279     case 0:
280       if      ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) {
281         myPoint1 = aSelectedObject;
282         if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
283           Group3Pnts->PushButton2->click();
284       }
285       else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) {
286         myPoint2 = aSelectedObject;
287         if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
288           Group3Pnts->PushButton3->click();
289       }
290       else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) {
291         myPoint3 = aSelectedObject;
292         if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
293           Group3Pnts->PushButton1->click();
294       }
295       break;
296     case 1:
297       if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) {
298         myPoint1 = aSelectedObject;
299         if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
300           Group3Pnts2->PushButton2->click();
301       }
302       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) {
303         myPoint2 = aSelectedObject;
304         if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
305           Group3Pnts2->PushButton3->click();
306       }
307       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) {
308         myPoint3 = aSelectedObject;
309         if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
310           Group3Pnts2->PushButton1->click();
311       }
312       break;
313     }
314   }
315
316   displayPreview();
317 }
318
319
320 //=================================================================================
321 // function : SetEditCurrentArgument()
322 // purpose  :
323 //=================================================================================
324 void BasicGUI_ArcDlg::SetEditCurrentArgument()
325 {
326   globalSelection(); // close local selection to clear it
327   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
328
329   QPushButton* send = (QPushButton*)sender();
330   switch ( getConstructorId() ) {
331   case 0:
332     if      ( send == Group3Pnts->PushButton1 ) {
333       myEditCurrentArgument = Group3Pnts->LineEdit1;
334       Group3Pnts->PushButton2->setDown(false);
335       Group3Pnts->PushButton3->setDown(false);
336       Group3Pnts->LineEdit1->setEnabled(true);
337       Group3Pnts->LineEdit2->setEnabled(false);
338       Group3Pnts->LineEdit3->setEnabled(false);
339     }
340     else if ( send == Group3Pnts->PushButton2 ) {
341       myEditCurrentArgument = Group3Pnts->LineEdit2;
342       Group3Pnts->PushButton1->setDown(false);
343       Group3Pnts->PushButton3->setDown(false);
344       Group3Pnts->LineEdit1->setEnabled(false);
345       Group3Pnts->LineEdit2->setEnabled(true);
346       Group3Pnts->LineEdit3->setEnabled(false);
347     }
348     else if ( send == Group3Pnts->PushButton3 ) {
349       myEditCurrentArgument = Group3Pnts->LineEdit3;
350       Group3Pnts->PushButton1->setDown(false);
351       Group3Pnts->PushButton2->setDown(false);
352       Group3Pnts->LineEdit1->setEnabled(false);
353       Group3Pnts->LineEdit2->setEnabled(false);
354       Group3Pnts->LineEdit3->setEnabled(true);
355     }
356     break;
357   case 1:
358     if      ( send == Group3Pnts2->PushButton1 ) {
359       myEditCurrentArgument = Group3Pnts2->LineEdit1;
360       Group3Pnts2->PushButton2->setDown(false);
361       Group3Pnts2->PushButton3->setDown(false);
362       Group3Pnts2->LineEdit1->setEnabled(true);
363       Group3Pnts2->LineEdit2->setEnabled(false);
364       Group3Pnts2->LineEdit3->setEnabled(false);
365     }
366     else if ( send == Group3Pnts2->PushButton2 ) {
367       myEditCurrentArgument = Group3Pnts2->LineEdit2;
368       Group3Pnts2->PushButton1->setDown(false);
369       Group3Pnts2->PushButton3->setDown(false);
370       Group3Pnts2->LineEdit1->setEnabled(false);
371       Group3Pnts2->LineEdit2->setEnabled(true);
372       Group3Pnts2->LineEdit3->setEnabled(false);
373     }
374     else if ( send == Group3Pnts2->PushButton3 ) {
375       myEditCurrentArgument = Group3Pnts2->LineEdit3;
376       Group3Pnts2->PushButton1->setDown(false);
377       Group3Pnts2->PushButton2->setDown(false);
378       Group3Pnts2->LineEdit1->setEnabled(false);
379       Group3Pnts2->LineEdit2->setEnabled(false);
380       Group3Pnts2->LineEdit3->setEnabled(true);
381     }
382     break;
383   }
384   myEditCurrentArgument->setFocus();
385   //  SelectionIntoArgument();
386   send->setDown(true);
387   displayPreview();
388 }
389
390
391 //=================================================================================
392 // function : LineEditReturnPressed()
393 // purpose  :
394 //=================================================================================
395 void BasicGUI_ArcDlg::LineEditReturnPressed()
396 {
397   QLineEdit* send = (QLineEdit*)sender();
398   if ( send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 ||
399        send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ) {
400     myEditCurrentArgument = send;
401     GEOMBase_Skeleton::LineEditReturnPressed();
402   }
403 }
404
405
406 //=================================================================================
407 // function : ActivateThisDialog()
408 // purpose  :
409 //=================================================================================
410 void BasicGUI_ArcDlg::ActivateThisDialog()
411 {
412   GEOMBase_Skeleton::ActivateThisDialog();
413
414   connect( myGeomGUI->getApp()->selectionMgr(),
415            SIGNAL( currentSelectionChanged() ),
416            this,
417            SLOT(SelectionIntoArgument() ) );
418
419   ConstructorsClicked( getConstructorId() );
420 }
421
422 //=================================================================================
423 // function : enterEvent()
424 // purpose  :
425 //=================================================================================
426 void BasicGUI_ArcDlg::enterEvent( QEvent* )
427 {
428   if ( !mainFrame()->GroupConstructors->isEnabled() )
429     ActivateThisDialog();
430 }
431
432 //=================================================================================
433 // function : createOperation
434 // purpose  :
435 //=================================================================================
436 GEOM::GEOM_IOperations_ptr BasicGUI_ArcDlg::createOperation()
437 {
438   return myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() );
439 }
440
441 //=================================================================================
442 // function : isEqual
443 // purpose  : it may also be needed to check for min distance between gp_Pnt-s...
444 //=================================================================================
445 static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 )
446 {
447   return thePnt1->_is_equivalent( thePnt2 );
448 }
449
450 //=================================================================================
451 // function : isValid
452 // purpose  :
453 //=================================================================================
454 bool BasicGUI_ArcDlg::isValid( QString& msg )
455 {
456   switch (getConstructorId()) {
457   case 0:
458     {
459       if (Group3Pnts->LineEdit1->text().trimmed().isEmpty() ||
460           Group3Pnts->LineEdit2->text().trimmed().isEmpty() ||
461           Group3Pnts->LineEdit3->text().trimmed().isEmpty())
462         return false;
463       break;
464     }
465   case 1:
466     {
467       if (Group3Pnts2->LineEdit1->text().trimmed().isEmpty() ||
468           Group3Pnts2->LineEdit2->text().trimmed().isEmpty() ||
469           Group3Pnts2->LineEdit3->text().trimmed().isEmpty())
470         return false;
471       break;
472     }
473   }
474   return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
475     !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
476 }
477
478 //=================================================================================
479 // function : execute
480 // purpose  :
481 //=================================================================================
482 bool BasicGUI_ArcDlg::execute( ObjectList& objects )
483 {
484   bool res = false;
485   GEOM::GEOM_Object_var anObj;
486
487   switch ( getConstructorId() ) {
488   case 0:
489     {
490       if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) {
491         anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeArc( myPoint1, myPoint2, myPoint3 );
492         res = true;
493       }
494       break;
495     }
496   case 1:
497     {
498       bool Sense = Group3Pnts2->CheckButton1->isChecked();
499       if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) {
500         anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeArcCenter( myPoint1, myPoint2, myPoint3, Sense );
501         res = true;
502       }
503       break;
504     }
505   }
506   if ( !anObj->_is_nil() ) {
507     objects.push_back( anObj._retn() );
508   }
509   return res;
510 }
511
512 //=================================================================================
513 // function : ConstructorsClicked()
514 // purpose  : Radio button management
515 //=================================================================================
516 void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
517 {
518   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
519
520   switch ( constructorId ) {
521   case 0:
522     {
523       globalSelection(); // close local contexts, if any
524       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
525
526       Group3Pnts2->hide();
527       Group3Pnts->show();
528       Group3Pnts->PushButton1->setDown(true);
529       Group3Pnts->PushButton2->setDown(false);
530       Group3Pnts->PushButton3->setDown(false);
531       Group3Pnts->LineEdit1->setText( "" );
532       Group3Pnts->LineEdit2->setText( "" );
533       Group3Pnts->LineEdit3->setText( "" );
534       Group3Pnts->LineEdit1->setEnabled(true);
535       Group3Pnts->LineEdit2->setEnabled(false);
536       Group3Pnts->LineEdit3->setEnabled(false);
537       myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
538
539       myEditCurrentArgument = Group3Pnts->LineEdit1;
540       break;
541     }
542   case 1:
543     {
544       globalSelection(); // close local contexts, if any
545       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
546
547       Group3Pnts->hide();
548       Group3Pnts2->show();
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       myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
559       
560       myEditCurrentArgument = Group3Pnts2->LineEdit1;
561       break;
562     }
563   }
564
565   qApp->processEvents();
566   updateGeometry();
567   resize( minimumSize() );
568
569   myEditCurrentArgument->setFocus();
570   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
571            this, SLOT( SelectionIntoArgument() ) );
572
573   if ( CORBA::is_nil( myPoint1 ) )
574     SelectionIntoArgument();
575
576   displayPreview();
577 }
578
579 //=================================================================================
580 // function : ReverseSense()
581 // purpose  : Orientation of the arc
582 //=================================================================================
583 void BasicGUI_ArcDlg::ReverseSense()
584 {
585   displayPreview();
586 }
587
588 //=================================================================================
589 // function : addSubshapeToStudy
590 // purpose  : virtual method to add new SubObjects if local selection
591 //=================================================================================
592 void BasicGUI_ArcDlg::addSubshapesToStudy()
593 {
594   QMap<QString, GEOM::GEOM_Object_var> objMap;
595
596   switch ( getConstructorId() ) {
597   case 0:
598     objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
599     objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
600     objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
601     break;
602   case 1:
603     objMap[Group3Pnts2->LineEdit1->text()] = myPoint1;
604     objMap[Group3Pnts2->LineEdit2->text()] = myPoint2;
605     objMap[Group3Pnts2->LineEdit3->text()] = myPoint3;
606     break;
607   }
608   addSubshapesToFather( objMap );
609 }