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