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