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 "SalomeApp_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>
99 * Class : SMESHGUI_MeshPatternDlg
100 * Description : Dialog to specify filters for VTK viewer
103 //=======================================================================
104 // name : SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg
105 // Purpose : Constructor
106 //=======================================================================
107 SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule,
108 const char* theName )
109 : QDialog( SMESH::GetDesktop( theModule ), theName, false, WStyle_Customize |
110 WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
112 mySMESHGUI( theModule ),
113 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
115 setCaption(tr("CAPTION"));
117 QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
119 QFrame* aMainFrame = createMainFrame (this);
120 QFrame* aBtnFrame = createButtonFrame(this);
122 aDlgLay->addWidget(aMainFrame);
123 aDlgLay->addWidget(aBtnFrame);
125 aDlgLay->setStretchFactor(aMainFrame, 1);
129 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
134 //=======================================================================
135 // name : SMESHGUI_MeshPatternDlg::createMainFrame
136 // Purpose : Create frame containing dialog's input fields
137 //=======================================================================
138 QFrame* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent)
140 SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
141 QPixmap iconSlct ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
142 QPixmap icon2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
143 QPixmap icon3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
144 QPixmap iconOpen ( mgr->loadPixmap("STD", tr("ICON_FILE_OPEN")));
146 QPixmap iconSample2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
147 QPixmap iconSample3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_3D")));
149 QGroupBox* aMainGrp = new QGroupBox (1, Qt::Horizontal, theParent);
150 aMainGrp->setFrameStyle(QFrame::NoFrame);
151 aMainGrp->setInsideMargin(0);
153 // Pattern type group
155 myTypeGrp = new QButtonGroup (1, Qt::Vertical, tr("PATTERN_TYPE"), aMainGrp);
156 mySwitch2d = new QRadioButton (myTypeGrp);
157 mySwitch3d = new QRadioButton (myTypeGrp);
158 mySwitch2d->setPixmap(icon2d);
159 mySwitch3d->setPixmap(icon3d);
160 myTypeGrp->insert(mySwitch2d, Type_2d);
161 myTypeGrp->insert(mySwitch3d, Type_3d);
165 QGroupBox* aMeshGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_MESH"), aMainGrp);
166 new QLabel(tr("SMESH_MESH"), aMeshGrp);
167 mySelBtn[ Mesh ] = new QPushButton(aMeshGrp);
168 mySelBtn[ Mesh ]->setPixmap(iconSlct);
169 mySelEdit[ Mesh ] = new QLineEdit(aMeshGrp);
170 mySelEdit[ Mesh ]->setReadOnly(true);
174 QGroupBox* aPatGrp = new QGroupBox(1, Qt::Horizontal, tr("PATTERN"), aMainGrp);
177 QGroupBox* aNameGrp = new QGroupBox(1, Qt::Vertical, aPatGrp);
178 aNameGrp->setFrameStyle(QFrame::NoFrame);
179 aNameGrp->setInsideMargin(0);
180 new QLabel(tr("PATTERN"), aNameGrp);
181 myName = new QLineEdit(aNameGrp);
182 myName->setReadOnly(true);
183 myOpenBtn = new QPushButton(aNameGrp);
184 myOpenBtn->setPixmap(iconOpen);
185 myNewBtn = new QPushButton(tr("NEW"), aNameGrp);
187 // Mode selection check box
188 myRefine = new QCheckBox(tr("REFINE"), aPatGrp);
190 // selection widgets for Apply to geom mode
191 myGeomGrp = new QGroupBox(3, Qt::Horizontal, aPatGrp);
192 myGeomGrp->setFrameStyle(QFrame::NoFrame);
193 myGeomGrp->setInsideMargin(0);
195 for (int i = Object; i <= Vertex2; i++)
197 mySelLbl[ i ] = new QLabel(myGeomGrp);
198 mySelBtn[ i ] = new QPushButton(myGeomGrp);
199 mySelBtn[ i ]->setPixmap(iconSlct);
200 mySelEdit[ i ] = new QLineEdit(myGeomGrp);
201 mySelEdit[ i ]->setReadOnly(true);
204 // Widgets for refinement of existing mesh elements
205 myRefineGrp = new QFrame(aPatGrp);
206 myRefineGrp->setFrameStyle(QFrame::NoFrame);
207 QGridLayout* aRefGrid = new QGridLayout(myRefineGrp, 3, 3, 0, 5);
209 mySelLbl[ Ids ] = new QLabel(myRefineGrp);
210 mySelBtn[ Ids ] = new QPushButton(myRefineGrp);
211 mySelBtn[ Ids ]->setPixmap(iconSlct);
212 mySelEdit[ Ids ] = new QLineEdit(myRefineGrp);
214 QLabel* aNodeLbl = new QLabel(tr("NODE_1"), myRefineGrp);
215 myNode1 = new QSpinBox(myRefineGrp);
216 myNode2Lbl = new QLabel(tr("NODE_2"), myRefineGrp);
217 myNode2 = new QSpinBox(myRefineGrp);
219 aRefGrid->addWidget(mySelLbl [ Ids ], 0, 0);
220 aRefGrid->addWidget(mySelBtn [ Ids ], 0, 1);
221 aRefGrid->addWidget(mySelEdit[ Ids ], 0, 2);
222 aRefGrid->addWidget(aNodeLbl, 1, 0);
223 aRefGrid->addMultiCellWidget(myNode1, 1, 1, 1, 2);
224 aRefGrid->addWidget(myNode2Lbl, 2, 0);
225 aRefGrid->addMultiCellWidget(myNode2, 2, 2, 1, 2);
228 myReverseChk = new QCheckBox(tr("REVERSE"), aPatGrp);
230 // CreatePoly check box
231 myCreatePolygonsChk = new QCheckBox( tr( "CREATE_POLYGONS_NEAR_BOUNDARY" ), aPatGrp );
232 myCreatePolyedrsChk = new QCheckBox( tr( "CREATE_POLYEDRS_NEAR_BOUNDARY" ), aPatGrp );
234 // Pictures 2d and 3d
235 for (int i = 0; i < 2; i++) {
237 myPicture2d = new SMESHGUI_PatternWidget(aPatGrp),
238 myPicture2d->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
240 myPicture3d = new QFrame(aPatGrp),
241 myPreview3d = new QLabel(myPicture3d);
242 myPreview3d->setPixmap(iconSample3d);
243 QGridLayout* aLay = new QGridLayout(myPicture3d, 3, 3, 0, 0);
244 QSpacerItem* aSpacerH1 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
245 QSpacerItem* aSpacerH2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
246 QSpacerItem* aSpacerV1 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
247 QSpacerItem* aSpacerV2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
248 aLay->addItem(aSpacerH1, 1, 0);
249 aLay->addItem(aSpacerH2, 1, 2);
250 aLay->addItem(aSpacerV1, 0, 1);
251 aLay->addItem(aSpacerV2, 2, 1);
252 aLay->addWidget(myPreview3d, 1, 1);
256 myPreviewChk = new QCheckBox(tr("PREVIEW"), aPatGrp);
258 // Connect signals and slots
260 connect(myTypeGrp, SIGNAL(clicked(int)), SLOT(onTypeChanged(int)));
261 connect(myOpenBtn, SIGNAL(clicked()), SLOT(onOpen()));
262 connect(myNewBtn, SIGNAL(clicked()), SLOT(onNew()));
264 connect(myReverseChk, SIGNAL(toggled(bool)), SLOT(onReverse(bool)));
265 connect(myPreviewChk, SIGNAL(toggled(bool)), SLOT(onPreview(bool)));
266 connect(myRefine, SIGNAL(toggled(bool)), SLOT(onModeToggled(bool)));
268 connect(myNode1, SIGNAL(valueChanged(int)), SLOT(onNodeChanged(int)));
269 connect(myNode2, SIGNAL(valueChanged(int)), SLOT(onNodeChanged(int)));
271 connect(mySelEdit[Ids], SIGNAL(textChanged(const QString&)), SLOT(onTextChanged(const QString&)));
273 QMap< int, QPushButton* >::iterator anIter;
274 for (anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter)
275 connect(*anIter, SIGNAL(clicked()), SLOT(onSelInputChanged()));
280 //=======================================================================
281 // name : SMESHGUI_MeshPatternDlg::createButtonFrame
282 // Purpose : Create frame containing buttons
283 //=======================================================================
284 QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame (QWidget* theParent)
286 QFrame* aFrame = new QFrame(theParent);
287 aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
289 myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
290 myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
291 myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
293 QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
295 QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
297 aLay->addWidget(myOkBtn);
298 aLay->addWidget(myApplyBtn);
299 aLay->addItem(aSpacer);
300 aLay->addWidget(myCloseBtn);
302 connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
303 connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
304 connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
309 //=======================================================================
310 // name : SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg
311 // Purpose : Destructor
312 //=======================================================================
313 SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg()
317 //=======================================================================
318 // name : SMESHGUI_MeshPatternDlg::Init
319 // Purpose : Init dialog fields, connect signals and slots, show dialog
320 //=======================================================================
321 void SMESHGUI_MeshPatternDlg::Init()
323 myPattern = SMESH::GetPattern();
325 myIsCreateDlgOpen = false;
329 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
330 myMesh = SMESH::SMESH_Mesh::_nil();
332 myMeshShape = GEOM::GEOM_Object::_nil();
333 myGeomObj[ Object ] = GEOM::GEOM_Object::_nil();
334 myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();
335 myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();
337 // selection and SMESHGUI
338 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
339 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
340 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
342 myTypeGrp->setButton(Type_2d);
343 onTypeChanged(Type_2d);
344 onModeToggled(isRefine());
348 resize(minimumSize());
354 mySMESHGUI->DefineDlgPosition(this, x, y);
359 //=======================================================================
360 // name : SMESHGUI_MeshPatternDlg::isValid
361 // Purpose : Verify validity of entry data
362 //=======================================================================
363 bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess)
367 (myMesh->_is_nil() || !getIds(ids) || getNode(false) < 0 ||
368 myType == Type_3d && (getNode(true) < 0 || getNode(false) == getNode(true))))
371 (myMesh->_is_nil() || myMeshShape->_is_nil() || myGeomObj[ Object ]->_is_nil() ||
372 myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil())))
375 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
376 tr("SMESHGUI_INVALID_PARAMETERS"), QMessageBox::Ok);
383 //=======================================================================
384 // name : SMESHGUI_MeshPatternDlg::onApply
385 // Purpose : SLOT called when "Apply" button pressed.
386 //=======================================================================
387 bool SMESHGUI_MeshPatternDlg::onApply()
395 if (isRefine()) { // Refining existing mesh elements
398 SMESH::long_array_var varIds = new SMESH::long_array();
399 varIds->length(ids.count());
401 for (QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it)
404 ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked())
405 : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
407 } else { // Applying a pattern to geometrical object
408 if (myType == Type_2d)
409 myPattern->ApplyToFace(myGeomObj[Object], myGeomObj[Vertex1], myReverseChk->isChecked());
411 myPattern->ApplyTo3DBlock(myGeomObj[Object], myGeomObj[Vertex1], myGeomObj[Vertex2]);
414 bool toCreatePolygons = myCreatePolygonsChk->isChecked();
415 bool toCreatePolyedrs = myCreatePolyedrsChk->isChecked();
416 if ( myPattern->MakeMesh( myMesh, toCreatePolygons, toCreatePolyedrs ) ) {
417 mySelectionMgr->clearSelected();
418 bool autoUpdate = SMESHGUI::automaticUpdate();
419 if (!isRefine() && autoUpdate) {
420 _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
421 SMESH_Actor* anActor = SMESH::FindActorByEntry(aSO->GetID().c_str());
423 anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str());
425 SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
432 mySMESHGUI->updateObjBrowser(true);
435 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
436 tr("SMESH_OPERATION_FAILED"), QMessageBox::Ok);
439 } catch (const SALOME::SALOME_Exception& S_ex) {
440 SalomeApp_Tools::QtCatchCorbaException(S_ex);
447 //=======================================================================
448 // name : SMESHGUI_MeshPatternDlg::onOk
449 // Purpose : SLOT called when "Ok" button pressed.
450 //=======================================================================
451 void SMESHGUI_MeshPatternDlg::onOk()
457 //=======================================================================
458 // name : SMESHGUI_MeshPatternDlg::onClose
459 // Purpose : SLOT called when "Close" button pressed. Close dialog
460 //=======================================================================
461 void SMESHGUI_MeshPatternDlg::onClose()
463 mySelectionMgr->clearFilters();
464 SMESH::SetPickable();
465 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
466 aViewWindow->SetSelectionMode(ActorSelection);
467 disconnect(mySelectionMgr, 0, this, 0);
468 disconnect(mySMESHGUI, 0, this, 0);
469 mySMESHGUI->ResetState();
474 //=======================================================================
475 // name : SMESHGUI_MeshPatternDlg::onSelectionDone
476 // Purpose : SLOT called when selection changed
477 //=======================================================================
478 void SMESHGUI_MeshPatternDlg::onSelectionDone()
484 if (mySelInput == Mesh) {
486 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
487 if (aList.Extent() != 1)
490 // Retrieve mesh from selection
491 Handle(SALOME_InteractiveObject) anIO = aList.First();
492 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
493 if (aMesh->_is_nil())
496 // Get geom object corresponding to the mesh
497 _PTR(SObject) aSO = SMESH::FindSObject(aMesh.in());
498 myMeshShape = SMESH::GetGeom(aSO);
500 // Clear fields of geom objects if mesh was changed
501 if (myMesh != aMesh) {
502 for (int i = Object; i <= Ids; i++) {
503 myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
504 mySelEdit[ i ]->setText("");
510 // Set name of mesh in line edit
512 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
513 mySelEdit[ Mesh ]->setText(aName);
515 } else if (mySelInput == Ids) {
517 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
518 if (aList.Extent() != 1)
522 if (!SMESH::GetNameOfSelectedElements(mySelector, aList.First(), anIds))
526 mySelEdit[ Ids ]->setText(anIds);
531 mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
532 if (aList.Extent() != 1)
535 // Get geom object from selection
536 Handle(SALOME_InteractiveObject) anIO = aList.First();
537 GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
538 if (anObj->_is_nil())
541 // Clear fields of vertexes if face or 3d block was changed
542 if (anObj != myGeomObj[ mySelInput ] && mySelInput == Object) {
543 for (int i = Vertex1; i <= Vertex2; i++) {
544 myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
545 mySelEdit[ i ]->setText("");
549 myGeomObj[ mySelInput ] = anObj;
551 // Set name of geom object in line edit
553 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
554 mySelEdit[ mySelInput ]->setText(aName);
556 } catch (const SALOME::SALOME_Exception& S_ex) {
557 SalomeApp_Tools::QtCatchCorbaException(S_ex);
567 //=======================================================================
568 // name : SMESHGUI_MeshPatternDlg::resetSelInput
569 // Purpose : Reset fields corresponding to the current selection input
570 //=======================================================================
571 void SMESHGUI_MeshPatternDlg::resetSelInput()
573 if (mySelInput == Mesh)
575 myMesh = SMESH::SMESH_Mesh::_nil();
576 myMeshShape = GEOM::GEOM_Object::_nil();
580 myGeomObj[ mySelInput ] = GEOM::GEOM_Object::_nil();
582 mySelEdit[ mySelInput ]->setText("");
585 //=======================================================================
586 // name : SMESHGUI_MeshPatternDlg::onDeactivate
587 // Purpose : SLOT called when dialog must be deativated
588 //=======================================================================
589 void SMESHGUI_MeshPatternDlg::onDeactivate()
591 mySelectionMgr->clearFilters();
592 //if (myReverseChk->isChecked())
594 disconnect(mySelectionMgr, 0, this, 0);
598 //=======================================================================
599 // name : SMESHGUI_MeshPatternDlg::enterEvent
600 // Purpose : Event filter
601 //=======================================================================
602 void SMESHGUI_MeshPatternDlg::enterEvent (QEvent*)
604 if (myIsCreateDlgOpen)
607 if (myReverseChk->isChecked())
609 mySMESHGUI->EmitSignalDeactivateDialog();
612 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
613 onTextChanged(mySelEdit[Ids]->text());
616 //=======================================================================
617 // name : SMESHGUI_MeshPatternDlg::closeEvent
619 //=======================================================================
620 void SMESHGUI_MeshPatternDlg::closeEvent (QCloseEvent*)
625 //=======================================================================
626 // name : SMESHGUI_MeshPatternDlg::onSelInputChanged
627 // Purpose : SLOT. Called when -> button clicked.
628 // Change current selection input field
629 //=======================================================================
630 void SMESHGUI_MeshPatternDlg::onSelInputChanged()
632 const QObject* aSender = sender();
633 for (int i = Mesh; i <= Ids; i++)
634 if (aSender == mySelBtn[ i ])
641 //=======================================================================
642 // name : SMESHGUI_MeshPatternDlg::prepareFilters
643 // Purpose : Prepare filters for dialog
644 //=======================================================================
645 QStringList SMESHGUI_MeshPatternDlg::prepareFilters() const
647 static QStringList aList;
650 aList.append(tr("PATTERN_FILT"));
651 //aList.append(tr("ALL_FILES_FILTER"));
657 //=======================================================================
658 // name : 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 SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, true);
675 aDlg->setCaption(tr("LOAD_PATTERN"));
676 aDlg->setMode(QFileDialog::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();
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
702 if (!aFile.open(IO_ReadOnly)) {
703 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
704 tr("ERROR_OF_OPENING"), QMessageBox::Ok);
708 QByteArray aDataArray = aFile.readAll();
709 const char* aData = aDataArray.data();
711 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
712 tr("ERROR_OF_READING"), QMessageBox::Ok);
716 if (loadFromFile(aData))
717 myName->setText(QFileInfo(fName).baseName());
723 //=======================================================================
724 // name : SMESHGUI_MeshPatternDlg::onCloseCreationDlg
725 // Purpose : SLOT. Called when "Pattern creation" dialog closed with "Close"
726 //=======================================================================
727 void SMESHGUI_MeshPatternDlg::onCloseCreationDlg()
730 myIsCreateDlgOpen = false;
733 //=======================================================================
734 // name : SMESHGUI_MeshPatternDlg::onOkCreationDlg
735 // Purpose : SLOT. Called when "Pattern creation" dialog closed with OK
736 // or SAVE buttons. Initialize myPattern field. Redisplay preview
737 //=======================================================================
738 void SMESHGUI_MeshPatternDlg::onOkCreationDlg()
740 myPattern = SMESH::SMESH_Pattern::_duplicate(myCreationDlg->GetPattern());
741 myName->setText(myCreationDlg->GetPatternName());
744 myIsCreateDlgOpen = false;
747 //=======================================================================
748 // name : SMESHGUI_MeshPatternDlg::onNew
749 // Purpose : SLOT. Called when "New..." button clicked. Create new pattern
750 //=======================================================================
751 void SMESHGUI_MeshPatternDlg::onNew()
754 myIsCreateDlgOpen = true;
755 if (myCreationDlg == 0)
757 myCreationDlg = new SMESHGUI_CreatePatternDlg( mySMESHGUI, myType);
758 connect(myCreationDlg, SIGNAL(NewPattern()), SLOT(onOkCreationDlg()));
759 connect(myCreationDlg, SIGNAL(Close()), SLOT(onCloseCreationDlg()));
762 myCreationDlg->Init(myType);
764 myCreationDlg->SetMesh(myMesh);
765 myCreationDlg->show();
768 //=======================================================================
769 // name : SMESHGUI_MeshPatternDlg::onReverse
770 // Purpose : SLOT. Called when state of "Reverse order..." checkbox chaged
771 // Calculate new points of the mesh to be created. Redisplay preview
772 //=======================================================================
773 void SMESHGUI_MeshPatternDlg::onReverse (bool)
778 //=======================================================================
780 // name : SMESHGUI_MeshPatternDlg::onPreview
781 // Purpose : SLOT. Called when state of "Preview" checkbox changed
782 // Display/Erase preview
783 //=======================================================================
784 void SMESHGUI_MeshPatternDlg::onPreview (bool)
789 //=======================================================================
790 // name : SMESHGUI_MeshPatternDlg::displayPreview
791 // Purpose : Display preview
792 //=======================================================================
793 void SMESHGUI_MeshPatternDlg::displayPreview()
796 // Redisplay preview in dialog
797 SMESH::point_array_var pnts = myPattern->GetPoints();
798 SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
799 SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false);
801 if (pnts->length() == 0 ||
802 keyPoints->length() == 0 ||
803 elemPoints->length() == 0) {
807 PointVector aPoints(pnts->length());
808 QValueVector<int> aKeyPoints(keyPoints->length());
809 ConnectivityVector anElemPoints(elemPoints->length());
811 for (int i = 0, n = pnts->length(); i < n; i++)
812 aPoints[ i ] = pnts[ i ];
814 for (int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++)
815 aKeyPoints[ i2 ] = keyPoints[ i2 ];
817 for (int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++) {
818 QValueVector<int> aVec(elemPoints[ i3 ].length());
819 for (int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++)
820 aVec[ i4 ] = elemPoints[ i3 ][ i4 ];
822 anElemPoints[ i3 ] = aVec;
825 myPicture2d->SetPoints(aPoints, aKeyPoints, anElemPoints);
828 // Redisplay preview in 3D viewer
829 if (myPreviewActor != 0) {
830 if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView()) {
831 vf->RemoveActor(myPreviewActor);
834 myPreviewActor->Delete();
838 if (!myPreviewChk->isChecked() || !isValid(false))
841 vtkUnstructuredGrid* aGrid = getGrid();
845 // Create and display actor
846 vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
847 aMapper->SetInput(aGrid);
849 myPreviewActor = SALOME_Actor::New();
850 myPreviewActor->PickableOff();
851 myPreviewActor->SetMapper(aMapper);
853 vtkProperty* aProp = vtkProperty::New();
854 aProp->SetRepresentationToWireframe();
855 aProp->SetColor(250, 0, 250);
856 if (SMESH::FindActorByObject(myMesh))
857 aProp->SetLineWidth( SMESH::GetFloat( "SMESH:element_width", 1 ) + 1 );
859 aProp->SetLineWidth(1);
860 myPreviewActor->SetProperty(aProp);
862 myPreviewActor->SetRepresentation(3);
864 SMESH::GetCurrentVtkView()->AddActor(myPreviewActor);
865 SMESH::GetCurrentVtkView()->Repaint();
869 } catch (const SALOME::SALOME_Exception& S_ex) {
870 SalomeApp_Tools::QtCatchCorbaException(S_ex);
877 //=======================================================================
878 // name : SMESHGUI_MeshPatternDlg::erasePreview
879 // Purpose : Erase preview
880 //=======================================================================
881 void SMESHGUI_MeshPatternDlg::erasePreview()
883 // Erase preview in 2D viewer
884 myPicture2d->SetPoints(PointVector(), QValueVector<int>(), ConnectivityVector());
886 // Erase preview in 3D viewer
887 if (myPreviewActor == 0)
891 if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView())
893 vf->RemoveActor(myPreviewActor);
896 myPreviewActor->Delete();
900 //=======================================================================
901 // name : SMESHGUI_MeshPatternDlg::updateWgState
902 // Purpose : Enable/disable selection widgets
903 //=======================================================================
904 void SMESHGUI_MeshPatternDlg::updateWgState()
906 if (myMesh->_is_nil()) {
907 for (int i = Object; i <= Ids; i++) {
908 mySelBtn [ i ]->setEnabled(false);
909 mySelEdit[ i ]->setEnabled(false);
910 mySelEdit[ i ]->setText("");
912 myNode1->setEnabled(false);
913 myNode2->setEnabled(false);
914 myNode1->setRange(0, 0);
915 myNode2->setRange(0, 0);
917 mySelBtn [ Object ]->setEnabled(true);
918 mySelEdit[ Object ]->setEnabled(true);
919 mySelBtn [ Ids ] ->setEnabled(true);
920 mySelEdit[ Ids ] ->setEnabled(true);
922 if (myGeomObj[ Object ]->_is_nil()) {
923 for (int i = Vertex1; i <= Vertex2; i++) {
924 mySelBtn [ i ]->setEnabled(false);
925 mySelEdit[ i ]->setEnabled(false);
926 mySelEdit[ i ]->setText("");
929 for (int i = Object; i <= Vertex2; i++) {
930 mySelBtn [ i ]->setEnabled(true);
931 mySelEdit[ i ]->setEnabled(true);
936 if (!CORBA::is_nil(myPattern) && getIds(ids)) {
937 SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
938 if (keyPoints->length()) {
939 myNode1->setEnabled(true);
940 myNode2->setEnabled(true);
941 myNode1->setRange(1, keyPoints->length());
942 myNode2->setRange(1, keyPoints->length());
947 myNode1->setEnabled(false);
948 myNode2->setEnabled(false);
949 myNode1->setRange(0, 0);
950 myNode2->setRange(0, 0);
954 //=======================================================================
955 // name : SMESHGUI_MeshPatternDlg::activateSelection
956 // Purpose : Activate selection in accordance with current selection input
957 //=======================================================================
958 void SMESHGUI_MeshPatternDlg::activateSelection()
960 mySelectionMgr->clearFilters();
961 if (mySelInput == Ids) {
962 SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
964 SMESH::SetPickable(anActor);
966 if (myType == Type_2d)
968 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
969 aViewWindow->SetSelectionMode(FaceSelection);
973 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
974 aViewWindow->SetSelectionMode(CellSelection);
978 SMESH::SetPickable();
979 //mySelectionMgr->setSelectionModes(ActorSelection);
980 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
981 aViewWindow->SetSelectionMode(ActorSelection);
984 if (mySelInput == Object && !myMeshShape->_is_nil()) {
985 if (myType == Type_2d) {
987 mySelectionMgr->installFilter
988 (new SMESH_NumberFilter ("GEOM", TopAbs_VERTEX, myNbPoints, TopAbs_FACE, myMeshShape));
990 mySelectionMgr->installFilter
991 (new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, myNbPoints, TopAbs_FACE, myMeshShape));
993 TColStd_MapOfInteger aTypes;
994 aTypes.Add(TopAbs_SHELL);
995 aTypes.Add(TopAbs_SOLID);
996 mySelectionMgr->installFilter
997 (new SMESH_NumberFilter ("GEOM", TopAbs_FACE, 6, aTypes, myMeshShape, true));
999 } else if ((mySelInput == Vertex1 || mySelInput == Vertex2) && !myGeomObj[ Object ]->_is_nil()) {
1000 mySelectionMgr->installFilter
1001 (new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX, myGeomObj[ Object ]));
1006 //=======================================================================
1007 // name : SMESHGUI_MeshPatternDlg::loadFromFile
1008 // Purpose : Load pattern from file
1009 //=======================================================================
1010 bool SMESHGUI_MeshPatternDlg::loadFromFile (const QString& theName)
1013 SMESH::SMESH_Pattern_var aPattern = SMESH::GetPattern();
1015 if (!aPattern->LoadFromFile(theName.latin1()) ||
1016 myType == Type_2d && !aPattern->Is2D()) {
1017 SMESH::SMESH_Pattern::ErrorCode aCode = aPattern->GetErrorCode();
1019 if (aCode == SMESH::SMESH_Pattern::ERR_READ_NB_POINTS ) aMess = tr("ERR_READ_NB_POINTS");
1020 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_POINT_COORDS ) aMess = tr("ERR_READ_POINT_COORDS");
1021 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_TOO_FEW_POINTS) aMess = tr("ERR_READ_TOO_FEW_POINTS");
1022 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_3D_COORD ) aMess = tr("ERR_READ_3D_COORD");
1023 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_NO_KEYPOINT ) aMess = tr("ERR_READ_NO_KEYPOINT");
1024 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_INDEX ) aMess = tr("ERR_READ_BAD_INDEX");
1025 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_ELEM_POINTS ) aMess = tr("ERR_READ_ELEM_POINTS");
1026 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_NO_ELEMS ) aMess = tr("ERR_READ_NO_ELEMS");
1027 else if (aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_KEY_POINT ) aMess = tr("ERR_READ_BAD_KEY_POINT");
1028 else aMess = tr("ERROR_OF_LOADING");
1030 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), aMess, QMessageBox::Ok);
1033 myPattern = aPattern;
1036 } catch (const SALOME::SALOME_Exception& S_ex) {
1037 SalomeApp_Tools::QtCatchCorbaException(S_ex);
1038 QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
1039 tr("ERROR_OF_LOADING"), QMessageBox::Ok);
1044 //=======================================================================
1045 // name : SMESHGUI_MeshPatternDlg::onTypeChanged
1046 // Purpose : SLOT. Called when pattern type changed.
1047 // Change dialog's look and feel
1048 //=======================================================================
1049 void SMESHGUI_MeshPatternDlg::onTypeChanged (int theType)
1051 if (myType == theType)
1057 myGeomObj[ Object ] = GEOM::GEOM_Object::_nil();
1058 myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();
1059 myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();
1060 myPattern = SMESH::GetPattern();
1062 myName->setText("");
1063 mySelEdit[ Object ]->setText("");
1064 mySelEdit[ Vertex1 ]->setText("");
1065 mySelEdit[ Vertex2 ]->setText("");
1066 mySelEdit[ Ids ] ->setText("");
1067 myCreatePolygonsChk->show();
1068 myCreatePolyedrsChk->show();
1070 if (theType == Type_2d) {
1072 mySelLbl [ Vertex2 ]->hide();
1073 mySelBtn [ Vertex2 ]->hide();
1074 mySelEdit[ Vertex2 ]->hide();
1075 myReverseChk->show();
1076 myPicture2d->show();
1077 myPicture3d->hide();
1078 mySelLbl[ Object ]->setText(tr("FACE"));
1079 mySelLbl[ Vertex1 ]->setText(tr("VERTEX"));
1081 mySelLbl[ Ids ]->setText(tr("MESH_FACES"));
1086 mySelLbl [ Vertex2 ]->show();
1087 mySelBtn [ Vertex2 ]->show();
1088 mySelEdit[ Vertex2 ]->show();
1089 myReverseChk->hide();
1090 myPicture2d->hide();
1091 myPicture3d->show();
1092 mySelLbl[ Object ]->setText(tr("3D_BLOCK"));
1093 mySelLbl[ Vertex1 ]->setText(tr("VERTEX1"));
1094 mySelLbl[ Vertex2 ]->setText(tr("VERTEX2"));
1096 mySelLbl[ Ids ]->setText(tr("MESH_VOLUMES"));
1102 activateSelection();
1107 //=======================================================================
1108 // name : SMESHGUI_MeshPatternDlg::getGrid
1109 // Purpose : Get unstructured grid for pattern
1110 //=======================================================================
1111 vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()
1114 // Get points from pattern
1115 SMESH::point_array_var pnts;
1116 QValueList<int> ids;
1117 if (isRefine() && getIds(ids)) {
1118 SMESH::long_array_var varIds = new SMESH::long_array();
1119 varIds->length(ids.count());
1121 for (QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it)
1123 pnts = myType == Type_2d
1124 ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked())
1125 : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
1127 pnts = myType == Type_2d
1128 ? myPattern->ApplyToFace (myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked())
1129 : myPattern->ApplyTo3DBlock(myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ]);
1132 SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(true);
1134 if (pnts->length() == 0 || elemPoints->length() == 0)
1137 // to do : to be removed /////////////////////////////////////////////
1140 for (int i1 = 0, n1 = pnts->length(); i1 < n1; i1++)
1141 printf("%d: %g %g %g\n", i1, pnts[ i1 ].x, pnts[ i1 ].y, pnts[ i1 ].z);
1143 printf("\nELEMENTS : \n");
1144 for (int i2 = 0, n2 = elemPoints->length(); i2 < n2; i2++)
1148 for (int i3 = 0, n3 = elemPoints[ i2 ].length(); i3 < n3; i3++)
1149 printf("%d ", elemPoints[ i2 ][ i3 ]);
1155 //////////////////////////////////////////////////////////////////////
1157 // Calculate number of points used for cell
1158 vtkIdType aNbCells = elemPoints->length();
1159 vtkIdType aCellsSize = 0;
1160 for (int i = 0, n = elemPoints->length(); i < n; i++)
1161 aCellsSize += elemPoints[ i ].length();
1163 // Create unstructured grid and other usefull arrays
1164 vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
1166 vtkCellArray* aConnectivity = vtkCellArray::New();
1167 aConnectivity->Allocate(aCellsSize, 0);
1169 vtkPoints* aPoints = vtkPoints::New();
1170 aPoints->SetNumberOfPoints(pnts->length());
1172 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
1173 aCellTypesArray->SetNumberOfComponents(1);
1174 aCellTypesArray->Allocate(aNbCells * aCellTypesArray->GetNumberOfComponents());
1176 vtkIdList *anIdList = vtkIdList::New();
1178 // Fill array of points
1179 for (int p = 0, nbPnt = pnts->length(); p < nbPnt; p++)
1180 aPoints->SetPoint(p, pnts[ p ].x, pnts[ p ].y, pnts[ p ].z);
1182 for (int e = 0, nbElem = elemPoints->length(); e < nbElem; e++) {
1183 int nbPoints = elemPoints[ e ].length();
1184 anIdList->SetNumberOfIds(nbPoints);
1185 for (int i = 0; i < nbPoints; i++)
1186 anIdList->SetId(i, elemPoints[ e ][ i ]);
1188 aConnectivity->InsertNextCell(anIdList);
1190 if (nbPoints == 3) aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
1191 else if (nbPoints == 5) aCellTypesArray->InsertNextValue(VTK_PYRAMID);
1192 else if (nbPoints == 6) aCellTypesArray->InsertNextValue(VTK_WEDGE);
1193 else if (nbPoints == 8) aCellTypesArray->InsertNextValue(VTK_HEXAHEDRON);
1194 else if (nbPoints == 4 && myType == Type_2d) aCellTypesArray->InsertNextValue(VTK_QUAD);
1195 else if (nbPoints == 4 && myType == Type_3d) aCellTypesArray->InsertNextValue(VTK_TETRA);
1196 else aCellTypesArray->InsertNextValue(VTK_EMPTY_CELL);
1199 vtkIntArray* aCellLocationsArray = vtkIntArray::New();
1200 aCellLocationsArray->SetNumberOfComponents(1);
1201 aCellLocationsArray->SetNumberOfTuples(aNbCells);
1203 aConnectivity->InitTraversal();
1204 for (vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell(npts, pts); idType++)
1205 aCellLocationsArray->SetValue(idType, aConnectivity->GetTraversalLocation(npts));
1207 aGrid->SetPoints(aPoints);
1208 aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aConnectivity);
1210 aConnectivity->Delete();
1212 aCellTypesArray->Delete();
1214 aCellLocationsArray->Delete();
1222 //=======================================================================
1223 // name : onModeToggled
1225 //=======================================================================
1226 void SMESHGUI_MeshPatternDlg::onModeToggled (bool on)
1228 on ? myRefineGrp->show() : myRefineGrp->hide();
1229 on ? myGeomGrp->hide() : myGeomGrp->show();
1234 //=======================================================================
1237 //=======================================================================
1238 bool SMESHGUI_MeshPatternDlg::isRefine() const
1240 return myRefine->isChecked();
1243 //=======================================================================
1244 // name : onTextChanged
1246 //=======================================================================
1247 void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText)
1249 if (myBusy || !isRefine())
1254 if (mySelInput != Ids) {
1256 activateSelection();
1259 // hilight entered elements/nodes
1260 SMDS_Mesh* aMesh = 0;
1261 SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
1263 aMesh = anActor->GetObject()->GetMesh();
1266 QStringList aListId = QStringList::split(" ", theNewText, false);
1268 TColStd_MapOfInteger newIndices;
1270 for (int i = 0; i < aListId.count(); i++) {
1271 const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
1272 if (e && e->GetType() == (myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume))
1273 newIndices.Add(e->GetID());
1275 mySelector->AddOrRemoveIndex( anActor->getIO(), newIndices, false);
1276 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1277 aViewWindow->highlight( anActor->getIO(), true, true );
1283 //=======================================================================
1284 // name : onNodeChanged
1286 //=======================================================================
1287 void SMESHGUI_MeshPatternDlg::onNodeChanged (int value)
1289 if (myType == Type_3d) {
1290 QSpinBox* first = (QSpinBox*)sender();
1291 QSpinBox* second = first == myNode1 ? myNode2 : myNode1;
1292 int secondVal = second->value();
1293 if (secondVal == value) {
1294 secondVal = value == second->maxValue() ? second->minValue() : value + 1;
1295 bool blocked = second->signalsBlocked();
1296 second->blockSignals(true);
1297 second->setValue(secondVal);
1298 second->blockSignals(blocked);
1305 //=======================================================================
1308 //=======================================================================
1309 bool SMESHGUI_MeshPatternDlg::getIds (QValueList<int>& ids) const
1312 QStringList strIds = QStringList::split(" ", mySelEdit[Ids]->text());
1315 for (QStringList::iterator it = strIds.begin(); it != strIds.end(); ++it) {
1316 val = (*it).toInt(&isOk);
1324 //=======================================================================
1327 //=======================================================================
1328 int SMESHGUI_MeshPatternDlg::getNode (bool second) const
1330 return second ? myNode2->value() - 1 : myNode1->value() - 1;