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