Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_NodesDlg.cxx
1 //  SMESH SMESHGUI : GUI for SMESH component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : SMESHGUI_NodesDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #include "SMESHGUI_NodesDlg.h"
30
31 #include "SMESHGUI.h"
32 #include "SMESHGUI_SpinBox.h"
33 #include "SMESHGUI_Utils.h"
34 #include "SMESHGUI_VTKUtils.h"
35 #include "SMESHGUI_MeshUtils.h"
36
37 #include "SMESH_Actor.h"
38 #include "SMESH_ActorUtils.h"
39 #include "SMESH_ObjectDef.h"
40
41 #include "SMDS_Mesh.hxx"
42 #include "SMDS_MeshNode.hxx"
43
44 #include "SUIT_Session.h"
45 #include "SUIT_OverrideCursor.h"
46 #include "SUIT_ViewWindow.h"
47 #include "SUIT_ViewManager.h"
48 #include "SUIT_MessageBox.h"
49 #include "SUIT_Desktop.h"
50
51 #include "SalomeApp_Study.h"
52 #include "LightApp_Application.h"
53 #include "LightApp_SelectionMgr.h"
54
55 #include "SVTK_Selector.h"
56 #include "SVTK_ViewWindow.h"
57 #include "VTKViewer_CellLocationsArray.h"
58
59 #include "SALOME_Actor.h"
60 #include "SALOME_ListIO.hxx"
61
62 #include "utilities.h"
63
64 // VTK Includes
65 #include <vtkCell.h>
66 #include <vtkIdList.h>
67 #include <vtkCellArray.h>
68 #include <vtkUnsignedCharArray.h>
69 #include <vtkUnstructuredGrid.h>
70 #include <vtkDataSetMapper.h>
71 #include <vtkActorCollection.h>
72 #include <vtkRenderer.h>
73 #include <vtkProperty.h>
74
75 // QT Includes
76 #include <qbuttongroup.h>
77 #include <qframe.h>
78 #include <qgroupbox.h>
79 #include <qlabel.h>
80 #include <qlineedit.h>
81 #include <qpushbutton.h>
82 #include <qradiobutton.h>
83 #include <qlayout.h>
84 #include <qvariant.h>
85 #include <qtooltip.h>
86 #include <qwhatsthis.h>
87 #include <qimage.h>
88 #include <qpixmap.h>
89 #include <qvalidator.h>
90 #include <qevent.h>
91
92 using namespace std;
93
94
95 namespace SMESH {
96
97   void AddNode (SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z)
98   {
99     SUIT_OverrideCursor wc;
100     try {
101       _PTR(SObject) aSobj = SMESH::FindSObject(theMesh);
102       SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
103       aMeshEditor->AddNode(x,y,z);
104       _PTR(Study) aStudy = GetActiveStudyDocument();
105       CORBA::Long anId = aStudy->StudyId();
106       if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId, aSobj->GetID().c_str())) {
107         aVisualObj->Update(true);
108       }
109     } catch (SALOME::SALOME_Exception& exc) {
110       INFOS("Follow exception was cought:\n\t" << exc.details.text);
111     } catch (const std::exception& exc) {
112       INFOS("Follow exception was cought:\n\t" << exc.what());
113     } catch (...) {
114       INFOS("Unknown exception was cought !!!");
115     }
116   }
117
118   class TNodeSimulation {
119     SVTK_ViewWindow* myViewWindow;
120
121     SALOME_Actor *myPreviewActor;
122     vtkDataSetMapper* myMapper;
123     vtkPoints* myPoints;
124
125   public:
126     TNodeSimulation(SVTK_ViewWindow* theViewWindow):
127       myViewWindow(theViewWindow)
128     {
129       vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
130
131       // Create points
132       myPoints = vtkPoints::New();
133       myPoints->SetNumberOfPoints(1);
134       myPoints->SetPoint(0,0.0,0.0,0.0);
135
136       // Create cells
137       vtkIdList *anIdList = vtkIdList::New();
138       anIdList->SetNumberOfIds(1);
139
140       vtkCellArray *aCells = vtkCellArray::New();
141       aCells->Allocate(2, 0);
142
143       vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
144       aCellTypesArray->SetNumberOfComponents(1);
145       aCellTypesArray->Allocate(1);
146
147       anIdList->SetId(0, 0);
148       aCells->InsertNextCell(anIdList);
149       aCellTypesArray->InsertNextValue(VTK_VERTEX);
150
151       VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
152       aCellLocationsArray->SetNumberOfComponents(1);
153       aCellLocationsArray->SetNumberOfTuples(1);
154
155       aCells->InitTraversal();
156       vtkIdType npts;
157       aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts));
158
159       aGrid->SetCells(aCellTypesArray, aCellLocationsArray, aCells);
160
161       aGrid->SetPoints(myPoints);
162       aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aCells);
163       aCellLocationsArray->Delete();
164       aCellTypesArray->Delete();
165       aCells->Delete();
166       anIdList->Delete();
167
168       // Create and display actor
169       myMapper = vtkDataSetMapper::New();
170       myMapper->SetInput(aGrid);
171       aGrid->Delete();
172
173       myPreviewActor = SALOME_Actor::New();
174       myPreviewActor->SetInfinitive(true);
175       myPreviewActor->VisibilityOff();
176       myPreviewActor->PickableOff();
177       myPreviewActor->SetMapper(myMapper);
178
179       vtkProperty* aProp = vtkProperty::New();
180       aProp->SetRepresentationToPoints();
181
182       vtkFloatingPointType anRGB[3];
183       GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
184       aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
185
186       vtkFloatingPointType aPointSize = GetFloat( "SMESH:node_size", 3 );
187       aProp->SetPointSize( aPointSize );
188
189       myPreviewActor->SetProperty( aProp );
190       aProp->Delete();
191
192       myViewWindow->AddActor(myPreviewActor);
193     }
194
195     void SetPosition (float x, float y, float z)
196     {
197       myPoints->SetPoint(0,x,y,z);
198       myPoints->Modified();
199       SetVisibility(true);
200     }
201
202     void SetVisibility (bool theVisibility)
203     {
204       myPreviewActor->SetVisibility(theVisibility);
205       RepaintCurrentView();
206     }
207
208     ~TNodeSimulation()
209     {
210       myViewWindow->RemoveActor(myPreviewActor);
211       myPreviewActor->Delete();
212
213       myMapper->RemoveAllInputs();
214       myMapper->Delete();
215
216       myPoints->Delete();
217     }
218   };
219 }
220
221 //=================================================================================
222 // class    : SMESHGUI_NodesDlg()
223 // purpose  :
224 //=================================================================================
225 SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (SMESHGUI* theModule,
226                                       const char* name,
227                                       bool modal,
228                                       WFlags fl): 
229   QDialog(SMESH::GetDesktop(theModule), 
230           name, 
231           modal, 
232           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
233   mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
234   mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
235   mySMESHGUI(theModule)
236 {
237   mySimulation = new SMESH::TNodeSimulation(SMESH::GetViewWindow( mySMESHGUI ));
238
239   QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
240   if (!name)
241     setName("SMESHGUI_NodesDlg");
242   resize(303, 185);
243   setCaption(tr("MESH_NODE_TITLE"));
244   setSizeGripEnabled(TRUE);
245   SMESHGUI_NodesDlgLayout = new QGridLayout(this);
246   SMESHGUI_NodesDlgLayout->setSpacing(6);
247   SMESHGUI_NodesDlgLayout->setMargin(11);
248
249   /***************************************************************/
250   GroupButtons = new QGroupBox(this, "GroupButtons");
251   GroupButtons->setGeometry(QRect(10, 10, 281, 48));
252   GroupButtons->setTitle(tr("" ));
253   GroupButtons->setColumnLayout(0, Qt::Vertical);
254   GroupButtons->layout()->setSpacing(0);
255   GroupButtons->layout()->setMargin(0);
256   GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
257   GroupButtonsLayout->setAlignment(Qt::AlignTop);
258   GroupButtonsLayout->setSpacing(6);
259   GroupButtonsLayout->setMargin(11);
260   buttonHelp = new QPushButton(GroupButtons, "buttonHelp");
261   buttonHelp->setText(tr("SMESH_BUT_HELP" ));
262   buttonHelp->setAutoDefault(TRUE);
263   GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
264   buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
265   buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
266   buttonCancel->setAutoDefault(TRUE);
267   GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
268   buttonApply = new QPushButton(GroupButtons, "buttonApply");
269   buttonApply->setText(tr("SMESH_BUT_APPLY" ));
270   buttonApply->setAutoDefault(TRUE);
271   GroupButtonsLayout->addWidget(buttonApply, 0, 1);
272   QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
273   GroupButtonsLayout->addItem(spacer_9, 0, 2);
274   buttonOk = new QPushButton(GroupButtons, "buttonOk");
275   buttonOk->setText(tr("SMESH_BUT_OK" ));
276   buttonOk->setAutoDefault(TRUE);
277   buttonOk->setDefault(TRUE);
278   GroupButtonsLayout->addWidget(buttonOk, 0, 0);
279   SMESHGUI_NodesDlgLayout->addWidget(GroupButtons, 2, 0);
280
281   /***************************************************************/
282   GroupConstructors = new QButtonGroup(this, "GroupConstructors");
283   GroupConstructors->setTitle(tr("MESH_NODE" ));
284   GroupConstructors->setExclusive(TRUE);
285   GroupConstructors->setColumnLayout(0, Qt::Vertical);
286   GroupConstructors->layout()->setSpacing(0);
287   GroupConstructors->layout()->setMargin(0);
288   GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
289   GroupConstructorsLayout->setAlignment(Qt::AlignTop);
290   GroupConstructorsLayout->setSpacing(6);
291   GroupConstructorsLayout->setMargin(11);
292   Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
293   Constructor1->setText(tr("" ));
294   Constructor1->setPixmap(image0);
295   Constructor1->setChecked(TRUE);
296   GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
297   QSpacerItem* spacer_2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
298   GroupConstructorsLayout->addItem(spacer_2, 0, 1);
299   SMESHGUI_NodesDlgLayout->addWidget(GroupConstructors, 0, 0);
300
301   /***************************************************************/
302   GroupCoordinates = new QGroupBox(this, "GroupCoordinates");
303   GroupCoordinates->setTitle(tr("SMESH_COORDINATES" ));
304   GroupCoordinates->setColumnLayout(0, Qt::Vertical);
305   GroupCoordinates->layout()->setSpacing(0);
306   GroupCoordinates->layout()->setMargin(0);
307   GroupCoordinatesLayout = new QGridLayout(GroupCoordinates->layout());
308   GroupCoordinatesLayout->setAlignment(Qt::AlignTop);
309   GroupCoordinatesLayout->setSpacing(6);
310   GroupCoordinatesLayout->setMargin(11);
311   TextLabel_X = new QLabel(GroupCoordinates, "TextLabel_X");
312   TextLabel_X->setText(tr("SMESH_X" ));
313   GroupCoordinatesLayout->addWidget(TextLabel_X, 0, 0);
314   TextLabel_Y = new QLabel(GroupCoordinates, "TextLabel_Y");
315   TextLabel_Y->setText(tr("SMESH_Y" ));
316   GroupCoordinatesLayout->addWidget(TextLabel_Y, 0, 2);
317
318   TextLabel_Z = new QLabel(GroupCoordinates, "TextLabel_Z");
319   TextLabel_Z->setText(tr("SMESH_Z" ));
320   GroupCoordinatesLayout->addWidget(TextLabel_Z, 0, 4);
321
322   SpinBox_X = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_X");
323   GroupCoordinatesLayout->addWidget(SpinBox_X, 0, 1);
324
325   SpinBox_Y = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_Y");
326   GroupCoordinatesLayout->addWidget(SpinBox_Y, 0, 3);
327
328   SpinBox_Z = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_Z");
329   GroupCoordinatesLayout->addWidget(SpinBox_Z, 0, 5);
330
331   SMESHGUI_NodesDlgLayout->addWidget(GroupCoordinates, 1, 0);
332
333   myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_nodes";
334
335   /* Initialisation and display */
336   Init();
337 }
338
339 //=======================================================================
340 // function : ~SMESHGUI_NodesDlg()
341 // purpose  : Destructor
342 //=======================================================================
343 SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg()
344 {
345   delete mySimulation;
346 }
347
348 //=================================================================================
349 // function : Init()
350 // purpose  :
351 //=================================================================================
352 void SMESHGUI_NodesDlg::Init ()
353 {
354   /* Get setting of step value from file configuration */
355   double step;
356   // QString St = SUIT_CONFIG->getSetting("xxxxxxxxxxxxx");  TODO
357   // step = St.toDouble();                                    TODO
358   step = 25.0;
359
360   /* min, max, step and decimals for spin boxes */
361   SpinBox_X->RangeStepAndValidator(-999.999, +999.999, step, 3);
362   SpinBox_Y->RangeStepAndValidator(-999.999, +999.999, step, 3);
363   SpinBox_Z->RangeStepAndValidator(-999.999, +999.999, step, 3);
364   SpinBox_X->SetValue(0.0);
365   SpinBox_Y->SetValue(0.0);
366   SpinBox_Z->SetValue(0.0);
367
368   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
369
370   /* signals and slots connections */
371   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
372   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
373   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
374   connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
375
376   connect(SpinBox_X, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double)));
377   connect(SpinBox_Y, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double)));
378   connect(SpinBox_Z, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double)));
379
380   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
381   connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
382   /* to close dialog if study frame change */
383   connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
384
385   this->show();
386
387   // set selection mode
388   SMESH::SetPointRepresentation(true);
389   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
390     aViewWindow->SetSelectionMode(NodeSelection);
391
392   SelectionIntoArgument();
393 }
394
395 //=================================================================================
396 // function : ValueChangedInSpinBox()
397 // purpose  :
398 //=================================================================================
399 void SMESHGUI_NodesDlg::ValueChangedInSpinBox (double newValue)
400 {
401   if (!myMesh->_is_nil()) {
402     double vx = SpinBox_X->GetValue();
403     double vy = SpinBox_Y->GetValue();
404     double vz = SpinBox_Z->GetValue();
405
406     mySimulation->SetPosition(vx,vy,vz);
407   }
408 }
409
410 //=================================================================================
411 // function : ClickOnOk()
412 // purpose  :
413 //=================================================================================
414 void SMESHGUI_NodesDlg::ClickOnOk()
415 {
416   if (ClickOnApply())
417     ClickOnCancel();
418 }
419
420 //=================================================================================
421 // function : ClickOnApply()
422 // purpose  :
423 //=================================================================================
424 bool SMESHGUI_NodesDlg::ClickOnApply()
425 {
426   if (mySMESHGUI->isActiveStudyLocked())
427     return false;
428
429   if (myMesh->_is_nil()) {
430     SUIT_MessageBox::warn1(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
431                            tr("MESH_IS_NOT_SELECTED"), tr("SMESH_BUT_OK"));
432     return false;
433   }
434
435   /* Recup args and call method */
436   double x = SpinBox_X->GetValue();
437   double y = SpinBox_Y->GetValue();
438   double z = SpinBox_Z->GetValue();
439   mySimulation->SetVisibility(false);
440   SMESH::AddNode(myMesh,x,y,z);
441   SMESH::SetPointRepresentation(true);
442
443   // select myMesh
444   SALOME_ListIO aList;
445   mySelectionMgr->selectedObjects(aList);
446   if (aList.Extent() != 1) {
447     if (SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView()) {
448       vtkActorCollection *aCollection = aViewWindow->getRenderer()->GetActors();
449       aCollection->InitTraversal();
450       while (vtkActor *anAct = aCollection->GetNextActor()) {
451         if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
452           if (anActor->hasIO()) {
453             if (SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>(anActor->GetObject().get())) {
454               if (myMesh->_is_equivalent(aMeshObj->GetMeshServer())) {
455                 aList.Clear();
456                 aList.Append(anActor->getIO());
457                 mySelectionMgr->setSelectedObjects(aList, false);
458                 break;
459               }
460             }
461           }
462         }
463       }
464     }
465   }
466   return true;
467 }
468
469 //=================================================================================
470 // function : ClickOnCancel()
471 // purpose  :
472 //=================================================================================
473 void SMESHGUI_NodesDlg::ClickOnCancel()
474 {
475   disconnect(mySelectionMgr, 0, this, 0);
476   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
477     aViewWindow->SetSelectionMode(ActorSelection);
478
479   mySimulation->SetVisibility(false);
480   SMESH::SetPointRepresentation(false);
481   mySMESHGUI->ResetState();
482
483   reject();
484 }
485
486 //=================================================================================
487 // function : ClickOnHelp()
488 // purpose  :
489 //=================================================================================
490 void SMESHGUI_NodesDlg::ClickOnHelp()
491 {
492   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
493   if (app) 
494     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
495   else {
496     SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
497                            QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
498                            arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName),
499                            QObject::tr("BUT_OK"));
500   }
501 }
502
503 //=================================================================================
504 // function : SelectionIntoArgument()
505 // purpose  : Called when selection as changed or other case
506 //=================================================================================
507 void SMESHGUI_NodesDlg::SelectionIntoArgument()
508 {
509   if (!GroupConstructors->isEnabled())
510     return;
511
512   mySimulation->SetVisibility(false);
513   SMESH::SetPointRepresentation(true);
514
515   const SALOME_ListIO& aList = mySelector->StoredIObjects();
516   if (aList.Extent() == 1) {
517     Handle(SALOME_InteractiveObject) anIO = aList.First();
518     if (anIO->hasEntry()) {
519       myMesh = SMESH::GetMeshByIO(anIO);
520       if (myMesh->_is_nil()) return;
521       QString aText;
522       if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) {
523         if (SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh.in())) {
524           if (SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh()) {
525             if (const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
526               SpinBox_X->SetValue(aNode->X());
527               SpinBox_Y->SetValue(aNode->Y());
528               SpinBox_Z->SetValue(aNode->Z());
529             }
530           }
531         }
532       }
533       mySimulation->SetPosition(SpinBox_X->GetValue(),
534                                 SpinBox_Y->GetValue(),
535                                 SpinBox_Z->GetValue());
536     }
537   }
538 }
539
540 //=================================================================================
541 // function : closeEvent()
542 // purpose  :
543 //=================================================================================
544 void SMESHGUI_NodesDlg::closeEvent (QCloseEvent*)
545 {
546   this->ClickOnCancel(); /* same than click on cancel button */
547 }
548
549 //=================================================================================
550 // function : hideEvent()
551 // purpose  : caused by ESC key
552 //=================================================================================
553 void SMESHGUI_NodesDlg::hideEvent (QHideEvent*)
554 {
555   if (!isMinimized())
556     ClickOnCancel();
557 }
558
559 //=================================================================================
560 // function : enterEvent()
561 // purpose  : to reactivate this dialog box when mouse enter onto the window
562 //=================================================================================
563 void SMESHGUI_NodesDlg::enterEvent(QEvent*)
564 {
565   if (!GroupConstructors->isEnabled())
566     ActivateThisDialog();
567 }
568
569 //=================================================================================
570 // function : DeactivateActiveDialog()
571 // purpose  : public slot to deactivate if active
572 //=================================================================================
573 void SMESHGUI_NodesDlg::DeactivateActiveDialog()
574 {
575   if (GroupConstructors->isEnabled()) {
576     GroupConstructors->setEnabled(false);
577     GroupCoordinates->setEnabled(false);
578     GroupButtons->setEnabled(false);
579     mySimulation->SetVisibility(false);
580     mySMESHGUI->ResetState();
581     mySMESHGUI->SetActiveDialogBox(0);
582   }
583 }
584
585 //=================================================================================
586 // function : ActivateThisDialog()
587 // purpose  :
588 //=================================================================================
589 void SMESHGUI_NodesDlg::ActivateThisDialog()
590 {
591   mySMESHGUI->EmitSignalDeactivateDialog();
592   GroupConstructors->setEnabled(true);
593   GroupCoordinates->setEnabled(true);
594   GroupButtons->setEnabled(true);
595
596   SMESH::SetPointRepresentation(true);
597   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
598     aViewWindow->SetSelectionMode(NodeSelection);
599
600   SelectionIntoArgument();
601 }