]> SALOME platform Git repositories - modules/hexablock.git/blob - src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx
Salome HOME
cb99ce6e26355085a0b619ddfd1c145c2aef4e29
[modules/hexablock.git] / src / HEXABLOCKGUI / MyBasicGUI_PointDlg.cxx
1 // Copyright (C) 2009-2012  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.
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 <GeometryGUI.h>
28 #include <GEOMBase.h>
29
30 #include "MyDlgRef.hxx"
31
32 #include <GEOMImpl_Types.hxx>
33
34 #include <QApplication>
35 #include <QButtonGroup>
36 #include <QHBoxLayout>
37 #include <QLabel>
38 #include <QRadioButton>
39 #include <QMenu>
40 #include <QTimer>
41
42 #include <gp_Pnt.hxx>
43 #include <TopoDS_Shape.hxx>
44 #include <TopAbs_ShapeEnum.hxx>
45 #include <TopoDS.hxx>
46 #include <BRep_Tool.hxx>
47 #include <TopExp.hxx>
48 #include <TColStd_IndexedMapOfInteger.hxx>
49 #include <TopTools_IndexedMapOfShape.hxx>
50
51
52 #include <VTKViewer_ViewModel.h>
53 #include <SUIT_MessageBox.h>
54 #include <SUIT_OverrideCursor.h>
55 #include <SalomeApp_Tools.h>
56 #include <SalomeApp_Study.h>
57
58 #include "HEXABLOCKGUI_DocumentModel.hxx"
59 #include "HEXABLOCKGUI_DocumentSelectionModel.hxx"
60 #include "HEXABLOCKGUI_DocumentItem.hxx"
61 #include "HEXABLOCKGUI_SalomeTools.hxx"
62 #include "HEXABLOCKGUI.hxx"
63 #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx"
64
65 #define PARAM_VALUE 0
66 #define COORD_VALUE 1
67 #define LENGTH_VALUE 2
68
69 #define GEOM_POINT_XYZ    0
70 #define GEOM_POINT_REF    1
71 #define GEOM_POINT_EDGE   2
72 #define GEOM_POINT_INTINT 3
73 #define GEOM_POINT_SURF   4
74
75 #define SPACING 6
76 #define MARGIN  9
77
78 using namespace HEXABLOCK::GUI;
79
80 Q_DECLARE_METATYPE(QModelIndex);
81 Q_DECLARE_METATYPE(HEXABLOCK::GUI::HexaTreeRole);
82
83 enum { SelectEdge, SelectWire };
84
85 //=================================================================================
86 // class    : MyBasicGUI_PointDlg()
87 // purpose  : Constructs a MyBasicGUI_PointDlg which is a child of 'parent', with the
88 //            name 'name' and widget flags set to 'f'.
89 //            The dialog will by default be modeless, unless you set 'modal' to
90 //            TRUE to construct a modal dialog.
91 //=================================================================================
92 MyBasicGUI_PointDlg::MyBasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
93                                       bool modal, Qt::WindowFlags fl)
94   : MyGEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
95     myBusy (false),
96     _documentModel(0),
97     _patternDataSelectionModel(0),
98     _currentObj(0),
99     _selectionMutex(false)
100 {
101   QWidget* w = centralWidget();
102   QString objectName = w->objectName();
103   QString className = w->metaObject()->className();
104 ;
105   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
106   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT")));
107   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_EDGE")));
108   QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
109   QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_REF")));
110   QPixmap image4 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_LINES")));
111   QPixmap image5 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_FACE")));
112   QPixmap image6 (aResMgr->loadPixmap("GEOM", tr("ICO_LINE")));
113   QPixmap image7 (aResMgr->loadPixmap("GEOM", tr("ICO_WIRE")));
114
115 //   setWindowTitle(tr("GEOM_POINT_TITLE"));
116   setWindowTitle( tr("Vertex Association") );
117   setMinimumWidth(260);
118
119
120
121
122   mainFrame()->GroupConstructors->setTitle(tr("GEOM_POINTS"));
123   mainFrame()->RadioButton1->setIcon(image0);
124   mainFrame()->RadioButton2->setIcon(image3);
125   mainFrame()->RadioButton3->setIcon(image1);
126   mainFrame()->RadioButton4->show();
127   mainFrame()->RadioButton4->setIcon(image4);
128   mainFrame()->RadioButton5->show();
129   mainFrame()->RadioButton5->setIcon(image5);
130
131   myParamGroup = new QGroupBox(centralWidget());
132   myParamCoord = new QButtonGroup(myParamGroup);
133   QHBoxLayout* boxLayout = new QHBoxLayout(myParamGroup);
134   boxLayout->setMargin(MARGIN); boxLayout->setSpacing(SPACING);
135   QRadioButton* btn = new QRadioButton(tr("GEOM_PARAM_VALUE"), myParamGroup);
136   myParamCoord->addButton(btn, PARAM_VALUE);
137   boxLayout->addWidget(btn);
138   btn = new QRadioButton(tr("GEOM_LENGTH_VALUE"), myParamGroup);
139   myParamCoord->addButton(btn, LENGTH_VALUE);
140   boxLayout->addWidget(btn);
141   btn = new QRadioButton(tr("GEOM_COORD_VALUE"), myParamGroup);
142   myParamCoord->addButton(btn, COORD_VALUE);
143   boxLayout->addWidget(btn);
144   myParamCoord->setExclusive(true);
145   myParamCoord->button(PARAM_VALUE)->setChecked(true);
146
147   GroupXYZ = new DlgRef_3Spin(centralWidget());
148   GroupXYZ->GroupBox1->setTitle(tr("GEOM_COORDINATES"));
149   GroupXYZ->TextLabel1->setText(tr("GEOM_X"));
150   GroupXYZ->TextLabel2->setText(tr("GEOM_Y"));
151   GroupXYZ->TextLabel3->setText(tr("GEOM_Z"));
152
153   GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget());
154   GroupOnCurve->GroupBox1->setTitle(tr("GEOM_POINT_ON_EDGE"));
155   GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE"));
156   GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT"));
157   GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
158   GroupOnCurve->PushButton1->setIcon(image2);
159   GroupOnCurve->PushButton2->setIcon(image2);
160
161   GroupOnSurface = new DlgRef_1Sel2Spin(centralWidget());
162   GroupOnSurface->GroupBox1->setTitle(tr("GEOM_POINT_ON_FACE"));
163   GroupOnSurface->TextLabel1->setText(tr("GEOM_FACE"));
164   GroupOnSurface->TextLabel2->setText(tr("GEOM_UPARAMETER"));
165   GroupOnSurface->TextLabel3->setText(tr("GEOM_VPARAMETER"));
166   GroupOnSurface->PushButton1->setIcon(image2);
167
168   GroupRefPoint = new DlgRef_1Sel3Spin(centralWidget());
169   GroupRefPoint->GroupBox1->setTitle(tr("GEOM_REF_POINT"));
170   GroupRefPoint->TextLabel1->setText(tr("GEOM_POINT"));
171   GroupRefPoint->PushButton1->setIcon(image2);
172   GroupRefPoint->TextLabel2->setText(tr("GEOM_DX"));
173   GroupRefPoint->TextLabel3->setText(tr("GEOM_DY"));
174   GroupRefPoint->TextLabel4->setText(tr("GEOM_DZ"));
175
176   /* popup menu for line intersect buttons */
177   myBtnPopup = new QMenu(this);
178   QIcon ico_line = QIcon(image6);
179   QIcon ico_wire = QIcon(image7);
180   myActions[myBtnPopup->addAction(ico_line, tr("GEOM_EDGE"))] = SelectEdge;
181   myActions[myBtnPopup->addAction(ico_wire, tr("GEOM_WIRE"))] = SelectWire;
182
183   GroupLineIntersection = new DlgRef_2Sel(centralWidget());
184   GroupLineIntersection->GroupBox1->setTitle(tr("GEOM_LINE_INTERSECTION"));
185   GroupLineIntersection->TextLabel1->setText(tr("GEOM_LINE1"));
186   GroupLineIntersection->TextLabel2->setText(tr("GEOM_LINE2"));
187   GroupLineIntersection->PushButton1->setIcon(image2);
188   GroupLineIntersection->PushButton1->setMenu(myBtnPopup);
189   GroupLineIntersection->PushButton2->setIcon(image2);
190   GroupLineIntersection->PushButton2->setMenu(myBtnPopup);
191   GroupLineIntersection->LineEdit2->setEnabled(false);
192
193   myCoordGrp = new QGroupBox(tr("GEOM_COORDINATES_RES"), centralWidget());
194   QGridLayout* myCoordGrpLayout = new QGridLayout(myCoordGrp);
195   myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_X"), myCoordGrp), 0, 0);
196   myX = new QLineEdit(myCoordGrp);
197   myCoordGrpLayout->addWidget(myX, 0, 1);
198   myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_Y"), myCoordGrp), 1, 0);
199   myY = new QLineEdit(myCoordGrp);
200   myCoordGrpLayout->addWidget(myY, 1, 1);
201   myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_Z"), myCoordGrp), 2, 0);
202   myZ = new QLineEdit(myCoordGrp);
203   myCoordGrpLayout->addWidget(myZ, 2, 1);
204
205   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
206   layout->setMargin(0); layout->setSpacing(6);
207   layout->addWidget(myParamGroup);
208   layout->addWidget(GroupXYZ);
209   layout->addWidget(GroupOnCurve);
210   layout->addWidget(GroupOnSurface);
211   layout->addWidget(GroupRefPoint);
212   layout->addWidget(GroupLineIntersection);
213   layout->addWidget(myCoordGrp);
214
215
216   myX->setReadOnly(true);
217   myY->setReadOnly(true);
218   myZ->setReadOnly(true);
219
220   myX->setEnabled(false);
221   myY->setEnabled(false);
222   myZ->setEnabled(false);
223
224   QPalette aPal = myX->palette();
225   aPal.setColor(QPalette::Disabled, QPalette::Text, QColor(0, 0, 0));
226   myX->setPalette(aPal);
227   myY->setPalette(aPal);
228   myZ->setPalette(aPal);
229
230   setHelpFileName("gui_asso_quad_to_geom.html#associate-to-a-vertex-of-the-geometry");/*"create_point_page.html"*/
231
232   Init();
233
234   /* HEXABLOCK */
235   _initInputWidget();
236 //  _initViewManager();
237   /* HEXABLOCK */
238 }
239
240
241 //=================================================================================
242 // function : ~MyBasicGUI_PointDlg()
243 // purpose  : Destructor
244 //=================================================================================
245 MyBasicGUI_PointDlg::~MyBasicGUI_PointDlg()
246 {
247 }
248
249 //=================================================================================
250 // function : Init()
251 // purpose  :
252 //=================================================================================
253 void MyBasicGUI_PointDlg::Init()
254 {
255   GroupOnCurve->LineEdit1->setReadOnly(true);
256   GroupOnCurve->LineEdit2->setReadOnly(true);
257   GroupOnSurface->LineEdit1->setReadOnly(true);
258   GroupRefPoint->LineEdit1->setReadOnly(true);
259   GroupLineIntersection->LineEdit1->setReadOnly(true);
260   GroupLineIntersection->LineEdit2->setReadOnly(true);
261   GroupLineIntersection->LineEdit1->setEnabled(true);
262   GroupLineIntersection->LineEdit2->setEnabled(false);
263
264   myEdge.nullify();
265   myFace.nullify();
266   myRefPoint.nullify();
267   myLine1.nullify();
268   myLine2.nullify();
269   myNeedType = TopAbs_VERTEX;
270
271   myEditCurrentArgument = 0;
272
273   /* Get setting of step value from file configuration */
274   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
275   double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
276
277   /* min, max, step and decimals for spin boxes */
278   initSpinBox(GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
279   initSpinBox(GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision");
280   initSpinBox(GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision");
281   GroupXYZ->SpinBox_DX->setValue(0.0);
282   GroupXYZ->SpinBox_DY->setValue(0.0);
283   GroupXYZ->SpinBox_DZ->setValue(0.0);
284
285   initSpinBox(GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
286   initSpinBox(GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision");
287   initSpinBox(GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision");
288   GroupRefPoint->SpinBox_DX->setValue(0.0);
289   GroupRefPoint->SpinBox_DY->setValue(0.0);
290   GroupRefPoint->SpinBox_DZ->setValue(0.0);
291
292   step = 0.1;
293
294   initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision");
295   GroupOnCurve->SpinBox_DX->setValue(0.5);
296
297   initSpinBox(GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision");
298   GroupOnSurface->SpinBox_DX->setValue(0.5);
299   initSpinBox(GroupOnSurface->SpinBox_DY, 0., 1., step, "parametric_precision");
300   GroupOnSurface->SpinBox_DY->setValue(0.5);
301
302   /* signals and slots connections */
303   if ( myGeomGUI ){
304     connect(myGeomGUI,      SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
305     connect(myGeomGUI,      SIGNAL(SignalCloseAllDialogs()),        this, SLOT(close()));
306   }
307   //connect(buttonOk(),     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
308   connect(buttonApply(),  SIGNAL(clicked()), this, SLOT(ClickOnApply()));
309   connect(buttonHelp(), SIGNAL(clicked()), this, SLOT(onHelpRequested()) );
310 //  connect( closeButton, SIGNAL(clicked()), this, SLOT(close()) );
311
312   connect(this,           SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
313
314   connect(myParamCoord,   SIGNAL(buttonClicked(int)), this, SLOT(ClickParamCoord(int)));
315
316   connect(GroupOnCurve->PushButton1,          SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
317   connect(GroupOnCurve->PushButton2,          SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
318   connect(GroupOnSurface->PushButton1,        SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
319   connect(GroupLineIntersection->PushButton1, SIGNAL(pressed()), this, SLOT(SetEditCurrentArgument()));
320   connect(GroupLineIntersection->PushButton2, SIGNAL(pressed()), this, SLOT(SetEditCurrentArgument()));
321
322   connect(myBtnPopup, SIGNAL(triggered(QAction*)), this, SLOT(onBtnPopup(QAction*)));
323
324   connect(GroupOnCurve->SpinBox_DX,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
325   connect(GroupOnSurface->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
326   connect(GroupOnSurface->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
327   connect(GroupXYZ->SpinBox_DX,       SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
328   connect(GroupXYZ->SpinBox_DY,       SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
329   connect(GroupXYZ->SpinBox_DZ,       SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
330   connect(GroupRefPoint->SpinBox_DX,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
331   connect(GroupRefPoint->SpinBox_DY,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
332   connect(GroupRefPoint->SpinBox_DZ,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
333
334   connect( mainFrame()->RadioButton1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
335   connect( mainFrame()->RadioButton2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
336   connect( mainFrame()->RadioButton3, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
337   connect( mainFrame()->RadioButton4, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
338   connect( mainFrame()->RadioButton5, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
339   connect( myParamCoord->button(PARAM_VALUE), SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
340   connect( myParamCoord->button(LENGTH_VALUE), SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
341   connect( myParamCoord->button(COORD_VALUE), SIGNAL(clicked()), this, SLOT(updateHelpFileName()) );
342
343   if ( myGeomGUI ){
344     connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this,  SLOT(SetDoubleSpinBoxStep(double)));
345
346     connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
347             this,  SLOT(SelectionIntoArgument()));
348   }
349
350   initName(tr("GEOM_VERTEX"));
351
352   ConstructorsClicked(0);
353 }
354
355 //=================================================================================
356 // function : onHelpRequested()
357 // purpose  : show help in web browser
358 //=================================================================================
359 void MyBasicGUI_PointDlg::onHelpRequested()
360 {
361         LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
362         if ( app )
363                 //     app->onHelpContextModule( myGeometryGUI ? app->moduleName( myGeometryGUI->moduleName() ) : QString( "" ), _helpFileName );
364                 app->onHelpContextModule( "HEXABLOCK", myHelpFileName );
365
366         else {
367                 QString platform;
368 #ifdef WIN32
369                 platform = "winapplication";
370 #else
371                 platform = "application";
372 #endif
373
374                 SUIT_MessageBox::warning( 0, QObject::tr( "WRN_WARNING" ),
375                                 QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
376                                 arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ),
377                                 QObject::tr( "BUT_OK" ) );
378         }
379 }
380
381 //===============================================================
382 // function : updateHelpFileName()
383 // purpose  : update the help file according to the current panel
384 //===============================================================
385 void MyBasicGUI_PointDlg::updateHelpFileName()
386 {
387         if ( sender() == mainFrame()->RadioButton1 ){
388                 setHelpFileName("gui_asso_quad_to_geom.html#associate-to-a-vertex-of-the-geometry");
389         } else if ( sender() == mainFrame()->RadioButton2 ){
390                 setHelpFileName("gui_asso_vertex_to_geom.html#by-a-reference");
391         } else if ( sender() == mainFrame()->RadioButton3 ){
392                 setHelpFileName("gui_asso_vertex_to_geom.html#by-an-edge-and-a-parameter");
393         } else if ( sender() == mainFrame()->RadioButton4 ){
394                 setHelpFileName("gui_asso_vertex_to_geom.html#by-intersection-of-two-lines-or-wires");
395         } else if ( sender() == mainFrame()->RadioButton5 ){
396                 setHelpFileName("gui_asso_vertex_to_geom.html#by-a-face-and-two-parameters");
397         } else if (sender() == myParamCoord->button(PARAM_VALUE)){
398                 if (mainFrame()->RadioButton3->isChecked()){
399                         setHelpFileName("gui_asso_vertex_to_geom.html#by-an-edge-and-a-parameter");
400                 } else if (mainFrame()->RadioButton5->isChecked()){
401                         setHelpFileName("gui_asso_vertex_to_geom.html#by-a-face-and-two-parameters");
402                 }
403         } else if (sender() == myParamCoord->button(LENGTH_VALUE)){
404                         setHelpFileName("gui_asso_vertex_to_geom.html#by-an-edge-and-a-length");
405         } else if (sender() == myParamCoord->button(COORD_VALUE)){
406                 if (mainFrame()->RadioButton3->isChecked()){
407                         setHelpFileName("gui_asso_vertex_to_geom.html#by-an-edge-and-coordinates");
408                 } else if (mainFrame()->RadioButton5->isChecked()){
409                         setHelpFileName("gui_asso_vertex_to_geom.html#by-a-face-and-coordinates");
410                 }
411         }
412 }
413
414 //=================================================================================
415 // function : SetDoubleSpinBoxStep()
416 // purpose  : Double spin box management
417 //=================================================================================
418 void MyBasicGUI_PointDlg::SetDoubleSpinBoxStep(double step)
419 {
420   GroupOnCurve->SpinBox_DX->setSingleStep(step);
421   GroupXYZ->SpinBox_DX->setSingleStep(step);
422   GroupXYZ->SpinBox_DY->setSingleStep(step);
423   GroupXYZ->SpinBox_DZ->setSingleStep(step);
424   GroupRefPoint->SpinBox_DX->setSingleStep(step);
425   GroupRefPoint->SpinBox_DY->setSingleStep(step);
426   GroupRefPoint->SpinBox_DZ->setSingleStep(step);
427 }
428
429
430 //=================================================================================
431 // function : ConstructorsClicked()
432 // purpose  : Radio button management
433 //=================================================================================
434 void MyBasicGUI_PointDlg::ConstructorsClicked(int constructorId)
435 {
436 //   HEXABLOCKGUI::currentOccView->raise();
437 //   HEXABLOCKGUI::currentOccView->setFocus();
438   switch (constructorId) {
439   case GEOM_POINT_XYZ:
440     {
441       globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
442       myNeedType = TopAbs_VERTEX;
443       localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType);
444
445       GroupRefPoint->hide();
446       GroupOnCurve->hide();
447       GroupLineIntersection->hide();
448       GroupOnSurface->hide();
449       myCoordGrp->hide();
450       myParamGroup->hide();
451       GroupXYZ->show();
452       break;
453     }
454   case GEOM_POINT_REF:
455     {
456       globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
457       myNeedType = TopAbs_VERTEX;
458       localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType);
459
460       myEditCurrentArgument = GroupRefPoint->LineEdit1;
461       //myEditCurrentArgument->setText("");
462       //myRefPoint.nullify();
463       GroupRefPoint->PushButton1->setDown(true);
464       myParamGroup->hide();
465       GroupXYZ->hide();
466       GroupOnCurve->hide();
467       GroupLineIntersection->hide();
468       GroupOnSurface->hide();
469       GroupRefPoint->show();
470       myCoordGrp->show();
471       break;
472     }
473   case GEOM_POINT_EDGE:
474     {
475       globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
476       myNeedType = TopAbs_EDGE;
477       localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType);
478
479       myEditCurrentArgument = GroupOnCurve->LineEdit1;
480 //      myEditCurrentArgument->setText("");
481 //      myEdge.nullify();
482 //      myRefPoint.nullify();
483       GroupOnCurve->PushButton1->setDown(true);
484       GroupRefPoint->hide();
485       GroupLineIntersection->hide();
486       GroupOnSurface->hide();
487       myParamGroup->show();
488       myParamCoord->button(LENGTH_VALUE)->show();
489       myParamCoord->button(PARAM_VALUE)->setChecked(true);
490       GroupOnCurve->show();
491       myCoordGrp->show();
492       updateParamCoord(false);
493       break;
494     }
495   case GEOM_POINT_INTINT:
496     {
497       globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
498       myNeedType = TopAbs_EDGE;
499       localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType);
500
501       myEditCurrentArgument = GroupLineIntersection->LineEdit1;
502 //      GroupLineIntersection->LineEdit1->setText("");
503 //      GroupLineIntersection->LineEdit2->setText("");
504       GroupLineIntersection->LineEdit1->setEnabled(true);
505       GroupLineIntersection->LineEdit2->setEnabled(false);
506 //      myLine1.nullify();
507 //      myLine2.nullify();
508       GroupLineIntersection->PushButton1->setDown(true);
509       GroupLineIntersection->PushButton2->setDown(false);
510       myParamGroup->hide();
511       GroupXYZ->hide();
512       GroupRefPoint->hide();
513       GroupOnCurve->hide();
514       GroupOnSurface->hide();
515       myCoordGrp->hide();
516       GroupLineIntersection->show();
517       break;
518     }
519   case GEOM_POINT_SURF:
520     {
521       globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
522       myNeedType = TopAbs_FACE;
523       localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType);
524
525       myEditCurrentArgument = GroupOnSurface->LineEdit1;
526       //myEditCurrentArgument->setText("");
527       //myFace.nullify();
528       GroupOnSurface->PushButton1->setDown(true);
529       GroupRefPoint->hide();
530       GroupOnCurve->hide();
531       GroupLineIntersection->hide();
532       myParamGroup->show();
533       myParamCoord->button(LENGTH_VALUE)->hide();
534       myParamCoord->button(PARAM_VALUE)->setChecked(true);
535       GroupOnSurface->show();
536       myCoordGrp->show();
537       updateParamCoord(false);
538       break;
539     }
540   }
541
542 //  myX->setText("");
543 //  myY->setText("");
544 //  myZ->setText("");
545
546   QTimer::singleShot(50, this, SLOT(updateSize()));
547
548   SelectionIntoArgument();
549 }
550
551 //=================================================================================
552 // function : ClickOnOk()
553 // purpose  :
554 //=================================================================================
555 void MyBasicGUI_PointDlg::ClickOnOk()
556 {
557   setIsApplyAndClose(true);
558   if (onAccept())
559     close();
560 }
561
562 //=================================================================================
563 // function : ClickOnApply()
564 // purpose  :
565 //=================================================================================
566 bool MyBasicGUI_PointDlg::ClickOnApply()
567 {
568   if (!onAccept())
569     return false;
570
571   initName();
572 //  ConstructorsClicked(getConstructorId());
573
574   //Set selection mode to the last selected mode
575   globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
576   localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType);
577
578   return true;
579 }
580
581
582 //=================================================================================
583 // function : SelectionIntoArgument()
584 // purpose  : Called when selection as changed (for constructors not using local context)
585 //=================================================================================
586 void MyBasicGUI_PointDlg::SelectionIntoArgument()
587 {
588         GEOM::GeomObjPtr aSelectedObject = getSelected(myNeedType);
589         TopoDS_Shape aShape;
590         if (!aSelectedObject || !GEOMBase::GetShape(aSelectedObject.get(), aShape) || aShape.IsNull())
591                 return;
592
593         erasePreview();
594         const int id = getConstructorId();
595
596         if ((id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF)
597                         && myEditCurrentArgument != 0)
598         {
599                 myEditCurrentArgument->setText("");
600                 myX->setText("");
601                 myY->setText("");
602                 myZ->setText("");
603                 myFace.nullify();
604                 if (myEditCurrentArgument == GroupOnCurve->LineEdit1)
605                         myEdge.nullify();
606                 else if (myEditCurrentArgument == GroupOnCurve->LineEdit2)
607                         myRefPoint.nullify();
608         }
609         else if (id == GEOM_POINT_INTINT) {
610                 myEditCurrentArgument->setText("");
611                 if (myEditCurrentArgument == GroupLineIntersection->LineEdit1)
612                         myLine1.nullify();
613                 else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2)
614                         myLine2.nullify();
615         }
616
617         QString aName = GEOMBase::GetName(aSelectedObject.get());
618         myBusy = true;
619         if (id == GEOM_POINT_XYZ) {
620                 gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
621                 GroupXYZ->SpinBox_DX->setValue(aPnt.X());
622                 GroupXYZ->SpinBox_DY->setValue(aPnt.Y());
623                 GroupXYZ->SpinBox_DZ->setValue(aPnt.Z());
624         }
625         else if (id == GEOM_POINT_REF) {
626                 myRefPoint = aSelectedObject;
627                 GroupRefPoint->LineEdit1->setText(aName);
628         }
629         else if (id == GEOM_POINT_EDGE) {
630                 myEditCurrentArgument->setText(aName);
631                 if (myEditCurrentArgument == GroupOnCurve->LineEdit1) {
632                         myEdge = aSelectedObject;
633                         if (myEdge && !myRefPoint) {
634                                 GroupOnCurve->PushButton2->click();
635                         }
636                 }
637                 else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) {
638                         myRefPoint = aSelectedObject;
639                         if (myRefPoint && !myEdge) {
640                                 GroupOnCurve->PushButton1->click();
641                         }
642                 }
643         }
644         else if (id == GEOM_POINT_INTINT) {
645                 myEditCurrentArgument->setText(aName);
646                 if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) {
647                         myLine1 = aSelectedObject;
648                         if (!myLine2) {
649                                 GroupLineIntersection->PushButton2->setMenu(0);
650                                 GroupLineIntersection->PushButton2->click();
651                                 GroupLineIntersection->PushButton2->setDown(true);
652                                 GroupLineIntersection->PushButton2->setMenu(myBtnPopup);
653                         }
654                 }
655                 else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) {
656                         myLine2 = aSelectedObject;
657                         if (!myLine1) {
658                                 GroupLineIntersection->PushButton1->setMenu(0);
659                                 GroupLineIntersection->PushButton1->click();
660                                 GroupLineIntersection->PushButton1->setDown(true);
661                                 GroupLineIntersection->PushButton1->setMenu(myBtnPopup);
662                         }
663                 }
664         }
665         else if (id == GEOM_POINT_SURF) {
666                 myFace = aSelectedObject;
667                 GroupOnSurface->LineEdit1->setText(aName);
668         }
669         myBusy = false;
670
671
672         displayPreview(true);
673 }
674
675
676 //=================================================================================
677 // function : SetEditCurrentArgument()
678 // purpose  :
679 //=================================================================================
680 void MyBasicGUI_PointDlg::SetEditCurrentArgument()
681 {
682   QPushButton* send = (QPushButton*)sender();
683
684   if (send == GroupRefPoint->PushButton1) {
685     GroupRefPoint->LineEdit1->setFocus();
686     myEditCurrentArgument = GroupRefPoint->LineEdit1;
687     globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
688     localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), TopAbs_VERTEX);
689   }
690   else if (send == GroupOnCurve->PushButton1) {
691     GroupOnCurve->LineEdit1->setFocus();
692     myEditCurrentArgument = GroupOnCurve->LineEdit1;
693     globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
694     myNeedType = TopAbs_EDGE;
695     localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType);
696     GroupOnCurve->PushButton2->setDown(false);
697     GroupOnCurve->LineEdit1->setEnabled(true);
698     GroupOnCurve->LineEdit2->setEnabled(false);
699   }
700   else if (send == GroupOnCurve->PushButton2) {
701     GroupOnCurve->LineEdit2->setFocus();
702     myEditCurrentArgument = GroupOnCurve->LineEdit2;
703     globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
704     myNeedType = TopAbs_VERTEX;
705     localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType);
706     GroupOnCurve->PushButton1->setDown(false);
707     GroupOnCurve->LineEdit2->setEnabled(true);
708     GroupOnCurve->LineEdit1->setEnabled(false);
709   }
710   else if (send == GroupOnSurface->PushButton1)
711   {
712     GroupOnSurface->LineEdit1->setFocus();
713     myEditCurrentArgument = GroupOnSurface->LineEdit1;
714     globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
715     localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), TopAbs_FACE);
716   }
717   else if (send == GroupLineIntersection->PushButton1) {
718     GroupLineIntersection->LineEdit1->setFocus();
719     myEditCurrentArgument = GroupLineIntersection->LineEdit1;
720     GroupLineIntersection->PushButton2->setDown(false);
721     GroupLineIntersection->LineEdit1->setEnabled(true);
722     GroupLineIntersection->LineEdit2->setEnabled(false);
723   }
724   else if (send == GroupLineIntersection->PushButton2) {
725     GroupLineIntersection->LineEdit2->setFocus();
726     myEditCurrentArgument = GroupLineIntersection->LineEdit2;
727     GroupLineIntersection->PushButton1->setDown(false);
728     GroupLineIntersection->LineEdit1->setEnabled(false);
729     GroupLineIntersection->LineEdit2->setEnabled(true);
730   }
731   send->setDown(true);
732
733   if ((send == GroupLineIntersection->PushButton1 ||
734          send == GroupLineIntersection->PushButton2) && !myBusy)
735     SelectionIntoArgument();
736 }
737
738
739 //=================================================================================
740 // function : enterEvent()
741 // purpose  : to reactivate this dialog box when mouse enter onto the window
742 //=================================================================================
743 void MyBasicGUI_PointDlg::enterEvent(QEvent*)
744 {
745   if (!mainFrame()->GroupConstructors->isEnabled())
746     ActivateThisDialog();
747 }
748
749
750 //=================================================================================
751 // function : ActivateThisDialog()
752 // purpose  :
753 //=================================================================================
754 void MyBasicGUI_PointDlg::ActivateThisDialog()
755 {
756   MyGEOMBase_Skeleton::ActivateThisDialog();
757
758   if ( myGeomGUI ){
759     connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
760             this, SLOT(SelectionIntoArgument()));
761   }
762   ConstructorsClicked(getConstructorId());
763 }
764
765
766 //=================================================================================
767 // function : DeactivateActiveDialog()
768 // purpose  : public slot to deactivate if active
769 //=================================================================================
770 void MyBasicGUI_PointDlg::DeactivateActiveDialog()
771 {
772   // myGeomGUI->SetState(-1);
773   MyGEOMBase_Skeleton::DeactivateActiveDialog();
774 }
775
776
777 //=================================================================================
778 // function : ValueChangedInSpinBox()
779 // purpose  :
780 //=================================================================================
781 void MyBasicGUI_PointDlg::ValueChangedInSpinBox(double newValue)
782 {
783   displayPreview(true);
784 }
785
786 //=================================================================================
787 // function : CheckBoxClicked()
788 // purpose  : Check Boxes Management
789 //=================================================================================
790 void MyBasicGUI_PointDlg::CheckBoxClicked(int  State)
791 {
792   displayPreview(true);
793 }
794
795
796 //=================================================================================
797 // funcion  : getParameter()
798 // purpose  :
799 //=================================================================================
800 double MyBasicGUI_PointDlg::getParameter() const
801 {
802   return GroupOnCurve->SpinBox_DX->value();
803 }
804
805
806 //=================================================================================
807 // funcion  : getUParameter()
808 // purpose  :
809 //=================================================================================
810 double MyBasicGUI_PointDlg::getUParameter() const
811 {
812   return GroupOnSurface->SpinBox_DX->value();
813 }
814
815
816 //=================================================================================
817 // funcion  : getVParameter()
818 // purpose  :
819 //=================================================================================
820 double MyBasicGUI_PointDlg::getVParameter() const
821 {
822   return GroupOnSurface->SpinBox_DY->value();
823 }
824
825
826 //=================================================================================
827 // function : OnPointSelected
828 // purpose  :
829 //=================================================================================
830 void MyBasicGUI_PointDlg::OnPointSelected(const gp_Pnt& thePnt)
831 {
832   if (getConstructorId() == GEOM_POINT_XYZ) {
833     GroupXYZ->SpinBox_DX->setValue(thePnt.X());
834     GroupXYZ->SpinBox_DY->setValue(thePnt.Y());
835     GroupXYZ->SpinBox_DZ->setValue(thePnt.Z());
836
837     displayPreview(true);
838   }
839 }
840
841 //=================================================================================
842 // function : createOperation
843 // purpose  :
844 //=================================================================================
845 GEOM::GEOM_IOperations_ptr MyBasicGUI_PointDlg::createOperation()
846 {
847   return myGeomGUI->GetGeomGen()->GetIBasicOperations(getStudyId());
848 }
849
850 //=================================================================================
851 // function : isValid
852 // purpose  :
853 //=================================================================================
854 bool MyBasicGUI_PointDlg::isValid(QString& msg)
855 {
856   bool ok = false;
857   switch (getConstructorId()) {
858   case GEOM_POINT_XYZ :
859     ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) &&
860          GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) &&
861          GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview());
862     break;
863   case GEOM_POINT_REF:
864     ok = GroupRefPoint->SpinBox_DX->isValid(msg, !IsPreview()) &&
865          GroupRefPoint->SpinBox_DY->isValid(msg, !IsPreview()) &&
866          GroupRefPoint->SpinBox_DZ->isValid(msg, !IsPreview()) &&
867          myRefPoint;
868     break;
869   case GEOM_POINT_EDGE:
870     if (myParamCoord->checkedId() == PARAM_VALUE || myParamCoord->checkedId() == LENGTH_VALUE)
871       ok = GroupOnCurve->SpinBox_DX->isValid(msg, !IsPreview());
872     else
873       ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) &&
874            GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) &&
875            GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview());
876     ok = myEdge && ok;
877     break;
878   case GEOM_POINT_INTINT:
879     ok = myLine1 && myLine2;
880     break;
881   case GEOM_POINT_SURF:
882     if (myParamCoord->checkedId() == PARAM_VALUE)
883       ok = GroupOnSurface->SpinBox_DX->isValid(msg, !IsPreview()) &&
884            GroupOnSurface->SpinBox_DY->isValid(msg, !IsPreview());
885     else
886       ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) &&
887            GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) &&
888            GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview());
889     ok = myFace && ok;
890     break;
891   default:
892     break;
893   }
894   return ok;
895 }
896
897 //=================================================================================
898 // function : execute
899 // purpose  :
900 //=================================================================================
901 bool MyBasicGUI_PointDlg::execute(ObjectList& objects)
902 {
903   bool res = false;
904
905   GEOM::GEOM_Object_var anObj;
906   QStringList aParameters;
907
908   GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow(getOperation());
909
910   switch (getConstructorId()) {
911   case GEOM_POINT_XYZ :
912     {
913       double x = GroupXYZ->SpinBox_DX->value();
914       double y = GroupXYZ->SpinBox_DY->value();
915       double z = GroupXYZ->SpinBox_DZ->value();
916
917       aParameters << GroupXYZ->SpinBox_DX->text();
918       aParameters << GroupXYZ->SpinBox_DY->text();
919       aParameters << GroupXYZ->SpinBox_DZ->text();
920
921       anObj = anOper->MakePointXYZ(x, y, z);
922       res = true;
923       break;
924     }
925   case GEOM_POINT_REF :
926     {
927       double dx = GroupRefPoint->SpinBox_DX->value();
928       double dy = GroupRefPoint->SpinBox_DY->value();
929       double dz = GroupRefPoint->SpinBox_DZ->value();
930
931       aParameters << GroupRefPoint->SpinBox_DX->text();
932       aParameters << GroupRefPoint->SpinBox_DY->text();
933       aParameters << GroupRefPoint->SpinBox_DZ->text();
934
935       anObj = anOper->MakePointWithReference(myRefPoint.get(), dx, dy, dz);
936       res = true;
937       break;
938     }
939   case GEOM_POINT_EDGE :
940     {
941       if (myParamCoord->checkedId() == PARAM_VALUE) {
942         anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter());
943         aParameters<<GroupOnCurve->SpinBox_DX->text();
944       }
945       else if (myParamCoord->checkedId() == LENGTH_VALUE) {
946         anObj = anOper->MakePointOnCurveByLength(myEdge.get(), getParameter(), myRefPoint.get());
947         aParameters<<GroupOnCurve->SpinBox_DX->text();
948       }
949       else if (myParamCoord->checkedId() == COORD_VALUE) {
950         double x = GroupXYZ->SpinBox_DX->value();
951         double y = GroupXYZ->SpinBox_DY->value();
952         double z = GroupXYZ->SpinBox_DZ->value();
953
954         aParameters << GroupXYZ->SpinBox_DX->text();
955         aParameters << GroupXYZ->SpinBox_DY->text();
956         aParameters << GroupXYZ->SpinBox_DZ->text();
957
958         anObj = anOper->MakePointOnCurveByCoord(myEdge.get(), x, y, z);
959       }
960       res = true;
961       break;
962     }
963   case GEOM_POINT_INTINT :
964     anObj = anOper->MakePointOnLinesIntersection(myLine1.get(), myLine2.get());
965     if (!anObj->_is_nil()) {
966       QString aName = getNewObjectName();
967       if (anObj->GetShapeType() == GEOM::COMPOUND && aName.startsWith("Vertex"))
968         initName(tr("GEOM_COMPOUND"));
969       else if (anObj->GetShapeType() == GEOM::VERTEX && aName.startsWith("Compound"))
970         initName(tr("GEOM_VERTEX"));
971     }
972     res = true;
973     break;
974   case GEOM_POINT_SURF :
975     {
976       if (myParamCoord->checkedId() == PARAM_VALUE) {
977         anObj = anOper->MakePointOnSurface(myFace.get(), getUParameter(), getVParameter());
978         aParameters<<GroupOnSurface->SpinBox_DX->text();
979         aParameters<<GroupOnSurface->SpinBox_DY->text();
980       } else {
981         double x = GroupXYZ->SpinBox_DX->value();
982         double y = GroupXYZ->SpinBox_DY->value();
983         double z = GroupXYZ->SpinBox_DZ->value();
984
985         aParameters << GroupXYZ->SpinBox_DX->text();
986         aParameters << GroupXYZ->SpinBox_DY->text();
987         aParameters << GroupXYZ->SpinBox_DZ->text();
988
989         anObj = anOper->MakePointOnSurfaceByCoord(myFace.get(), x, y, z);
990       }
991       res = true;
992       break;
993     }
994   }
995
996   const int id = getConstructorId();
997   if(!anObj->_is_nil() && !IsPreview() && (id == GEOM_POINT_XYZ ||
998                                            id == GEOM_POINT_REF ||
999                                            id == GEOM_POINT_EDGE ||
1000                                            id == GEOM_POINT_SURF)) {
1001       anObj->SetParameters(aParameters.join(":").toLatin1().constData());
1002   }
1003
1004   if (id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF) {
1005     TopoDS_Shape aShape;
1006     if (GEOMBase::GetShape(anObj, aShape) && !aShape.IsNull() &&
1007          aShape.ShapeType() == TopAbs_VERTEX) {
1008       gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
1009       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1010       int aPrecision = resMgr->integerValue("Geometry", "length_precision", 6);
1011       myX->setText(DlgRef::PrintDoubleValue(aPnt.X(), aPrecision));
1012       myY->setText(DlgRef::PrintDoubleValue(aPnt.Y(), aPrecision));
1013       myZ->setText(DlgRef::PrintDoubleValue(aPnt.Z(), aPrecision));
1014     }
1015     else {
1016       myX->setText("");
1017       myY->setText("");
1018       myZ->setText("");
1019     }
1020   }
1021
1022   if (!anObj->_is_nil()) {
1023     objects.push_back(anObj._retn());
1024   }
1025
1026   return res;
1027 }
1028
1029 //=================================================================================
1030 // function : addSubshapeToStudy
1031 // purpose  : virtual method to add new SubObjects if local selection
1032 //=================================================================================
1033 void MyBasicGUI_PointDlg::addSubshapesToStudy()
1034 {
1035   switch (getConstructorId()) {
1036   case GEOM_POINT_REF:
1037     GEOMBase::PublishSubObject(myRefPoint.get());
1038     break;
1039   case GEOM_POINT_EDGE:
1040     GEOMBase::PublishSubObject(myEdge.get());
1041     break;
1042   case GEOM_POINT_INTINT:
1043     GEOMBase::PublishSubObject(myLine1.get());
1044     GEOMBase::PublishSubObject(myLine2.get());
1045     break;
1046   case GEOM_POINT_SURF:
1047     GEOMBase::PublishSubObject(myFace.get());
1048     break;
1049   default:
1050     break;
1051   }
1052 }
1053
1054 //=================================================================================
1055 // function : ClickParamCoord()
1056 // purpose  :
1057 //=================================================================================
1058 void MyBasicGUI_PointDlg::ClickParamCoord(int id)
1059 {
1060   updateParamCoord(true);
1061   displayPreview(true);
1062 }
1063
1064 //=================================================================================
1065 // function : updateParamCoord
1066 // purpose  :
1067 //=================================================================================
1068 void MyBasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
1069 {
1070   bool isParam = myParamCoord->checkedId() == PARAM_VALUE;
1071   bool isLength = myParamCoord->checkedId() == LENGTH_VALUE;
1072
1073   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1074   double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
1075
1076   const int id = getConstructorId();
1077   if (id == GEOM_POINT_EDGE) {
1078     GroupOnCurve->TextLabel2->setVisible(isLength);
1079     GroupOnCurve->PushButton2->setVisible(isLength);
1080     GroupOnCurve->LineEdit2->setVisible(isLength);
1081     GroupOnCurve->TextLabel3->setVisible(isParam || isLength);
1082     GroupOnCurve->SpinBox_DX->setVisible(isParam || isLength);
1083     if (isParam){
1084       initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision");
1085 //      GroupOnCurve->SpinBox_DX->setValue(0.5);
1086       GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
1087     }
1088     else if (isLength){
1089       initSpinBox(GroupOnCurve->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
1090 //      GroupOnCurve->SpinBox_DX->setValue(0);
1091       GroupOnCurve->TextLabel3->setText(tr("GEOM_LENGTH"));
1092     }
1093   }
1094   else if (id == GEOM_POINT_SURF) {
1095     GroupOnSurface->TextLabel2->setShown(isParam);
1096     GroupOnSurface->TextLabel3->setShown(isParam);
1097     GroupOnSurface->SpinBox_DX->setShown(isParam);
1098     GroupOnSurface->SpinBox_DY->setShown(isParam);
1099   }
1100
1101   GroupXYZ->setShown(!isParam && !isLength);
1102
1103   if (theIsUpdate)
1104     QTimer::singleShot(50, this, SLOT(updateSize()));
1105 }
1106
1107 //=================================================================================
1108 // function : onBtnPopup()
1109 // purpose  :
1110 //=================================================================================
1111 void MyBasicGUI_PointDlg::onBtnPopup(QAction* a)
1112 {
1113   globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any
1114   myNeedType = myActions[a] == SelectEdge ? TopAbs_EDGE : TopAbs_WIRE;
1115   localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType);
1116 }
1117
1118 //=================================================================================
1119 // function : updateSize
1120 // purpose  : adjust dialog size to minimum
1121 //=================================================================================
1122 void MyBasicGUI_PointDlg::updateSize()
1123 {
1124   qApp->processEvents();
1125   updateGeometry();
1126   resize(minimumSizeHint());
1127 }
1128
1129
1130
1131
1132
1133 /*
1134       HEXABLOCK
1135 */
1136
1137
1138
1139 void MyBasicGUI_PointDlg::setDocumentModel( HEXABLOCK::GUI::DocumentModel* m)
1140 {
1141   _documentModel = m;
1142 }
1143
1144 void MyBasicGUI_PointDlg::setPatternDataSelectionModel( HEXABLOCK::GUI::PatternDataSelectionModel* s)
1145 {
1146   _patternDataSelectionModel = s;
1147 }
1148
1149 void MyBasicGUI_PointDlg::_initInputWidget()
1150 {
1151
1152 //   QVBoxLayout* mainLayout = new QVBoxLayout( centralWidget() );
1153 //   setLayout( mainLayout );
1154 //   QHBoxLayout* up   = new QHBoxLayout( centralWidget() );
1155 //   QVBoxLayout* down = new QVBoxLayout( centralWidget() );
1156
1157 //   QGroupBox *GroupBoxName = new QGroupBox(centralWidget());
1158 //   GroupBoxName->setObjectName(QString::fromUtf8("GroupBoxName"));
1159 //   GroupBoxName->setTitle("Vertex");
1160 //   QHBoxLayout *hboxLayout1 = new QHBoxLayout(GroupBoxName);
1161 //   hboxLayout1->setSpacing(6);
1162 //   hboxLayout1->setContentsMargins(9, 9, 9, 9);
1163 //   hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
1164 //   QLabel *NameLabel = new QLabel(GroupBoxName);
1165 //   NameLabel->setObjectName(QString::fromUtf8("NameLabel"));
1166 //   NameLabel->setWordWrap(false);
1167 //   NameLabel->setText( "Name : " );
1168 //   hboxLayout1->addWidget( NameLabel );
1169 //   mainFrame()->_vertex_le = new QLineEdit( GroupBoxName );
1170 //   mainFrame()->_vertex_le->setObjectName(QString::fromUtf8("mainFrame()->_vertex_le"));
1171 //   hboxLayout1->addWidget(mainFrame()->_vertex_le);
1172 //
1173 //   layout()->addWidget( GroupBoxName );
1174
1175
1176
1177   QRegExp rx("");
1178   QValidator *validator = new QRegExpValidator(rx, this);
1179
1180 //   setProperty( "HexaWidgetType",  QVariant::fromValue(HEXABLOCK::GUI::VERTEX_TREE) );
1181 //   installEventFilter(this);
1182
1183   mainFrame()->_vertex_le->setProperty( "HexaWidgetType",  QVariant::fromValue(HEXABLOCK::GUI::VERTEX_TREE) );
1184   mainFrame()->_vertex_le->installEventFilter(this);
1185   mainFrame()->_vertex_le->setValidator( validator );
1186 }
1187
1188 void MyBasicGUI_PointDlg::clear()
1189 {
1190
1191     mainFrame()->_vertex_le->clear();
1192     mainFrame()->_vertex_le->setProperty("QModelIndex", QVariant());
1193 }
1194
1195 void MyBasicGUI_PointDlg::_initViewManager()
1196 {
1197 //  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
1198 //  _mgr   = dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
1199 //  _vtkVm = anApp->getViewManager( SVTK_Viewer::Type(),      false );
1200 //  _occVm = anApp->getViewManager( OCCViewer_Viewer::Type(), false );
1201 //  SUIT_ViewManager* activeVm = anApp->activeViewManager();
1202 //  onWindowActivated ( activeVm );
1203 }
1204
1205
1206 // bool MyBasicGUI_PointDlg::_onSelectionChanged( const QItemSelection& sel, QLineEdit*  le )
1207 // {
1208 //   QModelIndexList l = sel.indexes();
1209 //   if ( l.count() == 0 ) return false;
1210 //
1211 //   //type from selection (first)
1212 //   QModelIndex selected = l[0];
1213 //   int selType = selected.data(HEXABLOCK::GUI::HEXA_TREE_ROLE).toInt();
1214 //
1215 //   //type of widget
1216 //   QVariant v = le->property("HexaWidgetType");
1217 //   if ( !v.isValid() ) return false;
1218 //   HexaWidgetType wType = v.value<HexaWidgetType>();
1219 //
1220 //   // check selection compatibility between selection and widget
1221 //   if ( selType != wType ){
1222 //     SUIT_MessageBox::information( 0,
1223 //       tr("HEXA_INFO"),
1224 //       tr("Bad selection type: please select a %1").arg( _strHexaWidgetType[wType]) );
1225 //     return false;
1226 //   }
1227 //
1228 //   //fill the lineEdit if selection is OK
1229 //   le->setText( selected.data().toString() );// name
1230 //   le->setProperty("QModelIndex",  QVariant::fromValue(selected) );
1231 //   return true;
1232 // }
1233
1234
1235
1236 void MyBasicGUI_PointDlg::onSelectionChanged( const QItemSelection& sel, const QItemSelection& unsel )
1237 {
1238   QString className = metaObject()->className();
1239 //  QItemSelectionModel* selector = dynamic_cast<QItemSelectionModel*>(sender());
1240
1241   if (_patternDataSelectionModel)
1242           _patternDataSelectionModel->highlightEltsWithAssocs(sel.indexes());
1243
1244   if ( _selectionMutex ) return;
1245   if ( _currentObj != mainFrame()->_vertex_le ) return;
1246
1247   bool selOk = false;
1248
1249   QModelIndexList l = sel.indexes();
1250   if ( l.count() != 0 ){
1251     //type from selection (first)
1252     QModelIndex selected = l[0];
1253     int selType = selected.data(HEXABLOCK::GUI::HEXA_TREE_ROLE).toInt();
1254     // check selection compatibility between selection and widget
1255     if ( selType == HEXABLOCK::GUI::VERTEX_TREE ){
1256       mainFrame()->_vertex_le->setText( selected.data().toString() );// name
1257       mainFrame()->_vertex_le->setProperty("QModelIndex",  QVariant::fromValue(selected) );
1258       selOk = true;
1259     } else {
1260       _patternDataSelectionModel->clearSelection();
1261       SUIT_MessageBox::information( 0,
1262         tr("HEXA_INFO"),
1263         tr("Bad selection type: please select a %1").arg( "VERTEX" ) );
1264     }
1265   }
1266 }
1267
1268
1269 void MyBasicGUI_PointDlg::onWindowActivated(SUIT_ViewManager* vm)
1270 {
1271 //  SUIT_ViewWindow* v = vm->getActiveView();
1272   QString vmType = vm->getType();
1273   if ( (vmType == SVTK_Viewer::Type()) || (vmType == VTKViewer_Viewer::Type()) ){
1274     mainFrame()->_vertex_le->setFocus();
1275   } else if ( vmType == OCCViewer_Viewer::Type() ){
1276 //     lines_lw->setFocus();
1277 //     ConstructorsClicked(0);
1278     ConstructorsClicked( getConstructorId() );
1279   }
1280 }
1281
1282 // ============================================================== _isLineOrListWidget
1283 /*
1284  * Return true is the widget is a line or a list
1285  * false otherwise.
1286  */
1287 bool MyBasicGUI_PointDlg::_isLineOrListWidget(QObject *widget)
1288 {
1289         if (widget == NULL) return false;
1290
1291         QLineEdit       *lineEdit = dynamic_cast<QLineEdit*>(widget);
1292         QListWidget *listWidget = dynamic_cast<QListWidget*>(widget);
1293         return (lineEdit != NULL) || (listWidget != NULL);
1294
1295 }//_isLineOrListWidget
1296
1297
1298
1299 // ============================================================== _highlightWidget
1300 /*
1301  * Highlight the given widget with the given color.
1302  */
1303 void MyBasicGUI_PointDlg::_highlightWidget(QObject *obj, Qt::GlobalColor clr)
1304 {
1305         if (!_isLineOrListWidget(obj)) return;
1306
1307         QWidget *widget = dynamic_cast<QWidget*>(obj); //sure it's not NULL (_isLineOrListWidget(obj))
1308         QPalette palette1 = widget->palette();
1309         palette1.setColor(widget->backgroundRole(), clr);
1310         widget->setPalette(palette1);
1311
1312 }//_highlightWidget
1313
1314
1315 bool MyBasicGUI_PointDlg::eventFilter(QObject *obj, QEvent *event)
1316 {
1317
1318 //  if (event->type() == QEvent::FocusOut)
1319 //        _highlightWidget(obj, Qt::white);
1320 //
1321 //  else
1322   if ( (event->type() != QEvent::FocusIn)
1323     or (obj != mainFrame()->_vertex_le) ){
1324     return MyGEOMBase_Skeleton::eventFilter(obj, event);
1325   }
1326 //  _highlightWidget(obj, Qt::yellow);
1327
1328   QVariant       vxVariant;
1329   QModelIndex    vxIndex;
1330
1331   _currentObj = obj;
1332 //   HEXABLOCKGUI::currentVtkView->raise();
1333   HEXABLOCKGUI::currentDocGView->setVertexSelection();
1334
1335   vxVariant = mainFrame()->_vertex_le->property("QModelIndex");
1336   if ( !vxVariant.isValid() ) {
1337           return MyGEOMBase_Skeleton::eventFilter(obj, event);
1338   }
1339   vxIndex = vxVariant.value<QModelIndex>();
1340   _selectionMutex = true;
1341   _patternDataSelectionModel->select( vxIndex, QItemSelectionModel::Clear );
1342   _patternDataSelectionModel->select( vxIndex, QItemSelectionModel::Select );
1343   _selectionMutex = false;
1344   return false;
1345 }
1346
1347
1348 void MyBasicGUI_PointDlg::hideEvent ( QHideEvent * event )
1349 {
1350     disconnect( _patternDataSelectionModel, SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ),
1351             this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) );
1352
1353     //Disconnection salome selection signals
1354     if (HEXABLOCKGUI::selectionMgr() != NULL)
1355         disconnect(  HEXABLOCKGUI::selectionMgr() , SIGNAL(currentSelectionChanged()),
1356                 this, SLOT(onCurrentSelectionChanged()) );
1357
1358     //Disconnect vtk window activation signals
1359     if (HEXABLOCKGUI::currentDocGView->getViewWindow() != NULL)
1360         disconnect( HEXABLOCKGUI::currentDocGView->getViewWindow()->getViewManager(),
1361                 SIGNAL( activated(SUIT_ViewManager*) ),
1362                 this, SLOT( onWindowActivated(SUIT_ViewManager*) ) );
1363
1364     //Disconnect occ window activation signals
1365     if (HEXABLOCKGUI::currentOccGView->getViewWindow() != NULL)
1366         disconnect( HEXABLOCKGUI::currentOccGView->getViewWindow()->getViewManager(),
1367                 SIGNAL( activated(SUIT_ViewManager*) ),
1368                 this, SLOT( onWindowActivated(SUIT_ViewManager*) ) );
1369
1370     _documentModel->allowEdition();
1371     DeactivateActiveDialog();
1372     MyGEOMBase_Skeleton::hideEvent( event );
1373 }
1374
1375 void MyBasicGUI_PointDlg::showEvent( QShowEvent * event )
1376 {
1377   _documentModel->disallowEdition();
1378   //     _patternDataSelectionModel->clearSelection();
1379   connect( _patternDataSelectionModel, SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ),
1380               this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) );
1381
1382   //Connect to salome selection signals
1383   if (HEXABLOCKGUI::selectionMgr() != NULL)
1384   {
1385       connect( HEXABLOCKGUI::selectionMgr(), SIGNAL(currentSelectionChanged()),
1386               this, SLOT(onCurrentSelectionChanged()), Qt::UniqueConnection );
1387   }
1388
1389   //Connect to vtk window activation signals
1390   if (HEXABLOCKGUI::currentDocGView->getViewWindow() != NULL)
1391   {
1392       connect( HEXABLOCKGUI::currentDocGView->getViewWindow()->getViewManager(), SIGNAL( activated(SUIT_ViewManager*) ),
1393                  this, SLOT( onWindowActivated(SUIT_ViewManager*) ), Qt::UniqueConnection );
1394   }
1395
1396   //connect to occ window activation signals
1397   if (HEXABLOCKGUI::currentOccGView->getViewWindow() != NULL)
1398   {
1399       connect( HEXABLOCKGUI::currentOccGView->getViewWindow()->getViewManager(),
1400               SIGNAL( activated(SUIT_ViewManager*) ),
1401               this, SLOT( onWindowActivated(SUIT_ViewManager*) ), Qt::UniqueConnection );
1402   }
1403
1404 //  connect( _mgr, SIGNAL(currentSelectionChanged()), this, SLOT(onCurrentSelectionChanged()) );
1405 //  connect( _vtkVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) );
1406 //  connect( _occVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) );
1407
1408
1409   SalomeApp_Application* app = (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() );
1410
1411   if ( !myGeomGUI && app )
1412     myGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
1413
1414
1415   ActivateThisDialog();
1416   MyGEOMBase_Skeleton::showEvent ( event );
1417 }
1418
1419
1420
1421
1422 bool MyBasicGUI_PointDlg::onAccept( const bool publish, const bool useTransaction )
1423 {
1424
1425   GEOM::GEOM_Object_ptr newVertex;
1426   QString               newVertexEntry;
1427   QString               newVertexName;
1428   QString               newVertexBrep;
1429   gp_Pnt                aPnt;
1430
1431
1432
1433   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
1434   if ( !appStudy ) return false;
1435   _PTR(Study) aStudy = appStudy->studyDS();
1436
1437   bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked();
1438   if ( aLocked ) {
1439     SUIT_MessageBox::warning ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(),
1440                                QObject::tr("WRN_WARNING"),
1441                                QObject::tr("WRN_STUDY_LOCKED"),
1442                                QObject::tr("BUT_OK") );
1443     return false;
1444   }
1445
1446   QString msg;
1447   if ( !isValid( msg ) ) {
1448     showError( msg );
1449     return false;
1450   }
1451
1452   erasePreview( false );
1453
1454   bool result = false;
1455
1456   try {
1457     if ( ( !publish && !useTransaction ) || openCommand() ) {
1458       SUIT_OverrideCursor wc;
1459       SUIT_Session::session()->activeApplication()->putInfo( "" );
1460       ObjectList objects;
1461       if ( !execute( objects ) || !getOperation()->IsDone() ) {
1462         wc.suspend();
1463         abortCommand();
1464         showError();
1465       }
1466       else {
1467         addSubshapesToStudy(); // add Subshapes if local selection
1468         const int nbObjs = objects.size();
1469         QStringList anEntryList;
1470         int aNumber = 1;
1471         for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
1472           GEOM::GEOM_Object_var obj=*it;
1473           if ( publish ) {
1474             QString aName = getNewObjectName();
1475             if ( nbObjs > 1 ) {
1476               if (aName.isEmpty())
1477                 aName = getPrefix(obj);
1478               if (nbObjs <= 30) {
1479                 // Try to find a unique name
1480                 aName = GEOMBase::GetDefaultName(aName, extractPrefix());
1481               } else {
1482                 // Don't check name uniqueness in case of numerous objects
1483                 aName = aName + "_" + QString::number(aNumber++);
1484               }
1485             } else {
1486               // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
1487               if ( aName.isEmpty() )
1488                 aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
1489             }
1490             anEntryList << addInStudy( obj, aName.toLatin1().constData() );
1491
1492             newVertex      = obj;
1493             newVertexEntry = anEntryList[0];
1494             TopoDS_Shape aShape;
1495             GEOMBase::GetShape( newVertex, aShape );
1496             if ( !aShape.IsNull() ){
1497               newVertexName = GEOMBase::GetName( newVertex );
1498               newVertexBrep = HEXABLOCK::GUI::shape2string( aShape ).c_str();
1499               aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
1500             }
1501
1502             // updateView=false
1503             display( obj, false );
1504 #ifdef WITHGENERICOBJ
1505             // obj has been published in study. Its refcount has been incremented.
1506             // It is safe to decrement its refcount
1507             // so that it will be destroyed when the entry in study will be removed
1508             obj->UnRegister();
1509 #endif
1510           }
1511           else {
1512             // asv : fix of PAL6454. If publish==false, then the original shape
1513             // was modified, and need to be re-cached in GEOM_Client before redisplay
1514 //             clearShapeBuffer( obj );
1515             // withChildren=true, updateView=false
1516             redisplay( obj, true, false );
1517           }
1518         }
1519
1520         if ( nbObjs ) {
1521           commitCommand();
1522           updateObjBrowser();
1523           if( SUIT_Application* anApp = SUIT_Session::session()->activeApplication() ) {
1524             if( LightApp_Application* aLightApp = dynamic_cast<LightApp_Application*>( anApp ) ){
1525               aLightApp->browseObjects( anEntryList, isApplyAndClose(), isOptimizedBrowsing() );
1526             }
1527             anApp->putInfo( QObject::tr("GEOM_PRP_DONE") );
1528           }
1529           result = true;
1530         }
1531         else
1532           abortCommand();
1533       }
1534     }
1535   }
1536   catch( const SALOME::SALOME_Exception& e ) {
1537     SalomeApp_Tools::QtCatchCorbaException( e );
1538     abortCommand();
1539   }
1540
1541   updateViewer();
1542
1543   if (result){
1544     SUIT_OverrideCursor wc;
1545     if ( !_documentModel )             return false;
1546     if ( !_patternDataSelectionModel ) return false;
1547     const HEXABLOCK::GUI::PatternDataModel* patternDataModel = dynamic_cast<const HEXABLOCK::GUI::PatternDataModel*>( _patternDataSelectionModel->model() );
1548     if ( !patternDataModel ) return false;
1549     _currentObj = NULL;
1550
1551     QVariant v = mainFrame()->_vertex_le->property("QModelIndex");
1552     if ( !v.isValid() ) return false;
1553     QModelIndex iVertex = patternDataModel->mapToSource( v.value<QModelIndex>() );
1554
1555     if ( iVertex.isValid() ){
1556       HEXABLOCK::GUI::DocumentModel::GeomObj aPoint;
1557       aPoint.shapeName  = newVertexName;
1558       aPoint.subid = QString::number(-1);
1559       aPoint.brep  = newVertexBrep;
1560       _documentModel->setGeomObjName(newVertexEntry, newVertexName);
1561       _documentModel->setGeomObjEntry(newVertexName, newVertexEntry);
1562 //      _documentModel->addAssociation( iVertex, aPoint );
1563       _documentModel->setVertexAssociation(iVertex, aPnt.X(), aPnt.Y(), aPnt.Z());
1564       // to select/highlight result
1565 //       _patternDataSelectionModel->clearSelection();
1566 //       mainFrame()->_vertex_le->setFocus();
1567
1568 //       globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow());
1569 //       localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), TopAbs_VERTEX);
1570       _patternDataSelectionModel->select( patternDataModel->mapFromSource(iVertex), QItemSelectionModel::Clear );
1571       _patternDataSelectionModel->select( patternDataModel->mapFromSource(iVertex), QItemSelectionModel::Select );
1572       _currentObj = NULL;
1573       result = true;
1574     } else  {
1575       SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE VERTEX ASSOCIATION" ) );
1576       return false;
1577     }
1578   }
1579
1580
1581   return result;
1582 }
1583