1 // Copyright (C) 2007-2008 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
22 // SMESH SMESHGUI : GUI for SMESH component
23 // File : SMESHGUI_NodesDlg.cxx
24 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
27 #include "SMESHGUI_NodesDlg.h"
30 #include "SMESHGUI_SpinBox.h"
31 #include "SMESHGUI_Utils.h"
32 #include "SMESHGUI_VTKUtils.h"
33 #include "SMESHGUI_MeshUtils.h"
34 #include "SMESHGUI_GroupUtils.h"
36 #include <SMESH_Actor.h>
37 #include <SMESH_ActorUtils.h>
38 #include <SMESH_ObjectDef.h>
40 #include <SMDS_Mesh.hxx>
41 #include <SMDS_MeshNode.hxx>
43 // SALOME GUI includes
44 #include <SUIT_Session.h>
45 #include <SUIT_OverrideCursor.h>
46 #include <SUIT_MessageBox.h>
47 #include <SUIT_Desktop.h>
48 #include <SUIT_ResourceMgr.h>
50 #include <LightApp_Application.h>
51 #include <LightApp_SelectionMgr.h>
53 #include <SVTK_ViewWindow.h>
54 #include <VTKViewer_Algorithm.h>
55 #include <VTKViewer_CellLocationsArray.h>
57 // SALOME KERNEL includes
58 #include <SALOMEDS_Study.hxx>
59 #include <SALOMEDS_SObject.hxx>
61 #include <utilities.h>
64 #include <vtkIdList.h>
65 #include <vtkCellArray.h>
66 #include <vtkUnsignedCharArray.h>
67 #include <vtkUnstructuredGrid.h>
68 #include <vtkDataSetMapper.h>
69 #include <vtkRenderer.h>
70 #include <vtkProperty.h>
71 #include <vtkPoints.h>
77 #include <QPushButton>
78 #include <QRadioButton>
79 #include <QHBoxLayout>
80 #include <QVBoxLayout>
82 #include <QButtonGroup>
85 #include <SALOMEconfig.h>
86 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
93 long AddNode( SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z, const QStringList& theParameters )
96 SUIT_OverrideCursor wc;
98 _PTR(SObject) aSobj = SMESH::FindSObject( theMesh );
99 SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
100 aNodeId = aMeshEditor->AddNode( x, y, z );
101 theMesh->SetParameters( theParameters.join(":").toLatin1().constData() );
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 );
108 catch ( SALOME::SALOME_Exception& exc ) {
109 INFOS( "Follow exception was cought:\n\t" << exc.details.text );
111 catch ( const std::exception& exc ) {
112 INFOS( "Follow exception was cought:\n\t" << exc.what() );
115 INFOS( "Unknown exception was cought !!!" );
120 class TNodeSimulation
122 SVTK_ViewWindow* myViewWindow;
124 SALOME_Actor* myPreviewActor;
125 vtkDataSetMapper* myMapper;
129 TNodeSimulation( SVTK_ViewWindow* theViewWindow ):
130 myViewWindow( theViewWindow )
132 vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
135 myPoints = vtkPoints::New();
136 myPoints->SetNumberOfPoints( 1 );
137 myPoints->SetPoint( 0, 0.0, 0.0, 0.0 );
140 vtkIdList *anIdList = vtkIdList::New();
141 anIdList->SetNumberOfIds( 1 );
143 vtkCellArray *aCells = vtkCellArray::New();
144 aCells->Allocate( 2, 0 );
146 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
147 aCellTypesArray->SetNumberOfComponents( 1 );
148 aCellTypesArray->Allocate( 1 );
150 anIdList->SetId( 0, 0 );
151 aCells->InsertNextCell( anIdList );
152 aCellTypesArray->InsertNextValue( VTK_VERTEX );
154 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
155 aCellLocationsArray->SetNumberOfComponents( 1 );
156 aCellLocationsArray->SetNumberOfTuples( 1 );
158 aCells->InitTraversal();
160 aCellLocationsArray->SetValue( 0, aCells->GetTraversalLocation( npts ) );
162 aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
164 aGrid->SetPoints( myPoints );
165 aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
166 aCellLocationsArray->Delete();
167 aCellTypesArray->Delete();
171 // Create and display actor
172 myMapper = vtkDataSetMapper::New();
173 myMapper->SetInput( aGrid );
176 myPreviewActor = SALOME_Actor::New();
177 myPreviewActor->SetInfinitive( true );
178 myPreviewActor->VisibilityOff();
179 myPreviewActor->PickableOff();
180 myPreviewActor->SetMapper( myMapper );
182 vtkProperty* aProp = vtkProperty::New();
183 aProp->SetRepresentationToPoints();
185 vtkFloatingPointType anRGB[3];
186 GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
187 aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
189 vtkFloatingPointType aPointSize = GetFloat( "SMESH:node_size", 3 );
190 aProp->SetPointSize( aPointSize );
192 myPreviewActor->SetProperty( aProp );
195 myViewWindow->AddActor( myPreviewActor );
198 void SetPosition( float x, float y, float z )
200 myPoints->SetPoint( 0, x, y, z );
201 myPoints->Modified();
202 SetVisibility( true );
205 void SetVisibility( bool theVisibility )
207 myPreviewActor->SetVisibility( theVisibility );
208 RepaintCurrentView();
213 myViewWindow->RemoveActor( myPreviewActor );
214 myPreviewActor->Delete();
216 myMapper->RemoveAllInputs();
224 //=================================================================================
225 // class : SMESHGUI_NodesDlg()
227 //=================================================================================
228 SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ):
229 QDialog( SMESH::GetDesktop( theModule ) ),
230 mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
231 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
232 mySMESHGUI( theModule )
235 setAttribute( Qt::WA_DeleteOnClose, true );
236 setWindowTitle( tr("MESH_NODE_TITLE") );
237 setSizeGripEnabled( true );
239 mySimulation = new SMESH::TNodeSimulation( SMESH::GetViewWindow( mySMESHGUI ) );
241 QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH",
242 tr( "ICON_DLG_NODE" ) ) );
244 QVBoxLayout* SMESHGUI_NodesDlgLayout = new QVBoxLayout( this );
245 SMESHGUI_NodesDlgLayout->setSpacing( SPACING );
246 SMESHGUI_NodesDlgLayout->setMargin( MARGIN );
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 );
255 Constructor1 = new QRadioButton( GroupConstructors );
256 Constructor1->setIcon( image0 );
257 Constructor1->setChecked( true );
259 GroupConstructorsLayout->addWidget( Constructor1 );
260 ButtonGroup->addButton( Constructor1, 0 );
262 /***************************************************************/
263 GroupCoordinates = new QGroupBox( tr( "SMESH_COORDINATES" ), this );
264 QHBoxLayout* GroupCoordinatesLayout = new QHBoxLayout(GroupCoordinates);
265 GroupCoordinatesLayout->setSpacing(SPACING);
266 GroupCoordinatesLayout->setMargin(MARGIN);
268 TextLabel_X = new QLabel( tr( "SMESH_X" ), GroupCoordinates );
269 SpinBox_X = new SMESHGUI_SpinBox( GroupCoordinates );
271 TextLabel_Y = new QLabel( tr( "SMESH_Y" ), GroupCoordinates );
272 SpinBox_Y = new SMESHGUI_SpinBox( GroupCoordinates );
274 TextLabel_Z = new QLabel( tr( "SMESH_Z" ), GroupCoordinates );
275 SpinBox_Z = new SMESHGUI_SpinBox( GroupCoordinates );
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 );
285 /***************************************************************/
286 GroupGroups = new QGroupBox( tr( "SMESH_ADD_TO_GROUP" ), this );
287 GroupGroups->setCheckable( true );
288 QHBoxLayout* GroupGroupsLayout = new QHBoxLayout(GroupGroups);
289 GroupGroupsLayout->setSpacing(SPACING);
290 GroupGroupsLayout->setMargin(MARGIN);
292 TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
293 ComboBox_GroupName = new QComboBox( GroupGroups );
294 ComboBox_GroupName->setEditable( true );
296 GroupGroupsLayout->addWidget( TextLabel_GroupName );
297 GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
299 /***************************************************************/
300 GroupButtons = new QGroupBox( this );
301 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
302 GroupButtonsLayout->setSpacing( SPACING );
303 GroupButtonsLayout->setMargin( MARGIN );
304 buttonOk = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), GroupButtons );
305 buttonOk->setAutoDefault( true );
306 buttonOk->setDefault( true );
307 buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons );
308 buttonApply->setAutoDefault( true );
309 buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons );
310 buttonCancel->setAutoDefault( true );
311 buttonHelp = new QPushButton( tr( "SMESH_BUT_HELP" ), GroupButtons );
312 buttonHelp->setAutoDefault( true );
314 GroupButtonsLayout->addWidget( buttonOk );
315 GroupButtonsLayout->addSpacing( 10 );
316 GroupButtonsLayout->addWidget( buttonApply );
317 GroupButtonsLayout->addSpacing( 10 );
318 GroupButtonsLayout->addStretch();
319 GroupButtonsLayout->addWidget( buttonCancel );
320 GroupButtonsLayout->addWidget( buttonHelp );
322 /***************************************************************/
323 SMESHGUI_NodesDlgLayout->addWidget( GroupConstructors );
324 SMESHGUI_NodesDlgLayout->addWidget( GroupCoordinates );
325 SMESHGUI_NodesDlgLayout->addWidget( GroupGroups );
326 SMESHGUI_NodesDlgLayout->addWidget( GroupButtons );
328 myHelpFileName = "adding_nodes_and_elements_page.html#adding_nodes_anchor";
330 /* Initialisation and display */
334 //=======================================================================
335 // function : ~SMESHGUI_NodesDlg()
336 // purpose : Destructor
337 //=======================================================================
338 SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg()
343 //=================================================================================
346 //=================================================================================
347 void SMESHGUI_NodesDlg::Init()
349 /* Get setting of step value from file configuration */
352 /* min, max, step and decimals for spin boxes */
353 SpinBox_X->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
354 SpinBox_Y->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
355 SpinBox_Z->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
356 SpinBox_X->SetValue( 0.0 );
357 SpinBox_Y->SetValue( 0.0 );
358 SpinBox_Z->SetValue( 0.0 );
360 /* reset "Add to group" control */
361 GroupGroups->setChecked( false );
363 mySMESHGUI->SetActiveDialogBox( this );
365 /* signals and slots connections */
366 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
367 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
368 connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
369 connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) );
371 connect( SpinBox_X, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
372 connect( SpinBox_Y, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
373 connect( SpinBox_Z, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
375 connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), SLOT( SelectionIntoArgument() ) );
376 connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog() ) );
377 /* to close dialog if study frame change */
378 connect( mySMESHGUI, SIGNAL( SignalStudyFrameChanged() ), SLOT( ClickOnCancel() ) );
380 // set selection mode
381 SMESH::SetPointRepresentation( true );
382 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
383 aViewWindow->SetSelectionMode( NodeSelection );
385 SelectionIntoArgument();
388 //=================================================================================
389 // function : ValueChangedInSpinBox()
391 //=================================================================================
392 void SMESHGUI_NodesDlg::ValueChangedInSpinBox( double newValue )
394 if ( !myMesh->_is_nil() ) {
395 double vx = SpinBox_X->GetValue();
396 double vy = SpinBox_Y->GetValue();
397 double vz = SpinBox_Z->GetValue();
399 mySimulation->SetPosition( vx, vy, vz );
403 //=================================================================================
404 // function : ClickOnOk()
406 //=================================================================================
407 void SMESHGUI_NodesDlg::ClickOnOk()
409 if ( ClickOnApply() )
413 //=================================================================================
414 // function : ClickOnApply()
416 //=================================================================================
417 bool SMESHGUI_NodesDlg::ClickOnApply()
419 if ( mySMESHGUI->isActiveStudyLocked() )
422 if ( myMesh->_is_nil() ) {
423 SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ),
424 tr( "MESH_IS_NOT_SELECTED" ) );
431 /* Recup args and call method */
432 double x = SpinBox_X->GetValue();
433 double y = SpinBox_Y->GetValue();
434 double z = SpinBox_Z->GetValue();
436 QStringList aParameters;
437 aParameters << SpinBox_X->text();
438 aParameters << SpinBox_Y->text();
439 aParameters << SpinBox_Z->text();
441 mySimulation->SetVisibility( false );
442 long aNodeId = SMESH::AddNode( myMesh, x, y, z, aParameters );
443 SMESH::SetPointRepresentation( true );
445 if( aNodeId != -1 && GroupGroups->isChecked() ) {
446 SMESH::SMESH_Group_var aGroup;
447 QString aGroupName = ComboBox_GroupName->currentText();
448 SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
449 for( int i = 0, n = aListOfGroups.length(); i < n; i++ ) {
450 SMESH::SMESH_GroupBase_var aGroupBase = aListOfGroups[i];
451 if( !aGroupBase->_is_nil() ) {
452 SMESH::SMESH_Group_var aRefGroup = SMESH::SMESH_Group::_narrow( aGroupBase );
453 if( !aRefGroup->_is_nil() ) {
454 QString aRefGroupName( aRefGroup->GetName() );
455 if( aRefGroupName == aGroupName ) {
456 aGroup = aRefGroup; // // add node to existing group
462 if( aGroup->_is_nil() ) // create new group
463 aGroup = SMESH::AddGroup( myMesh, SMESH::NODE, aGroupName );
465 if( !aGroup->_is_nil() ) {
466 SMESH::long_array_var anIdList = new SMESH::long_array;
467 anIdList->length( 1 );
468 anIdList[0] = aNodeId;
469 aGroup->Add( anIdList.inout() );
475 mySelectionMgr->selectedObjects( aList );
476 if ( aList.Extent() != 1 ) {
477 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() ) {
478 VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
479 vtkActorCollection *aCollection = aCopy.GetActors();
480 aCollection->InitTraversal();
481 while ( vtkActor *anAct = aCollection->GetNextActor() ) {
482 if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct ) ) {
483 if ( anActor->hasIO() ) {
484 if ( SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>( anActor->GetObject().get() ) ) {
485 if ( myMesh->_is_equivalent( aMeshObj->GetMeshServer() ) ) {
487 aList.Append( anActor->getIO() );
488 mySelectionMgr->setSelectedObjects( aList, false );
500 //=================================================================================
501 // function : ClickOnCancel()
503 //=================================================================================
504 void SMESHGUI_NodesDlg::ClickOnCancel()
506 disconnect( mySelectionMgr, 0, this, 0 );
507 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
508 aViewWindow->SetSelectionMode( ActorSelection );
510 mySimulation->SetVisibility( false );
511 SMESH::SetPointRepresentation( false );
512 mySMESHGUI->ResetState();
517 //=================================================================================
518 // function : ClickOnHelp()
520 //=================================================================================
521 void SMESHGUI_NodesDlg::ClickOnHelp()
523 LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
525 app->onHelpContextModule( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) :
526 QString( "" ), myHelpFileName );
530 platform = "winapplication";
532 platform = "application";
534 SUIT_MessageBox::warning( this, tr("WRN_WARNING"),
535 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
536 arg( app->resourceMgr()->stringValue( "ExternalBrowser",
538 arg( myHelpFileName ) );
542 //=================================================================================
543 // function : SelectionIntoArgument()
544 // purpose : Called when selection as changed or other case
545 //=================================================================================
546 void SMESHGUI_NodesDlg::SelectionIntoArgument()
548 if ( !GroupConstructors->isEnabled() )
551 mySimulation->SetVisibility( false );
552 SMESH::SetPointRepresentation( true );
554 QString aCurrentEntry = myEntry;
556 const SALOME_ListIO& aList = mySelector->StoredIObjects();
557 if ( aList.Extent() == 1 ) {
558 Handle(SALOME_InteractiveObject) anIO = aList.First();
559 if ( anIO->hasEntry() ) {
560 myEntry = anIO->getEntry();
561 myMesh = SMESH::GetMeshByIO( anIO );
562 if ( myMesh->_is_nil() ) return;
564 if ( SMESH::GetNameOfSelectedNodes( mySelector, anIO, aText ) == 1 ) {
565 if ( SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh.in() ) ) {
566 if ( SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh() ) {
567 if ( const SMDS_MeshNode* aNode = aMesh->FindNode( aText.toInt() ) ) {
568 SpinBox_X->SetValue( aNode->X() );
569 SpinBox_Y->SetValue( aNode->Y() );
570 SpinBox_Z->SetValue( aNode->Z() );
575 mySimulation->SetPosition( SpinBox_X->GetValue(),
576 SpinBox_Y->GetValue(),
577 SpinBox_Z->GetValue() );
582 if ( !myMesh->_is_nil() && myEntry != aCurrentEntry ) {
583 ComboBox_GroupName->clear();
584 ComboBox_GroupName->addItem( QString() );
585 SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
586 for( int i = 0, n = aListOfGroups.length(); i < n; i++ ) {
587 SMESH::SMESH_GroupBase_var aGroupBase = aListOfGroups[i];
588 if ( !aGroupBase->_is_nil() && aGroupBase->GetType() == SMESH::NODE ) {
589 SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow( aGroupBase );
590 if ( !aGroup->_is_nil() ) {
591 QString aGroupName( aGroup->GetName() );
592 if ( !aGroupName.isEmpty() )
593 ComboBox_GroupName->addItem( aGroupName );
600 //=================================================================================
601 // function : closeEvent()
603 //=================================================================================
604 void SMESHGUI_NodesDlg::closeEvent( QCloseEvent* )
606 this->ClickOnCancel(); /* same than click on cancel button */
609 //=================================================================================
610 // function : hideEvent()
611 // purpose : caused by ESC key
612 //=================================================================================
613 void SMESHGUI_NodesDlg::hideEvent( QHideEvent* )
615 if ( !isMinimized() )
619 //=================================================================================
620 // function : enterEvent()
621 // purpose : to reactivate this dialog box when mouse enter onto the window
622 //=================================================================================
623 void SMESHGUI_NodesDlg::enterEvent( QEvent* )
625 if ( !GroupConstructors->isEnabled() )
626 ActivateThisDialog();
629 //=================================================================================
630 // function : DeactivateActiveDialog()
631 // purpose : public slot to deactivate if active
632 //=================================================================================
633 void SMESHGUI_NodesDlg::DeactivateActiveDialog()
635 if ( GroupConstructors->isEnabled() ) {
636 GroupConstructors->setEnabled( false );
637 GroupCoordinates->setEnabled( false );
638 GroupButtons->setEnabled( false );
639 mySimulation->SetVisibility( false );
640 mySMESHGUI->ResetState();
641 mySMESHGUI->SetActiveDialogBox( 0 );
645 //=================================================================================
646 // function : ActivateThisDialog()
648 //=================================================================================
649 void SMESHGUI_NodesDlg::ActivateThisDialog()
651 mySMESHGUI->EmitSignalDeactivateDialog();
652 GroupConstructors->setEnabled( true );
653 GroupCoordinates->setEnabled( true );
654 GroupButtons->setEnabled( true );
656 SMESH::SetPointRepresentation( true );
657 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
658 aViewWindow->SetSelectionMode( NodeSelection );
660 SelectionIntoArgument();
663 //=================================================================================
664 // function : keyPressEvent()
666 //=================================================================================
667 void SMESHGUI_NodesDlg::keyPressEvent( QKeyEvent* e )
669 QDialog::keyPressEvent( e );
670 if ( e->isAccepted() )
673 if ( e->key() == Qt::Key_F1 ) {
679 //=================================================================================
680 // function : isValid
682 //=================================================================================
683 bool SMESHGUI_NodesDlg::isValid()
687 ok = SpinBox_X->isValid( msg, true ) && ok;
688 ok = SpinBox_Y->isValid( msg, true ) && ok;
689 ok = SpinBox_Z->isValid( msg, true ) && ok;
692 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
693 if ( !msg.isEmpty() )
695 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
699 if( GroupGroups->isChecked() && ComboBox_GroupName->currentText().isEmpty() ) {
700 SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ), tr( "GROUP_NAME_IS_EMPTY" ) );