Salome HOME
RNC: EDF 1542: Take into account orientation in newly created MakeVertexOnCurveByLeng...
[modules/geom.git] / src / BasicGUI / BasicGUI_PointDlg.cxx
1 //  Copyright (C) 2007-2010  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
23 //  GEOM GEOMGUI : GUI for Geometry component
24 //  File   : BasicGUI_PointDlg.cxx
25 //  Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
26 //
27 #include "BasicGUI_PointDlg.h"
28
29 #include <SUIT_ResourceMgr.h>
30 #include <SUIT_Session.h>
31 #include <SalomeApp_Application.h>
32 #include <LightApp_SelectionMgr.h>
33
34 #include <GeometryGUI.h>
35 #include <GEOMBase.h>
36
37 #include <DlgRef.h>
38
39 #include <GEOMImpl_Types.hxx>
40
41 #include <QApplication>
42 #include <QButtonGroup>
43 #include <QHBoxLayout>
44 #include <QLabel>
45 #include <QRadioButton>
46 #include <QMenu>
47 #include <QTimer>
48
49 #include <gp_Pnt.hxx>
50 #include <TopoDS_Shape.hxx>
51 #include <TopAbs_ShapeEnum.hxx>
52 #include <TopoDS.hxx>
53 #include <BRep_Tool.hxx>
54 #include <TopExp.hxx>
55 #include <TColStd_IndexedMapOfInteger.hxx>
56 #include <TopTools_IndexedMapOfShape.hxx>
57
58 #define PARAM_VALUE 0
59 #define COORD_VALUE 1
60 #define LENGTH_VALUE 2
61
62 #define GEOM_POINT_XYZ    0
63 #define GEOM_POINT_REF    1
64 #define GEOM_POINT_EDGE   2
65 #define GEOM_POINT_INTINT 3
66 #define GEOM_POINT_SURF   4
67
68 #define SPACING 6
69 #define MARGIN  9
70
71 //=================================================================================
72 // class    : BasicGUI_PointDlg()
73 // purpose  : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the
74 //            name 'name' and widget flags set to 'f'.
75 //            The dialog will by default be modeless, unless you set 'modal' to
76 //            TRUE to construct a modal dialog.
77 //=================================================================================
78 BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
79                                       bool modal, Qt::WindowFlags fl )
80   : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ),
81     myBusy ( false )
82 {
83   QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT") ) );
84   QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_EDGE" ) ) );
85   QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
86   QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_REF" ) ) );
87   QPixmap image4( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_LINES") ) );
88   QPixmap image5( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_FACE" ) ) );
89   QPixmap image6( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICO_LINE" ) ) );
90   QPixmap image7( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICO_WIRE" ) ) );
91
92   setWindowTitle( tr( "GEOM_POINT_TITLE" ) );
93
94   /***************************************************************/
95   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_POINTS" ) );
96   mainFrame()->RadioButton1->setIcon( image0 );
97   mainFrame()->RadioButton2->setIcon( image3 );
98   mainFrame()->RadioButton3->setIcon( image1 );
99   mainFrame()->RadioButton4->show();
100   mainFrame()->RadioButton4->setIcon( image4 );
101   mainFrame()->RadioButton5->show();
102   mainFrame()->RadioButton5->setIcon( image5 );
103
104   myParamGroup = new QGroupBox( centralWidget() );
105   myParamCoord = new QButtonGroup( myParamGroup );
106   QHBoxLayout* boxLayout = new QHBoxLayout( myParamGroup );
107   boxLayout->setMargin( MARGIN ); boxLayout->setSpacing( SPACING );
108   QRadioButton* btn = new QRadioButton( tr( "GEOM_PARAM_VALUE" ), myParamGroup );
109   myParamCoord->addButton( btn, PARAM_VALUE );
110   boxLayout->addWidget( btn );
111   btn = new QRadioButton( tr( "GEOM_LENGTH_VALUE" ), myParamGroup ); 
112   myParamCoord->addButton( btn, LENGTH_VALUE );
113   boxLayout->addWidget( btn );
114   btn = new QRadioButton( tr( "GEOM_COORD_VALUE" ), myParamGroup );
115   myParamCoord->addButton( btn, COORD_VALUE );
116   boxLayout->addWidget( btn );
117   myParamCoord->setExclusive( true );
118   myParamCoord->button( PARAM_VALUE )->setChecked( true );
119
120   GroupXYZ = new DlgRef_3Spin( centralWidget() );
121   GroupXYZ->GroupBox1->setTitle( tr( "GEOM_COORDINATES" ) );
122   GroupXYZ->TextLabel1->setText( tr( "GEOM_X" ) );
123   GroupXYZ->TextLabel2->setText( tr( "GEOM_Y" ) );
124   GroupXYZ->TextLabel3->setText( tr( "GEOM_Z" ) );
125
126   GroupOnCurve = new DlgRef_1Sel1Spin1Check( centralWidget() );
127   GroupOnCurve->GroupBox1->setTitle( tr( "GEOM_POINT_ON_EDGE" ) );
128   GroupOnCurve->TextLabel1->setText( tr( "GEOM_EDGE" ) );
129   GroupOnCurve->TextLabel2->setText( tr( "GEOM_PARAMETER" ) );
130   GroupOnCurve->CheckButton1->setText( tr( "GEOM_REVERSE" ) );
131   GroupOnCurve->PushButton1->setIcon( image2 );
132   
133
134   GroupOnSurface = new DlgRef_1Sel2Spin( centralWidget() );
135   GroupOnSurface->GroupBox1->setTitle( tr( "GEOM_POINT_ON_FACE" ) );
136   GroupOnSurface->TextLabel1->setText( tr( "GEOM_FACE" ) );
137   GroupOnSurface->TextLabel2->setText( tr( "GEOM_UPARAMETER" ) );
138   GroupOnSurface->TextLabel3->setText( tr( "GEOM_VPARAMETER" ) );
139   GroupOnSurface->PushButton1->setIcon( image2 );
140
141   GroupRefPoint = new DlgRef_1Sel3Spin( centralWidget() );
142   GroupRefPoint->GroupBox1->setTitle( tr( "GEOM_REF_POINT" ) );
143   GroupRefPoint->TextLabel1->setText( tr( "GEOM_POINT" ) );
144   GroupRefPoint->PushButton1->setIcon( image2 );
145   GroupRefPoint->TextLabel2->setText( tr( "GEOM_DX" ) );
146   GroupRefPoint->TextLabel3->setText( tr( "GEOM_DY" ) );
147   GroupRefPoint->TextLabel4->setText( tr( "GEOM_DZ" ) );
148
149   /* popup menu for line intersect buttons */
150   myBtnPopup = new QMenu(this);
151   QIcon ico_line = QIcon( image6 );
152   QIcon ico_wire = QIcon( image7 );
153   myActions[myBtnPopup->addAction( ico_line, tr( "GEOM_EDGE" ) )] = 0;
154   myActions[myBtnPopup->addAction( ico_wire, tr( "GEOM_WIRE" ) )] = 1;
155
156   GroupLineIntersection = new DlgRef_2Sel( centralWidget() );
157   GroupLineIntersection->GroupBox1->setTitle( tr( "GEOM_LINE_INTERSECTION" ) );
158   GroupLineIntersection->TextLabel1->setText( tr( "GEOM_LINE1" ) );
159   GroupLineIntersection->TextLabel2->setText( tr( "GEOM_LINE2" ) );
160   GroupLineIntersection->PushButton1->setIcon( image2 );
161   GroupLineIntersection->PushButton1->setMenu( myBtnPopup );
162   GroupLineIntersection->PushButton2->setIcon( image2 );
163   GroupLineIntersection->PushButton2->setMenu( myBtnPopup );
164   GroupLineIntersection->LineEdit2->setEnabled(false);
165
166   myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES_RES" ), centralWidget() );
167   QGridLayout* myCoordGrpLayout = new QGridLayout( myCoordGrp );
168   myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), myCoordGrp ), 0, 0 );
169   myX = new QLineEdit( myCoordGrp );
170   myCoordGrpLayout->addWidget( myX, 0, 1 );
171   myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_Y" ), myCoordGrp ), 1, 0 );
172   myY = new QLineEdit( myCoordGrp );
173   myCoordGrpLayout->addWidget( myY, 1, 1 );
174   myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_Z" ), myCoordGrp ), 2, 0 );
175   myZ = new QLineEdit( myCoordGrp );
176   myCoordGrpLayout->addWidget( myZ, 2, 1 );
177
178   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
179   layout->setMargin( 0 ); layout->setSpacing( 6 );
180   layout->addWidget( myParamGroup );
181   layout->addWidget( GroupXYZ );
182   layout->addWidget( GroupOnCurve );
183   layout->addWidget( GroupOnSurface );
184   layout->addWidget( GroupRefPoint );
185   layout->addWidget( GroupLineIntersection );
186   layout->addWidget( myCoordGrp );
187
188   myX->setReadOnly( true );
189   myY->setReadOnly( true );
190   myZ->setReadOnly( true );
191
192   myX->setEnabled( false );
193   myY->setEnabled( false );
194   myZ->setEnabled( false );
195
196   QPalette aPal = myX->palette();
197   aPal.setColor( QPalette::Disabled, QPalette::Text, QColor( 0, 0, 0 ) );
198   myX->setPalette( aPal );
199   myY->setPalette( aPal );
200   myZ->setPalette( aPal );
201
202   setHelpFileName( "create_point_page.html" );
203
204   Init();
205 }
206
207
208 //=================================================================================
209 // function : ~BasicGUI_PointDlg()
210 // purpose  : Destructor
211 //=================================================================================
212 BasicGUI_PointDlg::~BasicGUI_PointDlg()
213 {
214 }
215
216
217 //=================================================================================
218 // function : Init()
219 // purpose  :
220 //=================================================================================
221 void BasicGUI_PointDlg::Init()
222 {
223   GroupOnCurve->LineEdit1->setReadOnly( true );
224   GroupOnSurface->LineEdit1->setReadOnly( true );
225   GroupRefPoint->LineEdit1->setReadOnly( true );
226   GroupLineIntersection->LineEdit1->setReadOnly( true );
227   GroupLineIntersection->LineEdit2->setReadOnly( true );
228   GroupLineIntersection->LineEdit1->setEnabled( true );
229   GroupLineIntersection->LineEdit2->setEnabled( false );
230
231   myEdge = GEOM::GEOM_Object::_nil();
232   myRefPoint = GEOM::GEOM_Object::_nil();
233   myNeedType = TopAbs_VERTEX;
234
235   myEditCurrentArgument = 0;
236   myCheckFlag = 0;
237
238   /* Get setting of step value from file configuration */
239   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
240   double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
241
242   /* min, max, step and decimals for spin boxes */
243   initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
244   initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
245   initSpinBox( GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
246   GroupXYZ->SpinBox_DX->setValue( 0.0 );
247   GroupXYZ->SpinBox_DY->setValue( 0.0 );
248   GroupXYZ->SpinBox_DZ->setValue( 0.0 );
249
250   initSpinBox( GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
251   initSpinBox( GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
252   initSpinBox( GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
253   GroupRefPoint->SpinBox_DX->setValue( 0.0 );
254   GroupRefPoint->SpinBox_DY->setValue( 0.0 );
255   GroupRefPoint->SpinBox_DZ->setValue( 0.0 );
256
257   step = 0.1;
258
259   initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision" );
260   GroupOnCurve->SpinBox_DX->setValue( 0.5 );
261
262   initSpinBox( GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision" );
263   GroupOnSurface->SpinBox_DX->setValue( 0.5 );
264   initSpinBox( GroupOnSurface->SpinBox_DY, 0., 1., step, "parametric_precision" );
265   GroupOnSurface->SpinBox_DY->setValue( 0.5 );
266
267   /* signals and slots connections */
268   connect( myGeomGUI,      SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
269   connect( myGeomGUI,      SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );
270
271   connect( buttonOk(),     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
272   connect( buttonApply(),  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
273
274   connect( this,           SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
275
276   connect( myParamCoord,   SIGNAL( buttonClicked( int ) ), this, SLOT( ClickParamCoord( int ) ) );
277   connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
278   connect( GroupOnCurve->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
279
280   connect( GroupOnSurface->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
281   connect( GroupOnSurface->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
282
283   connect( myBtnPopup, SIGNAL( triggered( QAction* ) ), SLOT( onBtnPopup( QAction* ) ) );
284   connect( GroupLineIntersection->PushButton1, SIGNAL( pressed() ),       this, SLOT( SetEditCurrentArgument() ) );
285   connect( GroupLineIntersection->PushButton2, SIGNAL( pressed() ),       this, SLOT( SetEditCurrentArgument() ) );
286   connect( GroupLineIntersection->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
287   connect( GroupLineIntersection->LineEdit2,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
288
289   connect( GroupOnCurve->SpinBox_DX,   SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
290   connect( GroupOnSurface->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
291   connect( GroupOnSurface->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
292   connect( GroupXYZ->SpinBox_DX,       SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
293   connect( GroupXYZ->SpinBox_DY,       SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
294   connect( GroupXYZ->SpinBox_DZ,       SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
295   connect( GroupRefPoint->SpinBox_DX,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
296   connect( GroupRefPoint->SpinBox_DY,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
297   connect( GroupRefPoint->SpinBox_DZ,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
298
299   connect( GroupOnCurve->CheckButton1, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) );
300
301   connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this,  SLOT( SetDoubleSpinBoxStep( double ) ) );
302
303   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
304            this,  SLOT(SelectionIntoArgument() ) );
305
306   initName( tr( "GEOM_VERTEX" ) );
307
308   ConstructorsClicked( 0 );
309 }
310
311 //=================================================================================
312 // function : SetDoubleSpinBoxStep()
313 // purpose  : Double spin box management
314 //=================================================================================
315 void BasicGUI_PointDlg::SetDoubleSpinBoxStep( double step )
316 {
317   GroupOnCurve->SpinBox_DX->setSingleStep(step);
318   GroupXYZ->SpinBox_DX->setSingleStep(step);
319   GroupXYZ->SpinBox_DY->setSingleStep(step);
320   GroupXYZ->SpinBox_DZ->setSingleStep(step);
321   GroupRefPoint->SpinBox_DX->setSingleStep(step);
322   GroupRefPoint->SpinBox_DY->setSingleStep(step);
323   GroupRefPoint->SpinBox_DZ->setSingleStep(step);
324 }
325
326
327 //=================================================================================
328 // function : ConstructorsClicked()
329 // purpose  : Radio button management
330 //=================================================================================
331 void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
332 {
333   switch ( constructorId ) {
334   case GEOM_POINT_XYZ:
335     {
336       globalSelection(); // close local contexts, if any
337       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
338
339       GroupRefPoint->hide();
340       GroupOnCurve->hide();
341       GroupLineIntersection->hide();
342       GroupOnSurface->hide();
343       myCoordGrp->hide();
344       myParamGroup->hide();
345       GroupXYZ->show();
346       break;
347     }
348   case GEOM_POINT_REF:
349     {
350       globalSelection(); // close local contexts, if any
351       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
352
353       myEditCurrentArgument = GroupRefPoint->LineEdit1;
354       myEditCurrentArgument->setText( "" );
355       myRefPoint = GEOM::GEOM_Object::_nil();
356       GroupRefPoint->PushButton1->setDown(true);
357       myParamGroup->hide();
358       GroupXYZ->hide();
359       GroupOnCurve->hide();
360       GroupLineIntersection->hide();
361       GroupOnSurface->hide();
362       GroupRefPoint->show();
363       myCoordGrp->show();
364       break;
365     }
366   case GEOM_POINT_EDGE:
367     {
368       globalSelection(); // close local contexts, if any
369       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
370
371       myEditCurrentArgument = GroupOnCurve->LineEdit1;
372       myEditCurrentArgument->setText( "" );
373       myEdge = GEOM::GEOM_Object::_nil();
374       GroupOnCurve->PushButton1->setDown(true);
375       GroupRefPoint->hide();
376       GroupLineIntersection->hide();
377       GroupOnSurface->hide();
378       myParamGroup->show();
379       myParamCoord->button( LENGTH_VALUE )->show();
380       myParamCoord->button( PARAM_VALUE )->setChecked( true );
381       GroupOnCurve->show();
382       myCoordGrp->show();
383       updateParamCoord( false );
384       break;
385     }
386   case GEOM_POINT_INTINT:
387     {
388       globalSelection(); // close local contexts, if any
389       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
390       myNeedType = TopAbs_EDGE;
391
392       myEditCurrentArgument = GroupLineIntersection->LineEdit1;
393       GroupLineIntersection->LineEdit1->setText( "" );
394       GroupLineIntersection->LineEdit2->setText( "" );
395       GroupLineIntersection->LineEdit1->setEnabled( true );
396       GroupLineIntersection->LineEdit2->setEnabled( false );
397       myLine1 = GEOM::GEOM_Object::_nil();
398       myLine2 = GEOM::GEOM_Object::_nil();
399       GroupLineIntersection->PushButton1->setDown(true);
400       GroupLineIntersection->PushButton2->setDown(false);
401       myParamGroup->hide();
402       GroupXYZ->hide();
403       GroupRefPoint->hide();
404       GroupOnCurve->hide();
405       GroupOnSurface->hide();
406       myCoordGrp->hide();
407       GroupLineIntersection->show();
408       break;
409     }
410   case GEOM_POINT_SURF:
411     {
412       globalSelection(); // close local contexts, if any
413       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
414
415       myEditCurrentArgument = GroupOnSurface->LineEdit1;
416       myEditCurrentArgument->setText( "" );
417       myFace = GEOM::GEOM_Object::_nil();
418       GroupOnSurface->PushButton1->setDown(true);
419       GroupRefPoint->hide();
420       GroupOnCurve->hide();
421       GroupLineIntersection->hide();
422       myParamGroup->show();
423       myParamCoord->button( LENGTH_VALUE )->hide();
424       myParamCoord->button( PARAM_VALUE )->setChecked(true);
425       GroupOnSurface->show();
426       myCoordGrp->show();
427       updateParamCoord( false );
428       break;
429     }
430   }
431
432   myX->setText( "" );
433   myY->setText( "" );
434   myZ->setText( "" );
435
436   QTimer::singleShot(50, this, SLOT(updateSize()));
437
438   SelectionIntoArgument();
439 }
440
441
442 //=================================================================================
443 // function : ClickOnOk()
444 // purpose  :
445 //=================================================================================
446 void BasicGUI_PointDlg::ClickOnOk()
447 {
448   if ( onAccept() )
449     ClickOnCancel();
450 }
451
452
453 //=================================================================================
454 // function : ClickOnApply()
455 // purpose  :
456 //=================================================================================
457 bool BasicGUI_PointDlg::ClickOnApply()
458 {
459   if ( !onAccept() )
460     return false;
461
462   initName();
463   ConstructorsClicked( getConstructorId() );
464   return true;
465 }
466
467
468 //=================================================================================
469 // function : SelectionIntoArgument()
470 // purpose  : Called when selection as changed (for constructors not using local context)
471 //=================================================================================
472 void BasicGUI_PointDlg::SelectionIntoArgument()
473 {
474   erasePreview();
475   const int id = getConstructorId();
476
477   if ( ( id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF ) && myEditCurrentArgument != 0 )
478   {
479     myEditCurrentArgument->setText( "" );
480     myX->setText( "" );
481     myY->setText( "" );
482     myZ->setText( "" );
483     myRefPoint = myEdge = myFace = GEOM::GEOM_Object::_nil();
484   } else if ( id == GEOM_POINT_INTINT ) {
485     myEditCurrentArgument->setText( "" );
486     if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 )
487       myLine1 = GEOM::GEOM_Object::_nil();
488     else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 )
489       myLine2 = GEOM::GEOM_Object::_nil();
490   }
491
492   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
493   SALOME_ListIO aSelList;
494   aSelMgr->selectedObjects(aSelList);
495
496   if (aSelList.Extent() == 1) {
497     Handle(SALOME_InteractiveObject) anIO = aSelList.First();
498     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
499     if ( !CORBA::is_nil( aSelectedObject ) ) {
500       QString aName = GEOMBase::GetName(aSelectedObject);
501       TopoDS_Shape aShape;
502       if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
503         if ( id == GEOM_POINT_XYZ || id == GEOM_POINT_REF)
504           myNeedType = TopAbs_VERTEX;
505         else if ( id == GEOM_POINT_EDGE )
506           myNeedType = TopAbs_EDGE;
507         else if ( id == GEOM_POINT_SURF )
508           myNeedType = TopAbs_FACE;
509
510         TColStd_IndexedMapOfInteger aMap;
511         aSelMgr->GetIndexes(anIO, aMap);
512         if ( aMap.Extent() == 1 ) { // Local Selection
513           int anIndex = aMap( 1 );
514           if ( myNeedType == TopAbs_FACE )
515             aName += QString( ":face_%1" ).arg( anIndex );
516           else if ( myNeedType == TopAbs_WIRE )
517             aName += QString( ":wire_%1" ).arg( anIndex );
518           else if ( myNeedType == TopAbs_EDGE )
519             aName += QString( ":edge_%1" ).arg( anIndex );
520           else  if ( myNeedType == TopAbs_VERTEX )
521             aName += QString( ":vertex_%1" ).arg( anIndex );
522
523           //Find SubShape Object in Father
524           GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
525           if ( aFindedObject->_is_nil() ) { // Object not found in study
526             GEOM::GEOM_IShapesOperations_var aShapesOp =
527               getGeomEngine()->GetIShapesOperations(getStudyId());
528             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
529           }
530           else {
531             aSelectedObject = aFindedObject; // get Object from study
532           }
533           GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE );
534         }
535         else { // Global Selection
536           if ( aShape.ShapeType() != myNeedType ) {
537             aSelectedObject = GEOM::GEOM_Object::_nil();
538             aName = "";
539             if ( id == GEOM_POINT_XYZ ) return;
540           }
541         }
542       }
543
544       if ( aShape.IsNull() || aShape.ShapeType() != myNeedType)
545         return;
546
547       myBusy = true;
548
549       if ( id == GEOM_POINT_XYZ ) {
550         gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
551         GroupXYZ->SpinBox_DX->setValue( aPnt.X() );
552         GroupXYZ->SpinBox_DY->setValue( aPnt.Y() );
553         GroupXYZ->SpinBox_DZ->setValue( aPnt.Z() );
554       }
555       else if ( id == GEOM_POINT_REF ) {
556         myRefPoint = aSelectedObject;
557         GroupRefPoint->LineEdit1->setText( aName );
558       }
559       else if ( id == GEOM_POINT_EDGE ) {
560         myEdge = aSelectedObject;
561         GroupOnCurve->LineEdit1->setText( aName );
562       }
563       else if ( id == GEOM_POINT_INTINT ) {
564         myEditCurrentArgument->setText( aName );
565         if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) {
566           myLine1 = aSelectedObject;
567           if ( !myLine1->_is_nil() && myLine2->_is_nil() ) {
568             GroupLineIntersection->PushButton2->setMenu( 0 );
569             GroupLineIntersection->PushButton2->click();
570             GroupLineIntersection->PushButton2->setDown(true);
571             GroupLineIntersection->PushButton2->setMenu( myBtnPopup );
572           }
573         }
574         else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) {
575           myLine2 = aSelectedObject;
576           if ( !myLine2->_is_nil() && myLine1->_is_nil() ) {
577             GroupLineIntersection->PushButton1->setMenu( 0 );
578             GroupLineIntersection->PushButton1->click();
579             GroupLineIntersection->PushButton1->setDown(true);
580             GroupLineIntersection->PushButton1->setMenu( myBtnPopup );
581           }
582         }
583       }
584       else if ( id == GEOM_POINT_SURF )
585       {
586         myFace = aSelectedObject;
587         GroupOnSurface->LineEdit1->setText( aName );
588       }
589       myBusy = false;
590     }
591   }
592
593   displayPreview();
594 }
595
596
597 //=================================================================================
598 // function : LineEditReturnPressed()
599 // purpose  :
600 //=================================================================================
601 void BasicGUI_PointDlg::LineEditReturnPressed()
602 {
603   QLineEdit* send = (QLineEdit*)sender();
604   if ( send == GroupRefPoint->LineEdit1         ||
605        send == GroupOnCurve->LineEdit1          ||
606        send == GroupLineIntersection->LineEdit1 ||
607        send == GroupLineIntersection->LineEdit2  ) {
608     myEditCurrentArgument = send;
609     GEOMBase_Skeleton::LineEditReturnPressed();
610   }
611 }
612
613
614 //=================================================================================
615 // function : SetEditCurrentArgument()
616 // purpose  :
617 //=================================================================================
618 void BasicGUI_PointDlg::SetEditCurrentArgument()
619 {
620   QPushButton* send = (QPushButton*)sender();
621
622   if ( send == GroupRefPoint->PushButton1 ) {
623     GroupRefPoint->LineEdit1->setFocus();
624     myEditCurrentArgument = GroupRefPoint->LineEdit1;
625     globalSelection(); // close local contexts, if any
626     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
627   }
628   else if ( send == GroupOnCurve->PushButton1 ) {
629     GroupOnCurve->LineEdit1->setFocus();
630     myEditCurrentArgument = GroupOnCurve->LineEdit1;
631     globalSelection(); // close local contexts, if any
632     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
633   }
634   else if ( send == GroupOnSurface->PushButton1 )
635   {
636     GroupOnSurface->LineEdit1->setFocus();
637     myEditCurrentArgument = GroupOnSurface->LineEdit1;
638     globalSelection(); // close local contexts, if any
639     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
640   }
641   else if ( send == GroupLineIntersection->PushButton1 ) {
642     GroupLineIntersection->LineEdit1->setFocus();
643     myEditCurrentArgument = GroupLineIntersection->LineEdit1;
644     GroupLineIntersection->PushButton2->setDown( false );
645     GroupLineIntersection->LineEdit1->setEnabled(true);
646     GroupLineIntersection->LineEdit2->setEnabled(false);
647   }
648   else if ( send == GroupLineIntersection->PushButton2 ) {
649     GroupLineIntersection->LineEdit2->setFocus();
650     myEditCurrentArgument = GroupLineIntersection->LineEdit2;
651     GroupLineIntersection->PushButton1->setDown( false );
652     GroupLineIntersection->LineEdit1->setEnabled(false);
653     GroupLineIntersection->LineEdit2->setEnabled(true);
654   }
655   send->setDown(true);
656
657   if ( ( send == GroupLineIntersection->PushButton1 ||
658          send == GroupLineIntersection->PushButton2 ) && !myBusy )
659     SelectionIntoArgument();
660 }
661
662
663 //=================================================================================
664 // function : enterEvent()
665 // purpose  : to reactivate this dialog box when mouse enter onto the window
666 //=================================================================================
667 void BasicGUI_PointDlg::enterEvent( QEvent* )
668 {
669   if ( !mainFrame()->GroupConstructors->isEnabled() )
670     ActivateThisDialog();
671 }
672
673
674 //=================================================================================
675 // function : ActivateThisDialog()
676 // purpose  :
677 //=================================================================================
678 void BasicGUI_PointDlg::ActivateThisDialog( )
679 {
680   GEOMBase_Skeleton::ActivateThisDialog();
681
682   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
683            this, SLOT( SelectionIntoArgument() ) );
684
685   ConstructorsClicked( getConstructorId() );
686 }
687
688
689 //=================================================================================
690 // function : DeactivateActiveDialog()
691 // purpose  : public slot to deactivate if active
692 //=================================================================================
693 void BasicGUI_PointDlg::DeactivateActiveDialog()
694 {
695   // myGeomGUI->SetState( -1 );
696   GEOMBase_Skeleton::DeactivateActiveDialog();
697 }
698
699
700 //=================================================================================
701 // function : ValueChangedInSpinBox()
702 // purpose  :
703 //=================================================================================
704 void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue)
705 {
706   displayPreview();
707 }
708
709 //=================================================================================
710 // function : CheckBoxClicked()
711 // purpose  : Check Boxes Management
712 //=================================================================================
713 void BasicGUI_PointDlg::CheckBoxClicked( int  State ) 
714 {
715   myCheckFlag = State;
716   displayPreview();
717 }
718
719
720 //=================================================================================
721 // funcion  : getParameter()
722 // purpose  :
723 //=================================================================================
724 double BasicGUI_PointDlg::getParameter() const
725 {
726   return GroupOnCurve->SpinBox_DX->value();
727 }
728
729
730 //=================================================================================
731 // funcion  : getUParameter()
732 // purpose  :
733 //=================================================================================
734 double BasicGUI_PointDlg::getUParameter() const
735 {
736   return GroupOnSurface->SpinBox_DX->value();
737 }
738
739
740 //=================================================================================
741 // funcion  : getVParameter()
742 // purpose  :
743 //=================================================================================
744 double BasicGUI_PointDlg::getVParameter() const
745 {
746   return GroupOnSurface->SpinBox_DY->value();
747 }
748
749
750 //=================================================================================
751 // function : OnPointSelected
752 // purpose  :
753 //=================================================================================
754 void BasicGUI_PointDlg::OnPointSelected( const gp_Pnt& thePnt )
755 {
756   if ( getConstructorId() == GEOM_POINT_XYZ ) {
757     GroupXYZ->SpinBox_DX->setValue( thePnt.X() );
758     GroupXYZ->SpinBox_DY->setValue( thePnt.Y() );
759     GroupXYZ->SpinBox_DZ->setValue( thePnt.Z() );
760
761     displayPreview();
762   }
763 }
764
765 //=================================================================================
766 // function : createOperation
767 // purpose  :
768 //=================================================================================
769 GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation()
770 {
771   return myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() );
772 }
773
774 //=================================================================================
775 // function : isValid
776 // purpose  :
777 //=================================================================================
778 bool BasicGUI_PointDlg::isValid( QString& msg )
779 {
780   const int id = getConstructorId();
781   if ( id == GEOM_POINT_XYZ ) {
782     bool ok = true;
783     ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
784     ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
785     ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
786     return ok;
787   }
788   else if ( id == GEOM_POINT_REF ) {
789     bool ok = true;
790     ok = GroupRefPoint->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
791     ok = GroupRefPoint->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
792     ok = GroupRefPoint->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
793
794     return !myRefPoint->_is_nil() && ok;
795   }
796   else if ( id == GEOM_POINT_EDGE ) {
797     bool ok = true;
798     if ( myParamCoord->checkedId() == PARAM_VALUE || myParamCoord->checkedId() == LENGTH_VALUE )
799       ok = GroupOnCurve->SpinBox_DX->isValid( msg, !IsPreview() );
800     else {
801       ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
802       ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
803       ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
804     }
805     return !myEdge->_is_nil() && ok;
806   }
807   else if ( id == GEOM_POINT_INTINT )
808     return ( !myLine1->_is_nil() && !myLine2->_is_nil() );
809   else if ( id == GEOM_POINT_SURF ) {
810     bool ok = true;
811     if ( myParamCoord->checkedId() == PARAM_VALUE ) {
812       ok = GroupOnSurface->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
813       ok = GroupOnSurface->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
814     }
815     else {
816       ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
817       ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
818       ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
819     }
820     return !myFace->_is_nil() && ok;
821   }
822   return false;
823 }
824
825 //=================================================================================
826 // function : execute
827 // purpose  :
828 //=================================================================================
829 bool BasicGUI_PointDlg::execute( ObjectList& objects )
830 {
831   bool res = false;
832
833   GEOM::GEOM_Object_var anObj;
834   QStringList aParameters;
835
836   GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() );
837
838   switch ( getConstructorId() ) {
839   case GEOM_POINT_XYZ :
840     {
841       double x = GroupXYZ->SpinBox_DX->value();
842       double y = GroupXYZ->SpinBox_DY->value();
843       double z = GroupXYZ->SpinBox_DZ->value();
844
845       aParameters << GroupXYZ->SpinBox_DX->text();
846       aParameters << GroupXYZ->SpinBox_DY->text();
847       aParameters << GroupXYZ->SpinBox_DZ->text();
848
849       anObj = anOper->MakePointXYZ( x, y, z );
850       res = true;
851       break;
852     }
853   case GEOM_POINT_REF :
854     {
855       double dx = GroupRefPoint->SpinBox_DX->value();
856       double dy = GroupRefPoint->SpinBox_DY->value();
857       double dz = GroupRefPoint->SpinBox_DZ->value();
858
859       aParameters << GroupRefPoint->SpinBox_DX->text();
860       aParameters << GroupRefPoint->SpinBox_DY->text();
861       aParameters << GroupRefPoint->SpinBox_DZ->text();
862
863       anObj = anOper->MakePointWithReference( myRefPoint, dx, dy, dz );
864       res = true;
865       break;
866     }
867   case GEOM_POINT_EDGE :
868     {
869       if ( myParamCoord->checkedId() == PARAM_VALUE ) {
870         anObj = anOper->MakePointOnCurve( myEdge, getParameter() );
871         aParameters<<GroupOnCurve->SpinBox_DX->text();
872       } 
873       else if ( myParamCoord->checkedId() == LENGTH_VALUE ) {
874         anObj = anOper->MakePointOnCurveByLength( myEdge, getParameter(), myCheckFlag );
875         
876         std::stringstream out;
877         out<<myCheckFlag;
878         std::string flag = out.str();
879         aParameters<<GroupOnCurve->SpinBox_DX->text();
880         aParameters<<flag.c_str();
881       }
882       else if ( myParamCoord->checkedId() == COORD_VALUE ) {
883         double x = GroupXYZ->SpinBox_DX->value();
884         double y = GroupXYZ->SpinBox_DY->value();
885         double z = GroupXYZ->SpinBox_DZ->value();
886
887         aParameters << GroupXYZ->SpinBox_DX->text();
888         aParameters << GroupXYZ->SpinBox_DY->text();
889         aParameters << GroupXYZ->SpinBox_DZ->text();
890
891         anObj = anOper->MakePointOnCurveByCoord( myEdge, x, y, z );
892       }
893       res = true;
894       break;
895     }
896   case GEOM_POINT_INTINT :
897     anObj = anOper->MakePointOnLinesIntersection( myLine1, myLine2 );
898     if ( !anObj->_is_nil() ) {
899       QString aName = getNewObjectName();
900       if ( anObj->GetShapeType() == GEOM::COMPOUND && aName.startsWith("Vertex") )
901         initName( tr( "GEOM_COMPOUND" ) );
902       else if (  anObj->GetShapeType() == GEOM::VERTEX && aName.startsWith("Compound"))
903         initName( tr( "GEOM_VERTEX" ) );
904     }
905     res = true;
906     break;
907   case GEOM_POINT_SURF :
908     {
909       if ( myParamCoord->checkedId() == PARAM_VALUE ) {
910         anObj = anOper->MakePointOnSurface( myFace, getUParameter(), getVParameter() );
911         aParameters<<GroupOnSurface->SpinBox_DX->text();
912         aParameters<<GroupOnSurface->SpinBox_DY->text();
913       } else {
914         double x = GroupXYZ->SpinBox_DX->value();
915         double y = GroupXYZ->SpinBox_DY->value();
916         double z = GroupXYZ->SpinBox_DZ->value();
917
918         aParameters << GroupXYZ->SpinBox_DX->text();
919         aParameters << GroupXYZ->SpinBox_DY->text();
920         aParameters << GroupXYZ->SpinBox_DZ->text();
921
922         anObj = anOper->MakePointOnSurfaceByCoord( myFace, x, y, z );
923       }
924       res = true;
925       break;
926     }
927   }
928
929   const int id = getConstructorId();
930   if(!anObj->_is_nil() && !IsPreview() && (id == GEOM_POINT_XYZ ||
931                                            id == GEOM_POINT_REF ||
932                                            id == GEOM_POINT_EDGE ||
933                                            id == GEOM_POINT_SURF) ) {
934       anObj->SetParameters(aParameters.join(":").toLatin1().constData());
935   }
936
937   if ( id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF ) {
938     TopoDS_Shape aShape;
939     if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() &&
940          aShape.ShapeType() == TopAbs_VERTEX ) {
941       gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
942       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
943       int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
944       myX->setText( DlgRef::PrintDoubleValue( aPnt.X(), aPrecision ) );
945       myY->setText( DlgRef::PrintDoubleValue( aPnt.Y(), aPrecision ) );
946       myZ->setText( DlgRef::PrintDoubleValue( aPnt.Z(), aPrecision ) );
947     }
948     else {
949       myX->setText( "" );
950       myY->setText( "" );
951       myZ->setText( "" );
952     }
953   }
954
955   if ( !anObj->_is_nil() ) {
956     objects.push_back( anObj._retn() );
957   }
958
959   return res;
960 }
961
962 //=================================================================================
963 // function : addSubshapeToStudy
964 // purpose  : virtual method to add new SubObjects if local selection
965 //=================================================================================
966 void BasicGUI_PointDlg::addSubshapesToStudy()
967 {
968   QMap<QString, GEOM::GEOM_Object_var> objMap;
969
970   switch ( getConstructorId() ) {
971   case GEOM_POINT_XYZ:
972     break;
973   case GEOM_POINT_REF:
974     objMap[GroupRefPoint->LineEdit1->text()] = myRefPoint;
975     break;
976   case GEOM_POINT_EDGE:
977     objMap[GroupOnCurve->LineEdit1->text()] = myEdge;
978     break;
979   case GEOM_POINT_INTINT:
980     objMap[GroupLineIntersection->LineEdit1->text()] = myLine1;
981     objMap[GroupLineIntersection->LineEdit2->text()] = myLine2;
982     break;
983   case GEOM_POINT_SURF:
984     objMap[GroupOnSurface->LineEdit1->text()] = myFace;
985     break;
986   }
987   addSubshapesToFather( objMap );
988 }
989
990 //=================================================================================
991 // function : ClickParamCoord()
992 // purpose  :
993 //=================================================================================
994 void BasicGUI_PointDlg::ClickParamCoord( int id )
995 {
996   updateParamCoord( true );
997   displayPreview();
998 }
999
1000 //=================================================================================
1001 // function : updateParamCoord
1002 // purpose  :
1003 //=================================================================================
1004 void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
1005 {
1006   bool isParam = myParamCoord->checkedId() == PARAM_VALUE;
1007   bool isLength = myParamCoord->checkedId() == LENGTH_VALUE;
1008
1009   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1010   double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
1011
1012   const int id = getConstructorId();
1013   if ( id == GEOM_POINT_EDGE ) {
1014     GroupOnCurve->TextLabel2->setVisible( isParam || isLength ); 
1015     GroupOnCurve->SpinBox_DX->setVisible( isParam || isLength );
1016     if ( isParam ){
1017       initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision" );
1018       GroupOnCurve->SpinBox_DX->setValue( 0.5 );
1019       GroupOnCurve->TextLabel2->setText(tr( "GEOM_PARAMETER" ));
1020       GroupOnCurve->CheckButton1->setVisible(false);
1021     }
1022     else if ( isLength ){
1023       initSpinBox( GroupOnCurve->SpinBox_DX, 0.0, COORD_MAX, step, "length_precision" );
1024       GroupOnCurve->SpinBox_DX->setValue( 0.0 );
1025       GroupOnCurve->TextLabel2->setText(tr( "GEOM_LENGTH" ));
1026       GroupOnCurve->CheckButton1->setVisible(true);
1027     }
1028   }  
1029   else if ( id == GEOM_POINT_SURF ) {
1030     GroupOnSurface->TextLabel2->setShown( isParam );
1031     GroupOnSurface->TextLabel3->setShown( isParam );
1032     GroupOnSurface->SpinBox_DX->setShown( isParam );
1033     GroupOnSurface->SpinBox_DY->setShown( isParam );
1034   }
1035     
1036   GroupXYZ->setShown( !isParam && !isLength );
1037
1038   if ( theIsUpdate )
1039     QTimer::singleShot(50, this, SLOT(updateSize()));
1040 }
1041
1042 //=================================================================================
1043 // function : onBtnPopup()
1044 // purpose  :
1045 //=================================================================================
1046 void BasicGUI_PointDlg::onBtnPopup( QAction* a )
1047 {
1048   int index = myActions[a];
1049   globalSelection(); // close local contexts, if any
1050   QString type;
1051   if ( index == 0 )
1052     myNeedType = TopAbs_EDGE;
1053   else 
1054     myNeedType = TopAbs_WIRE;
1055   
1056   localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
1057 }
1058
1059 //=================================================================================
1060 // function : updateSize
1061 // purpose  : adjust dialog size to minimum
1062 //=================================================================================
1063 void BasicGUI_PointDlg::updateSize() 
1064 {
1065   qApp->processEvents();
1066   updateGeometry();
1067   resize( minimumSizeHint() );
1068 }