Salome HOME
PAL15429 Computation of the mesh, based on "014.brep" via Tetrahedron(NETGEN), is...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MoveNodesDlg.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SMESH SMESHGUI : GUI for SMESH component
23 //  File   : SMESHGUI_MoveNodesDlg.cxx
24 //  Author : Nicolas REJNERI
25 //  Module : SMESH
26 //  $Header$
27 //
28 #include "SMESHGUI_MoveNodesDlg.h"
29
30 #include "SMESHGUI.h"
31 #include "SMESHGUI_SpinBox.h"
32 #include "SMESHGUI_IdValidator.h"
33 #include "SMESHGUI_Utils.h"
34 #include "SMESHGUI_VTKUtils.h"
35 #include "SMESHGUI_MeshUtils.h"
36
37 #include "SMESH_Actor.h"
38 #include "SMDS_Mesh.hxx"
39 #include "SMDS_MeshNode.hxx"
40
41 #include "LightApp_SelectionMgr.h"
42 #include "LightApp_Application.h"
43 #include "SUIT_ResourceMgr.h"
44 #include "SUIT_Desktop.h"
45 #include "SUIT_Session.h"
46 #include "SUIT_MessageBox.h"
47
48 #include "SVTK_Selector.h"
49 #include "SVTK_ViewModel.h"
50 #include "SVTK_ViewWindow.h"
51 #include "SALOME_ListIO.hxx"
52
53 #include "SVTK_ViewWindow.h"
54 #include "VTKViewer_CellLocationsArray.h"
55
56 #include "utilities.h"
57
58 // OCCT includes
59 #include <TColStd_MapOfInteger.hxx>
60
61 // VTK includes
62 #include <vtkCell.h>
63 #include <vtkIdList.h>
64 #include <vtkCellArray.h>
65 #include <vtkUnsignedCharArray.h>
66 #include <vtkUnstructuredGrid.h>
67 #include <vtkDataSetMapper.h>
68 #include <vtkProperty.h>
69
70 // QT includes
71 #include <qgroupbox.h>
72 #include <qlabel.h>
73 #include <qlineedit.h>
74 #include <qpushbutton.h>
75 #include <qradiobutton.h>
76 #include <qlayout.h>
77 #include <qpixmap.h>
78 #include <qmessagebox.h>
79 #include <qbuttongroup.h>
80
81 // IDL Headers
82 #include <SALOMEconfig.h>
83 #include CORBA_SERVER_HEADER(SMESH_Mesh)
84 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
85
86 #define MARGIN  10
87 #define SPACING 5
88
89
90 //=================================================================================
91 // name    : SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg
92 // Purpose :
93 //=================================================================================
94 SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg (SMESHGUI* theModule, 
95                                               const char* theName):
96   QDialog(SMESH::GetDesktop(theModule), 
97           theName, 
98           false,
99           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
100   mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
101   mySMESHGUI(theModule)
102 {
103   myPreviewActor = 0;
104   myBusy = false;
105
106   setCaption(tr("CAPTION"));
107
108   QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
109
110   QFrame* aMainFrame = createMainFrame  (this);
111   QFrame* aBtnFrame  = createButtonFrame(this);
112
113   aDlgLay->addWidget(aMainFrame);
114   aDlgLay->addWidget(aBtnFrame);
115
116   aDlgLay->setStretchFactor(aMainFrame, 1);
117
118   mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
119
120   myHelpFileName = "moving_nodes_page.html";
121
122   Init();
123 }
124
125 //=======================================================================
126 // name    : SMESHGUI_MoveNodesDlg::createButtonFrame
127 // Purpose : Create frame containing buttons
128 //=======================================================================
129 QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent)
130 {
131   QFrame* aFrame = new QFrame(theParent);
132   aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
133
134   myApplyBtn  = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
135   myCloseBtn  = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
136   myOkBtn     = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame);
137   myHelpBtn   = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
138
139   QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
140
141   QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
142
143   aLay->addWidget(myOkBtn);
144   aLay->addWidget(myApplyBtn);
145   aLay->addItem(aSpacer);
146   aLay->addWidget(myCloseBtn);
147   aLay->addWidget(myHelpBtn);
148
149   connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
150   connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
151   connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
152   connect(myHelpBtn,  SIGNAL(clicked()), SLOT(onHelp()));
153
154   return aFrame;
155 }
156
157 //=======================================================================
158 // name    : SMESHGUI_MoveNodesDlg::createMainFrame
159 // Purpose : Create frame containing dialog's input fields
160 //=======================================================================
161 QFrame* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent)
162 {
163   QFrame* aFrame = new QFrame(theParent);
164
165   QPixmap iconMoveNode (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
166   QPixmap iconSelect   (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
167
168   QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("MESH_NODE"), aFrame);
169   aPixGrp->setExclusive(TRUE);
170   QRadioButton* aRBut = new QRadioButton(aPixGrp);
171   aRBut->setPixmap(iconMoveNode);
172   aRBut->setChecked(TRUE);
173
174   QGroupBox* anIdGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_MOVE"), aFrame);
175   new QLabel(tr("NODE_ID"), anIdGrp);
176   (new QPushButton(anIdGrp))->setPixmap(iconSelect);
177   myId = new QLineEdit(anIdGrp);
178   myId->setValidator(new SMESHGUI_IdValidator(this, "validator", 1));
179
180   QGroupBox* aCoordGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_COORDINATES"), aFrame);
181   QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp);
182   aXLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
183   myX = new SMESHGUI_SpinBox(aCoordGrp);
184
185   QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp);
186   //aYLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
187   aYLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
188   myY = new SMESHGUI_SpinBox(aCoordGrp);
189
190   QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp);
191   //aZLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
192   aZLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
193   myZ = new SMESHGUI_SpinBox(aCoordGrp);
194
195   myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY);
196   myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY);
197   myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY);
198
199   QVBoxLayout* aLay = new QVBoxLayout(aFrame);
200   aLay->addWidget(aPixGrp);
201   aLay->addWidget(anIdGrp);
202   aLay->addWidget(aCoordGrp);
203
204   // connect signale and slots
205   connect(myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
206   connect(myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
207   connect(myZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
208   connect(myId, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
209
210   return aFrame;
211 }
212
213 //=======================================================================
214 // name    : SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg
215 // Purpose :
216 //=======================================================================
217 SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg()
218 {
219   erasePreview();
220 }
221
222 //=======================================================================
223 // name    : SMESHGUI_MoveNodesDlg::Init
224 // Purpose : Init dialog fields
225 //=======================================================================
226 void SMESHGUI_MoveNodesDlg::Init()
227 {
228   myPreviewActor = 0;
229   myMeshActor = 0;
230   myBusy = false;
231
232   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
233
234   // selection and SMESHGUI
235   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
236   connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
237   connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
238
239   reset();
240   setEnabled(true);
241
242   this->show();
243
244   // set selection mode
245   SMESH::SetPointRepresentation(true);
246   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
247     aViewWindow->SetSelectionMode(NodeSelection);
248
249   onSelectionDone();
250 }
251
252 //=======================================================================
253 // name    : SMESHGUI_MoveNodesDlg::isValid
254 // Purpose : Verify validity of entry information
255 //=======================================================================
256 bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess) const
257 {
258   if (myId->text().isEmpty()) {
259     if (theMess)
260       QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"),
261                                tr("NODE_ID_IS_NOT_DEFINED"), QMessageBox::Ok);
262     return false;
263   }
264   return true;
265 }
266
267 //=======================================================================
268 // name    : SMESHGUI_MoveNodesDlg::reset
269 // Purpose : Reset the dialog state
270 //=======================================================================
271 void SMESHGUI_MoveNodesDlg::reset()
272 {
273   myId->clear();
274   myX->SetValue(0);
275   myY->SetValue(0);
276   myZ->SetValue(0);
277   redisplayPreview();
278   updateButtons();
279 }
280
281 //=======================================================================
282 // name    : SMESHGUI_MoveNodesDlg::onApply
283 // Purpose : SLOT called when "Apply" button pressed.
284 //=======================================================================
285 bool SMESHGUI_MoveNodesDlg::onApply()
286 {
287   if (mySMESHGUI->isActiveStudyLocked())
288     return false;
289
290   if (!isValid(true))
291     return false;
292
293   SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
294   if (aMesh->_is_nil()) {
295     QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
296                              tr("SMESHG_NO_MESH"), QMessageBox::Ok);
297     return false;
298   }
299
300   SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
301   if (aMeshEditor->_is_nil())
302     return false;
303
304   int anId = myId->text().toInt();
305   bool aResult = false;
306   try {
307     aResult = aMeshEditor->MoveNode(anId, myX->GetValue(), myY->GetValue(), myZ->GetValue());
308   } catch (...) {
309   }
310
311   if (aResult) {
312     SALOME_ListIO aList;
313     aList.Append(myMeshActor->getIO());
314     mySelectionMgr->setSelectedObjects(aList,false);
315     SMESH::UpdateView();
316     reset();
317   }
318
319   return aResult;
320 }
321
322 //=======================================================================
323 // name    : SMESHGUI_MoveNodesDlg::onOk
324 // Purpose : SLOT called when "Ok" button pressed.
325 //=======================================================================
326 void SMESHGUI_MoveNodesDlg::onOk()
327 {
328   if (onApply())
329     onClose();
330 }
331
332 //=======================================================================
333 // name    : SMESHGUI_MoveNodesDlg::onClose
334 // Purpose : SLOT called when "Close" button pressed. Close dialog
335 //=======================================================================
336 void SMESHGUI_MoveNodesDlg::onClose()
337 {
338   //mySelectionMgr->clearSelected();
339   SMESH::SetPointRepresentation(false);
340   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
341     aViewWindow->SetSelectionMode(ActorSelection);
342   disconnect(mySelectionMgr, 0, this, 0);
343   disconnect(mySMESHGUI, 0, this, 0);
344   erasePreview();
345   mySMESHGUI->ResetState();
346   reject();
347 }
348
349 //=================================================================================
350 // function : onHelp()
351 // purpose  :
352 //=================================================================================
353 void SMESHGUI_MoveNodesDlg::onHelp()
354 {
355   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
356   if (app) 
357     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
358   else {
359                 QString platform;
360 #ifdef WIN32
361                 platform = "winapplication";
362 #else
363                 platform = "application";
364 #endif
365     SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
366                            QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
367                            arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
368                            QObject::tr("BUT_OK"));
369   }
370 }
371
372 //=======================================================================
373 // name    : SMESHGUI_MoveNodesDlg::onTextChange
374 // Purpose :
375 //=======================================================================
376 void SMESHGUI_MoveNodesDlg::onTextChange (const QString& theNewText)
377 {
378   if (myBusy) return;
379
380   myOkBtn->setEnabled(false);
381   myApplyBtn->setEnabled(false);
382   erasePreview();
383
384   // select entered node
385   if(myMeshActor){
386     if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()){
387       myBusy = true;
388       Handle(SALOME_InteractiveObject) anIO = myMeshActor->getIO();
389       SALOME_ListIO aList;
390       aList.Append(anIO);
391       mySelectionMgr->setSelectedObjects(aList,false);
392       myBusy = false;
393
394       if(const SMDS_MeshElement *anElem = aMesh->FindElement(theNewText.toInt())) {
395         TColStd_MapOfInteger aListInd;
396         aListInd.Add(anElem->GetID());
397         mySelector->AddOrRemoveIndex(anIO,aListInd, false);
398         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
399           aViewWindow->highlight(anIO,true,true);
400         
401         onSelectionDone();
402       }
403     }
404   }
405 }
406
407 //=======================================================================
408 // name    : SMESHGUI_MoveNodesDlg::onSelectionDone
409 // Purpose : SLOT called when selection changed
410 //=======================================================================
411 void SMESHGUI_MoveNodesDlg::onSelectionDone()
412 {
413   if (myBusy) return;
414   myMeshActor = 0;
415
416   SALOME_ListIO aList;
417   mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
418
419   if (aList.Extent() == 1) {
420     Handle(SALOME_InteractiveObject) anIO = aList.First();
421     myMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
422     if(myMeshActor){
423       QString aText;
424       if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) {
425         if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()) {
426           if(const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
427             myBusy = true;
428             myId->setText(aText);
429             myX->SetValue(aNode->X());
430             myY->SetValue(aNode->Y());
431             myZ->SetValue(aNode->Z());
432             myBusy = false;
433             erasePreview(); // avoid overlapping of a selection and a preview
434             updateButtons();
435             return;
436           }
437         }
438       }
439     }
440   }
441
442   reset();
443 }
444
445 //=======================================================================
446 // name    : SMESHGUI_MoveNodesDlg::onDeactivate
447 // Purpose : SLOT called when dialog must be deativated
448 //=======================================================================
449 void SMESHGUI_MoveNodesDlg::onDeactivate()
450 {
451   setEnabled(false);
452   erasePreview();
453 }
454
455 //=======================================================================
456 // name    : SMESHGUI_MoveNodesDlg::enterEvent
457 // Purpose : Event filter
458 //=======================================================================
459 void SMESHGUI_MoveNodesDlg::enterEvent (QEvent*)
460 {
461   if (!isEnabled()) {
462     mySMESHGUI->EmitSignalDeactivateDialog();
463
464     // set selection mode
465     SMESH::SetPointRepresentation(true);
466     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
467       aViewWindow->SetSelectionMode(NodeSelection);
468
469     redisplayPreview();
470
471     setEnabled(true);
472   }
473 }
474
475 //=======================================================================
476 // name    : SMESHGUI_MoveNodesDlg::closeEvent
477 // Purpose :
478 //=======================================================================
479 void SMESHGUI_MoveNodesDlg::closeEvent (QCloseEvent*)
480 {
481   onClose();
482   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
483     aViewWindow->Repaint();
484 }
485
486 //=======================================================================
487 // name    : SMESHGUI_MoveNodesDlg::hideEvent
488 // Purpose : may be caused by ESC key
489 //=======================================================================
490 void SMESHGUI_MoveNodesDlg::hideEvent (QHideEvent*)
491 {
492   if (!isMinimized())
493     onClose();
494 }
495
496 //=======================================================================
497 // name    : SMESHGUI_MoveNodesDlg::updateButtons
498 // Purpose : Update buttons state
499 //=======================================================================
500 void SMESHGUI_MoveNodesDlg::updateButtons()
501 {
502   bool isEnabled = isValid(false);
503   myOkBtn->setEnabled(isEnabled);
504   myApplyBtn->setEnabled(isEnabled);
505 }
506
507 //=======================================================================
508 // name    : SMESHGUI_MoveNodesDlg::erasePreview
509 // Purpose : Erase preview
510 //=======================================================================
511 void  SMESHGUI_MoveNodesDlg::erasePreview()
512 {
513   if (myPreviewActor == 0)
514     return;
515
516   SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
517   if (aViewWindow)
518     aViewWindow->RemoveActor(myPreviewActor);
519   myPreviewActor->Delete();
520   myPreviewActor = 0;
521   if (aViewWindow)
522     aViewWindow->Repaint();
523 }
524
525 //=======================================================================
526 // name    : SMESHGUI_MoveNodesDlg::redisplayPreview
527 // Purpose : Redisplay preview
528 //=======================================================================
529 void SMESHGUI_MoveNodesDlg::redisplayPreview()
530 {
531   if (myBusy)
532     return;
533
534   if (myPreviewActor != 0)
535     erasePreview();
536
537   if (!isValid(false))
538     return;
539
540   vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
541
542   vtkPoints* aPoints = vtkPoints::New();
543   aPoints->SetNumberOfPoints(1);
544   aPoints->SetPoint(0, myX->GetValue(), myY->GetValue(), myZ->GetValue());
545
546   // Create cells
547
548   vtkIdList *anIdList = vtkIdList::New();
549   anIdList->SetNumberOfIds(1);
550
551   vtkCellArray *aCells = vtkCellArray::New();
552   aCells->Allocate(2, 0);
553
554   vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
555   aCellTypesArray->SetNumberOfComponents(1);
556   aCellTypesArray->Allocate(1);
557
558   anIdList->SetId(0, 0);
559   aCells->InsertNextCell(anIdList);
560   aCellTypesArray->InsertNextValue(VTK_VERTEX);
561   anIdList->Delete();
562
563   VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
564   aCellLocationsArray->SetNumberOfComponents(1);
565   aCellLocationsArray->SetNumberOfTuples(1);
566
567   aCells->InitTraversal();
568   vtkIdType npts;
569   aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts));
570
571   aGrid->SetPoints(aPoints);
572   aPoints->Delete();
573
574   aGrid->SetCells(aCellTypesArray,aCellLocationsArray,aCells);
575   aCellLocationsArray->Delete();
576   aCellTypesArray->Delete();
577   aCells->Delete();
578
579   // Create and display actor
580   vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
581   aMapper->SetInput(aGrid);
582   aGrid->Delete();
583
584   myPreviewActor = SALOME_Actor::New();
585   myPreviewActor->PickableOff();
586   myPreviewActor->SetMapper(aMapper);
587   aMapper->Delete();
588
589   vtkProperty* aProp = vtkProperty::New();
590   aProp->SetRepresentationToWireframe();
591   aProp->SetColor(250, 0, 250);
592   aProp->SetPointSize(5);
593   myPreviewActor->SetProperty(aProp);
594   aProp->Delete();
595
596   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
597     {
598       aViewWindow->AddActor(myPreviewActor);
599       aViewWindow->Repaint();
600     }
601 }
602
603 //=================================================================================
604 // function : keyPressEvent()
605 // purpose  :
606 //=================================================================================
607 void SMESHGUI_MoveNodesDlg::keyPressEvent( QKeyEvent* e )
608 {
609   QDialog::keyPressEvent( e );
610   if ( e->isAccepted() )
611     return;
612
613   if ( e->key() == Key_F1 )
614     {
615       e->accept();
616       onHelp();
617     }
618 }