1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_NodesDlg.cxx
25 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
28 #include "SMESHGUI_NodesDlg.h"
31 #include "SMESHGUI_SpinBox.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_MeshUtils.h"
35 #include "SMESHGUI_GroupUtils.h"
37 #include <SMESH_Actor.h>
38 #include <SMESH_ActorUtils.h>
39 #include <SMESH_ObjectDef.h>
41 #include <SMDS_Mesh.hxx>
42 #include <SMDS_MeshNode.hxx>
44 // SALOME GUI includes
45 #include <SUIT_Session.h>
46 #include <SUIT_OverrideCursor.h>
47 #include <SUIT_MessageBox.h>
48 #include <SUIT_Desktop.h>
49 #include <SUIT_ResourceMgr.h>
51 #include <LightApp_Application.h>
52 #include <LightApp_SelectionMgr.h>
54 #include <SVTK_ViewWindow.h>
55 #include <VTKViewer_Algorithm.h>
56 #include <VTKViewer_CellLocationsArray.h>
58 // SALOME KERNEL includes
59 #include <SALOMEDS_Study.hxx>
60 #include <SALOMEDS_SObject.hxx>
62 #include <utilities.h>
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>
78 #include <QPushButton>
79 #include <QRadioButton>
80 #include <QHBoxLayout>
81 #include <QVBoxLayout>
83 #include <QButtonGroup>
86 #include <SALOMEconfig.h>
87 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
94 long AddNode( SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z, const QStringList& theParameters )
97 SUIT_OverrideCursor wc;
99 _PTR(SObject) aSobj = SMESH::FindSObject( theMesh );
100 SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
101 aNodeId = aMeshEditor->AddNode( x, y, z );
102 theMesh->SetParameters( theParameters.join(":").toLatin1().constData() );
103 _PTR(Study) aStudy = GetActiveStudyDocument();
104 CORBA::Long anId = aStudy->StudyId();
105 if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) {
106 aVisualObj->Update( true );
109 catch ( SALOME::SALOME_Exception& exc ) {
110 INFOS( "Follow exception was cought:\n\t" << exc.details.text );
112 catch ( const std::exception& exc ) {
113 INFOS( "Follow exception was cought:\n\t" << exc.what() );
116 INFOS( "Unknown exception was cought !!!" );
121 class TNodeSimulation
123 SVTK_ViewWindow* myViewWindow;
125 SALOME_Actor* myPreviewActor;
126 vtkDataSetMapper* myMapper;
130 TNodeSimulation( SVTK_ViewWindow* theViewWindow ):
131 myViewWindow( theViewWindow )
133 vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
136 myPoints = vtkPoints::New();
137 myPoints->SetNumberOfPoints( 1 );
138 myPoints->SetPoint( 0, 0.0, 0.0, 0.0 );
141 vtkIdList *anIdList = vtkIdList::New();
142 anIdList->SetNumberOfIds( 1 );
144 vtkCellArray *aCells = vtkCellArray::New();
145 aCells->Allocate( 2, 0 );
147 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
148 aCellTypesArray->SetNumberOfComponents( 1 );
149 aCellTypesArray->Allocate( 1 );
151 anIdList->SetId( 0, 0 );
152 aCells->InsertNextCell( anIdList );
153 aCellTypesArray->InsertNextValue( VTK_VERTEX );
155 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
156 aCellLocationsArray->SetNumberOfComponents( 1 );
157 aCellLocationsArray->SetNumberOfTuples( 1 );
159 aCells->InitTraversal();
161 aCellLocationsArray->SetValue( 0, aCells->GetTraversalLocation( npts ) );
163 aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
165 aGrid->SetPoints( myPoints );
166 aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
167 aCellLocationsArray->Delete();
168 aCellTypesArray->Delete();
172 // Create and display actor
173 myMapper = vtkDataSetMapper::New();
174 myMapper->SetInput( aGrid );
177 myPreviewActor = SALOME_Actor::New();
178 myPreviewActor->SetInfinitive( true );
179 myPreviewActor->VisibilityOff();
180 myPreviewActor->PickableOff();
181 myPreviewActor->SetMapper( myMapper );
183 vtkProperty* aProp = vtkProperty::New();
184 aProp->SetRepresentationToPoints();
186 vtkFloatingPointType anRGB[3];
187 GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
188 aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
190 vtkFloatingPointType aPointSize = GetFloat( "SMESH:node_size", 3 );
191 aProp->SetPointSize( aPointSize );
193 myPreviewActor->SetProperty( aProp );
196 myViewWindow->AddActor( myPreviewActor );
199 void SetPosition( float x, float y, float z )
201 myPoints->SetPoint( 0, x, y, z );
202 myPoints->Modified();
203 SetVisibility( true );
206 void SetVisibility( bool theVisibility )
208 myPreviewActor->SetVisibility( theVisibility );
209 RepaintCurrentView();
214 myViewWindow->RemoveActor( myPreviewActor );
215 myPreviewActor->Delete();
217 myMapper->RemoveAllInputs();
225 //=================================================================================
226 // class : SMESHGUI_NodesDlg()
228 //=================================================================================
229 SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ):
230 QDialog( SMESH::GetDesktop( theModule ) ),
231 mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
232 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
233 mySMESHGUI( theModule )
236 setAttribute( Qt::WA_DeleteOnClose, true );
237 setWindowTitle( tr("MESH_NODE_TITLE") );
238 setSizeGripEnabled( true );
240 mySimulation = new SMESH::TNodeSimulation( SMESH::GetViewWindow( mySMESHGUI ) );
242 QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH",
243 tr( "ICON_DLG_NODE" ) ) );
245 QVBoxLayout* SMESHGUI_NodesDlgLayout = new QVBoxLayout( this );
246 SMESHGUI_NodesDlgLayout->setSpacing( SPACING );
247 SMESHGUI_NodesDlgLayout->setMargin( MARGIN );
249 /***************************************************************/
250 GroupConstructors = new QGroupBox( tr( "MESH_NODE" ), this );
251 QButtonGroup* ButtonGroup = new QButtonGroup(this);
252 QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout( GroupConstructors );
253 GroupConstructorsLayout->setSpacing( SPACING );
254 GroupConstructorsLayout->setMargin( MARGIN );
256 Constructor1 = new QRadioButton( GroupConstructors );
257 Constructor1->setIcon( image0 );
258 Constructor1->setChecked( true );
260 GroupConstructorsLayout->addWidget( Constructor1 );
261 ButtonGroup->addButton( Constructor1, 0 );
263 /***************************************************************/
264 GroupCoordinates = new QGroupBox( tr( "SMESH_COORDINATES" ), this );
265 QHBoxLayout* GroupCoordinatesLayout = new QHBoxLayout(GroupCoordinates);
266 GroupCoordinatesLayout->setSpacing(SPACING);
267 GroupCoordinatesLayout->setMargin(MARGIN);
269 TextLabel_X = new QLabel( tr( "SMESH_X" ), GroupCoordinates );
270 SpinBox_X = new SMESHGUI_SpinBox( GroupCoordinates );
272 TextLabel_Y = new QLabel( tr( "SMESH_Y" ), GroupCoordinates );
273 SpinBox_Y = new SMESHGUI_SpinBox( GroupCoordinates );
275 TextLabel_Z = new QLabel( tr( "SMESH_Z" ), GroupCoordinates );
276 SpinBox_Z = new SMESHGUI_SpinBox( GroupCoordinates );
278 GroupCoordinatesLayout->addWidget( TextLabel_X );
279 GroupCoordinatesLayout->addWidget( SpinBox_X );
280 GroupCoordinatesLayout->addWidget( TextLabel_Y);
281 GroupCoordinatesLayout->addWidget( SpinBox_Y );
282 GroupCoordinatesLayout->addWidget( TextLabel_Z );
283 GroupCoordinatesLayout->addWidget( SpinBox_Z );
286 /***************************************************************/
287 GroupGroups = new QGroupBox( tr( "SMESH_ADD_TO_GROUP" ), this );
288 GroupGroups->setCheckable( true );
289 QHBoxLayout* GroupGroupsLayout = new QHBoxLayout(GroupGroups);
290 GroupGroupsLayout->setSpacing(SPACING);
291 GroupGroupsLayout->setMargin(MARGIN);
293 TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
294 ComboBox_GroupName = new QComboBox( GroupGroups );
295 ComboBox_GroupName->setEditable( true );
297 GroupGroupsLayout->addWidget( TextLabel_GroupName );
298 GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
300 /***************************************************************/
301 GroupButtons = new QGroupBox( this );
302 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
303 GroupButtonsLayout->setSpacing( SPACING );
304 GroupButtonsLayout->setMargin( MARGIN );
305 buttonOk = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), GroupButtons );
306 buttonOk->setAutoDefault( true );
307 buttonOk->setDefault( true );
308 buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons );
309 buttonApply->setAutoDefault( true );
310 buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons );
311 buttonCancel->setAutoDefault( true );
312 buttonHelp = new QPushButton( tr( "SMESH_BUT_HELP" ), GroupButtons );
313 buttonHelp->setAutoDefault( true );
315 GroupButtonsLayout->addWidget( buttonOk );
316 GroupButtonsLayout->addSpacing( 10 );
317 GroupButtonsLayout->addWidget( buttonApply );
318 GroupButtonsLayout->addSpacing( 10 );
319 GroupButtonsLayout->addStretch();
320 GroupButtonsLayout->addWidget( buttonCancel );
321 GroupButtonsLayout->addWidget( buttonHelp );
323 /***************************************************************/
324 SMESHGUI_NodesDlgLayout->addWidget( GroupConstructors );
325 SMESHGUI_NodesDlgLayout->addWidget( GroupCoordinates );
326 SMESHGUI_NodesDlgLayout->addWidget( GroupGroups );
327 SMESHGUI_NodesDlgLayout->addWidget( GroupButtons );
329 myHelpFileName = "adding_nodes_and_elements_page.html#adding_nodes_anchor";
331 /* Initialisation and display */
335 //=======================================================================
336 // function : ~SMESHGUI_NodesDlg()
337 // purpose : Destructor
338 //=======================================================================
339 SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg()
344 //=================================================================================
347 //=================================================================================
348 void SMESHGUI_NodesDlg::Init()
350 /* Get setting of step value from file configuration */
353 /* min, max, step and decimals for spin boxes */
354 SpinBox_X->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, "length_precision" );
355 SpinBox_Y->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, "length_precision" );
356 SpinBox_Z->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, "length_precision" );
357 SpinBox_X->SetValue( 0.0 );
358 SpinBox_Y->SetValue( 0.0 );
359 SpinBox_Z->SetValue( 0.0 );
361 /* reset "Add to group" control */
362 GroupGroups->setChecked( false );
364 mySMESHGUI->SetActiveDialogBox( this );
366 /* signals and slots connections */
367 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
368 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
369 connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
370 connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) );
372 connect( SpinBox_X, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
373 connect( SpinBox_Y, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
374 connect( SpinBox_Z, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
376 connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), SLOT( SelectionIntoArgument() ) );
377 connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog() ) );
378 /* to close dialog if study frame change */
379 connect( mySMESHGUI, SIGNAL( SignalStudyFrameChanged() ), SLOT( ClickOnCancel() ) );
381 // set selection mode
382 SMESH::SetPointRepresentation( true );
383 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
384 aViewWindow->SetSelectionMode( NodeSelection );
386 SelectionIntoArgument();
389 //=================================================================================
390 // function : ValueChangedInSpinBox()
392 //=================================================================================
393 void SMESHGUI_NodesDlg::ValueChangedInSpinBox( double newValue )
395 if ( !myMesh->_is_nil() ) {
396 double vx = SpinBox_X->GetValue();
397 double vy = SpinBox_Y->GetValue();
398 double vz = SpinBox_Z->GetValue();
400 mySimulation->SetPosition( vx, vy, vz );
404 //=================================================================================
405 // function : ClickOnOk()
407 //=================================================================================
408 void SMESHGUI_NodesDlg::ClickOnOk()
410 if ( ClickOnApply() )
414 //=================================================================================
415 // function : ClickOnApply()
417 //=================================================================================
418 bool SMESHGUI_NodesDlg::ClickOnApply()
420 if ( mySMESHGUI->isActiveStudyLocked() )
423 if ( myMesh->_is_nil() ) {
424 SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ),
425 tr( "MESH_IS_NOT_SELECTED" ) );
432 /* Recup args and call method */
433 double x = SpinBox_X->GetValue();
434 double y = SpinBox_Y->GetValue();
435 double z = SpinBox_Z->GetValue();
437 QStringList aParameters;
438 aParameters << SpinBox_X->text();
439 aParameters << SpinBox_Y->text();
440 aParameters << SpinBox_Z->text();
442 mySimulation->SetVisibility( false );
443 long aNodeId = SMESH::AddNode( myMesh, x, y, z, aParameters );
444 SMESH::SetPointRepresentation( true );
446 if( aNodeId != -1 && GroupGroups->isChecked() ) {
447 SMESH::SMESH_Group_var aGroup;
448 QString aGroupName = ComboBox_GroupName->currentText();
449 SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
450 for( int i = 0, n = aListOfGroups.length(); i < n; i++ ) {
451 SMESH::SMESH_GroupBase_var aGroupBase = aListOfGroups[i];
452 if( !aGroupBase->_is_nil() ) {
453 SMESH::SMESH_Group_var aRefGroup = SMESH::SMESH_Group::_narrow( aGroupBase );
454 if( !aRefGroup->_is_nil() ) {
455 QString aRefGroupName( aRefGroup->GetName() );
456 if( aRefGroupName == aGroupName ) {
457 aGroup = aRefGroup; // // add node to existing group
463 if( aGroup->_is_nil() ) // create new group
464 aGroup = SMESH::AddGroup( myMesh, SMESH::NODE, aGroupName );
466 if( !aGroup->_is_nil() ) {
467 SMESH::long_array_var anIdList = new SMESH::long_array;
468 anIdList->length( 1 );
469 anIdList[0] = aNodeId;
470 aGroup->Add( anIdList.inout() );
476 mySelectionMgr->selectedObjects( aList );
477 if ( aList.Extent() != 1 ) {
478 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() ) {
479 VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
480 vtkActorCollection *aCollection = aCopy.GetActors();
481 aCollection->InitTraversal();
482 while ( vtkActor *anAct = aCollection->GetNextActor() ) {
483 if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct ) ) {
484 if ( anActor->hasIO() ) {
485 if ( SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>( anActor->GetObject().get() ) ) {
486 if ( myMesh->_is_equivalent( aMeshObj->GetMeshServer() ) ) {
488 aList.Append( anActor->getIO() );
489 mySelectionMgr->setSelectedObjects( aList, false );
501 //=================================================================================
502 // function : ClickOnCancel()
504 //=================================================================================
505 void SMESHGUI_NodesDlg::ClickOnCancel()
507 disconnect( mySelectionMgr, 0, this, 0 );
508 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
509 aViewWindow->SetSelectionMode( ActorSelection );
511 mySimulation->SetVisibility( false );
512 SMESH::SetPointRepresentation( false );
513 mySMESHGUI->ResetState();
518 //=================================================================================
519 // function : ClickOnHelp()
521 //=================================================================================
522 void SMESHGUI_NodesDlg::ClickOnHelp()
524 LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
526 app->onHelpContextModule( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) :
527 QString( "" ), myHelpFileName );
531 platform = "winapplication";
533 platform = "application";
535 SUIT_MessageBox::warning( this, tr("WRN_WARNING"),
536 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
537 arg( app->resourceMgr()->stringValue( "ExternalBrowser",
539 arg( myHelpFileName ) );
543 //=================================================================================
544 // function : SelectionIntoArgument()
545 // purpose : Called when selection as changed or other case
546 //=================================================================================
547 void SMESHGUI_NodesDlg::SelectionIntoArgument()
549 if ( !GroupConstructors->isEnabled() )
552 mySimulation->SetVisibility( false );
553 SMESH::SetPointRepresentation( true );
555 QString aCurrentEntry = myEntry;
557 const SALOME_ListIO& aList = mySelector->StoredIObjects();
558 if ( aList.Extent() == 1 ) {
559 Handle(SALOME_InteractiveObject) anIO = aList.First();
560 if ( anIO->hasEntry() ) {
561 myEntry = anIO->getEntry();
562 myMesh = SMESH::GetMeshByIO( anIO );
563 if ( myMesh->_is_nil() ) return;
565 if ( SMESH::GetNameOfSelectedNodes( mySelector, anIO, aText ) == 1 ) {
566 if ( SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh.in() ) ) {
567 if ( SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh() ) {
568 if ( const SMDS_MeshNode* aNode = aMesh->FindNode( aText.toInt() ) ) {
569 SpinBox_X->SetValue( aNode->X() );
570 SpinBox_Y->SetValue( aNode->Y() );
571 SpinBox_Z->SetValue( aNode->Z() );
576 mySimulation->SetPosition( SpinBox_X->GetValue(),
577 SpinBox_Y->GetValue(),
578 SpinBox_Z->GetValue() );
583 if ( !myMesh->_is_nil() && myEntry != aCurrentEntry ) {
584 ComboBox_GroupName->clear();
585 ComboBox_GroupName->addItem( QString() );
586 SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
587 for( int i = 0, n = aListOfGroups.length(); i < n; i++ ) {
588 SMESH::SMESH_GroupBase_var aGroupBase = aListOfGroups[i];
589 if ( !aGroupBase->_is_nil() && aGroupBase->GetType() == SMESH::NODE ) {
590 SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow( aGroupBase );
591 if ( !aGroup->_is_nil() ) {
592 QString aGroupName( aGroup->GetName() );
593 if ( !aGroupName.isEmpty() )
594 ComboBox_GroupName->addItem( aGroupName );
601 //=================================================================================
602 // function : closeEvent()
604 //=================================================================================
605 void SMESHGUI_NodesDlg::closeEvent( QCloseEvent* )
607 this->ClickOnCancel(); /* same than click on cancel button */
610 //=================================================================================
611 // function : hideEvent()
612 // purpose : caused by ESC key
613 //=================================================================================
614 void SMESHGUI_NodesDlg::hideEvent( QHideEvent* )
616 if ( !isMinimized() )
620 //=================================================================================
621 // function : enterEvent()
622 // purpose : to reactivate this dialog box when mouse enter onto the window
623 //=================================================================================
624 void SMESHGUI_NodesDlg::enterEvent( QEvent* )
626 if ( !GroupConstructors->isEnabled() )
627 ActivateThisDialog();
630 //=================================================================================
631 // function : DeactivateActiveDialog()
632 // purpose : public slot to deactivate if active
633 //=================================================================================
634 void SMESHGUI_NodesDlg::DeactivateActiveDialog()
636 if ( GroupConstructors->isEnabled() ) {
637 GroupConstructors->setEnabled( false );
638 GroupCoordinates->setEnabled( false );
639 GroupButtons->setEnabled( false );
640 mySimulation->SetVisibility( false );
641 mySMESHGUI->ResetState();
642 mySMESHGUI->SetActiveDialogBox( 0 );
646 //=================================================================================
647 // function : ActivateThisDialog()
649 //=================================================================================
650 void SMESHGUI_NodesDlg::ActivateThisDialog()
652 mySMESHGUI->EmitSignalDeactivateDialog();
653 GroupConstructors->setEnabled( true );
654 GroupCoordinates->setEnabled( true );
655 GroupButtons->setEnabled( true );
657 SMESH::SetPointRepresentation( true );
658 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
659 aViewWindow->SetSelectionMode( NodeSelection );
661 SelectionIntoArgument();
664 //=================================================================================
665 // function : keyPressEvent()
667 //=================================================================================
668 void SMESHGUI_NodesDlg::keyPressEvent( QKeyEvent* e )
670 QDialog::keyPressEvent( e );
671 if ( e->isAccepted() )
674 if ( e->key() == Qt::Key_F1 ) {
680 //=================================================================================
681 // function : isValid
683 //=================================================================================
684 bool SMESHGUI_NodesDlg::isValid()
688 ok = SpinBox_X->isValid( msg, true ) && ok;
689 ok = SpinBox_Y->isValid( msg, true ) && ok;
690 ok = SpinBox_Z->isValid( msg, true ) && ok;
693 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
694 if ( !msg.isEmpty() )
696 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
700 if( GroupGroups->isChecked() && ComboBox_GroupName->currentText().isEmpty() ) {
701 SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ), tr( "GROUP_NAME_IS_EMPTY" ) );