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