1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_MeshPatternDlg.cxx
25 // Author : Sergey LITONIN
28 #include "SMESHGUI_MeshPatternDlg.h"
30 #include "QAD_Desktop.h"
31 #include "QAD_FileDlg.h"
33 #include "SMESHGUI_SpinBox.h"
35 #include "SALOME_Selection.h"
36 #include "SMESH_NumberFilter.hxx"
37 #include "SMESHGUI_Utils.h"
38 #include "SMESHGUI_VTKUtils.h"
39 #include "SMESHGUI_CreatePatternDlg.h"
40 #include "SMESHGUI_PatternWidget.h"
41 #include "SMESH_Actor.h"
42 #include "SALOMEGUI_QtCatchCorbaException.hxx"
43 #include "VTKViewer_ViewFrame.h"
44 #include "SMESHGUI_PatternUtils.h"
45 #include "SMESH_ActorUtils.h"
46 #include "SMDS_MeshElement.hxx"
47 #include "SMDS_Mesh.hxx"
49 #include <TColStd_MapOfInteger.hxx>
53 #include <qlineedit.h>
54 #include <qpushbutton.h>
55 #include <qgroupbox.h>
57 #include <qradiobutton.h>
58 #include <qcheckbox.h>
59 #include <qbuttongroup.h>
60 #include <qmessagebox.h>
63 #include <qvaluelist.h>
66 #include <vtkIdList.h>
67 #include <vtkIntArray.h>
68 #include <vtkCellArray.h>
69 #include <vtkUnsignedCharArray.h>
70 #include <vtkUnstructuredGrid.h>
71 #include <vtkDataSetMapper.h>
77 Class : SMESHGUI_MeshPatternDlg
78 Description : Dialog to specify filters for VTK viewer
81 //=======================================================================
82 // name : SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg
83 // Purpose : Constructor
84 //=======================================================================
85 SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( QWidget* theParent,
86 SALOME_Selection* theSelection,
88 : QDialog( theParent, theName, false,
89 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
92 setCaption( tr( "CAPTION" ) );
94 QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
96 QFrame* aMainFrame = createMainFrame ( this );
97 QFrame* aBtnFrame = createButtonFrame( this );
102 aDlgLay->addWidget( aMainFrame );
103 aDlgLay->addWidget( aBtnFrame );
105 aDlgLay->setStretchFactor( aMainFrame, 1 );
108 Init( theSelection );
111 //=======================================================================
112 // name : SMESHGUI_MeshPatternDlg::createMainFrame
113 // Purpose : Create frame containing dialog's input fields
114 //=======================================================================
115 QFrame* SMESHGUI_MeshPatternDlg::createMainFrame( QWidget* theParent )
117 QPixmap iconSlct( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
118 QPixmap icon2d ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_2d" ) ) );
119 QPixmap icon3d ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_3d" ) ) );
120 QPixmap iconOpen( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_FILE_OPEN" ) ) );
122 QPixmap iconSample2d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_2D" ) ) );
123 QPixmap iconSample3d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_3D" ) ) );
125 QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );
126 aMainGrp->setFrameStyle( QFrame::NoFrame );
127 aMainGrp->setInsideMargin( 0 );
129 // Pattern type group
131 myTypeGrp = new QButtonGroup( 1, Qt::Vertical, tr( "PATTERN_TYPE" ), aMainGrp );
132 mySwitch2d = new QRadioButton( myTypeGrp );
133 mySwitch3d = new QRadioButton( myTypeGrp );
134 mySwitch2d->setPixmap( icon2d );
135 mySwitch3d->setPixmap( icon3d );
136 myTypeGrp->insert( mySwitch2d, Type_2d );
137 myTypeGrp->insert( mySwitch3d, Type_3d );
142 QGroupBox* aMeshGrp = new QGroupBox( 1, Qt::Vertical, tr( "SMESH_MESH" ), aMainGrp );
143 new QLabel( tr( "SMESH_MESH" ), aMeshGrp );
144 mySelBtn[ Mesh ] = new QPushButton( aMeshGrp );
145 mySelBtn[ Mesh ]->setPixmap( iconSlct );
146 mySelEdit[ Mesh ] = new QLineEdit( aMeshGrp );
147 mySelEdit[ Mesh ]->setReadOnly( true );
151 QGroupBox* aPatGrp = new QGroupBox( 1, Qt::Horizontal, tr( "PATTERN" ), aMainGrp );
154 QGroupBox* aNameGrp = new QGroupBox( 1, Qt::Vertical, aPatGrp );
155 aNameGrp->setFrameStyle( QFrame::NoFrame );
156 aNameGrp->setInsideMargin( 0 );
157 new QLabel( tr( "PATTERN" ), aNameGrp );
158 myName = new QLineEdit( aNameGrp );
159 myName->setReadOnly( true );
160 myOpenBtn = new QPushButton( aNameGrp );
161 myOpenBtn->setPixmap( iconOpen );
162 myNewBtn = new QPushButton( tr( "NEW" ), aNameGrp );
164 // Mode selection check box
165 myRefine = new QCheckBox( tr( "REFINE" ), aPatGrp );
167 // selection widgets for Apply to geom mode
168 myGeomGrp = new QGroupBox( 3, Qt::Horizontal, aPatGrp );
169 myGeomGrp->setFrameStyle( QFrame::NoFrame );
170 myGeomGrp->setInsideMargin( 0 );
172 for ( int i = Object; i <= Vertex2; i++ )
174 mySelLbl[ i ] = new QLabel( myGeomGrp );
175 mySelBtn[ i ] = new QPushButton( myGeomGrp );
176 mySelBtn[ i ]->setPixmap( iconSlct );
177 mySelEdit[ i ] = new QLineEdit( myGeomGrp );
178 mySelEdit[ i ]->setReadOnly( true );
181 // Widgets for refinement of existing mesh elements
182 myRefineGrp = new QFrame( aPatGrp );
183 myRefineGrp->setFrameStyle( QFrame::NoFrame );
184 QGridLayout* aRefGrid = new QGridLayout( myRefineGrp, 3, 3, 0, 5 );
186 mySelLbl[ Ids ] = new QLabel( myRefineGrp );
187 mySelBtn[ Ids ] = new QPushButton( myRefineGrp );
188 mySelBtn[ Ids ]->setPixmap( iconSlct );
189 mySelEdit[ Ids ] = new QLineEdit( myRefineGrp );
191 QLabel* aNodeLbl = new QLabel( tr( "NODE_1" ), myRefineGrp );
192 myNode1 = new QSpinBox( myRefineGrp );
193 myNode2Lbl = new QLabel( tr( "NODE_2" ), myRefineGrp );
194 myNode2 = new QSpinBox( myRefineGrp );
196 aRefGrid->addWidget( mySelLbl [ Ids ], 0, 0 );
197 aRefGrid->addWidget( mySelBtn [ Ids ], 0, 1 );
198 aRefGrid->addWidget( mySelEdit[ Ids ], 0, 2 );
199 aRefGrid->addWidget( aNodeLbl, 1, 0 );
200 aRefGrid->addMultiCellWidget( myNode1, 1, 1, 1, 2 );
201 aRefGrid->addWidget( myNode2Lbl, 2, 0 );
202 aRefGrid->addMultiCellWidget( myNode2, 2, 2, 1, 2 );
205 myReverseChk = new QCheckBox( tr( "REVERSE" ), aPatGrp );
207 // Pictures 2d and 3d
208 for ( int i = 0; i < 2; i++ )
212 myPicture2d = new SMESHGUI_PatternWidget( aPatGrp ),
213 myPicture2d->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
217 myPicture3d = new QFrame( aPatGrp ),
218 myPreview3d = new QLabel( myPicture3d );
219 myPreview3d->setPixmap( iconSample3d );
220 QGridLayout* aLay = new QGridLayout( myPicture3d, 3, 3, 0, 0 );
221 QSpacerItem* aSpacerH1 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
222 QSpacerItem* aSpacerH2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
223 QSpacerItem* aSpacerV1 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
224 QSpacerItem* aSpacerV2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
225 aLay->addItem( aSpacerH1, 1, 0 );
226 aLay->addItem( aSpacerH2, 1, 2 );
227 aLay->addItem( aSpacerV1, 0, 1 );
228 aLay->addItem( aSpacerV2, 2, 1 );
229 aLay->addWidget( myPreview3d, 1, 1 );
233 myPreviewChk = new QCheckBox( tr( "PREVIEW" ), aPatGrp );
235 // Connect signals and slots
237 connect( myTypeGrp, SIGNAL( clicked( int ) ), SLOT( onTypeChanged( int ) ) );
238 connect( myOpenBtn, SIGNAL( clicked() ), SLOT( onOpen() ) );
239 connect( myNewBtn, SIGNAL( clicked() ), SLOT( onNew() ) );
240 connect( myReverseChk, SIGNAL( toggled( bool ) ), SLOT( onReverse( bool ) ) );
241 connect( myPreviewChk, SIGNAL( toggled( bool ) ), SLOT( onPreview( bool ) ) );
242 connect( myRefine, SIGNAL( toggled( bool ) ), SLOT( onModeToggled( bool ) ) );
243 connect( myNode1, SIGNAL( valueChanged( int ) ), SLOT( onNodeChanged( int ) ) );
244 connect( myNode2, SIGNAL( valueChanged( int ) ), SLOT( onNodeChanged( int ) ) );
245 connect( mySelEdit[Ids], SIGNAL( textChanged( const QString& ) ), SLOT( onTextChanged( const QString& ) ) );
247 QMap< int, QPushButton* >::iterator anIter;
248 for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter )
249 connect( *anIter, SIGNAL( clicked() ), SLOT( onSelInputChanged() ) );
254 //=======================================================================
256 // name : SMESHGUI_MeshPatternDlg::createButtonFrame
257 // Purpose : Create frame containing buttons
258 //=======================================================================
259 QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame( QWidget* theParent )
261 QFrame* aFrame = new QFrame( theParent );
262 aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
264 myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame );
265 myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
266 myCloseBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
268 QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
270 QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
272 aLay->addWidget( myOkBtn );
273 aLay->addWidget( myApplyBtn );
274 aLay->addItem( aSpacer);
275 aLay->addWidget( myCloseBtn );
277 connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
278 connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
279 connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
284 //=======================================================================
285 // name : SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg
286 // Purpose : Destructor
287 //=======================================================================
288 SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg()
292 //=======================================================================
293 // name : SMESHGUI_MeshPatternDlg::Init
294 // Purpose : Init dialog fields, connect signals and slots, show dialog
295 //=======================================================================
296 void SMESHGUI_MeshPatternDlg::Init( SALOME_Selection* theSelection )
298 myPattern = SMESH::GetPattern();
300 myIsCreateDlgOpen = false;
304 mySelection = theSelection;
305 SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
306 aSMESHGUI->SetActiveDialogBox( ( QDialog* )this );
307 myMesh = SMESH::SMESH_Mesh::_nil();
309 myMeshShape = GEOM::GEOM_Object::_nil();
310 myGeomObj[ Object ] = GEOM::GEOM_Object::_nil();
311 myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();
312 myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();
314 // selection and SMESHGUI
315 connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
316 connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
317 connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
319 myTypeGrp->setButton( Type_2d );
320 onTypeChanged( Type_2d );
321 onModeToggled( isRefine() );
325 resize( minimumSize() );
331 aSMESHGUI->DefineDlgPosition( this, x, y );
336 //=======================================================================
337 // name : SMESHGUI_MeshPatternDlg::isValid
338 // Purpose : Verify validity of entry data
339 //=======================================================================
340 bool SMESHGUI_MeshPatternDlg::isValid( const bool theMess )
343 if ( ( isRefine() && ( myMesh->_is_nil() || !getIds( ids ) || getNode( false ) < 0 || myType == Type_3d && ( getNode( true ) < 0 || getNode( false ) == getNode( true ) ) ) )
344 || ( !isRefine() && ( myMesh->_is_nil() || myMeshShape->_is_nil() || myGeomObj[ Object ]->_is_nil() ||
345 myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil() ) ) )
348 QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
349 tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SMESHGUI_INVALID_PARAMETERS" ), QMessageBox::Ok );
356 //=======================================================================
357 // name : SMESHGUI_MeshPatternDlg::onApply
358 // Purpose : SLOT called when "Apply" button pressed.
359 //=======================================================================
360 bool SMESHGUI_MeshPatternDlg::onApply()
369 if ( isRefine() ) { // Refining existing mesh elements
372 SMESH::long_array_var varIds = new SMESH::long_array();
373 varIds->length( ids.count() );
375 for ( QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it )
378 ? myPattern->ApplyToMeshFaces ( myMesh, varIds, getNode( false ), myReverseChk->isChecked() )
379 : myPattern->ApplyToHexahedrons( myMesh, varIds, getNode( false ), getNode( true ) );
381 else { // Applying a pattern to geometrical object
382 if ( myType == Type_2d )
383 myPattern->ApplyToFace(
384 myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() );
386 myPattern->ApplyTo3DBlock(
387 myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );
390 if ( myPattern->MakeMesh( myMesh ) )
392 mySelection->ClearIObjects();
394 SMESHGUI::GetSMESHGUI()->GetActiveStudy()->updateObjBrowser( true );
399 QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
400 tr( "SMESH_ERROR" ), tr( "SMESH_OPERATION_FAILED" ), QMessageBox::Ok );
404 catch( const SALOME::SALOME_Exception& S_ex )
406 QtCatchCorbaException( S_ex );
415 //=======================================================================
416 // name : SMESHGUI_MeshPatternDlg::onOk
417 // Purpose : SLOT called when "Ok" button pressed.
418 //=======================================================================
419 void SMESHGUI_MeshPatternDlg::onOk()
425 //=======================================================================
426 // name : SMESHGUI_MeshPatternDlg::onClose
427 // Purpose : SLOT called when "Close" button pressed. Close dialog
428 //=======================================================================
429 void SMESHGUI_MeshPatternDlg::onClose()
431 mySelection->ClearFilters();
432 SMESH::SetPickable();
433 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
434 disconnect( mySelection, 0, this, 0 );
435 disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
436 SMESHGUI::GetSMESHGUI()->ResetState();
443 //=======================================================================
444 // name : SMESHGUI_MeshPatternDlg::onSelectionDone
445 // Purpose : SLOT called when selection changed
446 //=======================================================================
447 void SMESHGUI_MeshPatternDlg::onSelectionDone()
454 if ( mySelInput == Mesh )
456 if ( mySelection->IObjectCount() != 1 )
459 // Retrieve mesh from selection
460 Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
461 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIO );
462 if ( aMesh->_is_nil() )
465 // Get geom object corresponding to the mesh
466 SALOMEDS::Study_var aStudy =
467 SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getStudyDocument();
469 SALOMEDS::SObject_var aSO = SMESH::FindSObject( aMesh.in() );
470 if ( aSO->_is_nil() )
473 bool isFound = false;
474 SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( aSO );
475 for( ; anIter->More(); anIter->Next() )
477 SALOMEDS::SObject_var aSO = anIter->Value();
478 SALOMEDS::SObject_var aRefSO;
480 GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(
481 aSO->ReferencedObject( aRefSO )? aRefSO->GetObject() : aSO->GetObject() );
483 if ( !aMeshShape->_is_nil() )
486 myMeshShape = aMeshShape;
493 myMeshShape = GEOM::GEOM_Object::_nil();
495 // Clear fields of geom objects if mesh was changed
496 if ( myMesh != aMesh )
498 for ( int i = Object; i <= Ids; i++ )
500 myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
501 mySelEdit[ i ]->setText( "" );
507 // Set name of mesh in line edit
509 SMESH::GetNameOfSelectedIObjects( mySelection, aName );
510 mySelEdit[ Mesh ]->setText( aName );
512 else if ( mySelInput == Ids ) {
514 if ( !SMESH::GetNameOfSelectedElements( mySelection, anIds ) )
518 mySelEdit[ Ids ]->setText( anIds );
523 if ( mySelection->IObjectCount() != 1 )
526 // Get geom object from selection
527 Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
528 GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIO );
529 if ( anObj->_is_nil() )
532 // Clear fields of vertexes if face or 3d block was changed
533 if ( anObj != myGeomObj[ mySelInput ] && mySelInput == Object )
535 for ( int i = Vertex1; i <= Vertex2; i++ )
537 myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
538 mySelEdit[ i ]->setText( "" );
542 myGeomObj[ mySelInput ] = anObj;
544 // Set name of geom object in line edit
546 SMESH::GetNameOfSelectedIObjects( mySelection, aName );
547 mySelEdit[ mySelInput ]->setText( aName );
550 catch( const SALOME::SALOME_Exception& S_ex )
552 QtCatchCorbaException( S_ex );
564 //=======================================================================
565 // name : SMESHGUI_MeshPatternDlg::resetSelInput
566 // Purpose : Reset fields corresponding to the current selection input
567 //=======================================================================
568 void SMESHGUI_MeshPatternDlg::resetSelInput()
570 if ( mySelInput == Mesh )
572 myMesh = SMESH::SMESH_Mesh::_nil();
573 myMeshShape = GEOM::GEOM_Object::_nil();
577 myGeomObj[ mySelInput ] = GEOM::GEOM_Object::_nil();
579 mySelEdit[ mySelInput ]->setText( "" );
582 //=======================================================================
583 // name : SMESHGUI_MeshPatternDlg::onDeactivate
584 // Purpose : SLOT called when dialog must be deativated
585 //=======================================================================
586 void SMESHGUI_MeshPatternDlg::onDeactivate()
588 mySelection->ClearFilters();
589 //if ( myReverseChk->isChecked() )
591 disconnect( mySelection, 0, this, 0 );
595 //=======================================================================
596 // name : SMESHGUI_MeshPatternDlg::enterEvent
597 // Purpose : Event filter
598 //=======================================================================
599 void SMESHGUI_MeshPatternDlg::enterEvent( QEvent* )
601 if ( myIsCreateDlgOpen )
604 if ( myReverseChk->isChecked() )
606 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;
609 connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
610 onTextChanged( mySelEdit[Ids]->text() );
614 //=================================================================================
615 // function : closeEvent()
617 //=================================================================================
618 void SMESHGUI_MeshPatternDlg::closeEvent( QCloseEvent* e )
623 //=======================================================================
624 // name : SMESHGUI_MeshPatternDlg::onSelInputChanged
625 // Purpose : SLOT. Called when -> button clicked.
626 // Change current selection input field
627 //=======================================================================
628 void SMESHGUI_MeshPatternDlg::onSelInputChanged()
630 const QObject* aSender = sender();
631 for ( int i = Mesh; i <= Ids; i++ )
632 if ( aSender == mySelBtn[ i ] )
639 //=======================================================================
640 // name : SMESHGUI_MeshPatternDlg::prepareFilters
641 // Purpose : Prepare filters for dialog
642 //=======================================================================
644 QStringList SMESHGUI_MeshPatternDlg::prepareFilters() const
646 static QStringList aList;
647 if ( aList.isEmpty() )
649 aList.append( tr( "PATTERN_FILT" ) );
650 //aList.append( tr( "ALL_FILES_FILTER" ) );
656 //================================================================
658 // Function : SMESHGUI_MeshPatternDlg::autoExtension
659 // Purpose : Append extension to the file name
660 //================================================================
661 QString SMESHGUI_MeshPatternDlg::autoExtension( const QString& theFileName ) const
663 QString anExt = theFileName.section( '.', -1 );
664 return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;
667 //=======================================================================
668 // name : SMESHGUI_MeshPatternDlg::onOpen
669 // Purpose : SLOT. Called when "Open" button clicked.
670 // Displays file open dialog
671 //=======================================================================
672 void SMESHGUI_MeshPatternDlg::onOpen()
674 QAD_FileDlg* aDlg = new QAD_FileDlg( this, true );
675 aDlg->setCaption( tr( "LOAD_PATTERN" ) );
676 aDlg->setMode( QFileDialogP::ExistingFile );
677 aDlg->setFilters( prepareFilters() );
678 if ( myName->text() != "" )
679 aDlg->setSelection( myName->text() + ".smp" );
680 QPushButton* anOkBtn = ( QPushButton* )aDlg->child( "OK", "QPushButton" );
682 anOkBtn->setText( tr( "SMESH_BUT_OK" ) );
684 if ( aDlg->exec() != Accepted )
687 QString fName = aDlg->selectedFile();
688 if ( fName.isEmpty() )
691 if ( QFileInfo( fName ).extension().isEmpty() )
692 fName = autoExtension( fName );
694 fName = QDir::convertSeparators( fName );
696 QString prev = QDir::convertSeparators( myName->text() );
700 // Read string from file
701 QFile aFile( fName );
702 if ( !aFile.open( IO_ReadOnly ) )
704 QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
705 tr( "SMESH_ERROR" ), tr( "ERROR_OF_OPENING" ), QMessageBox::Ok );
709 QByteArray aDataArray = aFile.readAll();
710 const char* aData = aDataArray.data();
713 QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
714 tr( "SMESH_ERROR" ), tr( "ERROR_OF_READING" ), QMessageBox::Ok );
718 if ( loadFromFile( aData ) )
719 myName->setText( QFileInfo( fName ).baseName() );
725 //=======================================================================
726 // name : SMESHGUI_MeshPatternDlg::onCloseCreationDlg
727 // Purpose : SLOT. Called when "Pattern creation" dialog closed with "Close"
728 //=======================================================================
729 void SMESHGUI_MeshPatternDlg::onCloseCreationDlg()
732 myIsCreateDlgOpen = false;
736 //=======================================================================
737 // name : SMESHGUI_MeshPatternDlg::onOkCreationDlg
738 // Purpose : SLOT. Called when "Pattern creation" dialog closed with OK
739 // or SAVE buttons. Initialize myPattern field. Redisplay preview
740 //=======================================================================
741 void SMESHGUI_MeshPatternDlg::onOkCreationDlg()
743 myPattern = SMESH::SMESH_Pattern::_duplicate( myCreationDlg->GetPattern() );
744 myName->setText( myCreationDlg->GetPatternName() );
747 myIsCreateDlgOpen = false;
751 //=======================================================================
752 // name : SMESHGUI_MeshPatternDlg::onNew
753 // Purpose : SLOT. Called when "New..." button clicked. Create new pattern
754 //=======================================================================
755 void SMESHGUI_MeshPatternDlg::onNew()
758 myIsCreateDlgOpen = true;
759 if ( myCreationDlg == 0 )
761 myCreationDlg = new SMESHGUI_CreatePatternDlg( this, mySelection, myType );
762 connect( myCreationDlg, SIGNAL( NewPattern() ), SLOT( onOkCreationDlg() ) );
763 connect( myCreationDlg, SIGNAL( Close() ), SLOT( onCloseCreationDlg() ) );
766 myCreationDlg->Init( mySelection, myType );
768 myCreationDlg->SetMesh( myMesh );
769 myCreationDlg->show();
772 //=======================================================================
773 // name : SMESHGUI_MeshPatternDlg::onReverse
774 // Purpose : SLOT. Called when state of "Reverse order..." checkbox chaged
775 // Calculate new points of the mesh to be created. Redisplay preview
776 //=======================================================================
777 void SMESHGUI_MeshPatternDlg::onReverse( bool )
782 //=======================================================================
784 // name : SMESHGUI_MeshPatternDlg::onPreview
785 // Purpose : SLOT. Called when state of "Preview" checkbox changed
786 // Display/Erase preview
787 //=======================================================================
788 void SMESHGUI_MeshPatternDlg::onPreview( bool )
793 //=======================================================================
794 // name : SMESHGUI_MeshPatternDlg::displayPreview
795 // Purpose : Display preview
796 //=======================================================================
797 void SMESHGUI_MeshPatternDlg::displayPreview()
801 // Redisplay preview in dialog
803 SMESH::point_array_var pnts = myPattern->GetPoints();
804 SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
805 SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints();
807 if ( pnts->length() == 0 ||
808 keyPoints->length() == 0 ||
809 elemPoints->length() == 0 )
817 PointVector aPoints( pnts->length() );
818 QValueVector<int> aKeyPoints( keyPoints->length() );
819 ConnectivityVector anElemPoints( elemPoints->length() );
821 for ( int i = 0, n = pnts->length(); i < n; i++ )
822 aPoints[ i ] = pnts[ i ];
824 for ( int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++ )
825 aKeyPoints[ i2 ] = keyPoints[ i2 ];
827 for ( int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++ )
829 QValueVector<int> aVec( elemPoints[ i3 ].length() );
830 for ( int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++ )
831 aVec[ i4 ] = elemPoints[ i3 ][ i4 ];
833 anElemPoints[ i3 ] = aVec;
836 myPicture2d->SetPoints( aPoints, aKeyPoints, anElemPoints );
840 // Redisplay preview in 3D viewer
842 if ( myPreviewActor != 0 )
844 if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )
846 vf->RemoveActor(myPreviewActor);
849 myPreviewActor->Delete();
853 if ( !myPreviewChk->isChecked() || !isValid( false ) )
856 vtkUnstructuredGrid* aGrid = getGrid();
860 // Create and display actor
861 vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
862 aMapper->SetInput( aGrid );
864 myPreviewActor = SALOME_Actor::New();
865 myPreviewActor->PickableOff();
866 myPreviewActor->SetMapper( aMapper );
868 vtkProperty* aProp = vtkProperty::New();
869 aProp->SetRepresentationToWireframe();
870 aProp->SetColor( 250, 0, 250 );
871 if ( SMESH::FindActorByObject( myMesh ) )
872 aProp->SetLineWidth( SMESH::GetFloat( "SMESH:SettingsWidth", 1 ) +1 );
874 aProp->SetLineWidth( 1 );
875 myPreviewActor->SetProperty( aProp );
877 myPreviewActor->SetRepresentation( 3 );
879 SMESH::GetCurrentVtkView()->AddActor( myPreviewActor );
880 SMESH::GetCurrentVtkView()->Repaint();
885 catch( const SALOME::SALOME_Exception& S_ex )
887 QtCatchCorbaException( S_ex );
896 //=======================================================================
897 // name : SMESHGUI_MeshPatternDlg::erasePreview
898 // Purpose : Erase preview
899 //=======================================================================
900 void SMESHGUI_MeshPatternDlg::erasePreview()
902 // Erase preview in 2D viewer
903 myPicture2d->SetPoints( PointVector(), QValueVector<int>(), ConnectivityVector() );
905 // Erase preview in 3D viewer
906 if ( myPreviewActor == 0 )
910 if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )
912 vf->RemoveActor(myPreviewActor);
915 myPreviewActor->Delete();
919 //=======================================================================
920 // name : SMESHGUI_MeshPatternDlg::updateWgState
921 // Purpose : Enable/disable selection widgets
922 //=======================================================================
923 void SMESHGUI_MeshPatternDlg::updateWgState()
925 if ( myMesh->_is_nil() )
927 for ( int i = Object; i <= Ids; i++ )
929 mySelBtn [ i ]->setEnabled( false );
930 mySelEdit[ i ]->setEnabled( false );
931 mySelEdit[ i ]->setText( "" );
933 myNode1->setEnabled( false );
934 myNode2->setEnabled( false );
935 myNode1->setRange( 0, 0 );
936 myNode2->setRange( 0, 0 );
940 mySelBtn [ Object ]->setEnabled( true );
941 mySelEdit[ Object ]->setEnabled( true );
942 mySelBtn [ Ids ] ->setEnabled( true );
943 mySelEdit[ Ids ] ->setEnabled( true );
945 if ( myGeomObj[ Object ]->_is_nil() )
947 for ( int i = Vertex1; i <= Vertex2; i++ )
949 mySelBtn [ i ]->setEnabled( false );
950 mySelEdit[ i ]->setEnabled( false );
951 mySelEdit[ i ]->setText( "" );
956 for ( int i = Object; i <= Vertex2; i++ )
958 mySelBtn [ i ]->setEnabled( true );
959 mySelEdit[ i ]->setEnabled( true );
964 if ( !CORBA::is_nil( myPattern ) && getIds( ids ) ) {
965 SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
966 if ( keyPoints->length() ) {
967 myNode1->setEnabled( true );
968 myNode2->setEnabled( true );
969 myNode1->setRange( 1, keyPoints->length() );
970 myNode2->setRange( 1, keyPoints->length() );
975 myNode1->setEnabled( false );
976 myNode2->setEnabled( false );
977 myNode1->setRange( 0, 0 );
978 myNode2->setRange( 0, 0 );
982 //=======================================================================
983 // name : SMESHGUI_MeshPatternDlg::activateSelection
984 // Purpose : Activate selection in accordance with current selection input
985 //=======================================================================
986 void SMESHGUI_MeshPatternDlg::activateSelection()
988 mySelection->ClearFilters();
989 if ( mySelInput == Ids ) {
990 SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
992 SMESH::SetPickable(anActor);
994 if ( myType == Type_2d )
995 QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
997 QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
1000 SMESH::SetPickable();
1001 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
1004 if ( mySelInput == Object && !myMeshShape->_is_nil() )
1006 if ( myType == Type_2d )
1008 if ( myNbPoints > 0 )
1009 mySelection->AddFilter( new SMESH_NumberFilter(
1011 "GEOM", TopAbs_VERTEX, myNbPoints, TopAbs_FACE, myMeshShape ) );
1013 mySelection->AddFilter( new SMESH_NumberFilter(
1014 "GEOM", TopAbs_SHAPE, myNbPoints, TopAbs_FACE, myMeshShape ) );
1018 TColStd_MapOfInteger aTypes;
1019 aTypes.Add( TopAbs_SHELL );
1020 aTypes.Add( TopAbs_SOLID );
1021 mySelection->AddFilter( new SMESH_NumberFilter(
1022 "GEOM", TopAbs_FACE, 6, aTypes, myMeshShape, true ) );
1025 else if ( ( mySelInput == Vertex1 || mySelInput == Vertex2 ) && !myGeomObj[ Object ]->_is_nil() )
1027 mySelection->AddFilter( new SMESH_NumberFilter(
1028 "GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX, myGeomObj[ Object ] ) );
1032 //=======================================================================
1033 // name : SMESHGUI_MeshPatternDlg::loadFromFile
1034 // Purpose : Load pattern from file
1035 //=======================================================================
1036 bool SMESHGUI_MeshPatternDlg::loadFromFile( const QString& theName )
1040 SMESH::SMESH_Pattern_var aPattern = SMESH::GetPattern();
1042 if ( !aPattern->LoadFromFile( theName.latin1() ) ||
1043 myType == Type_2d && !aPattern->Is2D())
1045 SMESH::SMESH_Pattern::ErrorCode aCode = aPattern->GetErrorCode();
1047 if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NB_POINTS ) aMess = tr( "ERR_READ_NB_POINTS" );
1048 else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_POINT_COORDS ) aMess = tr( "ERR_READ_POINT_COORDS" );
1049 else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_TOO_FEW_POINTS ) aMess = tr( "ERR_READ_TOO_FEW_POINTS" );
1050 else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_3D_COORD ) aMess = tr( "ERR_READ_3D_COORD" );
1051 else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NO_KEYPOINT ) aMess = tr( "ERR_READ_NO_KEYPOINT" );
1052 else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_INDEX ) aMess = tr( "ERR_READ_BAD_INDEX" );
1053 else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_ELEM_POINTS ) aMess = tr( "ERR_READ_ELEM_POINTS" );
1054 else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NO_ELEMS ) aMess = tr( "ERR_READ_NO_ELEMS" );
1055 else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_KEY_POINT ) aMess = tr( "ERR_READ_BAD_KEY_POINT" );
1056 else aMess = tr( "ERROR_OF_LOADING" );
1058 QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
1059 tr( "SMESH_ERROR" ), aMess, QMessageBox::Ok );
1064 myPattern = aPattern;
1068 catch( const SALOME::SALOME_Exception& S_ex )
1070 QtCatchCorbaException( S_ex );
1071 QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
1072 tr( "SMESH_ERROR" ), tr( "ERROR_OF_LOADING" ), QMessageBox::Ok );
1077 //=======================================================================
1078 // name : SMESHGUI_MeshPatternDlg::onTypeChanged
1080 // Purpose : SLOT. Called when pattern type changed.
1081 // Change dialog's look and feel
1082 //=======================================================================
1083 void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
1085 if ( myType == theType )
1091 myGeomObj[ Object ] = GEOM::GEOM_Object::_nil();
1092 myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();
1093 myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();
1094 myPattern = SMESH::GetPattern();
1096 myName->setText( "" );
1097 mySelEdit[ Object ]->setText( "" );
1098 mySelEdit[ Vertex1 ]->setText( "" );
1099 mySelEdit[ Vertex2 ]->setText( "" );
1100 mySelEdit[ Ids ] ->setText( "" );
1102 if ( theType == Type_2d )
1105 mySelLbl [ Vertex2 ]->hide();
1106 mySelBtn [ Vertex2 ]->hide();
1107 mySelEdit[ Vertex2 ]->hide();
1108 myReverseChk->show();
1109 myPicture2d->show();
1110 myPicture3d->hide();
1111 mySelLbl[ Object ]->setText( tr( "FACE" ) );
1112 mySelLbl[ Vertex1 ]->setText( tr( "VERTEX" ) );
1114 mySelLbl[ Ids ]->setText( tr( "MESH_FACES" ) );
1121 mySelLbl [ Vertex2 ]->show();
1122 mySelBtn [ Vertex2 ]->show();
1123 mySelEdit[ Vertex2 ]->show();
1124 myReverseChk->hide();
1125 myPicture2d->hide();
1126 myPicture3d->show();
1127 mySelLbl[ Object ]->setText( tr( "3D_BLOCK" ) );
1128 mySelLbl[ Vertex1 ]->setText( tr( "VERTEX1" ) );
1129 mySelLbl[ Vertex2 ]->setText( tr( "VERTEX2" ) );
1131 mySelLbl[ Ids ]->setText( tr( "MESH_VOLUMES" ) );
1137 activateSelection();
1142 //=======================================================================
1143 // name : SMESHGUI_MeshPatternDlg::getGrid
1144 // Purpose : Get unstructured grid for pattern
1145 //=======================================================================
1146 vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()
1150 // Get points from pattern
1151 SMESH::point_array_var pnts;
1152 QValueList<int> ids;
1153 if ( isRefine() && getIds( ids ) ) {
1154 SMESH::long_array_var varIds = new SMESH::long_array();
1155 varIds->length( ids.count() );
1157 for ( QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it )
1159 pnts = myType == Type_2d
1160 ? myPattern->ApplyToMeshFaces ( myMesh, varIds, getNode( false ), myReverseChk->isChecked() )
1161 : myPattern->ApplyToHexahedrons( myMesh, varIds, getNode( false ), getNode( true ) );
1164 pnts = myType == Type_2d
1165 ? myPattern->ApplyToFace ( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() )
1166 : myPattern->ApplyTo3DBlock( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );
1169 SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints();
1171 if ( pnts->length() == 0 || elemPoints->length() == 0 )
1176 // to do : to be removed /////////////////////////////////////////////
1179 for ( int i1 = 0, n1 = pnts->length(); i1 < n1; i1++ )
1180 printf( "%d: %g %g %g\n", i1, pnts[ i1 ].x, pnts[ i1 ].y, pnts[ i1 ].z );
1182 printf( "\nELEMENTS : \n" );
1183 for ( int i2 = 0, n2 = elemPoints->length(); i2 < n2; i2++ )
1186 printf( "%d: ", i2 );
1187 for ( int i3 = 0, n3 = elemPoints[ i2 ].length(); i3 < n3; i3++ )
1188 printf( "%d ", elemPoints[ i2 ][ i3 ] );
1194 //////////////////////////////////////////////////////////////////////
1196 // Calculate number of points used for cell
1197 vtkIdType aNbCells = elemPoints->length();
1198 vtkIdType aCellsSize = 0;
1199 for ( int i = 0, n = elemPoints->length(); i < n; i++ )
1200 aCellsSize += elemPoints[ i ].length();
1202 // Create unstructured grid and other usefull arrays
1203 vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
1205 vtkCellArray* aConnectivity = vtkCellArray::New();
1206 aConnectivity->Allocate( aCellsSize, 0 );
1208 vtkPoints* aPoints = vtkPoints::New();
1209 aPoints->SetNumberOfPoints( pnts->length() );
1211 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
1212 aCellTypesArray->SetNumberOfComponents( 1 );
1213 aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
1215 vtkIdList *anIdList = vtkIdList::New();
1217 // Fill array of points
1218 for ( int p = 0, nbPnt = pnts->length(); p < nbPnt; p++ )
1219 aPoints->SetPoint( p, pnts[ p ].x, pnts[ p ].y, pnts[ p ].z );
1221 for ( int e = 0, nbElem = elemPoints->length(); e < nbElem; e++ )
1223 int nbPoints = elemPoints[ e ].length();
1224 anIdList->SetNumberOfIds( nbPoints );
1225 for ( int i = 0; i < nbPoints; i++ )
1226 anIdList->SetId( i, elemPoints[ e ][ i ] );
1228 aConnectivity->InsertNextCell( anIdList );
1230 if ( nbPoints == 3 ) aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
1231 else if ( nbPoints == 5 ) aCellTypesArray->InsertNextValue( VTK_PYRAMID );
1232 else if ( nbPoints == 6 ) aCellTypesArray->InsertNextValue( VTK_WEDGE );
1233 else if ( nbPoints == 8 ) aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON );
1234 else if ( nbPoints == 4 && myType == Type_2d ) aCellTypesArray->InsertNextValue( VTK_QUAD );
1235 else if ( nbPoints == 4 && myType == Type_3d ) aCellTypesArray->InsertNextValue( VTK_TETRA );
1236 else aCellTypesArray->InsertNextValue( VTK_EMPTY_CELL );
1239 vtkIntArray* aCellLocationsArray = vtkIntArray::New();
1240 aCellLocationsArray->SetNumberOfComponents( 1 );
1241 aCellLocationsArray->SetNumberOfTuples( aNbCells );
1243 aConnectivity->InitTraversal();
1244 for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
1245 aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
1247 aGrid->SetPoints( aPoints );
1248 aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
1250 aConnectivity->Delete();
1252 aCellTypesArray->Delete();
1254 aCellLocationsArray->Delete();
1264 //=======================================================================
1265 // name : onModeToggled
1267 //=======================================================================
1268 void SMESHGUI_MeshPatternDlg::onModeToggled( bool on )
1270 on ? myRefineGrp->show() : myRefineGrp->hide();
1271 on ? myGeomGrp->hide() : myGeomGrp->show();
1274 //=======================================================================
1277 //=======================================================================
1278 bool SMESHGUI_MeshPatternDlg::isRefine() const
1280 return myRefine->isChecked();
1283 //=======================================================================
1284 //function : onTextChanged
1286 //=======================================================================
1287 void SMESHGUI_MeshPatternDlg::onTextChanged(const QString& theNewText)
1289 if ( myBusy || !isRefine() )
1294 if ( mySelInput != Ids ) {
1296 activateSelection();
1299 // hilight entered elements/nodes
1300 SMDS_Mesh* aMesh = 0;
1301 SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
1303 aMesh = anActor->GetObject()->GetMesh();
1306 mySelection->ClearIObjects();
1307 mySelection->AddIObject( anActor->getIO() );
1309 QStringList aListId = QStringList::split( " ", theNewText, false);
1311 for ( int i = 0; i < aListId.count(); i++ ) {
1312 const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
1313 if ( e && e->GetType() == ( myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume ) ) {
1314 if ( !mySelection->IsIndexSelected( anActor->getIO(), e->GetID() ) )
1315 mySelection->AddOrRemoveIndex( anActor->getIO(), e->GetID(), true );
1323 //=======================================================================
1324 //function : onNodeChanged
1326 //=======================================================================
1327 void SMESHGUI_MeshPatternDlg::onNodeChanged( int value )
1329 if ( myType == Type_3d ) {
1330 QSpinBox* first = (QSpinBox*)sender();
1331 QSpinBox* second = first == myNode1 ? myNode2 : myNode1;
1332 int secondVal = second->value();
1333 if ( secondVal == value ) {
1334 secondVal = value == second->maxValue() ? second->minValue() : value + 1;
1335 bool blocked = second->signalsBlocked();
1336 second->blockSignals( true );
1337 second->setValue( secondVal );
1338 second->blockSignals( blocked );
1345 //=======================================================================
1348 //=======================================================================
1349 bool SMESHGUI_MeshPatternDlg::getIds( QValueList<int>& ids ) const
1352 QStringList strIds = QStringList::split( " ", mySelEdit[Ids]->text() );
1355 for ( QStringList::iterator it = strIds.begin(); it != strIds.end(); ++it ) {
1356 val = (*it).toInt( &isOk );
1364 //=======================================================================
1365 //function : getNode1
1367 //=======================================================================
1368 int SMESHGUI_MeshPatternDlg::getNode( bool second ) const
1370 return second ? myNode2->value() - 1 : myNode1->value() - 1;