Salome HOME
Debug
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_NodesDlg.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_NodesDlg.cxx
24 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
25 // SMESH includes
26 //
27 #include "SMESHGUI_NodesDlg.h"
28
29 #include "SMESHGUI.h"
30 #include "SMESHGUI_SpinBox.h"
31 #include "SMESHGUI_Utils.h"
32 #include "SMESHGUI_VTKUtils.h"
33 #include "SMESHGUI_MeshUtils.h"
34
35 #include <SMESH_Actor.h>
36 #include <SMESH_ActorUtils.h>
37 #include <SMESH_ObjectDef.h>
38
39 #include <SMDS_Mesh.hxx>
40 #include <SMDS_MeshNode.hxx>
41
42 // SALOME GUI includes
43 #include <SUIT_Session.h>
44 #include <SUIT_OverrideCursor.h>
45 #include <SUIT_MessageBox.h>
46 #include <SUIT_Desktop.h>
47 #include <SUIT_ResourceMgr.h>
48
49 #include <LightApp_Application.h>
50 #include <LightApp_SelectionMgr.h>
51
52 #include <SalomeApp_Notebook.h>
53
54 #include <SVTK_ViewWindow.h>
55 #include <VTKViewer_Algorithm.h>
56 #include <VTKViewer_CellLocationsArray.h>
57
58 // SALOME KERNEL includes
59 #include <SALOMEDS_Study.hxx>
60 #include <SALOMEDS_SObject.hxx>
61
62 #include <utilities.h>
63
64 // VTK includes
65 #include <vtkIdList.h>
66 #include <vtkCellArray.h>
67 #include <vtkUnsignedCharArray.h>
68 #include <vtkUnstructuredGrid.h>
69 #include <vtkDataSetMapper.h>
70 #include <vtkRenderer.h>
71 #include <vtkProperty.h>
72 #include <vtkPoints.h>
73
74 // Qt includes
75 #include <QGroupBox>
76 #include <QLabel>
77 #include <QPushButton>
78 #include <QRadioButton>
79 #include <QHBoxLayout>
80 #include <QVBoxLayout>
81 #include <QKeyEvent>
82 #include <QButtonGroup>
83
84 // IDL includes
85 #include <SALOMEconfig.h>
86 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
87
88 #define SPACING 6
89 #define MARGIN  11
90
91 namespace SMESH
92 {
93   void AddNode( SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z,
94                 SalomeApp_Notebook* theNotebook, const QStringList& theParameters )
95   {
96     SUIT_OverrideCursor wc;
97     try {
98       _PTR(SObject) aSobj = SMESH::FindSObject( theMesh );
99       SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
100       aMeshEditor->AddNode( x, y, z );
101       theNotebook->setParameters( theMesh, theParameters );
102       _PTR(Study) aStudy = GetActiveStudyDocument();
103       CORBA::Long anId = aStudy->StudyId();
104       if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) {
105         aVisualObj->Update( true );
106       }
107     } 
108     catch ( SALOME::SALOME_Exception& exc ) {
109       INFOS( "Follow exception was cought:\n\t" << exc.details.text );
110     }
111     catch ( const std::exception& exc ) {
112       INFOS( "Follow exception was cought:\n\t" << exc.what() );
113     } 
114     catch ( ... ) {
115       INFOS( "Unknown exception was cought !!!" );
116     }
117   }
118
119   class TNodeSimulation 
120   {
121     SVTK_ViewWindow*  myViewWindow;
122
123     SALOME_Actor*     myPreviewActor;
124     vtkDataSetMapper* myMapper;
125     vtkPoints*        myPoints;
126
127   public:
128     TNodeSimulation( SVTK_ViewWindow* theViewWindow ):
129       myViewWindow( theViewWindow )
130     {
131       vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
132
133       // Create points
134       myPoints = vtkPoints::New();
135       myPoints->SetNumberOfPoints( 1 );
136       myPoints->SetPoint( 0, 0.0, 0.0, 0.0 );
137
138       // Create cells
139       vtkIdList *anIdList = vtkIdList::New();
140       anIdList->SetNumberOfIds( 1 );
141
142       vtkCellArray *aCells = vtkCellArray::New();
143       aCells->Allocate( 2, 0 );
144
145       vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
146       aCellTypesArray->SetNumberOfComponents( 1 );
147       aCellTypesArray->Allocate( 1 );
148
149       anIdList->SetId( 0, 0 );
150       aCells->InsertNextCell( anIdList );
151       aCellTypesArray->InsertNextValue( VTK_VERTEX );
152
153       VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
154       aCellLocationsArray->SetNumberOfComponents( 1 );
155       aCellLocationsArray->SetNumberOfTuples( 1 );
156
157       aCells->InitTraversal();
158       vtkIdType npts = 0;
159       aCellLocationsArray->SetValue( 0, aCells->GetTraversalLocation( npts ) );
160
161       aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
162
163       aGrid->SetPoints( myPoints );
164       aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
165       aCellLocationsArray->Delete();
166       aCellTypesArray->Delete();
167       aCells->Delete();
168       anIdList->Delete();
169
170       // Create and display actor
171       myMapper = vtkDataSetMapper::New();
172       myMapper->SetInput( aGrid );
173       aGrid->Delete();
174
175       myPreviewActor = SALOME_Actor::New();
176       myPreviewActor->SetInfinitive( true );
177       myPreviewActor->VisibilityOff();
178       myPreviewActor->PickableOff();
179       myPreviewActor->SetMapper( myMapper );
180
181       vtkProperty* aProp = vtkProperty::New();
182       aProp->SetRepresentationToPoints();
183
184       vtkFloatingPointType anRGB[3];
185       GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
186       aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
187
188       vtkFloatingPointType aPointSize = GetFloat( "SMESH:node_size", 3 );
189       aProp->SetPointSize( aPointSize );
190
191       myPreviewActor->SetProperty( aProp );
192       aProp->Delete();
193
194       myViewWindow->AddActor( myPreviewActor );
195     }
196
197     void SetPosition( float x, float y, float z )
198     {
199       myPoints->SetPoint( 0, x, y, z );
200       myPoints->Modified();
201       SetVisibility( true );
202     }
203
204     void SetVisibility( bool theVisibility )
205     {
206       myPreviewActor->SetVisibility( theVisibility );
207       RepaintCurrentView();
208     }
209
210     ~TNodeSimulation()
211     {
212       myViewWindow->RemoveActor( myPreviewActor );
213       myPreviewActor->Delete();
214
215       myMapper->RemoveAllInputs();
216       myMapper->Delete();
217
218       myPoints->Delete();
219     }
220   };
221 }
222
223 //=================================================================================
224 // class    : SMESHGUI_NodesDlg()
225 // purpose  :
226 //=================================================================================
227 SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ): 
228   QDialog( SMESH::GetDesktop( theModule ) ),
229   SMESHGUI_Helper( theModule ),
230   mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
231   mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
232   mySMESHGUI( theModule )
233 {
234   setModal( false );
235   setAttribute( Qt::WA_DeleteOnClose, true );
236   setWindowTitle( tr("MESH_NODE_TITLE") );
237   setSizeGripEnabled( true );
238   
239   mySimulation = new SMESH::TNodeSimulation( SMESH::GetViewWindow( mySMESHGUI ) );
240   
241   QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", 
242                                                                    tr( "ICON_DLG_NODE" ) ) );
243   
244   QVBoxLayout* SMESHGUI_NodesDlgLayout = new QVBoxLayout( this );
245   SMESHGUI_NodesDlgLayout->setSpacing( SPACING );
246   SMESHGUI_NodesDlgLayout->setMargin( MARGIN );
247
248   /***************************************************************/
249   GroupConstructors = new QGroupBox( tr( "MESH_NODE" ), this );
250   QButtonGroup* ButtonGroup = new QButtonGroup(this);
251   QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout( GroupConstructors );
252   GroupConstructorsLayout->setSpacing( SPACING );
253   GroupConstructorsLayout->setMargin( MARGIN );
254
255   Constructor1 = new QRadioButton( GroupConstructors );
256   Constructor1->setIcon( image0 );
257   Constructor1->setChecked( true );
258   
259   GroupConstructorsLayout->addWidget( Constructor1 );
260   ButtonGroup->addButton( Constructor1, 0 );
261
262   /***************************************************************/
263   GroupCoordinates = new QGroupBox( tr( "SMESH_COORDINATES" ), this );
264   QHBoxLayout* GroupCoordinatesLayout = new QHBoxLayout(GroupCoordinates);
265   GroupCoordinatesLayout->setSpacing(SPACING);
266   GroupCoordinatesLayout->setMargin(MARGIN);
267
268   TextLabel_X = new QLabel( tr( "SMESH_X" ), GroupCoordinates );
269   SpinBox_X = new SMESHGUI_SpinBox( GroupCoordinates );
270
271   TextLabel_Y = new QLabel( tr( "SMESH_Y" ), GroupCoordinates );
272   SpinBox_Y = new SMESHGUI_SpinBox( GroupCoordinates );
273
274   TextLabel_Z = new QLabel( tr( "SMESH_Z" ), GroupCoordinates );
275   SpinBox_Z = new SMESHGUI_SpinBox( GroupCoordinates );
276
277   GroupCoordinatesLayout->addWidget( TextLabel_X );
278   GroupCoordinatesLayout->addWidget( SpinBox_X );
279   GroupCoordinatesLayout->addWidget( TextLabel_Y);
280   GroupCoordinatesLayout->addWidget( SpinBox_Y );
281   GroupCoordinatesLayout->addWidget( TextLabel_Z );
282   GroupCoordinatesLayout->addWidget( SpinBox_Z );
283
284   /***************************************************************/
285   GroupButtons = new QGroupBox( this );
286   QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
287   GroupButtonsLayout->setSpacing( SPACING );
288   GroupButtonsLayout->setMargin( MARGIN );
289   buttonOk = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), GroupButtons );
290   buttonOk->setAutoDefault( true );
291   buttonOk->setDefault( true );
292   buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons );
293   buttonApply->setAutoDefault( true );
294   buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons );
295   buttonCancel->setAutoDefault( true );
296   buttonHelp = new QPushButton( tr( "SMESH_BUT_HELP" ), GroupButtons );
297   buttonHelp->setAutoDefault( true );
298
299   GroupButtonsLayout->addWidget( buttonOk );
300   GroupButtonsLayout->addSpacing( 10 );
301   GroupButtonsLayout->addWidget( buttonApply );
302   GroupButtonsLayout->addSpacing( 10 );
303   GroupButtonsLayout->addStretch();
304   GroupButtonsLayout->addWidget( buttonCancel );
305   GroupButtonsLayout->addWidget( buttonHelp );
306
307   /***************************************************************/
308   SMESHGUI_NodesDlgLayout->addWidget( GroupConstructors );
309   SMESHGUI_NodesDlgLayout->addWidget( GroupCoordinates );
310   SMESHGUI_NodesDlgLayout->addWidget( GroupButtons );
311
312   myHelpFileName = "adding_nodes_and_elements_page.html#adding_nodes_anchor";
313
314   /* Initialisation and display */
315   Init();
316 }
317
318 //=======================================================================
319 // function : ~SMESHGUI_NodesDlg()
320 // purpose  : Destructor
321 //=======================================================================
322 SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg()
323 {
324   delete mySimulation;
325 }
326
327 //=================================================================================
328 // function : Init()
329 // purpose  :
330 //=================================================================================
331 void SMESHGUI_NodesDlg::Init()
332 {
333   /* Get setting of step value from file configuration */
334   double step = 25.0;
335
336   /* min, max, step and decimals for spin boxes */
337   SpinBox_X->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
338   SpinBox_Y->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
339   SpinBox_Z->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
340   SpinBox_X->SetValue( 0.0 );
341   SpinBox_Y->SetValue( 0.0 );
342   SpinBox_Z->SetValue( 0.0 );
343
344   mySMESHGUI->SetActiveDialogBox( this );
345
346   /* signals and slots connections */
347   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
348   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
349   connect( buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
350   connect( buttonHelp,   SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) );
351
352   connect( SpinBox_X, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
353   connect( SpinBox_Y, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
354   connect( SpinBox_Z, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
355
356   connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ),      SLOT( SelectionIntoArgument() ) );
357   connect( mySMESHGUI,     SIGNAL( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog() ) );
358   /* to close dialog if study frame change */
359   connect( mySMESHGUI,     SIGNAL( SignalStudyFrameChanged() ),      SLOT( ClickOnCancel() ) );
360
361   // set selection mode
362   SMESH::SetPointRepresentation( true );
363   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
364     aViewWindow->SetSelectionMode( NodeSelection );
365
366   SelectionIntoArgument();
367 }
368
369 //=================================================================================
370 // function : ValueChangedInSpinBox()
371 // purpose  :
372 //=================================================================================
373 void SMESHGUI_NodesDlg::ValueChangedInSpinBox( double newValue )
374 {
375   if ( !myMesh->_is_nil() ) {
376     double vx = SpinBox_X->GetValue();
377     double vy = SpinBox_Y->GetValue();
378     double vz = SpinBox_Z->GetValue();
379
380     mySimulation->SetPosition( vx, vy, vz );
381   }
382 }
383
384 //=================================================================================
385 // function : ClickOnOk()
386 // purpose  :
387 //=================================================================================
388 void SMESHGUI_NodesDlg::ClickOnOk()
389 {
390   if ( ClickOnApply() )
391     ClickOnCancel();
392 }
393
394 //=================================================================================
395 // function : ClickOnApply()
396 // purpose  :
397 //=================================================================================
398 bool SMESHGUI_NodesDlg::ClickOnApply()
399 {
400   if ( mySMESHGUI->isActiveStudyLocked() )
401     return false;
402
403   if ( myMesh->_is_nil() ) {
404     SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ),
405                               tr( "MESH_IS_NOT_SELECTED" ) );
406     return false;
407   }
408
409   if( !isValid() )
410     return false;
411
412   /* Recup args and call method */
413   double x = SpinBox_X->GetValue();
414   double y = SpinBox_Y->GetValue();
415   double z = SpinBox_Z->GetValue();
416
417   QStringList aParameters;
418   aParameters << SpinBox_X->text();
419   aParameters << SpinBox_Y->text();
420   aParameters << SpinBox_Z->text();
421
422   mySimulation->SetVisibility( false );
423   SMESH::AddNode( myMesh, x, y, z, getNotebook(), aParameters );
424   SMESH::SetPointRepresentation( true );
425
426   // select myMesh
427   SALOME_ListIO aList;
428   mySelectionMgr->selectedObjects( aList );
429   if ( aList.Extent() != 1 ) {
430     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() ) {
431       VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
432       vtkActorCollection *aCollection = aCopy.GetActors();
433       aCollection->InitTraversal();
434       while ( vtkActor *anAct = aCollection->GetNextActor() ) {
435         if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct ) ) {
436           if ( anActor->hasIO() ) {
437             if ( SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>( anActor->GetObject().get() ) ) {
438               if ( myMesh->_is_equivalent( aMeshObj->GetMeshServer() ) ) {
439                 aList.Clear();
440                 aList.Append( anActor->getIO() );
441                 mySelectionMgr->setSelectedObjects( aList, false );
442                 break;
443               }
444             }
445           }
446         }
447       }
448     }
449   }
450   return true;
451 }
452
453 //=================================================================================
454 // function : ClickOnCancel()
455 // purpose  :
456 //=================================================================================
457 void SMESHGUI_NodesDlg::ClickOnCancel()
458 {
459   disconnect( mySelectionMgr, 0, this, 0 );
460   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
461     aViewWindow->SetSelectionMode( ActorSelection );
462
463   mySimulation->SetVisibility( false );
464   SMESH::SetPointRepresentation( false );
465   mySMESHGUI->ResetState();
466
467   reject();
468 }
469
470 //=================================================================================
471 // function : ClickOnHelp()
472 // purpose  :
473 //=================================================================================
474 void SMESHGUI_NodesDlg::ClickOnHelp()
475 {
476   LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
477   if ( app ) 
478     app->onHelpContextModule( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : 
479                               QString( "" ), myHelpFileName );
480   else {
481     QString platform;
482 #ifdef WIN32
483     platform = "winapplication";
484 #else
485     platform = "application";
486 #endif
487     SUIT_MessageBox::warning( this, tr("WRN_WARNING"),
488                               tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
489                               arg( app->resourceMgr()->stringValue( "ExternalBrowser", 
490                                                                     platform ) ).
491                               arg( myHelpFileName ) );
492   }
493 }
494
495 //=================================================================================
496 // function : SelectionIntoArgument()
497 // purpose  : Called when selection as changed or other case
498 //=================================================================================
499 void SMESHGUI_NodesDlg::SelectionIntoArgument()
500 {
501   if ( !GroupConstructors->isEnabled() )
502     return;
503
504   mySimulation->SetVisibility( false );
505   SMESH::SetPointRepresentation( true );
506
507   const SALOME_ListIO& aList = mySelector->StoredIObjects();
508   if ( aList.Extent() == 1 ) {
509     Handle(SALOME_InteractiveObject) anIO = aList.First();
510     if ( anIO->hasEntry() ) {
511       myMesh = SMESH::GetMeshByIO( anIO );
512       if ( myMesh->_is_nil() ) return;
513       QString aText;
514       if ( SMESH::GetNameOfSelectedNodes( mySelector, anIO, aText ) == 1 ) {
515         if ( SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh.in() ) ) {
516           if ( SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh() ) {
517             if ( const SMDS_MeshNode* aNode = aMesh->FindNode( aText.toInt() ) ) {
518               SpinBox_X->SetValue( aNode->X() );
519               SpinBox_Y->SetValue( aNode->Y() );
520               SpinBox_Z->SetValue( aNode->Z() );
521             }
522           }
523         }
524       }
525       mySimulation->SetPosition( SpinBox_X->GetValue(),
526                                  SpinBox_Y->GetValue(),
527                                  SpinBox_Z->GetValue() );
528     }
529   }
530 }
531
532 //=================================================================================
533 // function : closeEvent()
534 // purpose  :
535 //=================================================================================
536 void SMESHGUI_NodesDlg::closeEvent( QCloseEvent* )
537 {
538   this->ClickOnCancel(); /* same than click on cancel button */
539 }
540
541 //=================================================================================
542 // function : hideEvent()
543 // purpose  : caused by ESC key
544 //=================================================================================
545 void SMESHGUI_NodesDlg::hideEvent( QHideEvent* )
546 {
547   if ( !isMinimized() )
548     ClickOnCancel();
549 }
550
551 //=================================================================================
552 // function : enterEvent()
553 // purpose  : to reactivate this dialog box when mouse enter onto the window
554 //=================================================================================
555 void SMESHGUI_NodesDlg::enterEvent( QEvent* )
556 {
557   if ( !GroupConstructors->isEnabled() )
558     ActivateThisDialog();
559 }
560
561 //=================================================================================
562 // function : DeactivateActiveDialog()
563 // purpose  : public slot to deactivate if active
564 //=================================================================================
565 void SMESHGUI_NodesDlg::DeactivateActiveDialog()
566 {
567   if ( GroupConstructors->isEnabled() ) {
568     GroupConstructors->setEnabled( false );
569     GroupCoordinates->setEnabled( false );
570     GroupButtons->setEnabled( false );
571     mySimulation->SetVisibility( false );
572     mySMESHGUI->ResetState();
573     mySMESHGUI->SetActiveDialogBox( 0 );
574   }
575 }
576
577 //=================================================================================
578 // function : ActivateThisDialog()
579 // purpose  :
580 //=================================================================================
581 void SMESHGUI_NodesDlg::ActivateThisDialog()
582 {
583   mySMESHGUI->EmitSignalDeactivateDialog();
584   GroupConstructors->setEnabled( true );
585   GroupCoordinates->setEnabled( true );
586   GroupButtons->setEnabled( true );
587
588   SMESH::SetPointRepresentation( true );
589   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
590     aViewWindow->SetSelectionMode( NodeSelection );
591
592   SelectionIntoArgument();
593 }
594
595 //=================================================================================
596 // function : keyPressEvent()
597 // purpose  :
598 //=================================================================================
599 void SMESHGUI_NodesDlg::keyPressEvent( QKeyEvent* e )
600 {
601   QDialog::keyPressEvent( e );
602   if ( e->isAccepted() )
603     return;
604
605   if ( e->key() == Qt::Key_F1 ) {
606     e->accept();
607     ClickOnHelp();
608   }
609 }
610
611 //=================================================================================
612 // function : isValid
613 // purpose  :
614 //=================================================================================
615 bool SMESHGUI_NodesDlg::isValid()
616 {
617   return checkParameters( true, 3, SpinBox_X, SpinBox_Y, SpinBox_Z );
618 }