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