Salome HOME
Revert "Synchronize adm files"
[modules/hexablock.git] / src / HEXABLOCKGUI / MyBasicGUI_PointDlg.cxx
1 // Copyright (C) 2009-2014  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "MyBasicGUI_PointDlg.hxx"
21
22 #include <SUIT_ResourceMgr.h>
23 #include <SUIT_Session.h>
24 #include <SalomeApp_Application.h>
25 #include <LightApp_SelectionMgr.h>
26
27 #include "MyDlgRef.hxx"
28
29
30 #include <QApplication>
31 #include <QButtonGroup>
32 #include <QHBoxLayout>
33 #include <QLabel>
34 #include <QRadioButton>
35 #include <QMenu>
36 #include <QTimer>
37
38 #include <gp_Pnt.hxx>
39 #include <TopoDS_Shape.hxx>
40 #include <TopAbs_ShapeEnum.hxx>
41 #include <TopoDS.hxx>
42 #include <BRep_Tool.hxx>
43 #include <TopExp.hxx>
44 #include <TColStd_IndexedMapOfInteger.hxx>
45 #include <TopTools_IndexedMapOfShape.hxx>
46
47
48 #include <VTKViewer_ViewModel.h>
49 #include <SUIT_MessageBox.h>
50 #include <SUIT_OverrideCursor.h>
51 #include <SalomeApp_Tools.h>
52 #include <SalomeApp_Study.h>
53
54 #include "HEXABLOCKGUI_DocumentModel.hxx"
55 #include "HEXABLOCKGUI_DocumentSelectionModel.hxx"
56 #include "HEXABLOCKGUI_DocumentItem.hxx"
57 #include "HEXABLOCKGUI_SalomeTools.hxx"
58 #include "HEXABLOCKGUI.hxx"
59 #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx"
60
61 #define PARAM_VALUE 0
62 #define COORD_VALUE 1
63 #define LENGTH_VALUE 2
64
65 #define GEOM_POINT_XYZ    0
66 #define GEOM_POINT_REF    1
67 #define GEOM_POINT_EDGE   2
68 #define GEOM_POINT_INTINT 3
69 #define GEOM_POINT_SURF   4
70
71 #define SPACING 6
72 #define MARGIN  9
73
74 using namespace HEXABLOCK::GUI;
75
76 Q_DECLARE_METATYPE(HEXABLOCK::GUI::HexaTreeRole);
77 Q_DECLARE_METATYPE(TopAbs_ShapeEnum);
78 Q_DECLARE_METATYPE(TopoDS_Shape);
79
80 //=================================================================================
81 // class    : MyBasicGUI_PointDlg()
82 // purpose  : Constructs a MyBasicGUI_PointDlg which is a child of 'parent', with the
83 //            name 'name' and widget flags set to 'f'.
84 //            The dialog will by default be modeless, unless you set 'modal' to
85 //            TRUE to construct a modal dialog.
86 //=================================================================================
87 MyBasicGUI_PointDlg::MyBasicGUI_PointDlg(QWidget* parent, Qt::WindowFlags fl)
88 : MyGEOMBase_Skeleton(parent, fl),
89   myBusy (false)
90 {
91     SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
92     QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT")));
93     QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_EDGE")));
94     QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
95     QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_REF")));
96     QPixmap image4 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_LINES")));
97     QPixmap image5 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_FACE")));
98     QPixmap image6 (aResMgr->loadPixmap("GEOM", tr("ICO_LINE")));
99     QPixmap image7 (aResMgr->loadPixmap("GEOM", tr("ICO_WIRE")));
100
101     setWindowTitle( tr("Vertex Association") );
102 //    setMinimumWidth(260);
103 //    setMinimumHeight(400);
104
105     mainFrame()->GroupConstructors->setTitle(tr("GEOM_POINTS"));
106     mainFrame()->RadioButton1->setIcon(image0);
107     mainFrame()->RadioButton2->setIcon(image3);
108     mainFrame()->RadioButton3->setIcon(image1);
109     mainFrame()->RadioButton4->show();
110     mainFrame()->RadioButton4->setIcon(image4);
111     mainFrame()->RadioButton5->show();
112     mainFrame()->RadioButton5->setIcon(image5);
113
114     myParamGroup = new QGroupBox(centralWidget());
115     myParamCoord = new QButtonGroup(myParamGroup);
116     QHBoxLayout* boxLayout = new QHBoxLayout(myParamGroup);
117     boxLayout->setMargin(MARGIN); boxLayout->setSpacing(SPACING);
118
119     QRadioButton* btn = new QRadioButton(tr("By Param"), myParamGroup);
120     myParamCoord->addButton(btn, PARAM_VALUE);
121     boxLayout->addWidget(btn);
122
123     btn = new QRadioButton(tr("By Length"), myParamGroup);
124     myParamCoord->addButton(btn, LENGTH_VALUE);
125     boxLayout->addWidget(btn);
126
127     btn = new QRadioButton(tr("By Coords"), myParamGroup);
128     myParamCoord->addButton(btn, COORD_VALUE);
129     boxLayout->addWidget(btn);
130
131     myParamCoord->setExclusive(true);
132     myParamCoord->button(PARAM_VALUE)->setChecked(true);
133
134     GroupXYZ = new MyDlgRef_3Spin(centralWidget());
135     GroupXYZ->GroupBox1->setTitle(tr("GEOM_COORDINATES"));
136     GroupXYZ->TextLabel1->setText(tr("GEOM_X"));
137     GroupXYZ->TextLabel2->setText(tr("GEOM_Y"));
138     GroupXYZ->TextLabel3->setText(tr("GEOM_Z"));
139     coordsInputValue[GEOM_POINT_XYZ]  = new QVector3D(0, 0, 0);
140     coordsInputValue[GEOM_POINT_EDGE] = new QVector3D(0, 0, 0);
141     coordsInputValue[GEOM_POINT_SURF] = new QVector3D(0, 0, 0);
142
143     GroupOnCurve = new MyDlgRef_2Sel1Spin(centralWidget());
144     GroupOnCurve->GroupBox1->setTitle(tr("GEOM_POINT_ON_EDGE"));
145     GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE"));
146     GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT"));
147     GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
148     paramInputValue[PARAM_VALUE] = 0.5;
149     paramInputValue[LENGTH_VALUE] = 0.5;
150
151     GroupOnSurface = new MyDlgRef_1Sel2Spin(centralWidget());
152     GroupOnSurface->GroupBox1->setTitle(tr("GEOM_POINT_ON_FACE"));
153     GroupOnSurface->TextLabel1->setText(tr("GEOM_FACE"));
154     GroupOnSurface->TextLabel2->setText(tr("GEOM_UPARAMETER"));
155     GroupOnSurface->TextLabel3->setText(tr("GEOM_VPARAMETER"));
156
157     GroupRefPoint = new MyDlgRef_1Sel3Spin(centralWidget());
158     GroupRefPoint->GroupBox1->setTitle(tr("GEOM_REF_POINT"));
159     GroupRefPoint->TextLabel1->setText(tr("GEOM_POINT"));
160     GroupRefPoint->TextLabel2->setText(tr("GEOM_DX"));
161     GroupRefPoint->TextLabel3->setText(tr("GEOM_DY"));
162     GroupRefPoint->TextLabel4->setText(tr("GEOM_DZ"));
163
164     /* popup menu for line intersect buttons */
165     QIcon ico_line = QIcon(image6);
166     QIcon ico_wire = QIcon(image7);
167     // * menu for line1
168     myBtnPopup = new QMenu(this);
169     action_line1_edge = myBtnPopup->addAction(ico_line, tr("GEOM_EDGE"));
170     action_line1_wire = myBtnPopup->addAction(ico_wire, tr("GEOM_WIRE"));
171
172     // * menu for line 2
173     myBtnPopup2 = new QMenu(this);
174     action_line2_edge = myBtnPopup2->addAction(ico_line, tr("GEOM_EDGE"));
175     action_line2_wire = myBtnPopup2->addAction(ico_wire, tr("GEOM_WIRE"));
176
177     GroupLineIntersection = new MyDlgRef_2Sel(centralWidget());
178     GroupLineIntersection->GroupBox1->setTitle(tr("GEOM_LINE_INTERSECTION"));
179     GroupLineIntersection->TextLabel1->setText(tr("GEOM_LINE1"));
180     GroupLineIntersection->TextLabel2->setText(tr("GEOM_LINE2"));
181     GroupLineIntersection->PushButton1->setIcon(image2);
182     GroupLineIntersection->PushButton1->setMenu(myBtnPopup);
183     GroupLineIntersection->PushButton2->setIcon(image2);
184     GroupLineIntersection->PushButton2->setMenu(myBtnPopup2);
185
186     myCoordGrp = new QGroupBox(tr("GEOM_COORDINATES_RES"), centralWidget());
187     QGridLayout* myCoordGrpLayout = new QGridLayout(myCoordGrp);
188     myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_X"), myCoordGrp), 0, 0);
189     myX = new QLineEdit(myCoordGrp);
190     myCoordGrpLayout->addWidget(myX, 0, 1);
191     myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_Y"), myCoordGrp), 1, 0);
192     myY = new QLineEdit(myCoordGrp);
193     myCoordGrpLayout->addWidget(myY, 1, 1);
194     myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_Z"), myCoordGrp), 2, 0);
195     myZ = new QLineEdit(myCoordGrp);
196     myCoordGrpLayout->addWidget(myZ, 2, 1);
197
198     QVBoxLayout* layout = new QVBoxLayout(centralWidget());
199     layout->setMargin(0); layout->setSpacing(6);
200     layout->addWidget(myParamGroup);
201     layout->addWidget(GroupXYZ);
202     layout->addWidget(GroupOnCurve);
203     layout->addWidget(GroupOnSurface);
204     layout->addWidget(GroupRefPoint);
205     layout->addWidget(GroupLineIntersection);
206     layout->addWidget(myCoordGrp);
207
208     myX->setReadOnly(true);
209     myY->setReadOnly(true);
210     myZ->setReadOnly(true);
211
212     myX->setEnabled(false);
213     myY->setEnabled(false);
214     myZ->setEnabled(false);
215
216     QPalette aPal = myX->palette();
217     aPal.setColor(QPalette::Disabled, QPalette::Text, QColor(0, 0, 0));
218     myX->setPalette(aPal);
219     myY->setPalette(aPal);
220     myZ->setPalette(aPal);
221
222     _helpFileName = "gui_asso_quad_to_geom.html#associate-to-a-vertex-of-the-geometry";
223     _initWidget( _editMode );
224     mainFrame()->RadioButton1->click();
225 }
226
227 //=================================================================================
228 // function : ~MyBasicGUI_PointDlg()
229 // purpose  : Destructor
230 //=================================================================================
231 MyBasicGUI_PointDlg::~MyBasicGUI_PointDlg()
232 {
233 }
234
235 void MyBasicGUI_PointDlg::_initInputWidget( HexaBaseDialog::Mode editmode )
236 {
237     // *** Init input widgets ***/
238     initSpinBox(GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX);
239     initSpinBox(GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX);
240     initSpinBox(GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX);
241     GroupXYZ->SpinBox_DX->setValue(0.0);
242     GroupXYZ->SpinBox_DY->setValue(0.0);
243     GroupXYZ->SpinBox_DZ->setValue(0.0);
244
245     initSpinBox(GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX);
246     initSpinBox(GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX);
247     initSpinBox(GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX);
248     GroupRefPoint->SpinBox_DX->setValue(0.0);
249     GroupRefPoint->SpinBox_DY->setValue(0.0);
250     GroupRefPoint->SpinBox_DZ->setValue(0.0);
251
252     initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1.);
253     GroupOnCurve->SpinBox_DX->setValue(paramInputValue[PARAM_VALUE]);
254
255     initSpinBox(GroupOnSurface->SpinBox_DX, 0., 1.);
256     GroupOnSurface->SpinBox_DX->setValue(0.5);
257     initSpinBox(GroupOnSurface->SpinBox_DY, 0., 1.);
258     GroupOnSurface->SpinBox_DY->setValue(0.5);
259
260     // * vtk input widget
261     mainFrame()->_vertex_le->setReadOnly(true);
262     mainFrame()->_vertex_le->setProperty( "HexaWidgetType",  QVariant::fromValue(HEXABLOCK::GUI::VERTEX_TREE) );
263     mainFrame()->_vertex_le->installEventFilter(this);
264
265     // * geom input widgets
266     // point with ref
267     GroupRefPoint->LineEdit1->setReadOnly(true);
268     GroupRefPoint->LineEdit1->setProperty( "HexaWidgetType", QVariant::fromValue(GEOMPOINT_TREE) );
269     GroupRefPoint->LineEdit1->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_VERTEX) );
270     GroupRefPoint->LineEdit1->installEventFilter(this);
271
272     // point on curve
273     //  - Line
274     GroupOnCurve->LineEdit1->setReadOnly(true);
275     GroupOnCurve->LineEdit1->setProperty( "HexaWidgetType", QVariant::fromValue(GEOMEDGE_TREE) );
276     GroupOnCurve->LineEdit1->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) );
277     GroupOnCurve->LineEdit1->installEventFilter(this);
278
279     //  - Start point
280     GroupOnCurve->LineEdit2->setReadOnly(true);
281     GroupOnCurve->LineEdit2->setProperty( "HexaWidgetType", QVariant::fromValue(GEOMPOINT_TREE) );
282     GroupOnCurve->LineEdit2->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_VERTEX) );
283     GroupOnCurve->LineEdit2->installEventFilter(this);
284
285     // point of 2 lines intersection
286     //  - Line1
287     GroupLineIntersection->LineEdit1->setReadOnly(true);
288     GroupLineIntersection->LineEdit1->setProperty( "HexaWidgetType", QVariant::fromValue(GEOMEDGE_TREE) );
289     GroupLineIntersection->LineEdit1->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) );
290     GroupLineIntersection->LineEdit1->installEventFilter(this);
291
292     // - Line2
293     GroupLineIntersection->LineEdit2->setReadOnly(true);
294     GroupLineIntersection->LineEdit2->setProperty( "HexaWidgetType", QVariant::fromValue(GEOMEDGE_TREE) );
295     GroupLineIntersection->LineEdit2->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) );
296     GroupLineIntersection->LineEdit2->installEventFilter(this);
297
298     //point on surface
299     GroupOnSurface->LineEdit1->setReadOnly(true);
300     GroupOnSurface->LineEdit1->setProperty( "HexaWidgetType", QVariant::fromValue(GEOMFACE_TREE) );
301     GroupOnSurface->LineEdit1->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_FACE) );
302     GroupOnSurface->LineEdit1->installEventFilter(this);
303
304     // * connect signals
305     connect(this,           SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
306     connect(myParamCoord,   SIGNAL(buttonClicked(int)), this, SLOT(ClickParamCoord(int)));
307     connect(myBtnPopup, SIGNAL(triggered(QAction*)), this, SLOT(onBtnPopup(QAction*)));
308     connect(myBtnPopup2, SIGNAL(triggered(QAction*)), this, SLOT(onBtnPopup(QAction*)));
309
310     // ref point
311     connect(GroupRefPoint->LineEdit1, SIGNAL( textChanged(const QString&) ), this, SLOT(onUpdateResults(const QString&)));
312
313     //point on curve
314     connect(GroupOnCurve->LineEdit1, SIGNAL( textChanged(const QString&) ), this, SLOT(onUpdateResults(const QString&)));
315     connect(GroupOnCurve->LineEdit2, SIGNAL( textChanged(const QString&) ), this, SLOT(onUpdateResults(const QString&)));
316
317     connect(GroupOnCurve->SpinBox_DX,   SIGNAL(valueChanged(double)), this, SLOT(onParamValueChanged(double)));
318     connect(GroupOnCurve->SpinBox_DX,  SIGNAL(valueChanged(const QString&)), this, SLOT(onUpdateResults(const QString&)));
319
320     // intersection point
321     connect(GroupLineIntersection->LineEdit1, SIGNAL( textChanged(const QString&) ), this, SLOT(onUpdateResults(const QString&)));
322     connect(GroupLineIntersection->LineEdit2, SIGNAL( textChanged(const QString&) ), this, SLOT(onUpdateResults(const QString&)));
323
324     // point on surface
325     connect(GroupOnSurface->SpinBox_DX, SIGNAL(valueChanged(const QString&)), this, SLOT(onUpdateResults(const QString&)));
326     connect(GroupOnSurface->SpinBox_DY, SIGNAL(valueChanged(const QString&)), this, SLOT(onUpdateResults(const QString&)));
327     connect(GroupOnSurface->LineEdit1,  SIGNAL( textChanged(const QString&) ), this, SLOT(onUpdateResults(const QString&))); //surface: Face
328
329     // Coords X, Y, Z
330     connect(GroupXYZ->SpinBox_DX,       SIGNAL(valueChanged(double)), this, SLOT(onXCoordChanged(double)));
331     connect(GroupXYZ->SpinBox_DY,       SIGNAL(valueChanged(double)), this, SLOT(onYCoordChanged(double)));
332     connect(GroupXYZ->SpinBox_DZ,       SIGNAL(valueChanged(double)), this, SLOT(onZCoordChanged(double)));
333
334     connect(GroupXYZ->SpinBox_DX,  SIGNAL(valueChanged(const QString&)), this, SLOT(onUpdateResults(const QString&)));
335     connect(GroupXYZ->SpinBox_DY,  SIGNAL(valueChanged(const QString&)), this, SLOT(onUpdateResults(const QString&)));
336     connect(GroupXYZ->SpinBox_DZ,  SIGNAL(valueChanged(const QString&)), this, SLOT(onUpdateResults(const QString&)));
337
338     // DX, DY, DZ
339     connect(GroupRefPoint->SpinBox_DX,  SIGNAL(valueChanged(const QString&)), this, SLOT(onUpdateResults(const QString&)));
340     connect(GroupRefPoint->SpinBox_DY,  SIGNAL(valueChanged(const QString&)), this, SLOT(onUpdateResults(const QString&)));
341     connect(GroupRefPoint->SpinBox_DZ,  SIGNAL(valueChanged(const QString&)), this, SLOT(onUpdateResults(const QString&)));
342
343     // radio buttons
344     connect( mainFrame()->RadioButton1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
345     connect( mainFrame()->RadioButton2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
346     connect( mainFrame()->RadioButton3, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
347     connect( mainFrame()->RadioButton4, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
348     connect( mainFrame()->RadioButton5, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
349
350     connect( mainFrame()->RadioButton1, SIGNAL(clicked()), this, SLOT( refreshHighlight()) );
351     connect( mainFrame()->RadioButton2, SIGNAL(clicked()), this, SLOT(refreshHighlight()) );
352     connect( mainFrame()->RadioButton1, SIGNAL(clicked()), this, SLOT( refreshHighlight()) );
353     connect( mainFrame()->RadioButton2, SIGNAL(clicked()), this, SLOT(refreshHighlight()) );
354     connect( mainFrame()->RadioButton1, SIGNAL(clicked()), this, SLOT( refreshHighlight()) );
355
356     connect( myParamCoord->button(PARAM_VALUE), SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
357     connect( myParamCoord->button(LENGTH_VALUE), SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
358     connect( myParamCoord->button(COORD_VALUE), SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
359
360 }
361
362 void MyBasicGUI_PointDlg::showEvent ( QShowEvent * event )
363 {
364     HexaBaseDialog::showEvent(event);
365     if (getConstructorId() == GEOM_POINT_XYZ)
366         HEXABLOCKGUI::currentOccGView->setSelectionMode(TopAbs_VERTEX);
367 }
368 //===============================================================
369 // function : updateHelpFileName()
370 // purpose  : update the help file according to the current panel
371 //===============================================================
372 void MyBasicGUI_PointDlg::updateHelpFileName()
373 {
374     if ( sender() == mainFrame()->RadioButton1 ){
375         _helpFileName = "gui_asso_quad_to_geom.html#associate-to-a-vertex-of-the-geometry";
376     } else if ( sender() == mainFrame()->RadioButton2 ){
377         _helpFileName = "gui_asso_vertex_to_geom.html#by-a-reference";
378     } else if ( sender() == mainFrame()->RadioButton3 ){
379         _helpFileName = "gui_asso_vertex_to_geom.html#by-an-edge-and-a-parameter";
380     } else if ( sender() == mainFrame()->RadioButton4 ){
381         _helpFileName = "gui_asso_vertex_to_geom.html#by-intersection-of-two-lines-or-wires";
382     } else if ( sender() == mainFrame()->RadioButton5 ){
383         _helpFileName = "gui_asso_vertex_to_geom.html#by-a-face-and-two-parameters";
384     } else if (sender() == myParamCoord->button(PARAM_VALUE)){
385         if (mainFrame()->RadioButton3->isChecked()){
386             _helpFileName = "gui_asso_vertex_to_geom.html#by-an-edge-and-a-parameter";
387         } else if (mainFrame()->RadioButton5->isChecked()){
388             _helpFileName = "gui_asso_vertex_to_geom.html#by-a-face-and-two-parameters";
389         }
390     } else if (sender() == myParamCoord->button(LENGTH_VALUE)){
391         _helpFileName = "gui_asso_vertex_to_geom.html#by-an-edge-and-a-length";
392     } else if (sender() == myParamCoord->button(COORD_VALUE)){
393         if (mainFrame()->RadioButton3->isChecked()){
394             _helpFileName = "gui_asso_vertex_to_geom.html#by-an-edge-and-coordinates";
395         } else if (mainFrame()->RadioButton5->isChecked()){
396             _helpFileName = "gui_asso_vertex_to_geom.html#by-a-face-and-coordinates";
397         }
398     }
399 }
400
401 //=================================================================================
402 // function : SetDoubleSpinBoxStep()
403 // purpose  : Double spin box management
404 //=================================================================================
405 void MyBasicGUI_PointDlg::SetDoubleSpinBoxStep(double step)
406 {
407     GroupOnCurve->SpinBox_DX->setSingleStep(step);
408     GroupXYZ->SpinBox_DX->setSingleStep(step);
409     GroupXYZ->SpinBox_DY->setSingleStep(step);
410     GroupXYZ->SpinBox_DZ->setSingleStep(step);
411     GroupRefPoint->SpinBox_DX->setSingleStep(step);
412     GroupRefPoint->SpinBox_DY->setSingleStep(step);
413     GroupRefPoint->SpinBox_DZ->setSingleStep(step);
414 }
415
416
417 //=================================================================================
418 // function : ConstructorsClicked()
419 // purpose  : Radio button management
420 //=================================================================================
421 void MyBasicGUI_PointDlg::ConstructorsClicked(int constructorId)
422 {
423         clearVTKSelection();
424         clearOCCSelection();
425
426     switch (constructorId) {
427     case GEOM_POINT_XYZ:
428     {
429         HEXABLOCKGUI::currentOccGView->setSelectionMode(TopAbs_VERTEX);
430         GroupRefPoint->hide();
431         GroupOnCurve->hide();
432         GroupLineIntersection->hide();
433         GroupOnSurface->hide();
434         myCoordGrp->hide();
435         myParamGroup->hide();
436         GroupXYZ->show();
437         break;
438     }
439     case GEOM_POINT_REF:
440     {
441         myParamGroup->hide();
442         GroupXYZ->hide();
443         GroupOnCurve->hide();
444         GroupLineIntersection->hide();
445         GroupOnSurface->hide();
446         GroupRefPoint->show();
447         myCoordGrp->show();
448         break;
449     }
450     case GEOM_POINT_EDGE:
451     {
452         GroupRefPoint->hide();
453         GroupLineIntersection->hide();
454         GroupOnSurface->hide();
455         myParamGroup->show();
456         myParamCoord->button(LENGTH_VALUE)->show();
457         myParamCoord->button(PARAM_VALUE)->setChecked(true);
458         GroupOnCurve->show();
459         myCoordGrp->show();
460         updateParamCoord(false);
461         break;
462     }
463     case GEOM_POINT_INTINT:
464     {
465         myParamGroup->hide();
466         GroupXYZ->hide();
467         GroupRefPoint->hide();
468         GroupOnCurve->hide();
469         GroupOnSurface->hide();
470         myCoordGrp->show();
471         GroupLineIntersection->show();
472         break;
473     }
474     case GEOM_POINT_SURF:
475     {
476         GroupRefPoint->hide();
477         GroupOnCurve->hide();
478         GroupLineIntersection->hide();
479         myParamGroup->show();
480         myParamCoord->button(LENGTH_VALUE)->hide();
481         myParamCoord->button(PARAM_VALUE)->setChecked(true);
482         GroupOnSurface->show();
483         myCoordGrp->show();
484         updateParamCoord(false);
485         break;
486     }
487     }
488
489     updateInputs(constructorId);
490 }
491
492 //=================================================================================
493 // funcion  : getParameter()
494 // purpose  :
495 //=================================================================================
496 double MyBasicGUI_PointDlg::getParameter() const
497 {
498     return GroupOnCurve->SpinBox_DX->value();
499 }
500
501 //=================================================================================
502 // funcion  : getUParameter()
503 // purpose  :
504 //=================================================================================
505 double MyBasicGUI_PointDlg::getUParameter() const
506 {
507     return GroupOnSurface->SpinBox_DX->value();
508 }
509
510 //=================================================================================
511 // funcion  : getVParameter()
512 // purpose  :
513 //=================================================================================
514 double MyBasicGUI_PointDlg::getVParameter() const
515 {
516     return GroupOnSurface->SpinBox_DY->value();
517 }
518
519 void MyBasicGUI_PointDlg::onParamValueChanged(double newValue)
520 {
521     if (getConstructorId() == GEOM_POINT_EDGE)
522         paramInputValue[myParamCoord->checkedId()] = newValue;
523 }
524
525 // ============================================================== onSelectionChanged
526 /*
527  * Puts elements selected in the model in the corresponding widget (list widget or line edit)
528  * of the current dialog box.
529  */
530 void MyBasicGUI_PointDlg::onSelectionChanged( const QItemSelection& sel, const QItemSelection& unsel )
531 {
532     QModelIndexList l = sel.indexes();
533     if ( l.count() == 0)
534         return;
535
536     QModelIndex selected = l[0];
537     int selectedType = selected.data(HEXA_TREE_ROLE).toInt();
538     // fill the coordinates of the selected point
539     if ( getConstructorId() == GEOM_POINT_XYZ && selectedType == GEOMPOINT_TREE)
540     {
541         DocumentModel::GeomObj* geomObj = getGeomObj(selected);
542         if (geomObj == NULL)
543             return;
544
545         DocumentModel* docModel = getDocumentModel();
546         QString objId =  geomObj->shapeName + "," + geomObj->subId;
547         HEXA_NS::SubShape* ssh = docModel->getGeomPtr(objId);
548         if (ssh == NULL)
549             return;
550         TopoDS_Shape shape = ssh->getShape();
551         if (shape.IsNull() || shape.ShapeType() != TopAbs_VERTEX)
552             return;
553         TopoDS_Vertex vertex = TopoDS::Vertex(shape);
554         gp_Pnt pnt = BRep_Tool::Pnt(vertex);
555         OnPointSelected(pnt);
556         return;
557     }
558
559     QLineEdit*   aLineEdit   = NULL;
560     QListWidget* aListWidget = NULL;
561
562     // * put selection in the current line edit
563     aLineEdit = dynamic_cast<QLineEdit*>(_currentObj);
564     if ( aLineEdit != NULL )
565     {
566         _onSelectionChanged( sel, aLineEdit );
567         return;
568     }
569
570     // * put selection in the current list widget
571     aListWidget = dynamic_cast<QListWidget*>(_currentObj);
572     if ( aListWidget )
573         _onSelectionChanged( sel, aListWidget );
574 }
575
576
577 bool MyBasicGUI_PointDlg::apply(QModelIndex& result)
578 {
579     PatternGeomSelectionModel* pgsm = getPatternGeomSelectionModel();
580     PatternDataSelectionModel* pdsm = getPatternDataSelectionModel();
581     PatternDataModel* pdm = getPatternDataModel();
582     DocumentModel* docModel = getDocumentModel();
583
584     // get the selected vertex in the vtk view
585     QVariant v = mainFrame()->_vertex_le->property("QModelIndex");
586     if ( !v.isValid() )
587     {
588         SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE VERTEX ASSOCIATION" ) );
589         return false;
590     }
591     QModelIndex iVertex = pdm->mapToSource( v.value<QModelIndex>() );
592
593     // get the selected vertex in the geometry (occ view)
594     TopoDS_Vertex geomVertex = computeGeomVertex();
595
596     // control
597     if (!iVertex.isValid() || geomVertex.IsNull())
598     {
599         SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE VERTEX ASSOCIATION" ) );
600         return false;
601     }
602
603     // * set association
604     gp_Pnt aPnt = BRep_Tool::Pnt(geomVertex);
605     if (!docModel->setVertexAssociation(iVertex, aPnt.X(), aPnt.Y(), aPnt.Z()))
606     {
607         SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE VERTEX ASSOCIATION" ) );
608         return false;
609     }
610
611     // * update data in the occ view and the geom tree
612     HEXABLOCKGUI::currentOccGView->addVertexToCloud(geomVertex);
613     docModel->updateGeomTree();
614
615     // highlight associated items
616     QModelIndex iGeomVertex = docModel->getVertexAssociation(iVertex);
617     QModelIndexList list1, list2;
618     result = v.value<QModelIndex>();
619     list1 << result;
620     list2 << iGeomVertex;
621     pdsm->highlightTreeItems(list1); // data tree
622     pgsm->highlightTreeItems(list2); // geom tree
623     setFocus();
624     _updateCurrentObject(NULL);
625     HEXABLOCKGUI::currentOccGView->setSelectionMode(TopAbs_VERTEX);
626     HEXABLOCKGUI::currentDocGView->highlight(list1); // vtk view
627     HEXABLOCKGUI::currentOccGView->highlight(list1); // occ view
628
629     return true;
630 }
631
632
633 void MyBasicGUI_PointDlg::onXCoordChanged(double newValue)
634 {
635     int constructorId = getConstructorId();
636     if (constructorId != GEOM_POINT_XYZ && constructorId != GEOM_POINT_EDGE &&
637             constructorId != GEOM_POINT_SURF)
638         return;
639     coordsInputValue[constructorId]->setX(newValue);
640 }
641
642 void MyBasicGUI_PointDlg::onYCoordChanged(double newValue)
643 {
644     int constructorId = getConstructorId();
645     if (constructorId != GEOM_POINT_XYZ && constructorId != GEOM_POINT_EDGE &&
646             constructorId != GEOM_POINT_SURF)
647         return;
648     coordsInputValue[constructorId]->setY(newValue);
649 }
650
651 void MyBasicGUI_PointDlg::onZCoordChanged(double newValue)
652 {
653     int constructorId = getConstructorId();
654     if (constructorId != GEOM_POINT_XYZ && constructorId != GEOM_POINT_EDGE &&
655             constructorId != GEOM_POINT_SURF)
656         return;
657     coordsInputValue[constructorId]->setZ(newValue);
658
659 }
660
661 void MyBasicGUI_PointDlg::onUpdateResults(const QString& data)
662 {
663     if (getConstructorId() == GEOM_POINT_XYZ)
664         return;
665
666     // * compute the geom vertex
667     TopoDS_Vertex vertex = computeGeomVertex(true);
668
669     // * update results
670     if (vertex.IsNull())
671     {
672         myX->setText("");
673         myY->setText("");
674         myZ->setText("");
675         return;
676     }
677     gp_Pnt pnt = BRep_Tool::Pnt(vertex);
678     myX->setText(MyDlgRef::PrintDoubleValue(pnt.X(), 6));
679     myY->setText(MyDlgRef::PrintDoubleValue(pnt.Y(), 6));
680     myZ->setText(MyDlgRef::PrintDoubleValue(pnt.Z(), 6));
681 }
682
683 TopoDS_Vertex MyBasicGUI_PointDlg::computeGeomVertex(bool preview)
684 {
685     TopoDS_Vertex vertex;
686     int constructorId = getConstructorId();
687
688     //display an emply vertex to erase the current preview
689     HEXABLOCKGUI::currentOccGView->displayPreview(vertex);
690
691     // compute the point
692     switch (constructorId) {
693     case GEOM_POINT_XYZ:
694         vertex = computeGeomPointXYZ();
695         break;
696     case GEOM_POINT_REF:
697         vertex = computeGeomPointRef();
698         break;
699     case GEOM_POINT_EDGE:
700         vertex = computeGeomPointEdge();
701         break;
702     case GEOM_POINT_INTINT:
703         vertex = computeGeomPointInt();
704         break;
705     case GEOM_POINT_SURF:
706         vertex = computeGeomPointSurf();
707         break;
708     default:
709         break;
710     }
711
712     // * display preview of computed point
713     if (preview)
714         HEXABLOCKGUI::currentOccGView->displayPreview(vertex);
715
716     return vertex;
717 }
718
719 TopoDS_Vertex MyBasicGUI_PointDlg::computeGeomPointXYZ()
720 {
721     TopoDS_Vertex vertex;
722
723     if (getConstructorId() != GEOM_POINT_XYZ)
724         return vertex;
725
726     // - X, Y, Z Coords
727     double x = GroupXYZ->SpinBox_DX->value();
728     double y = GroupXYZ->SpinBox_DY->value();
729     double z = GroupXYZ->SpinBox_DZ->value();
730
731     // - compute the resulting vertex
732     vertex = makePoint(x, y, z);
733
734     return vertex;
735 }
736
737 TopoDS_Vertex MyBasicGUI_PointDlg::computeGeomPointRef()
738 {
739     TopoDS_Vertex vertex;
740
741     if (getConstructorId() != GEOM_POINT_REF)
742         return vertex;
743
744     // get parameters from widgets
745     double dx = GroupRefPoint->SpinBox_DX->value();
746     double dy = GroupRefPoint->SpinBox_DY->value();
747     double dz = GroupRefPoint->SpinBox_DZ->value();
748
749     QVariant v = GroupRefPoint->LineEdit1->property("TopoDS_Shape");
750     if ( !v.isValid() )
751         return vertex;
752     TopoDS_Shape shape = v.value<TopoDS_Shape>();
753
754     // compute the resulting point
755     vertex = makePointWithReference(shape, dx, dy, dz);
756
757     return vertex;
758 }
759
760 TopoDS_Vertex MyBasicGUI_PointDlg::computeGeomPointEdge()
761 {
762     TopoDS_Vertex vertex;
763
764     if (getConstructorId() != GEOM_POINT_EDGE)
765         return vertex;
766
767     // * get inputs values
768
769     // - the edge
770     QVariant v1 = GroupOnCurve->LineEdit1->property("TopoDS_Shape");
771     if ( !v1.isValid() )
772         return vertex;
773     TopoDS_Shape edgeShape = v1.value<TopoDS_Shape>();
774
775     bool isParam =  myParamCoord->checkedId() == PARAM_VALUE;
776     bool isLength = myParamCoord->checkedId() == LENGTH_VALUE;
777     bool isCoord  = myParamCoord->checkedId() == COORD_VALUE;
778     if (isParam)
779     {
780         // - param
781         double param = GroupOnCurve->SpinBox_DX->value();
782
783         // - compute the resulting vertex
784         vertex = makePointOnCurve(edgeShape, param);
785     }
786     else if (isLength)
787     {
788         // - the starting point
789         QVariant v2 = GroupOnCurve->LineEdit2->property("TopoDS_Shape");
790         if ( !v2.isValid() )
791                 return vertex;
792         TopoDS_Shape pointShape = v2.value<TopoDS_Shape>();
793
794         // - length
795         double length = GroupOnCurve->SpinBox_DX->value();
796
797         // - compute the resulting vertex
798         vertex = makePointOnCurveByLength(edgeShape, pointShape,length);
799     }
800     else if (isCoord)
801     {
802         // - X, Y, Z Coords
803         double x = GroupXYZ->SpinBox_DX->value();
804         double y = GroupXYZ->SpinBox_DY->value();
805         double z = GroupXYZ->SpinBox_DZ->value();
806
807         // - compute the resulting vertex
808         vertex = makePointOnCurveByCoord(edgeShape, x, y, z);
809     }
810
811     return vertex;
812 }
813
814 TopoDS_Vertex MyBasicGUI_PointDlg::computeGeomPointInt()
815 {
816     TopoDS_Vertex vertex;
817
818     if (getConstructorId() != GEOM_POINT_INTINT)
819         return vertex;
820
821     QVariant v;
822
823     // * get inputs values
824
825     // - get edge 1
826     v = GroupLineIntersection->LineEdit1->property("TopoDS_Shape");
827     if ( !v.isValid() )
828         return vertex;
829     TopoDS_Shape line1 = v.value<TopoDS_Shape>();
830
831     // - get edge 2
832     v = GroupLineIntersection->LineEdit2->property("TopoDS_Shape");
833     if ( !v.isValid() )
834         return vertex;
835     TopoDS_Shape line2 = v.value<TopoDS_Shape>();
836
837     // * compute the resulting vertex
838     vertex = makePointOnLinesIntersection(line1, line2);
839
840     return vertex;
841 }
842
843 TopoDS_Vertex MyBasicGUI_PointDlg::computeGeomPointSurf()
844 {
845     TopoDS_Vertex vertex;
846
847     if (getConstructorId() != GEOM_POINT_SURF)
848         return vertex;
849
850     // * get inputs values
851
852     // - the face
853     QVariant v = GroupOnSurface->LineEdit1->property("TopoDS_Shape");
854     if ( !v.isValid() )
855         return vertex;
856     TopoDS_Shape faceShape = v.value<TopoDS_Shape>();
857
858     bool isParam =  myParamCoord->checkedId() == PARAM_VALUE;
859     bool isCoord  = myParamCoord->checkedId() == COORD_VALUE;
860     if (isParam)
861     {
862         // - params U,V
863         double param_u = GroupOnSurface->SpinBox_DX->value();
864         double param_v = GroupOnSurface->SpinBox_DY->value();
865
866         // - compute the resulting vertex
867         vertex = makePointOnSurface(faceShape, param_u, param_v);
868     }
869     else if (isCoord)
870     {
871         // - X, Y, Z Coords
872         double x = GroupXYZ->SpinBox_DX->value();
873         double y = GroupXYZ->SpinBox_DY->value();
874         double z = GroupXYZ->SpinBox_DZ->value();
875
876         // - compute the resulting vertex
877         vertex = makePointOnSurfaceByCoord(faceShape, x, y, z);
878     }
879
880     return vertex;
881 }
882
883 //=================================================================================
884 // function : OnPointSelected
885 // purpose  :
886 //=================================================================================
887 void MyBasicGUI_PointDlg::OnPointSelected(const gp_Pnt& thePnt)
888 {
889     if (getConstructorId() == GEOM_POINT_XYZ) {
890         GroupXYZ->SpinBox_DX->setValue(thePnt.X());
891         GroupXYZ->SpinBox_DY->setValue(thePnt.Y());
892         GroupXYZ->SpinBox_DZ->setValue(thePnt.Z());
893     }
894 }
895
896 void MyBasicGUI_PointDlg::updateInputs(const int constructorId)
897 {
898     QString str;
899     QVector3D* coords = NULL;
900
901     switch (constructorId) {
902     case GEOM_POINT_XYZ :
903         coords = coordsInputValue[GEOM_POINT_XYZ];
904         break;
905     case GEOM_POINT_REF:
906         break;
907     case GEOM_POINT_EDGE:
908         coords = coordsInputValue[GEOM_POINT_EDGE];
909         updateParamCoord(true);
910         break;
911     case GEOM_POINT_INTINT:
912         break;
913     case GEOM_POINT_SURF:
914         coords = coordsInputValue[GEOM_POINT_SURF];
915         updateParamCoord(true);
916         break;
917     default:
918         break;
919     }
920
921     if (coords != NULL)
922     {
923         GroupXYZ->SpinBox_DX->setValue(coords->x());
924         GroupXYZ->SpinBox_DY->setValue(coords->y());
925         GroupXYZ->SpinBox_DZ->setValue(coords->z());
926     }
927
928     onUpdateResults(str);
929 }
930
931 //=================================================================================
932 // function : ClickParamCoord()
933 // purpose  :
934 //=================================================================================
935 void MyBasicGUI_PointDlg::ClickParamCoord(int id)
936 {
937     updateInputs(getConstructorId());
938 }
939
940 //=================================================================================
941 // function : updateParamCoord
942 // purpose  :
943 //=================================================================================
944 void MyBasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
945 {
946     bool isParam = myParamCoord->checkedId() == PARAM_VALUE;
947     bool isLength = myParamCoord->checkedId() == LENGTH_VALUE;
948
949     const int id = getConstructorId();
950     if (id == GEOM_POINT_EDGE) {
951         GroupOnCurve->TextLabel2->setVisible(isLength);
952         GroupOnCurve->LineEdit2->setVisible(isLength);
953         GroupOnCurve->TextLabel3->setVisible(isParam || isLength);
954         GroupOnCurve->SpinBox_DX->setVisible(isParam || isLength);
955         if (isParam){
956             GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
957             double value = paramInputValue[PARAM_VALUE];
958             GroupOnCurve->SpinBox_DX->setValue(0.5);
959             initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1.);
960             GroupOnCurve->SpinBox_DX->setValue(value);
961         }
962         else if (isLength){
963             GroupOnCurve->TextLabel3->setText(tr("GEOM_LENGTH"));
964             double value = paramInputValue[LENGTH_VALUE];
965             GroupOnCurve->SpinBox_DX->setValue(0.5);
966             initSpinBox(GroupOnCurve->SpinBox_DX, COORD_MIN, COORD_MAX);
967             GroupOnCurve->SpinBox_DX->setValue(value);
968         }
969     }
970     else if (id == GEOM_POINT_SURF) {
971         GroupOnSurface->TextLabel2->setShown(isParam);
972         GroupOnSurface->TextLabel3->setShown(isParam);
973         GroupOnSurface->SpinBox_DX->setShown(isParam);
974         GroupOnSurface->SpinBox_DY->setShown(isParam);
975     }
976
977     GroupXYZ->setShown(!isParam && !isLength);
978 }
979
980 //=================================================================================
981 // function : onBtnPopup()
982 // purpose  :
983 //=================================================================================
984 void MyBasicGUI_PointDlg::onBtnPopup(QAction* a)
985 {
986     if (a == action_line1_edge)
987     {
988         GroupLineIntersection->LineEdit1->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) );
989         GroupLineIntersection->LineEdit1->setFocus();
990         GroupLineIntersection->PushButton2->setDown(false);
991     }
992     else if (a == action_line1_wire)
993     {
994         GroupLineIntersection->LineEdit1->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_WIRE) );
995         GroupLineIntersection->LineEdit1->setFocus();
996         GroupLineIntersection->PushButton2->setDown(false);
997     }
998     else if (a == action_line2_edge)
999     {
1000         GroupLineIntersection->LineEdit2->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) );
1001         GroupLineIntersection->LineEdit2->setFocus();
1002         GroupLineIntersection->PushButton1->setDown(false);
1003     }
1004     else if (a == action_line2_wire)
1005     {
1006         GroupLineIntersection->LineEdit2->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_WIRE) );
1007         GroupLineIntersection->LineEdit2->setFocus();
1008         GroupLineIntersection->PushButton1->setDown(false);
1009     }
1010 }
1011
1012 //=================================================================================
1013 // function : updateSize
1014 // purpose  : adjust dialog size to minimum
1015 //=================================================================================
1016 void MyBasicGUI_PointDlg::updateSize()
1017 {
1018     qApp->processEvents();
1019     updateGeometry();
1020     resize(minimumSizeHint());
1021 }
1022
1023 void MyBasicGUI_PointDlg::clear()
1024 {
1025     mainFrame()->_vertex_le->clear();
1026     modelUnregister(mainFrame()->_vertex_le);
1027
1028     GroupRefPoint->LineEdit1->clear();
1029     GroupRefPoint->LineEdit1->setProperty("TopoDS_Shape", QVariant());
1030     GroupRefPoint->LineEdit1->setProperty("QModelIndex", QVariant());
1031     GroupRefPoint->LineEdit1->setProperty("HexaData", QVariant());
1032
1033     GroupOnCurve->LineEdit1->clear();
1034     GroupOnCurve->LineEdit1->setProperty("TopoDS_Shape", QVariant());
1035     GroupOnCurve->LineEdit1->setProperty("QModelIndex", QVariant());
1036     GroupOnCurve->LineEdit1->setProperty("HexaData", QVariant());
1037
1038     GroupOnCurve->LineEdit2->clear();
1039     GroupOnCurve->LineEdit2->setProperty("TopoDS_Shape", QVariant());
1040     GroupOnCurve->LineEdit2->setProperty("QModelIndex", QVariant());
1041     GroupOnCurve->LineEdit2->setProperty("HexaData", QVariant());
1042
1043     GroupLineIntersection->LineEdit1->clear();
1044     GroupLineIntersection->LineEdit1->setProperty("TopoDS_Shape", QVariant());
1045     GroupLineIntersection->LineEdit1->setProperty("QModelIndex", QVariant());
1046     GroupLineIntersection->LineEdit1->setProperty("HexaData", QVariant());
1047
1048     GroupLineIntersection->LineEdit2->clear();
1049     GroupLineIntersection->LineEdit2->setProperty("TopoDS_Shape", QVariant());
1050     GroupLineIntersection->LineEdit2->setProperty("QModelIndex", QVariant());
1051     GroupLineIntersection->LineEdit2->setProperty("HexaData", QVariant());
1052
1053     GroupOnSurface->LineEdit1->clear();
1054     GroupOnSurface->LineEdit1->setProperty("TopoDS_Shape", QVariant());
1055     GroupOnSurface->LineEdit1->setProperty("QModelIndex", QVariant());
1056     GroupOnSurface->LineEdit1->setProperty("HexaData", QVariant());
1057
1058     modelUnregister(this);
1059 }
1060
1061
1062 void MyBasicGUI_PointDlg::onWindowActivated(SUIT_ViewManager* vm)
1063 {
1064     QString vmType = vm->getType();
1065     if ( ((vmType == SVTK_Viewer::Type()) || (vmType == VTKViewer_Viewer::Type())) &&
1066             !mainFrame()->RadioButton4->isChecked() &&
1067             !myParamCoord->button(LENGTH_VALUE)->isChecked() )
1068         mainFrame()->_vertex_le->setFocus();
1069     else if ( vmType == OCCViewer_Viewer::Type() ){
1070         if (mainFrame()->RadioButton1->isChecked())
1071             // Make the field "Vertex of the model" lose the focus
1072             mainFrame()->RadioButton1->click();
1073         else if (mainFrame()->RadioButton2->isChecked())
1074             GroupRefPoint->LineEdit1->setFocus();
1075         else if (mainFrame()->RadioButton3->isChecked() &&
1076                 !myParamCoord->button(LENGTH_VALUE)->isChecked())
1077             GroupOnCurve->LineEdit1->setFocus();
1078         else if (mainFrame()->RadioButton5->isChecked())
1079             GroupOnSurface->LineEdit1->setFocus();
1080     }
1081 }