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"
31 #include "SMESHGUI_SpinBox.h"
32 #include "SMESHGUI_CreatePatternDlg.h"
33 #include "SMESHGUI_PatternWidget.h"
34 #include "SMESHGUI_Utils.h"
35 #include "SMESHGUI_VTKUtils.h"
36 #include "SMESHGUI_PatternUtils.h"
37 #include "SMESHGUI_GEOMGenUtils.h"
39 #include "SMESH_Actor.h"
40 #include "SMESH_ActorUtils.h"
41 #include "SMESH_NumberFilter.hxx"
43 #include "SMDS_Mesh.hxx"
44 #include "SMDS_MeshElement.hxx"
46 #include "SUIT_ResourceMgr.h"
47 #include "SUIT_Desktop.h"
48 #include "SUIT_FileDlg.h"
50 #include "LightApp_SelectionMgr.h"
51 #include "SalomeApp_Tools.h"
52 #include "SalomeApp_Study.h"
54 #include "SALOMEDS_SObject.hxx"
56 #include "SALOME_ListIO.hxx"
57 #include "SVTK_Selection.h"
59 #include "SVTK_ViewModel.h"
60 #include "SVTK_Selector.h"
61 #include "SVTK_ViewWindow.h"
64 #include <TColStd_MapOfInteger.hxx>
65 #include <TColStd_IndexedMapOfInteger.hxx>
70 #include <qlineedit.h>
71 #include <qpushbutton.h>
72 #include <qgroupbox.h>
74 #include <qradiobutton.h>
75 #include <qcheckbox.h>
76 #include <qbuttongroup.h>
77 #include <qmessagebox.h>
80 #include <qvaluelist.h>
83 #include <qfileinfo.h>
84 #include <qfiledialog.h>
88 #include <vtkIdList.h>
89 #include <vtkIntArray.h>
90 #include <vtkCellArray.h>
91 #include <vtkUnsignedCharArray.h>
92 #include <vtkUnstructuredGrid.h>
93 #include <vtkDataSetMapper.h>
94 #include <vtkProperty.h>
100 * Class : SMESHGUI_MeshPatternDlg
101 * Description : Dialog to specify filters for VTK viewer
104 //=======================================================================
105 // name : SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg
106 // Purpose : Constructor
107 //=======================================================================
108 SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule,
109 const char* theName )
110 : QDialog( SMESH::GetDesktop( theModule ), theName, false, WStyle_Customize |
111 WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
113 mySMESHGUI( theModule ),
114 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
116 setCaption(tr("CAPTION"));
118 QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
120 QFrame* aMainFrame = createMainFrame (this);
121 QFrame* aBtnFrame = createButtonFrame(this);
123 aDlgLay->addWidget(aMainFrame);
124 aDlgLay->addWidget(aBtnFrame);
126 aDlgLay->setStretchFactor(aMainFrame, 1);
130 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
135 //=======================================================================
136 // name : SMESHGUI_MeshPatternDlg::createMainFrame
137 // Purpose : Create frame containing dialog's input fields
138 //=======================================================================
139 QFrame* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent)
141 SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
142 QPixmap iconSlct ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
143 QPixmap icon2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
144 QPixmap icon3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
145 QPixmap iconOpen ( mgr->loadPixmap("STD", tr("ICON_FILE_OPEN")));
147 QPixmap iconSample2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
148 QPixmap iconSample3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_3D")));
150 QGroupBox* aMainGrp = new QGroupBox (1, Qt::Horizontal, theParent);
151 aMainGrp->setFrameStyle(QFrame::NoFrame);
152 aMainGrp->setInsideMargin(0);
154 // Pattern type group
156 myTypeGrp = new QButtonGroup (1, Qt::Vertical, tr("PATTERN_TYPE"), aMainGrp);
157 mySwitch2d = new QRadioButton (myTypeGrp);
158 mySwitch3d = new QRadioButton (myTypeGrp);
159 mySwitch2d->setPixmap(icon2d);
160 mySwitch3d->setPixmap(icon3d);
161 myTypeGrp->insert(mySwitch2d, Type_2d);
162 myTypeGrp->insert(mySwitch3d, Type_3d);
166 QGroupBox* aMeshGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_MESH"), aMainGrp);
167 new QLabel(tr("SMESH_MESH"), aMeshGrp);
168 mySelBtn[ Mesh ] = new QPushButton(aMeshGrp);
169 mySelBtn[ Mesh ]->setPixmap(iconSlct);
170 mySelEdit[ Mesh ] = new QLineEdit(aMeshGrp);
171 mySelEdit[ Mesh ]->setReadOnly(true);
175 QGroupBox* aPatGrp = new QGroupBox(1, Qt::Horizontal, tr("PATTERN"), aMainGrp);
178 QGroupBox* aNameGrp = new QGroupBox(1, Qt::Vertical, aPatGrp);
179 aNameGrp->setFrameStyle(QFrame::NoFrame);
180 aNameGrp->setInsideMargin(0);
181 new QLabel(tr("PATTERN"), aNameGrp);
182 myName = new QLineEdit(aNameGrp);
183 myName->setReadOnly(true);
184 myOpenBtn = new QPushButton(aNameGrp);
185 myOpenBtn->setPixmap(iconOpen);
186 myNewBtn = new QPushButton(tr("NEW"), aNameGrp);
188 // Mode selection check box
189 myRefine = new QCheckBox(tr("REFINE"), aPatGrp);
191 // selection widgets for Apply to geom mode
192 myGeomGrp = new QGroupBox(3, Qt::Horizontal, aPatGrp);
193 myGeomGrp->setFrameStyle(QFrame::NoFrame);
194 myGeomGrp->setInsideMargin(0);
196 for (int i = Object; i <= Vertex2; i++)
198 mySelLbl[ i ] = new QLabel(myGeomGrp);
199 mySelBtn[ i ] = new QPushButton(myGeomGrp);
200 mySelBtn[ i ]->setPixmap(iconSlct);
201 mySelEdit[ i ] = new QLineEdit(myGeomGrp);
202 mySelEdit[ i ]->setReadOnly(true);
205 // Widgets for refinement of existing mesh elements
206 myRefineGrp = new QFrame(aPatGrp);
207 myRefineGrp->setFrameStyle(QFrame::NoFrame);
208 QGridLayout* aRefGrid = new QGridLayout(myRefineGrp, 3, 3, 0, 5);
210 mySelLbl[ Ids ] = new QLabel(myRefineGrp);
211 mySelBtn[ Ids ] = new QPushButton(myRefineGrp);
212 mySelBtn[ Ids ]->setPixmap(iconSlct);
213 mySelEdit[ Ids ] = new QLineEdit(myRefineGrp);
215 QLabel* aNodeLbl = new QLabel(tr("NODE_1"), myRefineGrp);
216 myNode1 = new QSpinBox(myRefineGrp);
217 myNode2Lbl = new QLabel(tr("NODE_2"), myRefineGrp);
218 myNode2 = new QSpinBox(myRefineGrp);
220 aRefGrid->addWidget(mySelLbl [ Ids ], 0, 0);
221 aRefGrid->addWidget(mySelBtn [ Ids ], 0, 1);
222 aRefGrid->addWidget(mySelEdit[ Ids ], 0, 2);
223 aRefGrid->addWidget(aNodeLbl, 1, 0);
224 aRefGrid->addMultiCellWidget(myNode1, 1, 1, 1, 2);
225 aRefGrid->addWidget(myNode2Lbl, 2, 0);
226 aRefGrid->addMultiCellWidget(myNode2, 2, 2, 1, 2);
229 myReverseChk = new QCheckBox(tr("REVERSE"), aPatGrp);
231 // CreatePoly check box
232 myCreatePolygonsChk = new QCheckBox( tr( "CREATE_POLYGONS_NEAR_BOUNDARY" ), aPatGrp );
233 myCreatePolyedrsChk = new QCheckBox( tr( "CREATE_POLYEDRS_NEAR_BOUNDARY" ), aPatGrp );
235 // Pictures 2d and 3d
236 for (int i = 0; i < 2; i++) {
238 myPicture2d = new SMESHGUI_PatternWidget(aPatGrp),
239 myPicture2d->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
241 myPicture3d = new QFrame(aPatGrp),
242 myPreview3d = new QLabel(myPicture3d);
243 myPreview3d->setPixmap(iconSample3d);
244 QGridLayout* aLay = new QGridLayout(myPicture3d, 3, 3, 0, 0);
245 QSpacerItem* aSpacerH1 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
246 QSpacerItem* aSpacerH2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
247 QSpacerItem* aSpacerV1 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
248 QSpacerItem* aSpacerV2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
249 aLay->addItem(aSpacerH1, 1, 0);
250 aLay->addItem(aSpacerH2, 1, 2);
251 aLay->addItem(aSpacerV1, 0, 1);
252 aLay->addItem(aSpacerV2, 2, 1);
253 aLay->addWidget(myPreview3d, 1, 1);
257 myPreviewChk = new QCheckBox(tr("PREVIEW"), aPatGrp);
259 // Connect signals and slots
261 connect(myTypeGrp, SIGNAL(clicked(int)), SLOT(onTypeChanged(int)));
262 connect(myOpenBtn, SIGNAL(clicked()), SLOT(onOpen()));
263 connect(myNewBtn, SIGNAL(clicked()), SLOT(onNew()));
265 connect(myReverseChk, SIGNAL(toggled(bool)), SLOT(onReverse(bool)));
266 connect(myPreviewChk, SIGNAL(toggled(bool)), SLOT(onPreview(bool)));
267 connect(myRefine, SIGNAL(toggled(bool)), SLOT(onModeToggled(bool)));
269 connect(myNode1, SIGNAL(valueChanged(int)), SLOT(onNodeChanged(int)));
270 connect(myNode2, SIGNAL(valueChanged(int)), SLOT(onNodeChanged(int)));
272 connect(mySelEdit[Ids], SIGNAL(textChanged(const QString&)), SLOT(onTextChanged(const QString&)));
274 QMap< int, QPushButton* >::iterator anIter;
275 for (anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter)
276 connect(*anIter, SIGNAL(clicked()), SLOT(onSelInputChanged()));
281 //=======================================================================
282 // name : SMESHGUI_MeshPatternDlg::createButtonFrame
283 // Purpose : Create frame containing buttons
284 //=======================================================================
285 QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame (QWidget* theParent)
287 QFrame* aFrame = new QFrame(theParent);
288 aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
290 myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
291 myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
292 myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
294 QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
296 QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
298 aLay->addWidget(myOkBtn);
299 aLay->addWidget(myApplyBtn);
300 aLay->addItem(aSpacer);
301 aLay->addWidget(myCloseBtn);
303 connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
304 connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
305 connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
310 //=======================================================================
311 // name : SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg
312 // Purpose : Destructor
313 //=======================================================================
314 SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg()
318 //=======================================================================
319 // name : SMESHGUI_MeshPatternDlg::Init
320 // Purpose : Init dialog fields, connect signals and slots, show dialog
321 //=======================================================================
322 void SMESHGUI_MeshPatternDlg::Init()
324 myPattern = SMESH::GetPattern();
326 myIsCreateDlgOpen = false;
330 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
331 myMesh = SMESH::SMESH_Mesh::_nil();
333 myMeshShape = GEOM::GEOM_Object::_nil();
334 myGeomObj[ Object ] = GEOM::GEOM_Object::_nil();
335 myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();
336 myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();
338 // selection and SMESHGUI
339 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
340 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
341 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
343 myTypeGrp->setButton(Type_2d);
344 onTypeChanged(Type_2d);
345 onModeToggled(isRefine());
349 resize(minimumSize());
357 //=======================================================================
358 // name : SMESHGUI_MeshPatternDlg::isValid
359 // Purpose : Verify validity of entry data
360 //=======================================================================
361 bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess)
365 (myMesh->_is_nil() || !getIds(ids) || getNode(false) < 0 ||
366 myType == Type_3d && (getNode(true) < 0 || getNode(false) == getNode(true))))
369 (myMesh->_is_nil() || myMeshShape->_is_nil() || myGeomObj[ Object ]->_is_nil() ||
370 myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil())))
373 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
374 tr("SMESHGUI_INVALID_PARAMETERS"), QMessageBox::Ok);
381 //=======================================================================
382 // name : SMESHGUI_MeshPatternDlg::onApply
383 // Purpose : SLOT called when "Apply" button pressed.
384 //=======================================================================
385 bool SMESHGUI_MeshPatternDlg::onApply()
393 if (isRefine()) { // Refining existing mesh elements
396 SMESH::long_array_var varIds = new SMESH::long_array();
397 varIds->length(ids.count());
399 for (QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it)
402 ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked())
403 : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
405 } else { // Applying a pattern to geometrical object
406 if (myType == Type_2d)
407 myPattern->ApplyToFace(myGeomObj[Object], myGeomObj[Vertex1], myReverseChk->isChecked());
409 myPattern->ApplyTo3DBlock(myGeomObj[Object], myGeomObj[Vertex1], myGeomObj[Vertex2]);
412 bool toCreatePolygons = myCreatePolygonsChk->isChecked();
413 bool toCreatePolyedrs = myCreatePolyedrsChk->isChecked();
414 if ( myPattern->MakeMesh( myMesh, toCreatePolygons, toCreatePolyedrs ) ) {
415 //mySelectionMgr->clearSelected();
416 bool autoUpdate = SMESHGUI::automaticUpdate();
417 if (!isRefine() && autoUpdate) {
418 _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
419 SMESH_Actor* anActor = SMESH::FindActorByEntry(aSO->GetID().c_str());
421 anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str());
423 SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
430 mySMESHGUI->updateObjBrowser(true);
432 mySelEdit[ Ids ]->setText("");
436 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
437 tr("SMESH_OPERATION_FAILED"), QMessageBox::Ok);
440 } catch (const SALOME::SALOME_Exception& S_ex) {
441 SalomeApp_Tools::QtCatchCorbaException(S_ex);
448 //=======================================================================
449 // name : SMESHGUI_MeshPatternDlg::onOk
450 // Purpose : SLOT called when "Ok" button pressed.
451 //=======================================================================
452 void SMESHGUI_MeshPatternDlg::onOk()
458 //=======================================================================
459 // name : SMESHGUI_MeshPatternDlg::onClose
460 // Purpose : SLOT called when "Close" button pressed. Close dialog
461 //=======================================================================
462 void SMESHGUI_MeshPatternDlg::onClose()
464 mySelectionMgr->clearFilters();
465 SMESH::SetPickable();
466 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
467 aViewWindow->SetSelectionMode(ActorSelection);
468 disconnect(mySelectionMgr, 0, this, 0);
469 disconnect(mySMESHGUI, 0, this, 0);
470 mySMESHGUI->ResetState();
475 //=======================================================================
476 // name : SMESHGUI_MeshPatternDlg::onSelectionDone
477 // Purpose : SLOT called when selection changed
478 //=======================================================================
479 void SMESHGUI_MeshPatternDlg::onSelectionDone()
485 if (mySelInput == Mesh) {
487 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
488 if (aList.Extent() != 1)
491 // Retrieve mesh from selection
492 Handle(SALOME_InteractiveObject) anIO = aList.First();
493 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
494 if (aMesh->_is_nil())
497 // Get geom object corresponding to the mesh
498 _PTR(SObject) aSO = SMESH::FindSObject(aMesh.in());
499 myMeshShape = SMESH::GetGeom(aSO);
501 // Clear fields of geom objects if mesh was changed
502 if (myMesh != aMesh) {
503 for (int i = Object; i <= Ids; i++) {
504 myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
505 mySelEdit[ i ]->setText("");
511 // Set name of mesh in line edit
513 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
514 mySelEdit[ Mesh ]->setText(aName);
516 } else if (mySelInput == Ids) {
518 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
519 if (aList.Extent() != 1)
523 if (!SMESH::GetNameOfSelectedElements(mySelector, aList.First(), anIds))
527 mySelEdit[ Ids ]->setText(anIds);
532 mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
533 if (aList.Extent() != 1)
536 // Get geom object from selection
537 Handle(SALOME_InteractiveObject) anIO = aList.First();
538 GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
539 if (anObj->_is_nil())
542 // Clear fields of vertexes if face or 3d block was changed
543 if (anObj != myGeomObj[ mySelInput ] && mySelInput == Object) {
544 for (int i = Vertex1; i <= Vertex2; i++) {
545 myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
546 mySelEdit[ i ]->setText("");
550 myGeomObj[ mySelInput ] = anObj;
552 // Set name of geom object in line edit
554 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
555 mySelEdit[ mySelInput ]->setText(aName);
557 } catch (const SALOME::SALOME_Exception& S_ex) {
558 SalomeApp_Tools::QtCatchCorbaException(S_ex);
568 //=======================================================================
569 // name : SMESHGUI_MeshPatternDlg::resetSelInput
570 // Purpose : Reset fields corresponding to the current selection input
571 //=======================================================================
572 void SMESHGUI_MeshPatternDlg::resetSelInput()
574 if (mySelInput == Mesh)
576 myMesh = SMESH::SMESH_Mesh::_nil();
577 myMeshShape = GEOM::GEOM_Object::_nil();
581 myGeomObj[ mySelInput ] = GEOM::GEOM_Object::_nil();
583 mySelEdit[ mySelInput ]->setText("");
586 //=======================================================================
587 // name : SMESHGUI_MeshPatternDlg::onDeactivate
588 // Purpose : SLOT called when dialog must be deativated
589 //=======================================================================
590 void SMESHGUI_MeshPatternDlg::onDeactivate()
592 mySelectionMgr->clearFilters();
593 //if (myReverseChk->isChecked())
595 disconnect(mySelectionMgr, 0, this, 0);
599 //=======================================================================
600 // name : SMESHGUI_MeshPatternDlg::enterEvent
601 // Purpose : Event filter
602 //=======================================================================
603 void SMESHGUI_MeshPatternDlg::enterEvent (QEvent*)
605 if (myIsCreateDlgOpen)
608 if (myReverseChk->isChecked())
610 mySMESHGUI->EmitSignalDeactivateDialog();
613 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
614 onTextChanged(mySelEdit[Ids]->text());
617 //=======================================================================
618 // name : SMESHGUI_MeshPatternDlg::closeEvent
620 //=======================================================================
621 void SMESHGUI_MeshPatternDlg::closeEvent (QCloseEvent*)
626 //=======================================================================
627 // name : SMESHGUI_MeshPatternDlg::onSelInputChanged
628 // Purpose : SLOT. Called when -> button clicked.
629 // Change current selection input field
630 //=======================================================================
631 void SMESHGUI_MeshPatternDlg::onSelInputChanged()
633 const QObject* aSender = sender();
634 for (int i = Mesh; i <= Ids; i++)
635 if (aSender == mySelBtn[ i ])
642 //=======================================================================
643 // name : SMESHGUI_MeshPatternDlg::prepareFilters
644 // Purpose : Prepare filters for dialog
645 //=======================================================================
646 QStringList SMESHGUI_MeshPatternDlg::prepareFilters() const
648 static QStringList aList;
651 aList.append(tr("PATTERN_FILT"));
652 //aList.append(tr("ALL_FILES_FILTER"));
658 //=======================================================================
659 // name : SMESHGUI_MeshPatternDlg::autoExtension
660 // Purpose : Append extension to the file name
661 //=======================================================================
662 QString SMESHGUI_MeshPatternDlg::autoExtension (const QString& theFileName) const
664 QString anExt = theFileName.section('.', -1);
665 return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;
668 //=======================================================================
669 // name : SMESHGUI_MeshPatternDlg::onOpen
670 // Purpose : SLOT. Called when "Open" button clicked.
671 // Displays file open dialog
672 //=======================================================================
673 void SMESHGUI_MeshPatternDlg::onOpen()
675 SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, true);
676 aDlg->setCaption(tr("LOAD_PATTERN"));
677 aDlg->setMode(QFileDialog::ExistingFile);
678 aDlg->setFilters(prepareFilters());
679 if (myName->text() != "")
680 aDlg->setSelection(myName->text() + ".smp");
681 QPushButton* anOkBtn = (QPushButton*)aDlg->child("OK", "QPushButton");
683 anOkBtn->setText(tr("SMESH_BUT_OK"));
685 if (aDlg->exec() != Accepted)
688 QString fName = aDlg->selectedFile();
692 if (QFileInfo(fName).extension().isEmpty())
693 fName = autoExtension(fName);
695 fName = QDir::convertSeparators(fName);
697 QString prev = QDir::convertSeparators(myName->text());
701 // Read string from file
703 if (!aFile.open(IO_ReadOnly)) {
704 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
705 tr("ERROR_OF_OPENING"), QMessageBox::Ok);
709 QByteArray aDataArray = aFile.readAll();
710 const char* aData = aDataArray.data();
712 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
713 tr("ERROR_OF_READING"), QMessageBox::Ok);
717 if (loadFromFile(aData))
718 myName->setText(QFileInfo(fName).baseName());
724 //=======================================================================
725 // name : SMESHGUI_MeshPatternDlg::onCloseCreationDlg
726 // Purpose : SLOT. Called when "Pattern creation" dialog closed with "Close"
727 //=======================================================================
728 void SMESHGUI_MeshPatternDlg::onCloseCreationDlg()
731 myIsCreateDlgOpen = false;
734 //=======================================================================
735 // name : SMESHGUI_MeshPatternDlg::onOkCreationDlg
736 // Purpose : SLOT. Called when "Pattern creation" dialog closed with OK
737 // or SAVE buttons. Initialize myPattern field. Redisplay preview
738 //=======================================================================
739 void SMESHGUI_MeshPatternDlg::onOkCreationDlg()
741 myPattern = SMESH::SMESH_Pattern::_duplicate(myCreationDlg->GetPattern());
742 myName->setText(myCreationDlg->GetPatternName());
748 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( mySMESHGUI, myType);
762 connect(myCreationDlg, SIGNAL(NewPattern()), SLOT(onOkCreationDlg()));
763 connect(myCreationDlg, SIGNAL(Close()), SLOT(onCloseCreationDlg()));
766 myCreationDlg->Init(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()
800 // Redisplay preview in dialog
801 SMESH::point_array_var pnts = myPattern->GetPoints();
802 SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
803 SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false);
805 if (pnts->length() == 0 ||
806 keyPoints->length() == 0 ||
807 elemPoints->length() == 0) {
811 PointVector aPoints(pnts->length());
812 QValueVector<int> aKeyPoints(keyPoints->length());
813 ConnectivityVector anElemPoints(elemPoints->length());
815 for (int i = 0, n = pnts->length(); i < n; i++)
816 aPoints[ i ] = pnts[ i ];
818 for (int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++)
819 aKeyPoints[ i2 ] = keyPoints[ i2 ];
821 for (int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++) {
822 QValueVector<int> aVec(elemPoints[ i3 ].length());
823 for (int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++)
824 aVec[ i4 ] = elemPoints[ i3 ][ i4 ];
826 anElemPoints[ i3 ] = aVec;
829 myPicture2d->SetPoints(aPoints, aKeyPoints, anElemPoints);
832 // Redisplay preview in 3D viewer
833 if (myPreviewActor != 0) {
834 if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView()) {
835 vf->RemoveActor(myPreviewActor);
838 myPreviewActor->Delete();
842 if (!myPreviewChk->isChecked() || !isValid(false))
845 vtkUnstructuredGrid* aGrid = getGrid();
849 // Create and display actor
850 vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
851 aMapper->SetInput(aGrid);
853 myPreviewActor = SALOME_Actor::New();
854 myPreviewActor->PickableOff();
855 myPreviewActor->SetMapper(aMapper);
857 vtkProperty* aProp = vtkProperty::New();
858 aProp->SetRepresentationToWireframe();
859 aProp->SetColor(250, 0, 250);
860 if (SMESH::FindActorByObject(myMesh))
861 aProp->SetLineWidth( SMESH::GetFloat( "SMESH:element_width", 1 ) + 1 );
863 aProp->SetLineWidth(1);
864 myPreviewActor->SetProperty(aProp);
866 myPreviewActor->SetRepresentation(3);
868 SMESH::GetCurrentVtkView()->AddActor(myPreviewActor);
869 SMESH::GetCurrentVtkView()->Repaint();
873 } catch (const SALOME::SALOME_Exception& S_ex) {
874 SalomeApp_Tools::QtCatchCorbaException(S_ex);
881 //=======================================================================
882 // name : SMESHGUI_MeshPatternDlg::erasePreview
883 // Purpose : Erase preview
884 //=======================================================================
885 void SMESHGUI_MeshPatternDlg::erasePreview()
887 // Erase preview in 2D viewer
888 myPicture2d->SetPoints(PointVector(), QValueVector<int>(), ConnectivityVector());
890 // Erase preview in 3D viewer
891 if (myPreviewActor == 0)
895 if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView())
897 vf->RemoveActor(myPreviewActor);
900 myPreviewActor->Delete();
904 //=======================================================================
905 // name : SMESHGUI_MeshPatternDlg::updateWgState
906 // Purpose : Enable/disable selection widgets
907 //=======================================================================
908 void SMESHGUI_MeshPatternDlg::updateWgState()
910 if (myMesh->_is_nil()) {
911 for (int i = Object; i <= Ids; i++) {
912 mySelBtn [ i ]->setEnabled(false);
913 mySelEdit[ i ]->setEnabled(false);
914 mySelEdit[ i ]->setText("");
916 myNode1->setEnabled(false);
917 myNode2->setEnabled(false);
918 myNode1->setRange(0, 0);
919 myNode2->setRange(0, 0);
921 mySelBtn [ Object ]->setEnabled(true);
922 mySelEdit[ Object ]->setEnabled(true);
923 mySelBtn [ Ids ] ->setEnabled(true);
924 mySelEdit[ Ids ] ->setEnabled(true);
926 if (myGeomObj[ Object ]->_is_nil()) {
927 for (int i = Vertex1; i <= Vertex2; i++) {
928 mySelBtn [ i ]->setEnabled(false);
929 mySelEdit[ i ]->setEnabled(false);
930 mySelEdit[ i ]->setText("");
933 for (int i = Object; i <= Vertex2; i++) {
934 mySelBtn [ i ]->setEnabled(true);
935 mySelEdit[ i ]->setEnabled(true);
940 if (!CORBA::is_nil(myPattern)/* && getIds(ids)*/) {
941 SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
942 if (keyPoints->length()) {
943 myNode1->setEnabled(true);
944 myNode2->setEnabled(true);
945 myNode1->setRange(1, keyPoints->length());
946 myNode2->setRange(1, keyPoints->length());
951 myNode1->setEnabled(false);
952 myNode2->setEnabled(false);
953 myNode1->setRange(0, 0);
954 myNode2->setRange(0, 0);
958 //=======================================================================
959 // name : SMESHGUI_MeshPatternDlg::activateSelection
960 // Purpose : Activate selection in accordance with current selection input
961 //=======================================================================
962 void SMESHGUI_MeshPatternDlg::activateSelection()
964 mySelectionMgr->clearFilters();
965 if (mySelInput == Ids) {
966 SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
968 SMESH::SetPickable(anActor);
970 if (myType == Type_2d)
972 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
973 aViewWindow->SetSelectionMode(FaceSelection);
977 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
978 aViewWindow->SetSelectionMode(CellSelection);
982 SMESH::SetPickable();
983 //mySelectionMgr->setSelectionModes(ActorSelection);
984 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
985 aViewWindow->SetSelectionMode(ActorSelection);
988 if (mySelInput == Object && !myMeshShape->_is_nil()) {
989 if (myType == Type_2d) {
991 mySelectionMgr->installFilter
992 (new SMESH_NumberFilter ("GEOM", TopAbs_VERTEX, myNbPoints, TopAbs_FACE, myMeshShape));
994 mySelectionMgr->installFilter
995 (new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, myNbPoints, TopAbs_FACE, myMeshShape));
997 TColStd_MapOfInteger aTypes;
998 aTypes.Add(TopAbs_SHELL);
999 aTypes.Add(TopAbs_SOLID);
1000 mySelectionMgr->installFilter
1001 (new SMESH_NumberFilter ("GEOM", TopAbs_FACE, 6, aTypes, myMeshShape, true));
1003 } else if ((mySelInput == Vertex1 || mySelInput == Vertex2) && !myGeomObj[ Object ]->_is_nil()) {
1004 mySelectionMgr->installFilter
1005 (new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX, myGeomObj[ Object ]));
1010 //=======================================================================
1011 // name : SMESHGUI_MeshPatternDlg::loadFromFile
1012 // Purpose : Load pattern from file
1013 //=======================================================================
1014 bool SMESHGUI_MeshPatternDlg::loadFromFile (const QString& theName)
1017 SMESH::SMESH_Pattern_var aPattern = SMESH::GetPattern();
1019 if (!aPattern->LoadFromFile(theName.latin1()) ||
1020 myType == Type_2d && !aPattern->Is2D()) {
1021 SMESH::SMESH_Pattern::ErrorCode aCode = aPattern->GetErrorCode();
1023 if (aCode == SMESH::SMESH_Pattern::ERR_READ_NB_POINTS ) aMess = tr("ERR_READ_NB_POINTS");
1024 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_POINT_COORDS ) aMess = tr("ERR_READ_POINT_COORDS");
1025 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_TOO_FEW_POINTS) aMess = tr("ERR_READ_TOO_FEW_POINTS");
1026 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_3D_COORD ) aMess = tr("ERR_READ_3D_COORD");
1027 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_NO_KEYPOINT ) aMess = tr("ERR_READ_NO_KEYPOINT");
1028 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_INDEX ) aMess = tr("ERR_READ_BAD_INDEX");
1029 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_ELEM_POINTS ) aMess = tr("ERR_READ_ELEM_POINTS");
1030 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_NO_ELEMS ) aMess = tr("ERR_READ_NO_ELEMS");
1031 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_KEY_POINT ) aMess = tr("ERR_READ_BAD_KEY_POINT");
1032 else aMess = tr("ERROR_OF_LOADING");
1034 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), aMess, QMessageBox::Ok);
1037 myPattern = aPattern;
1040 } catch (const SALOME::SALOME_Exception& S_ex) {
1041 SalomeApp_Tools::QtCatchCorbaException(S_ex);
1042 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
1043 tr("ERROR_OF_LOADING"), QMessageBox::Ok);
1048 //=======================================================================
1049 // name : SMESHGUI_MeshPatternDlg::onTypeChanged
1050 // Purpose : SLOT. Called when pattern type changed.
1051 // Change dialog's look and feel
1052 //=======================================================================
1053 void SMESHGUI_MeshPatternDlg::onTypeChanged (int theType)
1055 if (myType == theType)
1061 myGeomObj[ Object ] = GEOM::GEOM_Object::_nil();
1062 myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();
1063 myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();
1064 myPattern = SMESH::GetPattern();
1066 myName->setText("");
1067 mySelEdit[ Object ]->setText("");
1068 mySelEdit[ Vertex1 ]->setText("");
1069 mySelEdit[ Vertex2 ]->setText("");
1070 mySelEdit[ Ids ] ->setText("");
1071 myCreatePolygonsChk->show();
1072 myCreatePolyedrsChk->show();
1074 if (theType == Type_2d) {
1076 mySelLbl [ Vertex2 ]->hide();
1077 mySelBtn [ Vertex2 ]->hide();
1078 mySelEdit[ Vertex2 ]->hide();
1079 myReverseChk->show();
1080 myPicture2d->show();
1081 myPicture3d->hide();
1082 mySelLbl[ Object ]->setText(tr("FACE"));
1083 mySelLbl[ Vertex1 ]->setText(tr("VERTEX"));
1085 mySelLbl[ Ids ]->setText(tr("MESH_FACES"));
1090 mySelLbl [ Vertex2 ]->show();
1091 mySelBtn [ Vertex2 ]->show();
1092 mySelEdit[ Vertex2 ]->show();
1093 myReverseChk->hide();
1094 myPicture2d->hide();
1095 myPicture3d->show();
1096 mySelLbl[ Object ]->setText(tr("3D_BLOCK"));
1097 mySelLbl[ Vertex1 ]->setText(tr("VERTEX1"));
1098 mySelLbl[ Vertex2 ]->setText(tr("VERTEX2"));
1100 mySelLbl[ Ids ]->setText(tr("MESH_VOLUMES"));
1106 activateSelection();
1111 //=======================================================================
1112 // name : SMESHGUI_MeshPatternDlg::getGrid
1113 // Purpose : Get unstructured grid for pattern
1114 //=======================================================================
1115 vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()
1118 // Get points from pattern
1119 SMESH::point_array_var pnts;
1120 QValueList<int> ids;
1121 if (isRefine() && getIds(ids)) {
1122 SMESH::long_array_var varIds = new SMESH::long_array();
1123 varIds->length(ids.count());
1125 for (QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it)
1127 pnts = myType == Type_2d
1128 ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked())
1129 : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
1131 pnts = myType == Type_2d
1132 ? myPattern->ApplyToFace (myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked())
1133 : myPattern->ApplyTo3DBlock(myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ]);
1136 SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(true);
1138 if (pnts->length() == 0 || elemPoints->length() == 0)
1141 // to do : to be removed /////////////////////////////////////////////
1144 for (int i1 = 0, n1 = pnts->length(); i1 < n1; i1++)
1145 printf("%d: %g %g %g\n", i1, pnts[ i1 ].x, pnts[ i1 ].y, pnts[ i1 ].z);
1147 printf("\nELEMENTS : \n");
1148 for (int i2 = 0, n2 = elemPoints->length(); i2 < n2; i2++)
1152 for (int i3 = 0, n3 = elemPoints[ i2 ].length(); i3 < n3; i3++)
1153 printf("%d ", elemPoints[ i2 ][ i3 ]);
1159 //////////////////////////////////////////////////////////////////////
1161 // Calculate number of points used for cell
1162 vtkIdType aNbCells = elemPoints->length();
1163 vtkIdType aCellsSize = 0;
1164 for (int i = 0, n = elemPoints->length(); i < n; i++)
1165 aCellsSize += elemPoints[ i ].length();
1167 // Create unstructured grid and other usefull arrays
1168 vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
1170 vtkCellArray* aConnectivity = vtkCellArray::New();
1171 aConnectivity->Allocate(aCellsSize, 0);
1173 vtkPoints* aPoints = vtkPoints::New();
1174 aPoints->SetNumberOfPoints(pnts->length());
1176 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
1177 aCellTypesArray->SetNumberOfComponents(1);
1178 aCellTypesArray->Allocate(aNbCells * aCellTypesArray->GetNumberOfComponents());
1180 vtkIdList *anIdList = vtkIdList::New();
1182 // Fill array of points
1183 for (int p = 0, nbPnt = pnts->length(); p < nbPnt; p++)
1184 aPoints->SetPoint(p, pnts[ p ].x, pnts[ p ].y, pnts[ p ].z);
1186 for (int e = 0, nbElem = elemPoints->length(); e < nbElem; e++) {
1187 int nbPoints = elemPoints[ e ].length();
1188 anIdList->SetNumberOfIds(nbPoints);
1189 for (int i = 0; i < nbPoints; i++)
1190 anIdList->SetId(i, elemPoints[ e ][ i ]);
1192 aConnectivity->InsertNextCell(anIdList);
1194 if (nbPoints == 3) aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
1195 else if (nbPoints == 5) aCellTypesArray->InsertNextValue(VTK_PYRAMID);
1196 else if (nbPoints == 6) aCellTypesArray->InsertNextValue(VTK_WEDGE);
1197 else if (nbPoints == 8) aCellTypesArray->InsertNextValue(VTK_HEXAHEDRON);
1198 else if (nbPoints == 4 && myType == Type_2d) aCellTypesArray->InsertNextValue(VTK_QUAD);
1199 else if (nbPoints == 4 && myType == Type_3d) aCellTypesArray->InsertNextValue(VTK_TETRA);
1200 else aCellTypesArray->InsertNextValue(VTK_EMPTY_CELL);
1203 vtkIntArray* aCellLocationsArray = vtkIntArray::New();
1204 aCellLocationsArray->SetNumberOfComponents(1);
1205 aCellLocationsArray->SetNumberOfTuples(aNbCells);
1207 aConnectivity->InitTraversal();
1208 for (vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell(npts, pts); idType++)
1209 aCellLocationsArray->SetValue(idType, aConnectivity->GetTraversalLocation(npts));
1211 aGrid->SetPoints(aPoints);
1212 aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aConnectivity);
1214 aConnectivity->Delete();
1216 aCellTypesArray->Delete();
1218 aCellLocationsArray->Delete();
1226 //=======================================================================
1227 // name : onModeToggled
1229 //=======================================================================
1230 void SMESHGUI_MeshPatternDlg::onModeToggled (bool on)
1232 on ? myRefineGrp->show() : myRefineGrp->hide();
1233 on ? myGeomGrp->hide() : myGeomGrp->show();
1238 //=======================================================================
1241 //=======================================================================
1242 bool SMESHGUI_MeshPatternDlg::isRefine() const
1244 return myRefine->isChecked();
1247 //=======================================================================
1248 // name : onTextChanged
1250 //=======================================================================
1251 void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText)
1253 if (myBusy || !isRefine())
1258 if (mySelInput != Ids) {
1260 activateSelection();
1263 // hilight entered elements/nodes
1264 SMDS_Mesh* aMesh = 0;
1265 SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
1267 aMesh = anActor->GetObject()->GetMesh();
1270 QStringList aListId = QStringList::split(" ", theNewText, false);
1272 TColStd_MapOfInteger newIndices;
1274 for (int i = 0; i < aListId.count(); i++) {
1275 const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
1276 if (e && e->GetType() == (myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume))
1277 newIndices.Add(e->GetID());
1279 mySelector->AddOrRemoveIndex( anActor->getIO(), newIndices, false);
1280 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1281 aViewWindow->highlight( anActor->getIO(), true, true );
1289 //=======================================================================
1290 // name : onNodeChanged
1292 //=======================================================================
1293 void SMESHGUI_MeshPatternDlg::onNodeChanged (int value)
1295 if (myType == Type_3d) {
1296 QSpinBox* first = (QSpinBox*)sender();
1297 QSpinBox* second = first == myNode1 ? myNode2 : myNode1;
1298 int secondVal = second->value();
1299 if (secondVal == value) {
1300 secondVal = value == second->maxValue() ? second->minValue() : value + 1;
1301 bool blocked = second->signalsBlocked();
1302 second->blockSignals(true);
1303 second->setValue(secondVal);
1304 second->blockSignals(blocked);
1311 //=======================================================================
1314 //=======================================================================
1315 bool SMESHGUI_MeshPatternDlg::getIds (QValueList<int>& ids) const
1318 QStringList strIds = QStringList::split(" ", mySelEdit[Ids]->text());
1321 for (QStringList::iterator it = strIds.begin(); it != strIds.end(); ++it) {
1322 val = (*it).toInt(&isOk);
1330 //=======================================================================
1333 //=======================================================================
1334 int SMESHGUI_MeshPatternDlg::getNode (bool second) const
1336 return second ? myNode2->value() - 1 : myNode1->value() - 1;