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