]> SALOME platform Git repositories - modules/geom.git/blob - src/BasicGUI/BasicGUI_PointDlg.cxx
Salome HOME
Small change of the interface for MakeVertexOnCurveByLength function: use boolean...
[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
237   /* Get setting of step value from file configuration */
238   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
239   double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
240
241   /* min, max, step and decimals for spin boxes */
242   initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
243   initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
244   initSpinBox( GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
245   GroupXYZ->SpinBox_DX->setValue( 0.0 );
246   GroupXYZ->SpinBox_DY->setValue( 0.0 );
247   GroupXYZ->SpinBox_DZ->setValue( 0.0 );
248
249   initSpinBox( GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
250   initSpinBox( GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
251   initSpinBox( GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
252   GroupRefPoint->SpinBox_DX->setValue( 0.0 );
253   GroupRefPoint->SpinBox_DY->setValue( 0.0 );
254   GroupRefPoint->SpinBox_DZ->setValue( 0.0 );
255
256   step = 0.1;
257
258   initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision" );
259   GroupOnCurve->SpinBox_DX->setValue( 0.5 );
260
261   initSpinBox( GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision" );
262   GroupOnSurface->SpinBox_DX->setValue( 0.5 );
263   initSpinBox( GroupOnSurface->SpinBox_DY, 0., 1., step, "parametric_precision" );
264   GroupOnSurface->SpinBox_DY->setValue( 0.5 );
265
266   /* signals and slots connections */
267   connect( myGeomGUI,      SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
268   connect( myGeomGUI,      SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );
269
270   connect( buttonOk(),     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
271   connect( buttonApply(),  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
272
273   connect( this,           SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
274
275   connect( myParamCoord,   SIGNAL( buttonClicked( int ) ), this, SLOT( ClickParamCoord( int ) ) );
276   connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
277   connect( GroupOnCurve->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
278
279   connect( GroupOnSurface->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
280   connect( GroupOnSurface->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
281
282   connect( myBtnPopup, SIGNAL( triggered( QAction* ) ), SLOT( onBtnPopup( QAction* ) ) );
283   connect( GroupLineIntersection->PushButton1, SIGNAL( pressed() ),       this, SLOT( SetEditCurrentArgument() ) );
284   connect( GroupLineIntersection->PushButton2, SIGNAL( pressed() ),       this, SLOT( SetEditCurrentArgument() ) );
285   connect( GroupLineIntersection->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
286   connect( GroupLineIntersection->LineEdit2,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
287
288   connect( GroupOnCurve->SpinBox_DX,   SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
289   connect( GroupOnSurface->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
290   connect( GroupOnSurface->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
291   connect( GroupXYZ->SpinBox_DX,       SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
292   connect( GroupXYZ->SpinBox_DY,       SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
293   connect( GroupXYZ->SpinBox_DZ,       SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
294   connect( GroupRefPoint->SpinBox_DX,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
295   connect( GroupRefPoint->SpinBox_DY,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
296   connect( GroupRefPoint->SpinBox_DZ,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
297
298   connect( GroupOnCurve->CheckButton1, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) );
299
300   connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this,  SLOT( SetDoubleSpinBoxStep( double ) ) );
301
302   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
303            this,  SLOT(SelectionIntoArgument() ) );
304
305   initName( tr( "GEOM_VERTEX" ) );
306
307   ConstructorsClicked( 0 );
308 }
309
310 //=================================================================================
311 // function : SetDoubleSpinBoxStep()
312 // purpose  : Double spin box management
313 //=================================================================================
314 void BasicGUI_PointDlg::SetDoubleSpinBoxStep( double step )
315 {
316   GroupOnCurve->SpinBox_DX->setSingleStep(step);
317   GroupXYZ->SpinBox_DX->setSingleStep(step);
318   GroupXYZ->SpinBox_DY->setSingleStep(step);
319   GroupXYZ->SpinBox_DZ->setSingleStep(step);
320   GroupRefPoint->SpinBox_DX->setSingleStep(step);
321   GroupRefPoint->SpinBox_DY->setSingleStep(step);
322   GroupRefPoint->SpinBox_DZ->setSingleStep(step);
323 }
324
325
326 //=================================================================================
327 // function : ConstructorsClicked()
328 // purpose  : Radio button management
329 //=================================================================================
330 void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
331 {
332   switch ( constructorId ) {
333   case GEOM_POINT_XYZ:
334     {
335       globalSelection(); // close local contexts, if any
336       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
337
338       GroupRefPoint->hide();
339       GroupOnCurve->hide();
340       GroupLineIntersection->hide();
341       GroupOnSurface->hide();
342       myCoordGrp->hide();
343       myParamGroup->hide();
344       GroupXYZ->show();
345       break;
346     }
347   case GEOM_POINT_REF:
348     {
349       globalSelection(); // close local contexts, if any
350       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
351
352       myEditCurrentArgument = GroupRefPoint->LineEdit1;
353       myEditCurrentArgument->setText( "" );
354       myRefPoint = GEOM::GEOM_Object::_nil();
355       GroupRefPoint->PushButton1->setDown(true);
356       myParamGroup->hide();
357       GroupXYZ->hide();
358       GroupOnCurve->hide();
359       GroupLineIntersection->hide();
360       GroupOnSurface->hide();
361       GroupRefPoint->show();
362       myCoordGrp->show();
363       break;
364     }
365   case GEOM_POINT_EDGE:
366     {
367       globalSelection(); // close local contexts, if any
368       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
369
370       myEditCurrentArgument = GroupOnCurve->LineEdit1;
371       myEditCurrentArgument->setText( "" );
372       myEdge = GEOM::GEOM_Object::_nil();
373       GroupOnCurve->PushButton1->setDown(true);
374       GroupRefPoint->hide();
375       GroupLineIntersection->hide();
376       GroupOnSurface->hide();
377       myParamGroup->show();
378       myParamCoord->button( LENGTH_VALUE )->show();
379       myParamCoord->button( PARAM_VALUE )->setChecked( true );
380       GroupOnCurve->show();
381       myCoordGrp->show();
382       updateParamCoord( false );
383       break;
384     }
385   case GEOM_POINT_INTINT:
386     {
387       globalSelection(); // close local contexts, if any
388       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
389       myNeedType = TopAbs_EDGE;
390
391       myEditCurrentArgument = GroupLineIntersection->LineEdit1;
392       GroupLineIntersection->LineEdit1->setText( "" );
393       GroupLineIntersection->LineEdit2->setText( "" );
394       GroupLineIntersection->LineEdit1->setEnabled( true );
395       GroupLineIntersection->LineEdit2->setEnabled( false );
396       myLine1 = GEOM::GEOM_Object::_nil();
397       myLine2 = GEOM::GEOM_Object::_nil();
398       GroupLineIntersection->PushButton1->setDown(true);
399       GroupLineIntersection->PushButton2->setDown(false);
400       myParamGroup->hide();
401       GroupXYZ->hide();
402       GroupRefPoint->hide();
403       GroupOnCurve->hide();
404       GroupOnSurface->hide();
405       myCoordGrp->hide();
406       GroupLineIntersection->show();
407       break;
408     }
409   case GEOM_POINT_SURF:
410     {
411       globalSelection(); // close local contexts, if any
412       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
413
414       myEditCurrentArgument = GroupOnSurface->LineEdit1;
415       myEditCurrentArgument->setText( "" );
416       myFace = GEOM::GEOM_Object::_nil();
417       GroupOnSurface->PushButton1->setDown(true);
418       GroupRefPoint->hide();
419       GroupOnCurve->hide();
420       GroupLineIntersection->hide();
421       myParamGroup->show();
422       myParamCoord->button( LENGTH_VALUE )->hide();
423       myParamCoord->button( PARAM_VALUE )->setChecked(true);
424       GroupOnSurface->show();
425       myCoordGrp->show();
426       updateParamCoord( false );
427       break;
428     }
429   }
430
431   myX->setText( "" );
432   myY->setText( "" );
433   myZ->setText( "" );
434
435   QTimer::singleShot(50, this, SLOT(updateSize()));
436
437   SelectionIntoArgument();
438 }
439
440
441 //=================================================================================
442 // function : ClickOnOk()
443 // purpose  :
444 //=================================================================================
445 void BasicGUI_PointDlg::ClickOnOk()
446 {
447   if ( onAccept() )
448     ClickOnCancel();
449 }
450
451
452 //=================================================================================
453 // function : ClickOnApply()
454 // purpose  :
455 //=================================================================================
456 bool BasicGUI_PointDlg::ClickOnApply()
457 {
458   if ( !onAccept() )
459     return false;
460
461   initName();
462   ConstructorsClicked( getConstructorId() );
463   return true;
464 }
465
466
467 //=================================================================================
468 // function : SelectionIntoArgument()
469 // purpose  : Called when selection as changed (for constructors not using local context)
470 //=================================================================================
471 void BasicGUI_PointDlg::SelectionIntoArgument()
472 {
473   erasePreview();
474   const int id = getConstructorId();
475
476   if ( ( id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF ) && myEditCurrentArgument != 0 )
477   {
478     myEditCurrentArgument->setText( "" );
479     myX->setText( "" );
480     myY->setText( "" );
481     myZ->setText( "" );
482     myRefPoint = myEdge = myFace = GEOM::GEOM_Object::_nil();
483   } else if ( id == GEOM_POINT_INTINT ) {
484     myEditCurrentArgument->setText( "" );
485     if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 )
486       myLine1 = GEOM::GEOM_Object::_nil();
487     else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 )
488       myLine2 = GEOM::GEOM_Object::_nil();
489   }
490
491   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
492   SALOME_ListIO aSelList;
493   aSelMgr->selectedObjects(aSelList);
494
495   if (aSelList.Extent() == 1) {
496     Handle(SALOME_InteractiveObject) anIO = aSelList.First();
497     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
498     if ( !CORBA::is_nil( aSelectedObject ) ) {
499       QString aName = GEOMBase::GetName(aSelectedObject);
500       TopoDS_Shape aShape;
501       if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
502         if ( id == GEOM_POINT_XYZ || id == GEOM_POINT_REF)
503           myNeedType = TopAbs_VERTEX;
504         else if ( id == GEOM_POINT_EDGE )
505           myNeedType = TopAbs_EDGE;
506         else if ( id == GEOM_POINT_SURF )
507           myNeedType = TopAbs_FACE;
508
509         TColStd_IndexedMapOfInteger aMap;
510         aSelMgr->GetIndexes(anIO, aMap);
511         if ( aMap.Extent() == 1 ) { // Local Selection
512           int anIndex = aMap( 1 );
513           if ( myNeedType == TopAbs_FACE )
514             aName += QString( ":face_%1" ).arg( anIndex );
515           else if ( myNeedType == TopAbs_WIRE )
516             aName += QString( ":wire_%1" ).arg( anIndex );
517           else if ( myNeedType == TopAbs_EDGE )
518             aName += QString( ":edge_%1" ).arg( anIndex );
519           else  if ( myNeedType == TopAbs_VERTEX )
520             aName += QString( ":vertex_%1" ).arg( anIndex );
521
522           //Find SubShape Object in Father
523           GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
524           if ( aFindedObject->_is_nil() ) { // Object not found in study
525             GEOM::GEOM_IShapesOperations_var aShapesOp =
526               getGeomEngine()->GetIShapesOperations(getStudyId());
527             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
528           }
529           else {
530             aSelectedObject = aFindedObject; // get Object from study
531           }
532           GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE );
533         }
534         else { // Global Selection
535           if ( aShape.ShapeType() != myNeedType ) {
536             aSelectedObject = GEOM::GEOM_Object::_nil();
537             aName = "";
538             if ( id == GEOM_POINT_XYZ ) return;
539           }
540         }
541       }
542
543       if ( aShape.IsNull() || aShape.ShapeType() != myNeedType)
544         return;
545
546       myBusy = true;
547
548       if ( id == GEOM_POINT_XYZ ) {
549         gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
550         GroupXYZ->SpinBox_DX->setValue( aPnt.X() );
551         GroupXYZ->SpinBox_DY->setValue( aPnt.Y() );
552         GroupXYZ->SpinBox_DZ->setValue( aPnt.Z() );
553       }
554       else if ( id == GEOM_POINT_REF ) {
555         myRefPoint = aSelectedObject;
556         GroupRefPoint->LineEdit1->setText( aName );
557       }
558       else if ( id == GEOM_POINT_EDGE ) {
559         myEdge = aSelectedObject;
560         GroupOnCurve->LineEdit1->setText( aName );
561       }
562       else if ( id == GEOM_POINT_INTINT ) {
563         myEditCurrentArgument->setText( aName );
564         if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) {
565           myLine1 = aSelectedObject;
566           if ( !myLine1->_is_nil() && myLine2->_is_nil() ) {
567             GroupLineIntersection->PushButton2->setMenu( 0 );
568             GroupLineIntersection->PushButton2->click();
569             GroupLineIntersection->PushButton2->setDown(true);
570             GroupLineIntersection->PushButton2->setMenu( myBtnPopup );
571           }
572         }
573         else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) {
574           myLine2 = aSelectedObject;
575           if ( !myLine2->_is_nil() && myLine1->_is_nil() ) {
576             GroupLineIntersection->PushButton1->setMenu( 0 );
577             GroupLineIntersection->PushButton1->click();
578             GroupLineIntersection->PushButton1->setDown(true);
579             GroupLineIntersection->PushButton1->setMenu( myBtnPopup );
580           }
581         }
582       }
583       else if ( id == GEOM_POINT_SURF )
584       {
585         myFace = aSelectedObject;
586         GroupOnSurface->LineEdit1->setText( aName );
587       }
588       myBusy = false;
589     }
590   }
591
592   displayPreview();
593 }
594
595
596 //=================================================================================
597 // function : LineEditReturnPressed()
598 // purpose  :
599 //=================================================================================
600 void BasicGUI_PointDlg::LineEditReturnPressed()
601 {
602   QLineEdit* send = (QLineEdit*)sender();
603   if ( send == GroupRefPoint->LineEdit1         ||
604        send == GroupOnCurve->LineEdit1          ||
605        send == GroupLineIntersection->LineEdit1 ||
606        send == GroupLineIntersection->LineEdit2  ) {
607     myEditCurrentArgument = send;
608     GEOMBase_Skeleton::LineEditReturnPressed();
609   }
610 }
611
612
613 //=================================================================================
614 // function : SetEditCurrentArgument()
615 // purpose  :
616 //=================================================================================
617 void BasicGUI_PointDlg::SetEditCurrentArgument()
618 {
619   QPushButton* send = (QPushButton*)sender();
620
621   if ( send == GroupRefPoint->PushButton1 ) {
622     GroupRefPoint->LineEdit1->setFocus();
623     myEditCurrentArgument = GroupRefPoint->LineEdit1;
624     globalSelection(); // close local contexts, if any
625     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
626   }
627   else if ( send == GroupOnCurve->PushButton1 ) {
628     GroupOnCurve->LineEdit1->setFocus();
629     myEditCurrentArgument = GroupOnCurve->LineEdit1;
630     globalSelection(); // close local contexts, if any
631     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
632   }
633   else if ( send == GroupOnSurface->PushButton1 )
634   {
635     GroupOnSurface->LineEdit1->setFocus();
636     myEditCurrentArgument = GroupOnSurface->LineEdit1;
637     globalSelection(); // close local contexts, if any
638     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
639   }
640   else if ( send == GroupLineIntersection->PushButton1 ) {
641     GroupLineIntersection->LineEdit1->setFocus();
642     myEditCurrentArgument = GroupLineIntersection->LineEdit1;
643     GroupLineIntersection->PushButton2->setDown( false );
644     GroupLineIntersection->LineEdit1->setEnabled(true);
645     GroupLineIntersection->LineEdit2->setEnabled(false);
646   }
647   else if ( send == GroupLineIntersection->PushButton2 ) {
648     GroupLineIntersection->LineEdit2->setFocus();
649     myEditCurrentArgument = GroupLineIntersection->LineEdit2;
650     GroupLineIntersection->PushButton1->setDown( false );
651     GroupLineIntersection->LineEdit1->setEnabled(false);
652     GroupLineIntersection->LineEdit2->setEnabled(true);
653   }
654   send->setDown(true);
655
656   if ( ( send == GroupLineIntersection->PushButton1 ||
657          send == GroupLineIntersection->PushButton2 ) && !myBusy )
658     SelectionIntoArgument();
659 }
660
661
662 //=================================================================================
663 // function : enterEvent()
664 // purpose  : to reactivate this dialog box when mouse enter onto the window
665 //=================================================================================
666 void BasicGUI_PointDlg::enterEvent( QEvent* )
667 {
668   if ( !mainFrame()->GroupConstructors->isEnabled() )
669     ActivateThisDialog();
670 }
671
672
673 //=================================================================================
674 // function : ActivateThisDialog()
675 // purpose  :
676 //=================================================================================
677 void BasicGUI_PointDlg::ActivateThisDialog( )
678 {
679   GEOMBase_Skeleton::ActivateThisDialog();
680
681   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
682            this, SLOT( SelectionIntoArgument() ) );
683
684   ConstructorsClicked( getConstructorId() );
685 }
686
687
688 //=================================================================================
689 // function : DeactivateActiveDialog()
690 // purpose  : public slot to deactivate if active
691 //=================================================================================
692 void BasicGUI_PointDlg::DeactivateActiveDialog()
693 {
694   // myGeomGUI->SetState( -1 );
695   GEOMBase_Skeleton::DeactivateActiveDialog();
696 }
697
698
699 //=================================================================================
700 // function : ValueChangedInSpinBox()
701 // purpose  :
702 //=================================================================================
703 void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue)
704 {
705   displayPreview();
706 }
707
708 //=================================================================================
709 // function : CheckBoxClicked()
710 // purpose  : Check Boxes Management
711 //=================================================================================
712 void BasicGUI_PointDlg::CheckBoxClicked( int  State ) 
713 {
714   displayPreview();
715 }
716
717
718 //=================================================================================
719 // funcion  : getParameter()
720 // purpose  :
721 //=================================================================================
722 double BasicGUI_PointDlg::getParameter() const
723 {
724   return GroupOnCurve->SpinBox_DX->value();
725 }
726
727
728 //=================================================================================
729 // funcion  : getUParameter()
730 // purpose  :
731 //=================================================================================
732 double BasicGUI_PointDlg::getUParameter() const
733 {
734   return GroupOnSurface->SpinBox_DX->value();
735 }
736
737
738 //=================================================================================
739 // funcion  : getVParameter()
740 // purpose  :
741 //=================================================================================
742 double BasicGUI_PointDlg::getVParameter() const
743 {
744   return GroupOnSurface->SpinBox_DY->value();
745 }
746
747
748 //=================================================================================
749 // function : OnPointSelected
750 // purpose  :
751 //=================================================================================
752 void BasicGUI_PointDlg::OnPointSelected( const gp_Pnt& thePnt )
753 {
754   if ( getConstructorId() == GEOM_POINT_XYZ ) {
755     GroupXYZ->SpinBox_DX->setValue( thePnt.X() );
756     GroupXYZ->SpinBox_DY->setValue( thePnt.Y() );
757     GroupXYZ->SpinBox_DZ->setValue( thePnt.Z() );
758
759     displayPreview();
760   }
761 }
762
763 //=================================================================================
764 // function : createOperation
765 // purpose  :
766 //=================================================================================
767 GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation()
768 {
769   return myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() );
770 }
771
772 //=================================================================================
773 // function : isValid
774 // purpose  :
775 //=================================================================================
776 bool BasicGUI_PointDlg::isValid( QString& msg )
777 {
778   const int id = getConstructorId();
779   if ( id == GEOM_POINT_XYZ ) {
780     bool ok = true;
781     ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
782     ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
783     ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
784     return ok;
785   }
786   else if ( id == GEOM_POINT_REF ) {
787     bool ok = true;
788     ok = GroupRefPoint->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
789     ok = GroupRefPoint->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
790     ok = GroupRefPoint->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
791
792     return !myRefPoint->_is_nil() && ok;
793   }
794   else if ( id == GEOM_POINT_EDGE ) {
795     bool ok = true;
796     if ( myParamCoord->checkedId() == PARAM_VALUE || myParamCoord->checkedId() == LENGTH_VALUE )
797       ok = GroupOnCurve->SpinBox_DX->isValid( msg, !IsPreview() );
798     else {
799       ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
800       ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
801       ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
802     }
803     return !myEdge->_is_nil() && ok;
804   }
805   else if ( id == GEOM_POINT_INTINT )
806     return ( !myLine1->_is_nil() && !myLine2->_is_nil() );
807   else if ( id == GEOM_POINT_SURF ) {
808     bool ok = true;
809     if ( myParamCoord->checkedId() == PARAM_VALUE ) {
810       ok = GroupOnSurface->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
811       ok = GroupOnSurface->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
812     }
813     else {
814       ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
815       ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
816       ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
817     }
818     return !myFace->_is_nil() && ok;
819   }
820   return false;
821 }
822
823 //=================================================================================
824 // function : execute
825 // purpose  :
826 //=================================================================================
827 bool BasicGUI_PointDlg::execute( ObjectList& objects )
828 {
829   bool res = false;
830
831   GEOM::GEOM_Object_var anObj;
832   QStringList aParameters;
833
834   GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() );
835
836   switch ( getConstructorId() ) {
837   case GEOM_POINT_XYZ :
838     {
839       double x = GroupXYZ->SpinBox_DX->value();
840       double y = GroupXYZ->SpinBox_DY->value();
841       double z = GroupXYZ->SpinBox_DZ->value();
842
843       aParameters << GroupXYZ->SpinBox_DX->text();
844       aParameters << GroupXYZ->SpinBox_DY->text();
845       aParameters << GroupXYZ->SpinBox_DZ->text();
846
847       anObj = anOper->MakePointXYZ( x, y, z );
848       res = true;
849       break;
850     }
851   case GEOM_POINT_REF :
852     {
853       double dx = GroupRefPoint->SpinBox_DX->value();
854       double dy = GroupRefPoint->SpinBox_DY->value();
855       double dz = GroupRefPoint->SpinBox_DZ->value();
856
857       aParameters << GroupRefPoint->SpinBox_DX->text();
858       aParameters << GroupRefPoint->SpinBox_DY->text();
859       aParameters << GroupRefPoint->SpinBox_DZ->text();
860
861       anObj = anOper->MakePointWithReference( myRefPoint, dx, dy, dz );
862       res = true;
863       break;
864     }
865   case GEOM_POINT_EDGE :
866     {
867       if ( myParamCoord->checkedId() == PARAM_VALUE ) {
868         anObj = anOper->MakePointOnCurve( myEdge, getParameter() );
869         aParameters<<GroupOnCurve->SpinBox_DX->text();
870       } 
871       else if ( myParamCoord->checkedId() == LENGTH_VALUE ) {
872         bool reversed = GroupOnCurve->CheckButton1->isChecked();
873         anObj = anOper->MakePointOnCurveByLength( myEdge, getParameter(), reversed );
874         
875         aParameters<<GroupOnCurve->SpinBox_DX->text();
876         aParameters<<QString::number( reversed );
877       }
878       else if ( myParamCoord->checkedId() == COORD_VALUE ) {
879         double x = GroupXYZ->SpinBox_DX->value();
880         double y = GroupXYZ->SpinBox_DY->value();
881         double z = GroupXYZ->SpinBox_DZ->value();
882
883         aParameters << GroupXYZ->SpinBox_DX->text();
884         aParameters << GroupXYZ->SpinBox_DY->text();
885         aParameters << GroupXYZ->SpinBox_DZ->text();
886
887         anObj = anOper->MakePointOnCurveByCoord( myEdge, x, y, z );
888       }
889       res = true;
890       break;
891     }
892   case GEOM_POINT_INTINT :
893     anObj = anOper->MakePointOnLinesIntersection( myLine1, myLine2 );
894     if ( !anObj->_is_nil() ) {
895       QString aName = getNewObjectName();
896       if ( anObj->GetShapeType() == GEOM::COMPOUND && aName.startsWith("Vertex") )
897         initName( tr( "GEOM_COMPOUND" ) );
898       else if (  anObj->GetShapeType() == GEOM::VERTEX && aName.startsWith("Compound"))
899         initName( tr( "GEOM_VERTEX" ) );
900     }
901     res = true;
902     break;
903   case GEOM_POINT_SURF :
904     {
905       if ( myParamCoord->checkedId() == PARAM_VALUE ) {
906         anObj = anOper->MakePointOnSurface( myFace, getUParameter(), getVParameter() );
907         aParameters<<GroupOnSurface->SpinBox_DX->text();
908         aParameters<<GroupOnSurface->SpinBox_DY->text();
909       } else {
910         double x = GroupXYZ->SpinBox_DX->value();
911         double y = GroupXYZ->SpinBox_DY->value();
912         double z = GroupXYZ->SpinBox_DZ->value();
913
914         aParameters << GroupXYZ->SpinBox_DX->text();
915         aParameters << GroupXYZ->SpinBox_DY->text();
916         aParameters << GroupXYZ->SpinBox_DZ->text();
917
918         anObj = anOper->MakePointOnSurfaceByCoord( myFace, x, y, z );
919       }
920       res = true;
921       break;
922     }
923   }
924
925   const int id = getConstructorId();
926   if(!anObj->_is_nil() && !IsPreview() && (id == GEOM_POINT_XYZ ||
927                                            id == GEOM_POINT_REF ||
928                                            id == GEOM_POINT_EDGE ||
929                                            id == GEOM_POINT_SURF) ) {
930       anObj->SetParameters(aParameters.join(":").toLatin1().constData());
931   }
932
933   if ( id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF ) {
934     TopoDS_Shape aShape;
935     if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() &&
936          aShape.ShapeType() == TopAbs_VERTEX ) {
937       gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
938       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
939       int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
940       myX->setText( DlgRef::PrintDoubleValue( aPnt.X(), aPrecision ) );
941       myY->setText( DlgRef::PrintDoubleValue( aPnt.Y(), aPrecision ) );
942       myZ->setText( DlgRef::PrintDoubleValue( aPnt.Z(), aPrecision ) );
943     }
944     else {
945       myX->setText( "" );
946       myY->setText( "" );
947       myZ->setText( "" );
948     }
949   }
950
951   if ( !anObj->_is_nil() ) {
952     objects.push_back( anObj._retn() );
953   }
954
955   return res;
956 }
957
958 //=================================================================================
959 // function : addSubshapeToStudy
960 // purpose  : virtual method to add new SubObjects if local selection
961 //=================================================================================
962 void BasicGUI_PointDlg::addSubshapesToStudy()
963 {
964   QMap<QString, GEOM::GEOM_Object_var> objMap;
965
966   switch ( getConstructorId() ) {
967   case GEOM_POINT_XYZ:
968     break;
969   case GEOM_POINT_REF:
970     objMap[GroupRefPoint->LineEdit1->text()] = myRefPoint;
971     break;
972   case GEOM_POINT_EDGE:
973     objMap[GroupOnCurve->LineEdit1->text()] = myEdge;
974     break;
975   case GEOM_POINT_INTINT:
976     objMap[GroupLineIntersection->LineEdit1->text()] = myLine1;
977     objMap[GroupLineIntersection->LineEdit2->text()] = myLine2;
978     break;
979   case GEOM_POINT_SURF:
980     objMap[GroupOnSurface->LineEdit1->text()] = myFace;
981     break;
982   }
983   addSubshapesToFather( objMap );
984 }
985
986 //=================================================================================
987 // function : ClickParamCoord()
988 // purpose  :
989 //=================================================================================
990 void BasicGUI_PointDlg::ClickParamCoord( int id )
991 {
992   updateParamCoord( true );
993   displayPreview();
994 }
995
996 //=================================================================================
997 // function : updateParamCoord
998 // purpose  :
999 //=================================================================================
1000 void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
1001 {
1002   bool isParam = myParamCoord->checkedId() == PARAM_VALUE;
1003   bool isLength = myParamCoord->checkedId() == LENGTH_VALUE;
1004
1005   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1006   double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
1007
1008   const int id = getConstructorId();
1009   if ( id == GEOM_POINT_EDGE ) {
1010     GroupOnCurve->TextLabel2->setVisible( isParam || isLength ); 
1011     GroupOnCurve->SpinBox_DX->setVisible( isParam || isLength );
1012     if ( isParam ){
1013       initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision" );
1014       GroupOnCurve->SpinBox_DX->setValue( 0.5 );
1015       GroupOnCurve->TextLabel2->setText(tr( "GEOM_PARAMETER" ));
1016       GroupOnCurve->CheckButton1->setVisible(false);
1017     }
1018     else if ( isLength ){
1019       initSpinBox( GroupOnCurve->SpinBox_DX, 0.0, COORD_MAX, step, "length_precision" );
1020       GroupOnCurve->SpinBox_DX->setValue( 0.0 );
1021       GroupOnCurve->TextLabel2->setText(tr( "GEOM_LENGTH" ));
1022       GroupOnCurve->CheckButton1->setVisible(true);
1023     }
1024   }  
1025   else if ( id == GEOM_POINT_SURF ) {
1026     GroupOnSurface->TextLabel2->setShown( isParam );
1027     GroupOnSurface->TextLabel3->setShown( isParam );
1028     GroupOnSurface->SpinBox_DX->setShown( isParam );
1029     GroupOnSurface->SpinBox_DY->setShown( isParam );
1030   }
1031     
1032   GroupXYZ->setShown( !isParam && !isLength );
1033
1034   if ( theIsUpdate )
1035     QTimer::singleShot(50, this, SLOT(updateSize()));
1036 }
1037
1038 //=================================================================================
1039 // function : onBtnPopup()
1040 // purpose  :
1041 //=================================================================================
1042 void BasicGUI_PointDlg::onBtnPopup( QAction* a )
1043 {
1044   int index = myActions[a];
1045   globalSelection(); // close local contexts, if any
1046   QString type;
1047   if ( index == 0 )
1048     myNeedType = TopAbs_EDGE;
1049   else 
1050     myNeedType = TopAbs_WIRE;
1051   
1052   localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
1053 }
1054
1055 //=================================================================================
1056 // function : updateSize
1057 // purpose  : adjust dialog size to minimum
1058 //=================================================================================
1059 void BasicGUI_PointDlg::updateSize() 
1060 {
1061   qApp->processEvents();
1062   updateGeometry();
1063   resize( minimumSizeHint() );
1064 }