1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_SewingDlg.cxx
25 // Author : Michael ZORIN, Open CASCADE S.A.S.
28 #include "SMESHGUI_SewingDlg.h"
31 #include "SMESHGUI_IdPreview.h"
32 #include "SMESHGUI_IdValidator.h"
33 #include "SMESHGUI_MergeDlg.h"
34 #include "SMESHGUI_MeshUtils.h"
35 #include "SMESHGUI_PreVisualObj.h"
36 #include "SMESHGUI_SpinBox.h"
37 #include "SMESHGUI_Utils.h"
38 #include "SMESHGUI_VTKUtils.h"
40 #include <SMDS_Mesh.hxx>
41 #include <SMESH_Actor.h>
42 #include <SMESH_TypeDefs.hxx>
44 // SALOME GUI includes
45 #include <LightApp_Application.h>
46 #include <LightApp_SelectionMgr.h>
47 #include <SALOME_ListIO.hxx>
48 #include <SUIT_Desktop.h>
49 #include <SUIT_MessageBox.h>
50 #include <SUIT_OverrideCursor.h>
51 #include <SUIT_ResourceMgr.h>
52 #include <SUIT_Session.h>
53 #include <SVTK_ViewModel.h>
54 #include <SVTK_ViewWindow.h>
55 #include <SalomeApp_IntSpinBox.h>
58 #include <TColStd_MapOfInteger.hxx>
61 #include <QApplication>
62 #include <QButtonGroup>
64 #include <QGridLayout>
66 #include <QHBoxLayout>
70 #include <QListWidget>
71 #include <QPushButton>
72 #include <QRadioButton>
73 #include <QToolButton>
74 #include <QVBoxLayout>
81 enum ActionType { MODE_AUTO=0, MODE_MANUAL,
82 MOVE_LEFT_1=0, MOVE_RIGHT_1, MOVE_LEFT_2, MOVE_RIGHT_2,
83 GROUP_COLOR=Qt::UserRole, GROUP_INDEX };
86 //=================================================================================
88 * \brief Dispalayer of free borders
90 //=================================================================================
92 struct SMESHGUI_SewingDlg::BorderGroupDisplayer
94 const SMESH::ListOfFreeBorders& myBorders;
95 const SMESH::FreeBordersGroup& myGroup;
97 SMESH::SMESH_Mesh_ptr myMesh;
99 std::vector< SMESH_Actor* > myPartActors;
100 SVTK_ViewWindow* myViewWindow;
101 SMESHGUI_IdPreview myIdPreview;
103 BorderGroupDisplayer( const SMESH::CoincidentFreeBorders& borders,
106 SMESH::SMESH_Mesh_ptr mesh);
107 ~BorderGroupDisplayer();
109 void ShowGroup( bool wholeBorders );
110 void ShowPart( int partIndex, bool toEdit );
114 void getPartEnds( int partIndex, std::vector<int> & ids, std::list<gp_XYZ>& coords);
117 //=================================================================================
118 // class : SMESHGUI_SewingDlg()
120 //=================================================================================
121 SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule )
122 : QDialog( SMESH::GetDesktop( theModule ) ),
123 mySMESHGUI( theModule ),
124 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
126 SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
127 QPixmap image0 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS")));
128 QPixmap image1 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
129 QPixmap image2 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
130 QPixmap image3 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
131 QPixmap image4 (mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
132 QPixmap IconRemove(mgr->loadPixmap("SMESH", tr("ICON_REMOVE")));
135 setAttribute(Qt::WA_DeleteOnClose, true);
136 setWindowTitle(tr("SMESH_SEWING"));
137 setSizeGripEnabled(true);
139 QVBoxLayout* SMESHGUI_SewingDlgLayout = new QVBoxLayout(this);
140 SMESHGUI_SewingDlgLayout->setSpacing(SPACING);
141 SMESHGUI_SewingDlgLayout->setMargin(MARGIN);
143 /***************************************************************/
144 ConstructorsBox = new QGroupBox(tr("SMESH_SEWING"), this);
145 GroupConstructors = new QButtonGroup(this);
146 QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
147 ConstructorsBoxLayout->setSpacing(SPACING);
148 ConstructorsBoxLayout->setMargin(MARGIN);
150 RadioButton1 = new QRadioButton(ConstructorsBox);
151 RadioButton1->setIcon(image0);
152 RadioButton2 = new QRadioButton(ConstructorsBox);
153 RadioButton2->setIcon(image1);
154 RadioButton3 = new QRadioButton(ConstructorsBox);
155 RadioButton3->setIcon(image2);
156 RadioButton4 = new QRadioButton(ConstructorsBox);
157 RadioButton4->setIcon(image3);
159 ConstructorsBoxLayout->addWidget(RadioButton1);
160 ConstructorsBoxLayout->addWidget(RadioButton2);
161 ConstructorsBoxLayout->addWidget(RadioButton3);
162 ConstructorsBoxLayout->addWidget(RadioButton4);
163 GroupConstructors->addButton(RadioButton1, 0);
164 GroupConstructors->addButton(RadioButton2, 1);
165 GroupConstructors->addButton(RadioButton3, 2);
166 GroupConstructors->addButton(RadioButton4, 3);
168 /***************************************************************/
169 GroupArguments = new QGroupBox(this);
170 QVBoxLayout* GroupArgumentsLayout = new QVBoxLayout(GroupArguments);
171 GroupArgumentsLayout->setSpacing(SPACING);
172 GroupArgumentsLayout->setMargin(MARGIN);
175 SubGroup1 = new QGroupBox(GroupArguments);
176 QGridLayout* SubGroup1Layout = new QGridLayout(SubGroup1);
177 SubGroup1Layout->setSpacing(SPACING);
178 SubGroup1Layout->setMargin(MARGIN);
180 // Controls of the first subgroup
181 TextLabel1 = new QLabel(SubGroup1);
182 SelectButton1 = new QPushButton(SubGroup1);
183 SelectButton1->setIcon(image4);
184 LineEdit1 = new QLineEdit(SubGroup1);
186 TextLabel2 = new QLabel(SubGroup1);
187 SelectButton2 = new QPushButton(SubGroup1);
188 SelectButton2->setIcon(image4);
189 LineEdit2 = new QLineEdit(SubGroup1);
191 TextLabel3 = new QLabel(SubGroup1);
192 SelectButton3 = new QPushButton(SubGroup1);
193 SelectButton3->setIcon(image4);
194 LineEdit3 = new QLineEdit(SubGroup1);
196 SubGroup1Layout->addWidget(TextLabel1, 0, 0);
197 SubGroup1Layout->addWidget(SelectButton1, 0, 1);
198 SubGroup1Layout->addWidget(LineEdit1, 0, 2);
199 SubGroup1Layout->addWidget(TextLabel2, 1, 0);
200 SubGroup1Layout->addWidget(SelectButton2, 1, 1);
201 SubGroup1Layout->addWidget(LineEdit2, 1, 2);
202 SubGroup1Layout->addWidget(TextLabel3, 2, 0);
203 SubGroup1Layout->addWidget(SelectButton3, 2, 1);
204 SubGroup1Layout->addWidget(LineEdit3, 2, 2);
207 SubGroup2 = new QGroupBox(GroupArguments);
208 QGridLayout* SubGroup2Layout = new QGridLayout(SubGroup2);
209 SubGroup2Layout->setSpacing(SPACING);
210 SubGroup2Layout->setMargin(MARGIN);
212 // Controls of the first subgroup
213 TextLabel4 = new QLabel(SubGroup2);
214 SelectButton4 = new QPushButton(SubGroup2);
215 SelectButton4->setIcon(image4);
216 LineEdit4 = new QLineEdit(SubGroup2);
218 TextLabel5 = new QLabel(SubGroup2);
219 SelectButton5 = new QPushButton(SubGroup2);
220 SelectButton5->setIcon(image4);
221 LineEdit5 = new QLineEdit(SubGroup2);
223 TextLabel6 = new QLabel(SubGroup2);
224 SelectButton6 = new QPushButton(SubGroup2);
225 SelectButton6->setIcon(image4);
226 LineEdit6 = new QLineEdit(SubGroup2);
228 SubGroup2Layout->addWidget(TextLabel4, 0, 0);
229 SubGroup2Layout->addWidget(SelectButton4, 0, 1);
230 SubGroup2Layout->addWidget(LineEdit4, 0, 2);
231 SubGroup2Layout->addWidget(TextLabel5, 1, 0);
232 SubGroup2Layout->addWidget(SelectButton5, 1, 1);
233 SubGroup2Layout->addWidget(LineEdit5, 1, 2);
234 SubGroup2Layout->addWidget(TextLabel6, 2, 0);
235 SubGroup2Layout->addWidget(SelectButton6, 2, 1);
236 SubGroup2Layout->addWidget(LineEdit6, 2, 2);
238 // Control for the merging equal elements
239 CheckBoxMerge = new QCheckBox(tr("MERGE_EQUAL_ELEMENTS"), GroupArguments);
241 // Control for the polygons creation instead of splitting
242 CheckBoxPolygons = new QCheckBox(tr("CREATE_POLYGONS_INSTEAD_SPLITTING"), GroupArguments);
244 // Control for the polyedres creation to obtain conform mesh
245 CheckBoxPolyedrs = new QCheckBox(tr("CREATE_POLYEDRS_NEAR_BOUNDARY"), GroupArguments);
247 /***************************************************************/
248 // Controls to switch free borders mode ( auto || manual )
250 ModeGroup = new QGroupBox( tr( "SMESH_MODE" ), GroupArguments );
251 ModeButGrp = new QButtonGroup( ModeGroup );
252 QHBoxLayout* aModeGroupLayout = new QHBoxLayout( ModeGroup );
253 aModeGroupLayout->setMargin( MARGIN );
254 aModeGroupLayout->setSpacing( SPACING );
256 QRadioButton* rb1 = new QRadioButton( tr( "SMESH_AUTOMATIC" ), ModeGroup );
257 QRadioButton* rb2 = new QRadioButton( tr( "SMESH_MANUAL" ), ModeGroup );
258 ModeButGrp->addButton( rb1, MODE_AUTO );
259 ModeButGrp->addButton( rb2, MODE_MANUAL );
260 aModeGroupLayout->addWidget( rb1 );
261 aModeGroupLayout->addWidget( rb2 );
262 rb1->setChecked(true);
264 /***************************************************************/
265 // Controls for detecting coincident free borders
267 SewFreeBordersWidget = new QWidget( GroupArguments );
268 QVBoxLayout* aSewFreeBordersLayout = new QVBoxLayout( SewFreeBordersWidget );
269 aSewFreeBordersLayout->setMargin( 0 );
270 aSewFreeBordersLayout->setSpacing( SPACING );
273 QWidget* TolAndAuto = new QWidget(SewFreeBordersWidget);
274 QLabel* TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), TolAndAuto);
275 SpinBoxTolerance = new SMESHGUI_SpinBox(TolAndAuto);
276 SpinBoxTolerance->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
277 SpinBoxTolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, "len_tol_precision");
278 SpinBoxTolerance->SetValue(0.); // auto-tolerance
281 AutoSewCheck = new QCheckBox(tr("AUTO_SEWING"), TolAndAuto);
282 AutoSewCheck->setChecked( true );
285 QGroupBox* GroupMesh = new QGroupBox(tr("SMESH_SELECT_WHOLE_MESH"), SewFreeBordersWidget);
286 QHBoxLayout* GroupMeshLayout = new QHBoxLayout(GroupMesh);
287 GroupMeshLayout->setSpacing(SPACING);
288 GroupMeshLayout->setMargin(MARGIN);
290 QLabel* TextLabelName = new QLabel(tr("SMESH_NAME"), GroupMesh);
291 //SelectMeshButton = new QPushButton(GroupMesh);
292 //SelectMeshButton->setIcon(IconSelect);
293 LineEditMesh = new QLineEdit(GroupMesh);
294 LineEditMesh->setReadOnly(true);
296 GroupMeshLayout->addWidget(TextLabelName);
297 //GroupMeshLayout->addWidget(SelectMeshButton);
298 GroupMeshLayout->addWidget(LineEditMesh);
300 QGridLayout* TolAndAutoLayout = new QGridLayout( TolAndAuto );
301 TolAndAutoLayout->setSpacing(SPACING);
302 TolAndAutoLayout->setMargin(0);
303 TolAndAutoLayout->addWidget(GroupMesh, 0, 0, 1, 2 );
304 TolAndAutoLayout->addWidget(TextLabelTolerance, 1, 0 );
305 TolAndAutoLayout->addWidget(SpinBoxTolerance, 1, 1 );
306 TolAndAutoLayout->addWidget(AutoSewCheck, 2, 0 );
308 aSewFreeBordersLayout->addWidget( TolAndAuto );
312 GroupCoincidentWidget = new QWidget(SewFreeBordersWidget);
313 QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincidentWidget);
314 GroupCoincidentLayout->setSpacing(SPACING);
315 GroupCoincidentLayout->setMargin(0);
317 QGroupBox* GroupCoincident = new QGroupBox(tr("COINCIDENT_FREE_BORDERS"), GroupCoincidentWidget);
318 QGridLayout* aCoincidentLayout = new QGridLayout(GroupCoincident);
319 aCoincidentLayout->setSpacing(SPACING);
320 aCoincidentLayout->setMargin(MARGIN);
324 ListCoincident = new QListWidget(GroupCoincident);
325 ListCoincident->setSelectionMode(QListWidget::ExtendedSelection);
327 DetectButton = new QPushButton(tr("DETECT"), GroupCoincident);
328 RemoveGroupButton = new QPushButton(tr("SMESH_BUT_REMOVE"), GroupCoincident);
330 SelectAllCheck = new QCheckBox(tr("SELECT_ALL"), GroupCoincident);
332 aCoincidentLayout->addWidget(ListCoincident, 0, 0, 4, 2);
333 aCoincidentLayout->addWidget(DetectButton, 1, 2);
334 aCoincidentLayout->addWidget(RemoveGroupButton, 3, 2);
335 aCoincidentLayout->addWidget(SelectAllCheck, 4, 0);
336 aCoincidentLayout->setRowMinimumHeight(1, 10);
337 aCoincidentLayout->setRowStretch (1, 5);
339 GroupCoincidentLayout->addWidget( GroupCoincident );
341 /*****************************************/
342 // Controls for editing the selected group
344 QGroupBox* GroupEdit = new QGroupBox(tr("EDIT_SELECTED_GROUP"), GroupCoincidentWidget);
345 QGridLayout* GroupEditLayout = new QGridLayout(GroupEdit);
346 GroupEditLayout->setSpacing(SPACING);
347 GroupEditLayout->setMargin(MARGIN);
349 ListEdit = new QListWidget(GroupEdit);
350 ListEdit->setFlow( QListView::LeftToRight );
351 ListEdit->setSelectionMode(QListWidget::ExtendedSelection);
352 SetFirstButton = new QPushButton(GroupEdit);
353 SetFirstButton->setIcon(QPixmap(SMESHGUI_MergeDlg::IconFirst()));
354 RemoveElemButton = new QPushButton(GroupEdit);
355 RemoveElemButton->setIcon(IconRemove);
357 MoveBorderEndsButGrp = new QButtonGroup( GroupEdit );
358 QToolButton* moveBut1 = new QToolButton( GroupEdit );
359 QToolButton* moveBut2 = new QToolButton( GroupEdit );
360 QToolButton* moveBut3 = new QToolButton( GroupEdit );
361 QToolButton* moveBut4 = new QToolButton( GroupEdit );
362 moveBut1->setArrowType( Qt::LeftArrow );
363 moveBut2->setArrowType( Qt::RightArrow );
364 moveBut3->setArrowType( Qt::LeftArrow );
365 moveBut4->setArrowType( Qt::RightArrow );
366 MoveBorderEndsButGrp->addButton( moveBut1, MOVE_LEFT_1 );
367 MoveBorderEndsButGrp->addButton( moveBut2, MOVE_RIGHT_1 );
368 MoveBorderEndsButGrp->addButton( moveBut3, MOVE_LEFT_2 );
369 MoveBorderEndsButGrp->addButton( moveBut4, MOVE_RIGHT_2 );
371 SwapBut = new QPushButton( "<->", GroupEdit );
372 BorderEndLine[0] = new QLineEdit( GroupEdit );
373 BorderEndLine[1] = new QLineEdit( GroupEdit );
374 BorderEndLine[0]->setReadOnly(true);
375 BorderEndLine[1]->setReadOnly(true);
376 QLabel* StepLabel = new QLabel(tr("STEP"), GroupEdit );
377 StepSpin = new SalomeApp_IntSpinBox( 1, 100000, 1, GroupEdit,
378 /*acceptNames=*/false, /*showTip=*/false );
379 StepSpin->setValue( 1 );
381 GroupEditLayout->addWidget(ListEdit, 0, 0, 1, 8);
382 GroupEditLayout->addWidget(SetFirstButton, 0, 8);
383 GroupEditLayout->addWidget(RemoveElemButton, 0, 9);
384 GroupEditLayout->addWidget(moveBut1, 1, 0);
385 GroupEditLayout->addWidget(BorderEndLine[0], 1, 1);
386 GroupEditLayout->addWidget(moveBut2, 1, 2);
387 GroupEditLayout->addWidget(moveBut3, 1, 3);
388 GroupEditLayout->addWidget(BorderEndLine[1], 1, 4);
389 GroupEditLayout->addWidget(moveBut4, 1, 5);
390 GroupEditLayout->setColumnStretch( 6, 5 );
391 GroupEditLayout->addWidget(SwapBut, 1, 7);
392 GroupEditLayout->addWidget(StepLabel, 1, 8);
393 GroupEditLayout->addWidget(StepSpin, 1, 9);
395 GroupCoincidentLayout->addWidget( GroupEdit );
396 aSewFreeBordersLayout->addWidget( GroupCoincidentWidget );
399 GroupArgumentsLayout->addWidget(ModeGroup);
400 GroupArgumentsLayout->addWidget(SubGroup1);
401 GroupArgumentsLayout->addWidget(SubGroup2);
402 GroupArgumentsLayout->addWidget(SewFreeBordersWidget);
403 GroupArgumentsLayout->addWidget(CheckBoxMerge);
404 GroupArgumentsLayout->addWidget(CheckBoxPolygons);
405 GroupArgumentsLayout->addWidget(CheckBoxPolyedrs);
407 /***************************************************************/
408 GroupButtons = new QGroupBox(this);
409 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
410 GroupButtonsLayout->setSpacing(SPACING);
411 GroupButtonsLayout->setMargin(MARGIN);
413 buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
414 buttonOk->setAutoDefault(true);
415 buttonOk->setDefault(true);
416 buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
417 buttonApply->setAutoDefault(true);
418 buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
419 buttonCancel->setAutoDefault(true);
420 buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
421 buttonHelp->setAutoDefault(true);
423 GroupButtonsLayout->addWidget(buttonOk);
424 GroupButtonsLayout->addSpacing(10);
425 GroupButtonsLayout->addWidget(buttonApply);
426 GroupButtonsLayout->addSpacing(10);
427 GroupButtonsLayout->addStretch();
428 GroupButtonsLayout->addWidget(buttonCancel);
429 GroupButtonsLayout->addWidget(buttonHelp);
431 /***************************************************************/
432 SMESHGUI_SewingDlgLayout->addWidget(ConstructorsBox);
433 SMESHGUI_SewingDlgLayout->addWidget(GroupArguments);
434 SMESHGUI_SewingDlgLayout->addWidget(GroupButtons);
435 //SMESHGUI_SewingDlgLayout->setStretch( 2, 10 );
437 /* Initialisations */
438 RadioButton1->setChecked(true);
440 LineEdit2->setValidator(new SMESHGUI_IdValidator(this, 1));
441 LineEdit3->setValidator(new SMESHGUI_IdValidator(this, 1));
442 LineEdit5->setValidator(new SMESHGUI_IdValidator(this, 1));
443 LineEdit6->setValidator(new SMESHGUI_IdValidator(this, 1));
445 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
447 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
449 myHelpFileName = "sewing_meshes_page.html";
456 /* signals and slots connections */
457 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
458 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
459 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
460 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
461 connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
463 connect(SelectButton1, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
464 connect(SelectButton2, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
465 connect(SelectButton3, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
466 connect(SelectButton4, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
467 connect(SelectButton5, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
468 connect(SelectButton6, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
470 connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
471 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
472 /* to close dialog if study change */
473 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
474 connect(mySMESHGUI, SIGNAL(SignalActivatedViewManager()), this, SLOT(onOpenView()));
475 connect(mySMESHGUI, SIGNAL(SignalCloseView()), this, SLOT(onCloseView()));
477 connect(LineEdit1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
478 connect(LineEdit2, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
479 connect(LineEdit3, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
480 connect(LineEdit4, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
481 connect(LineEdit5, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
482 connect(LineEdit6, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
484 connect(ModeButGrp, SIGNAL(buttonClicked(int)), SLOT(onModeChange(int)));
485 connect(AutoSewCheck, SIGNAL(stateChanged(int)), SLOT(onAutoSew(int)));
486 connect(DetectButton, SIGNAL(clicked()), SLOT(onDetectClicked()));
487 connect(RemoveGroupButton, SIGNAL(clicked()), SLOT(onRemoveGroupClicked()));
488 connect(ListCoincident, SIGNAL(itemSelectionChanged()), SLOT(onSelectGroup()));
489 connect(SelectAllCheck, SIGNAL(stateChanged(int)), SLOT(onSelectAll(int)));
490 connect(ListEdit, SIGNAL(itemSelectionChanged()), SLOT(onSelectBorderPartFromGroup()));
491 connect(SetFirstButton, SIGNAL(clicked()), SLOT(onSetFirstClicked()));
492 connect(RemoveElemButton, SIGNAL(clicked()), SLOT(onRemoveElemClicked()));
493 connect(MoveBorderEndsButGrp, SIGNAL(buttonClicked(int)), SLOT(onMoveBorderEnd(int)));
494 connect(SwapBut, SIGNAL(clicked()), SLOT(onSwapClicked()));
496 ConstructorsClicked(0);
499 //=================================================================================
500 // function : ~SMESHGUI_SewingDlg()
501 // purpose : Destroys the object and frees any allocated resources
502 //=================================================================================
503 SMESHGUI_SewingDlg::~SMESHGUI_SewingDlg()
505 for ( size_t i = 0; i < myBorderDisplayers.size(); ++i )
507 delete myBorderDisplayers[ i ];
508 myBorderDisplayers[ i ] = 0;
510 myBorderDisplayers.clear();
513 //=================================================================================
516 //=================================================================================
517 void SMESHGUI_SewingDlg::Init()
521 if ( LineEdit1->isVisible() )
522 myEditCurrentArgument = LineEdit1;
524 myEditCurrentArgument = LineEditMesh;
525 myEditCurrentArgument->setFocus();
527 myMesh = SMESH::SMESH_Mesh::_nil();
528 // CheckBoxMerge->setChecked(false);
529 // CheckBoxPolygons->setChecked(false);
530 // CheckBoxPolyedrs->setChecked(false);
531 SelectionIntoArgument();
534 //=================================================================================
535 // function : ConstructorsClicked()
536 // purpose : Radio button management
537 //=================================================================================
538 void SMESHGUI_SewingDlg::ConstructorsClicked (int constructorId)
540 disconnect(mySelectionMgr, 0, this, 0);
542 mySelectionMgr->selectedObjects( io );
543 mySelectionMgr->clearSelected();
544 LineEdit1->setText("");
545 LineEdit2->setText("");
546 LineEdit3->setText("");
547 LineEdit4->setText("");
548 LineEdit5->setText("");
549 LineEdit6->setText("");
550 myOk1 = myOk2 = myOk3 = myOk4 = myOk5 = myOk6 = false;
551 myEditCurrentArgument = LineEdit1;
552 myEditCurrentArgument->setFocus();
554 if (!TextLabel5->isEnabled()) {
555 TextLabel5->setEnabled(true);
556 SelectButton5->setEnabled(true);
557 LineEdit5->setEnabled(true);
558 } else if (!TextLabel6->isEnabled()) {
559 TextLabel6->setEnabled(true);
560 SelectButton6->setEnabled(true);
561 LineEdit6->setEnabled(true);
564 if (constructorId == 1 || constructorId == 3) {
565 if (CheckBoxPolygons->isVisible())
566 CheckBoxPolygons->hide();
567 if (CheckBoxPolyedrs->isVisible())
568 CheckBoxPolyedrs->hide();
571 if (( !SubGroup1->isVisible() ) &&
572 ( constructorId != 0 || ModeButGrp->checkedId() == MODE_MANUAL ))
578 if ( constructorId != 0 )
581 SewFreeBordersWidget->hide();
584 bool isNodeSelection = true;
586 switch (constructorId) {
589 GroupArguments->setTitle(tr("SEW_FREE_BORDERS"));
590 SubGroup1->setTitle(tr("BORDER_1"));
591 SubGroup2->setTitle(tr("BORDER_2"));
593 if (!CheckBoxPolygons->isVisible())
594 CheckBoxPolygons->show();
595 if (!CheckBoxPolyedrs->isVisible())
596 CheckBoxPolyedrs->show();
598 if ( !ModeGroup->isVisible() )
602 onModeChange( ModeButGrp->checkedId() );
604 isNodeSelection = ( ModeButGrp->checkedId() == MODE_MANUAL );
610 GroupArguments->setTitle(tr("SEW_CONFORM_FREE_BORDERS"));
611 SubGroup1->setTitle(tr("BORDER_1"));
612 SubGroup2->setTitle(tr("BORDER_2"));
614 TextLabel6->setEnabled(false);
615 SelectButton6->setEnabled(false);
616 LineEdit6->setEnabled(false);
624 GroupArguments->setTitle(tr("SEW_BORDER_TO_SIDE"));
625 SubGroup1->setTitle(tr("BORDER"));
626 SubGroup2->setTitle(tr("SIDE"));
628 TextLabel5->setEnabled(false);
629 SelectButton5->setEnabled(false);
630 LineEdit5->setEnabled(false);
632 if (!CheckBoxPolygons->isVisible())
633 CheckBoxPolygons->show();
634 if (!CheckBoxPolyedrs->isVisible())
635 CheckBoxPolyedrs->show();
643 GroupArguments->setTitle(tr("SEW_SIDE_ELEMENTS"));
644 SubGroup1->setTitle(tr("SIDE_1"));
645 SubGroup2->setTitle(tr("SIDE_2"));
647 TextLabel1->setText(tr("SMESH_ID_ELEMENTS"));
648 TextLabel2->setText(tr("NODE1_TO_MERGE"));
649 TextLabel3->setText(tr("NODE2_TO_MERGE"));
650 TextLabel4->setText(tr("SMESH_ID_ELEMENTS"));
651 TextLabel5->setText(tr("NODE1_TO_MERGE"));
652 TextLabel6->setText(tr("NODE2_TO_MERGE"));
654 LineEdit1->setValidator(new SMESHGUI_IdValidator(this));
655 LineEdit4->setValidator(new SMESHGUI_IdValidator(this));
657 isNodeSelection = false;
658 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
659 aViewWindow->SetSelectionMode(CellSelection);
664 if (constructorId != 3) {
665 TextLabel1->setText(tr("FIRST_NODE_ID"));
666 TextLabel2->setText(tr("SECOND_NODE_ID"));
667 TextLabel3->setText(tr("LAST_NODE_ID"));
668 TextLabel4->setText(tr("FIRST_NODE_ID"));
669 TextLabel5->setText(tr("SECOND_NODE_ID"));
670 TextLabel6->setText(tr("LAST_NODE_ID"));
672 LineEdit1->setValidator(new SMESHGUI_IdValidator(this, 1));
673 LineEdit4->setValidator(new SMESHGUI_IdValidator(this, 1));
676 if ( isNodeSelection )
678 SMESH::SetPointRepresentation(true);
679 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
680 aViewWindow->SetSelectionMode(NodeSelection);
685 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
686 mySelectionMgr->setSelectedObjects( io );
688 QApplication::instance()->processEvents();
694 //=======================================================================
695 //function : storeDisplayMode
696 //purpose : save representation of a mesh and switch it to wireframe mode
697 //=======================================================================
699 void SMESHGUI_SewingDlg::setDisplayMode()
701 myStoredEntityMode = 0;
702 myStoredRepresentation = -1;
705 myStoredEntityMode = myActor->GetEntityMode();
706 myStoredRepresentation = myActor->GetRepresentation();
708 myActor->SetEntityMode( myStoredEntityMode & ~SMESH_Actor::eVolumes );
709 myActor->SetRepresentation( SMESH_Actor::eEdge );
713 //=======================================================================
714 //function : restoreDisplayMode
715 //purpose : restore representation of a mesh
716 //=======================================================================
718 void SMESHGUI_SewingDlg::restoreDisplayMode()
720 if ( myActor && myStoredEntityMode )
722 if ( myActor->GetEntityMode() == ( myStoredEntityMode & ~SMESH_Actor::eVolumes ))
723 myActor->SetEntityMode( myStoredEntityMode );
725 if ( myActor->GetRepresentation() == SMESH_Actor::eEdge )
726 myActor->SetRepresentation( myStoredRepresentation );
728 myStoredEntityMode = 0;
729 myStoredRepresentation = -1;
733 //=======================================================================
734 //function : onModeChange
735 //purpose : SLOT called when mode (auto or manual) of Sew free borders change
736 //=======================================================================
738 void SMESHGUI_SewingDlg::onModeChange( int mode )
740 if ( mode == MODE_MANUAL )
742 myEditCurrentArgument = LineEdit1;
743 if ( !SubGroup1->isVisible() )
744 SubGroup1->show(), SubGroup2->show();
745 SewFreeBordersWidget->hide();
749 myEditCurrentArgument = LineEditMesh;
750 SubGroup1->hide(), SubGroup2->hide();
751 if ( !SewFreeBordersWidget->isVisible() )
752 SewFreeBordersWidget->show();
754 onAutoSew( AutoSewCheck->isChecked() );
756 QApplication::instance()->processEvents();
762 //=======================================================================
763 //function : onAutoSew
764 //purpose : SLOT called when Auto Sewing check box is checked
765 //=======================================================================
767 void SMESHGUI_SewingDlg::onAutoSew( int isAuto )
769 GroupCoincidentWidget->setVisible( !isAuto );
771 QApplication::instance()->processEvents();
773 SewFreeBordersWidget->hide();
774 if ( ModeButGrp->checkedId() == MODE_AUTO )
775 SewFreeBordersWidget->show();
780 resize(minimumSizeHint());
783 //=======================================================================
784 //function : haveBorders
785 //purpose : Returns true if myBorders have been initialized
786 //=======================================================================
788 bool SMESHGUI_SewingDlg::haveBorders()
790 return ( & myBorders.in() &&
791 myBorders->borders.length() &&
792 myBorders->coincidentGroups.length() );
795 //=======================================================================
796 //function : getGroupText
797 //purpose : Returns a text of a given group of coincident free borders
798 //=======================================================================
800 QString SMESHGUI_SewingDlg::getPartText(const SMESH::FreeBorderPart& aPART)
803 if ( 0 <= aPART.border && aPART.border < myBorders->borders.length() )
805 const SMESH::FreeBorder& aBRD = myBorders->borders[ aPART.border ];
806 if ( 0 <= aPART.node1 && aPART.node1 < aBRD.nodeIDs.length() &&
807 0 <= aPART.nodeLast && aPART.nodeLast < aBRD.nodeIDs.length() )
809 text += QString("( %1 %2 ) ")
810 .arg( aBRD.nodeIDs[ aPART.node1 ] )
811 .arg( aBRD.nodeIDs[ aPART.nodeLast ] );
817 //=======================================================================
818 //function : getGroupText
819 //purpose : Returns a text of a given group of coincident free borders
820 //=======================================================================
822 QString SMESHGUI_SewingDlg::getGroupText(int groupIndex)
826 if ( haveBorders() &&
828 groupIndex < myBorders->coincidentGroups.length() )
830 const SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ groupIndex ];
832 for ( CORBA::ULong iP = 0; iP < aGRP.length(); ++iP )
834 QString partText = getPartText( aGRP[ iP ]);
835 if ( partText.isEmpty() )
843 //=======================================================================
844 //function : onDetectClicked
845 //purpose : SLOT called when [Detect] is clicked
846 //=======================================================================
848 void SMESHGUI_SewingDlg::onDetectClicked()
850 ListCoincident->clear();
852 if ( myMesh->_is_nil() )
855 SUIT_OverrideCursor wc;
857 SMESH::SMESH_MeshEditor_var editor = myMesh->GetMeshEditor();
858 myBorders = editor->FindCoincidentFreeBorders( SpinBoxTolerance->GetValue() );
859 if ( !haveBorders() )
862 for ( size_t i = 0; i < myBorderDisplayers.size(); ++i )
864 delete myBorderDisplayers[ i ];
865 myBorderDisplayers[ i ] = 0;
867 myBorderDisplayers.resize( myBorders->coincidentGroups.length(), 0 );
869 for ( CORBA::ULong i = 0; i < myBorders->coincidentGroups.length(); ++i )
871 QString groupText = getGroupText( i );
872 if ( groupText.isEmpty() )
876 groupColor.setHsvF( float(i) / myBorders->coincidentGroups.length(), 1., 1. );
877 QPixmap icon( QSize( 20, 20 ));
878 icon.fill( groupColor );
880 QListWidgetItem * item = new QListWidgetItem( icon, groupText, ListCoincident );
881 item->setData( GROUP_COLOR, groupColor );
882 item->setData( GROUP_INDEX, i );
890 //=======================================================================
891 //function : onRemoveGroupClicked
893 //=======================================================================
895 void SMESHGUI_SewingDlg::onRemoveGroupClicked()
897 QList<QListWidgetItem*> selItems = ListCoincident->selectedItems();
898 for ( int i = 0; i < selItems.count(); ++i )
900 QListWidgetItem* item = selItems[ i ];
901 item->setSelected( false );
902 int groupIndex = item->data( GROUP_INDEX ).toInt();
904 myBorderDisplayers[ groupIndex ]->Hide();
905 SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
911 //=======================================================================
912 //function : showGroup
913 //purpose : display a group of coincident free borders in the Viewer
914 //=======================================================================
916 void SMESHGUI_SewingDlg::showGroup( QListWidgetItem* item )
919 item->listWidget() != ListCoincident ||
923 int groupIndex = item->data( GROUP_INDEX ).toInt();
924 QColor groupColor = item->data( GROUP_COLOR ).value<QColor>();
925 if ( groupIndex >= 0 &&
926 groupIndex < myBorders->coincidentGroups.length() )
928 if ( !myBorderDisplayers[ groupIndex ])
929 myBorderDisplayers[ groupIndex ] = new BorderGroupDisplayer( myBorders, groupIndex, groupColor, myMesh );
930 bool wholeBorders = setCurrentGroup();
931 myBorderDisplayers[ groupIndex ]->ShowGroup( wholeBorders );
935 //=======================================================================
936 //function : setCurrentGroup
937 //purpose : set index of a current free border group to myCurGroupIndex
938 //=======================================================================
940 bool SMESHGUI_SewingDlg::setCurrentGroup()
942 if ( !haveBorders() )
945 QList<QListWidgetItem*> selItems = ListCoincident->selectedItems();
946 if ( selItems.count() != 1 )
949 myCurGroupIndex = selItems[0]->data( GROUP_INDEX ).toInt();
951 return ( myCurGroupIndex >= 0 && myCurGroupIndex < myBorders->coincidentGroups.length() );
954 //=======================================================================
955 //function : setCurrentPart
956 //purpose : set index of a current free border of a current group to myCurPartIndex
957 //=======================================================================
959 bool SMESHGUI_SewingDlg::setCurrentPart()
961 if ( !setCurrentGroup() )
964 if ( ListEdit->selectedItems().count() != 1 )
967 myCurPartIndex = ListEdit->currentRow();
968 const SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
970 return ( myCurPartIndex >= 0 && myCurPartIndex < aGRP.length() );
973 //=======================================================================
974 //function : onSelectGroup
975 //purpose : SLOT called when selection of coincident free borders change
976 //=======================================================================
978 void SMESHGUI_SewingDlg::onSelectGroup()
983 BorderEndLine[0]->clear();
984 BorderEndLine[1]->clear();
985 for ( size_t i = 0; i < myBorderDisplayers.size(); ++i )
986 if ( myBorderDisplayers[ i ])
987 myBorderDisplayers[ i ]->Hide();
989 QList<QListWidgetItem*> selItems = ListCoincident->selectedItems();
991 RemoveGroupButton->setEnabled( selItems.count() > 0 );
993 onSelectBorderPartFromGroup(); // enable buttons
995 if ( !haveBorders() )
998 SelectAllCheck->blockSignals( true );
999 if ( ListCoincident->count() != selItems.count() )
1000 SelectAllCheck->setChecked( false );
1001 SelectAllCheck->blockSignals( false );
1003 if ( selItems.empty() ) // nothing selected - show all
1004 for ( int i = 0; i < ListCoincident->count(); ++i )
1005 showGroup( ListCoincident->item( i ));
1007 for ( int i = 0; i < selItems.count(); ++i )
1008 showGroup( selItems[ i ]);
1010 if ( setCurrentGroup() ) // edit a selected group
1012 const SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
1013 for ( CORBA::ULong iP = 0; iP < aGRP.length(); ++iP )
1014 new QListWidgetItem( getPartText( aGRP[ iP ]), ListEdit );
1016 SMESH::RepaintCurrentView();
1019 //=======================================================================
1020 //function : onSelectAll
1021 //purpose : SLOT called when Select All is checked
1022 //=======================================================================
1024 void SMESHGUI_SewingDlg::onSelectAll(int isOn)
1027 ListCoincident->selectAll();
1029 ListCoincident->clearSelection();
1032 //=======================================================================
1033 //function : onSelectBorderPartFromGroup
1034 //purpose : SLOT called when selection of borders in an edited group changes
1035 //=======================================================================
1037 void SMESHGUI_SewingDlg::onSelectBorderPartFromGroup()
1039 if ( myBusy ) return;
1040 BorderEndLine[0]->setText("");
1041 BorderEndLine[1]->setText("");
1042 MoveBorderEndsButGrp->button( MOVE_LEFT_1 )->setEnabled( false );
1043 MoveBorderEndsButGrp->button( MOVE_RIGHT_1 )->setEnabled( false );
1044 MoveBorderEndsButGrp->button( MOVE_LEFT_2 )->setEnabled( false );
1045 MoveBorderEndsButGrp->button( MOVE_RIGHT_2 )->setEnabled( false );
1046 SwapBut->setEnabled( false );
1047 SetFirstButton->setEnabled( false );
1048 RemoveElemButton->setEnabled ( ListEdit->count() > 2 );
1050 if ( !setCurrentGroup() )
1053 if ( !myBorderDisplayers[ myCurGroupIndex ]) return;
1054 myBorderDisplayers[ myCurGroupIndex ]->Hide();
1056 QList<QListWidgetItem*> selItems = ListEdit->selectedItems();
1057 bool editPart = ( setCurrentPart() );
1058 for ( int i = 0; i < selItems.count(); ++i )
1059 myBorderDisplayers[ myCurGroupIndex ]->ShowPart( ListEdit->row( selItems[i] ), editPart );
1061 if ( selItems.isEmpty() )
1062 myBorderDisplayers[ myCurGroupIndex ]->ShowGroup( /*wholeBorders=*/ true );
1066 SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
1067 SMESH::FreeBorderPart& aPRT = aGRP[ myCurPartIndex ];
1068 SMESH::FreeBorder& aBRD = myBorders->borders[ aPRT.border ];
1070 BorderEndLine[0]->setText( QString::number( aBRD.nodeIDs[ aPRT.node1 ]));
1071 BorderEndLine[1]->setText( QString::number( aBRD.nodeIDs[ aPRT.nodeLast ]));
1072 SwapBut->setEnabled( true );
1073 SetFirstButton->setEnabled( myCurPartIndex > 0 );
1075 int size = (int) aBRD.nodeIDs.length();
1076 bool isClosed = ( aBRD.nodeIDs[0] == aBRD.nodeIDs[ size-1 ]);
1079 bool isFwd = ( Abs( aPRT.node2 - aPRT.node1 ) == 1 ) ? aPRT.node2 > aPRT.node1 : aPRT.node2 < aPRT.node1;
1080 int dn = ( isFwd ? +1 : -1 ) * StepSpin->value();
1081 MoveBorderEndsButGrp->button( MOVE_LEFT_1 )->
1082 setEnabled( 0 <= aPRT.node1-dn && aPRT.node1-dn < size );
1083 MoveBorderEndsButGrp->button( MOVE_RIGHT_1 )->
1084 setEnabled( 0 <= aPRT.node1+dn && aPRT.node1+dn < size );
1085 MoveBorderEndsButGrp->button( MOVE_LEFT_2 )->
1086 setEnabled( 0 <= aPRT.nodeLast-dn && aPRT.nodeLast-dn < size );
1087 MoveBorderEndsButGrp->button( MOVE_RIGHT_2 )->
1088 setEnabled( 0 <= aPRT.nodeLast+dn && aPRT.nodeLast+dn < size );
1092 MoveBorderEndsButGrp->button( MOVE_LEFT_1 )->setEnabled( true );
1093 MoveBorderEndsButGrp->button( MOVE_RIGHT_1 )->setEnabled( true );
1094 MoveBorderEndsButGrp->button( MOVE_LEFT_2 )->setEnabled( true );
1095 MoveBorderEndsButGrp->button( MOVE_RIGHT_2 )->setEnabled( true );
1098 SMESH::RepaintCurrentView();
1101 //=======================================================================
1102 //function : onGroupChange
1103 //purpose : Update after modification of a current group by the user
1104 //=======================================================================
1106 void SMESHGUI_SewingDlg::onGroupChange( bool partChange )
1108 ListCoincident->currentItem()->setText( getGroupText( myCurGroupIndex ));
1110 const SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
1111 for ( int i = 0; i < ListEdit->count(); ++i )
1112 ListEdit->item( i )->setText( getPartText( aGRP[ i ]));
1114 myBorderDisplayers[ myCurGroupIndex ]->Update();
1117 onSelectBorderPartFromGroup();
1120 //=======================================================================
1121 //function : onSetFirstClicked
1122 //purpose : STOL called when |<< is clicked
1123 //=======================================================================
1125 void SMESHGUI_SewingDlg::onSetFirstClicked()
1127 if ( !setCurrentPart() || myCurPartIndex == 0 || ListEdit->count() == 0 )
1130 SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
1132 SMESH::FreeBorderPart new1st = aGRP[ myCurPartIndex ];
1133 for ( ; myCurPartIndex > 0; --myCurPartIndex )
1134 aGRP[ myCurPartIndex ] = aGRP[ myCurPartIndex - 1 ];
1141 ListEdit->clearSelection();
1143 ListEdit->setCurrentItem( ListEdit->item(0) );//ListEdit->item(0)->setSelected(true);
1146 //=======================================================================
1147 //function : onRemoveElemClicked
1149 //=======================================================================
1151 void SMESHGUI_SewingDlg::onRemoveElemClicked()
1153 if ( !setCurrentGroup() )
1156 SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
1158 QList<QListWidgetItem*> selItems = ListEdit->selectedItems();
1159 for ( int i = 0; i < selItems.count(); ++i )
1161 int part = ListEdit->row( selItems[i] );
1162 for ( ; part + 1 < aGRP.length(); ++part )
1163 aGRP[ part ] = aGRP[ part + 1 ];
1164 aGRP.length( aGRP.length() - 1 );
1168 if ( aGRP.length() == 0 )
1169 onRemoveGroupClicked();
1171 onGroupChange( /*partChange=*/true );
1174 //=======================================================================
1175 //function : onMoveBorderEnd
1177 //=======================================================================
1179 void SMESHGUI_SewingDlg::onMoveBorderEnd(int button)
1181 if ( !setCurrentPart() )
1184 SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
1185 SMESH::FreeBorderPart& aPRT = aGRP[ myCurPartIndex ];
1186 SMESH::FreeBorder& aBRD = myBorders->borders[ aPRT.border ];
1187 int size = (int) aBRD.nodeIDs.length();
1189 bool isClosed = ( aBRD.nodeIDs[0] == aBRD.nodeIDs[ size-1 ]);
1190 if ( isClosed ) --size;
1192 bool isFwd = ( Abs( aPRT.node2 - aPRT.node1 ) == 1 ) ? aPRT.node2 > aPRT.node1 : aPRT.node2 < aPRT.node1;
1193 int dn = ( isFwd ? +1 : -1 ) * StepSpin->value();
1194 if ( button == MOVE_LEFT_1 || button == MOVE_LEFT_2 )
1201 ( 0 <= aPRT.node1+dn && aPRT.node1+dn < size ))
1203 aPRT.node1 = ( aPRT.node1 + size + dn ) % size;
1204 aPRT.node2 = ( aPRT.node2 + size + dn ) % size;
1210 ( 0 <= aPRT.nodeLast+dn && aPRT.nodeLast+dn < size ))
1212 aPRT.nodeLast = ( aPRT.nodeLast + size + dn ) % size;
1216 return; // impossible to move
1219 onGroupChange( /*partChange=*/true );
1222 //=======================================================================
1223 //function : onSwapClicked
1224 //purpose : SLOT called when <-> is clicked
1225 //=======================================================================
1227 void SMESHGUI_SewingDlg::onSwapClicked()
1229 if ( !setCurrentPart() )
1232 SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
1233 SMESH::FreeBorderPart& aPRT = aGRP[ myCurPartIndex ];
1234 SMESH::FreeBorder& aBRD = myBorders->borders[ aPRT.border ];
1235 int size = (int) aBRD.nodeIDs.length();
1237 bool isClosed = ( aBRD.nodeIDs[0] == aBRD.nodeIDs[ size-1 ]);
1238 if ( isClosed ) --size;
1240 bool isFwd = ( Abs( aPRT.node2 - aPRT.node1 ) == 1 ) ? aPRT.node2 > aPRT.node1 : aPRT.node2 < aPRT.node1;
1242 std::swap( aPRT.nodeLast, aPRT.node1 );
1244 aPRT.node2 = ( aPRT.node1 + ( isFwd ? -1 : +1 ) + size ) % size;
1246 onGroupChange( /*partChange=*/true );
1249 //=================================================================================
1250 // function : ClickOnApply()
1252 //=================================================================================
1253 bool SMESHGUI_SewingDlg::ClickOnApply()
1255 if (mySMESHGUI->isActiveStudyLocked())
1258 bool aResult = false;
1262 bool toMerge = CheckBoxMerge->isChecked();
1263 bool toCreatePolygons = CheckBoxPolygons->isChecked();
1264 bool toCreatePolyedrs = CheckBoxPolyedrs->isChecked();
1266 SUIT_OverrideCursor aWaitCursor;
1267 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
1269 int aConstructorId = GetConstructorId();
1270 SMESH::SMESH_MeshEditor::Sew_Error anError;
1272 if (aConstructorId == 0)
1274 if ( ModeButGrp->checkedId() == MODE_MANUAL )
1276 anError = aMeshEditor->SewFreeBorders(LineEdit1->text().toLong(),
1277 LineEdit2->text().toLong(),
1278 LineEdit3->text().toLong(),
1279 LineEdit4->text().toLong(),
1280 LineEdit5->text().toLong(),
1281 LineEdit6->text().toLong(),
1287 int nbCoincGroups = ListCoincident->count();
1288 if ( AutoSewCheck->isChecked() )
1290 myBorders = aMeshEditor->FindCoincidentFreeBorders( SpinBoxTolerance->GetValue() );
1291 nbCoincGroups = myBorders->coincidentGroups.length();
1293 CORBA::Short nbSewed = aMeshEditor->SewCoincidentFreeBorders( myBorders.inout(),
1297 if ( nbCoincGroups == 0 )
1298 msg = tr("NO_BORDERS_TO_SEW");
1299 else if ( nbSewed < nbCoincGroups )
1300 msg = tr("NOT_ALL_BORDERS_SEWED").arg( nbSewed ).arg( nbCoincGroups );
1302 msg = tr("ALL_BORDERS_SEWED").arg( nbSewed );
1303 SUIT_MessageBox::information( this, tr("SMESH_INFORMATION"), msg );
1305 anError = SMESH::SMESH_MeshEditor::SEW_OK;
1308 else if (aConstructorId == 1)
1310 anError = aMeshEditor->SewConformFreeBorders(LineEdit1->text().toLong(),
1311 LineEdit2->text().toLong(),
1312 LineEdit3->text().toLong(),
1313 LineEdit4->text().toLong(),
1314 LineEdit5->text().toLong());
1316 else if (aConstructorId == 2)
1318 anError = aMeshEditor->SewBorderToSide(LineEdit1->text().toLong(),
1319 LineEdit2->text().toLong(),
1320 LineEdit3->text().toLong(),
1321 LineEdit4->text().toLong(),
1322 LineEdit6->text().toLong(),
1326 else if (aConstructorId == 3) {
1327 QStringList aListElementsId1 = LineEdit1->text().split(" ", QString::SkipEmptyParts);
1328 QStringList aListElementsId2 = LineEdit4->text().split(" ", QString::SkipEmptyParts);
1330 SMESH::long_array_var anElementsId1 = new SMESH::long_array;
1331 SMESH::long_array_var anElementsId2 = new SMESH::long_array;
1333 anElementsId1->length(aListElementsId1.count());
1334 anElementsId2->length(aListElementsId2.count());
1336 for (int i = 0; i < aListElementsId1.count(); i++)
1337 anElementsId1[i] = aListElementsId1[i].toInt();
1338 for (int i = 0; i < aListElementsId2.count(); i++)
1339 anElementsId2[i] = aListElementsId2[i].toInt();
1341 anError = aMeshEditor->SewSideElements(anElementsId1.inout(),
1342 anElementsId2.inout(),
1343 LineEdit2->text().toLong(),
1344 LineEdit5->text().toLong(),
1345 LineEdit3->text().toLong(),
1346 LineEdit6->text().toLong());
1348 aResult = (anError == SMESH::SMESH_MeshEditor::SEW_OK);
1350 if (toMerge && aResult)
1351 aMeshEditor->MergeEqualElements();
1354 QString msg = tr(QString("ERROR_%1").arg(anError).toLatin1().data());
1355 SUIT_MessageBox::warning(this, tr("SMESH_WRN_WARNING"), msg);
1364 Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
1365 SALOME_ListIO aList;
1367 mySelectionMgr->setSelectedObjects(aList, false);
1368 SMESH::UpdateView();
1371 ConstructorsClicked(GetConstructorId());
1373 SMESHGUI::Modified();
1380 //=================================================================================
1381 // function : ClickOnOk()
1383 //=================================================================================
1384 void SMESHGUI_SewingDlg::ClickOnOk()
1390 //=================================================================================
1391 // function : onOpenView()
1393 //=================================================================================
1394 void SMESHGUI_SewingDlg::onOpenView()
1397 SMESH::SetPointRepresentation(false);
1400 mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
1401 ActivateThisDialog();
1405 //=================================================================================
1406 // function : onCloseView()
1408 //=================================================================================
1409 void SMESHGUI_SewingDlg::onCloseView()
1411 DeactivateActiveDialog();
1414 for ( size_t i = 0; i < myBorderDisplayers.size(); ++i )
1416 delete myBorderDisplayers[ i ];
1417 myBorderDisplayers[ i ] = 0;
1419 myBorderDisplayers.clear();
1422 //=================================================================================
1423 // function : reject()
1425 //=================================================================================
1426 void SMESHGUI_SewingDlg::reject()
1428 restoreDisplayMode();
1429 //mySelectionMgr->clearSelected();
1430 SMESH::SetPointRepresentation(false);
1431 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1432 aViewWindow->SetSelectionMode(ActorSelection);
1433 disconnect(mySelectionMgr, 0, this, 0);
1434 mySMESHGUI->ResetState();
1438 //=================================================================================
1439 // function : ClickOnHelp()
1441 //=================================================================================
1442 void SMESHGUI_SewingDlg::ClickOnHelp()
1444 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
1446 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
1450 platform = "winapplication";
1452 platform = "application";
1454 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
1455 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
1456 arg(app->resourceMgr()->stringValue("ExternalBrowser",
1458 arg(myHelpFileName));
1462 //=======================================================================
1463 //function : onTextChange
1465 //=======================================================================
1466 void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText)
1468 QLineEdit* send = (QLineEdit*)sender();
1474 myEditCurrentArgument = send;
1476 if (send == LineEdit1)
1478 else if (send == LineEdit2)
1480 else if (send == LineEdit3)
1482 else if (send == LineEdit4)
1484 else if (send == LineEdit5)
1486 else if (send == LineEdit6)
1489 // hilight entered elements/nodes
1490 SMDS_Mesh* aMesh = 0;
1493 aMesh = myActor->GetObject()->GetMesh();
1498 TColStd_MapOfInteger newIndices;
1500 if (GetConstructorId() != 3 || (send != LineEdit1 && send != LineEdit4)) {
1501 SMESH::SetPointRepresentation(true);
1503 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1504 aViewWindow->SetSelectionMode(NodeSelection);
1506 const SMDS_MeshNode * n = aMesh->FindNode(theNewText.toInt());
1508 newIndices.Add(n->GetID());
1509 mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
1510 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1511 aViewWindow->highlight( myActor->getIO(), true, true );
1513 if (send == LineEdit1)
1515 else if (send == LineEdit2)
1517 else if (send == LineEdit3)
1519 else if (send == LineEdit4)
1521 else if (send == LineEdit5)
1523 else if (send == LineEdit6)
1527 SMESH::SetPointRepresentation(false);
1529 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1530 aViewWindow->SetSelectionMode(CellSelection);
1532 QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
1534 bool isEvenOneExists = false;
1536 for (int i = 0; i < aListId.count(); i++) {
1537 const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
1539 newIndices.Add(e->GetID());
1541 if (!isEvenOneExists)
1542 isEvenOneExists = true;
1545 mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
1546 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1547 aViewWindow->highlight( myActor->getIO(), true, true );
1549 if (isEvenOneExists) {
1550 if (send == LineEdit1)
1552 else if(send == LineEdit4)
1565 //=================================================================================
1566 // function : SelectionIntoArgument()
1567 // purpose : Called when selection as changed or other case
1568 //=================================================================================
1569 void SMESHGUI_SewingDlg::SelectionIntoArgument (bool isSelectionChanged)
1574 restoreDisplayMode();
1575 if (isSelectionChanged)
1578 QString aString = "";
1581 myEditCurrentArgument->setText(aString);
1582 ListCoincident->clear();
1586 onSelectGroup(); // erase preview
1588 if (!GroupButtons->isEnabled()) // inactive
1591 buttonOk->setEnabled(false);
1592 buttonApply->setEnabled(false);
1593 DetectButton->setEnabled(false);
1595 // get selected mesh
1596 SALOME_ListIO aList;
1597 mySelectionMgr->selectedObjects(aList);
1599 int nbSel = aList.Extent();
1603 Handle(SALOME_InteractiveObject) IO = aList.First();
1604 myMesh = SMESH::GetMeshByIO(IO);
1605 myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
1606 if (myMesh->_is_nil())
1609 CheckBoxPolyedrs->setEnabled( myMesh->NbVolumes() > 0 );
1611 if ( myEditCurrentArgument == LineEditMesh )
1613 LineEditMesh->setText( IO->getName() );
1614 ListCoincident->clear();
1615 if ( AutoSewCheck->isChecked() )
1617 buttonOk->setEnabled(true);
1618 buttonApply->setEnabled(true);
1620 DetectButton->setEnabled( myMesh->NbFaces() > 0 );
1628 // get selected elements/nodes
1630 if (( GetConstructorId() != 3 ) ||
1631 ( myEditCurrentArgument != LineEdit1 && myEditCurrentArgument != LineEdit4))
1633 aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
1638 aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
1644 myEditCurrentArgument->setText(aString);
1648 if (myEditCurrentArgument == LineEdit1)
1650 else if (myEditCurrentArgument == LineEdit2)
1652 else if (myEditCurrentArgument == LineEdit3)
1654 else if (myEditCurrentArgument == LineEdit4)
1656 else if (myEditCurrentArgument == LineEdit5)
1658 else if (myEditCurrentArgument == LineEdit6)
1664 //=================================================================================
1665 // function : SetEditCurrentArgument()
1667 //=================================================================================
1668 void SMESHGUI_SewingDlg::SetEditCurrentArgument()
1670 QPushButton* send = (QPushButton*)sender();
1672 disconnect(mySelectionMgr, 0, this, 0);
1673 mySelectionMgr->clearSelected();
1675 if (send == SelectButton1) {
1676 myEditCurrentArgument = LineEdit1;
1679 else if (send == SelectButton2) {
1680 myEditCurrentArgument = LineEdit2;
1683 else if (send == SelectButton3) {
1684 myEditCurrentArgument = LineEdit3;
1687 else if (send == SelectButton4) {
1688 myEditCurrentArgument = LineEdit4;
1691 else if (send == SelectButton5) {
1692 myEditCurrentArgument = LineEdit5;
1695 else if (send == SelectButton6) {
1696 myEditCurrentArgument = LineEdit6;
1700 if (GetConstructorId() != 3 || (send != SelectButton1 && send != SelectButton4)) {
1701 SMESH::SetPointRepresentation(true);
1703 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1704 aViewWindow->SetSelectionMode(NodeSelection);
1707 SMESH::SetPointRepresentation(false);
1708 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1709 aViewWindow->SetSelectionMode(CellSelection);
1712 myEditCurrentArgument->setFocus();
1713 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
1714 SelectionIntoArgument(false);
1717 //=================================================================================
1718 // function : DeactivateActiveDialog()
1720 //=================================================================================
1721 void SMESHGUI_SewingDlg::DeactivateActiveDialog()
1723 if (ConstructorsBox->isEnabled()) {
1724 ConstructorsBox->setEnabled(false);
1725 GroupArguments->setEnabled(false);
1726 GroupButtons->setEnabled(false);
1727 mySMESHGUI->ResetState();
1728 mySMESHGUI->SetActiveDialogBox(0);
1732 //=================================================================================
1733 // function : ActivateThisDialog()
1735 //=================================================================================
1736 void SMESHGUI_SewingDlg::ActivateThisDialog()
1738 /* Emit a signal to deactivate the active dialog */
1739 mySMESHGUI->EmitSignalDeactivateDialog();
1740 ConstructorsBox->setEnabled(true);
1741 GroupArguments->setEnabled(true);
1742 GroupButtons->setEnabled(true);
1744 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
1746 ConstructorsClicked(GetConstructorId());
1747 SelectionIntoArgument();
1750 //=================================================================================
1751 // function : enterEvent()
1753 //=================================================================================
1754 void SMESHGUI_SewingDlg::enterEvent (QEvent* e)
1756 if (!ConstructorsBox->isEnabled()) {
1757 SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
1758 if ( aViewWindow && !mySelector) {
1759 mySelector = aViewWindow->GetSelector();
1761 ActivateThisDialog();
1765 //=================================================================================
1766 // function : GetConstructorId()
1768 //=================================================================================
1769 int SMESHGUI_SewingDlg::GetConstructorId()
1771 return GroupConstructors->checkedId();
1774 //=================================================================================
1775 // function : GetConstructorId()
1777 //=================================================================================
1778 bool SMESHGUI_SewingDlg::IsValid()
1780 if ( myMesh->_is_nil() )
1783 if ( GetConstructorId() == 0 && ModeButGrp->checkedId() == MODE_AUTO )
1785 if ( AutoSewCheck->isChecked() )
1789 if ( haveBorders() )
1790 for ( int i = 0; i < ListCoincident->count(); ++i )
1792 int groupIndex = ListCoincident->item(i)->data( GROUP_INDEX ).toInt();
1793 nbGroups += ( !getGroupText( groupIndex ).isEmpty() );
1795 return nbGroups > 0;
1797 return (myOk1 && myOk2 && myOk3 && myOk4 && myOk5 && myOk6);
1800 //=======================================================================
1801 //function : UpdateButtons
1802 //purpose : activate [Apply] buttons
1803 //=======================================================================
1805 void SMESHGUI_SewingDlg::UpdateButtons()
1807 bool ok = IsValid();
1808 buttonOk->setEnabled( ok );
1809 buttonApply->setEnabled( ok );
1812 //=================================================================================
1813 // function : keyPressEvent()
1815 //=================================================================================
1816 void SMESHGUI_SewingDlg::keyPressEvent( QKeyEvent* e )
1818 QDialog::keyPressEvent( e );
1819 if ( e->isAccepted() )
1822 if ( e->key() == Qt::Key_F1 ) {
1828 SMESHGUI_SewingDlg::
1829 BorderGroupDisplayer::BorderGroupDisplayer( const SMESH::CoincidentFreeBorders& borders,
1832 SMESH::SMESH_Mesh_ptr mesh):
1833 myBorders ( borders.borders ),
1834 myGroup ( borders.coincidentGroups[ groupIndex ]),
1837 myViewWindow( SMESH::GetCurrentVtkView() ),
1838 myIdPreview ( myViewWindow )
1843 SMESHGUI_SewingDlg::BorderGroupDisplayer::~BorderGroupDisplayer()
1845 for ( size_t i = 0; i < myPartActors.size(); ++i )
1847 if ( myPartActors[ i ]) {
1848 myViewWindow->RemoveActor( myPartActors[i] );
1849 myPartActors[i]->Delete();
1852 myIdPreview.SetPointsLabeled(false);
1853 //myViewWindow->Repaint();
1856 void SMESHGUI_SewingDlg::BorderGroupDisplayer::Hide()
1858 for ( size_t i = 0; i < myPartActors.size(); ++i )
1859 if ( myPartActors[ i ])
1860 myPartActors[ i ]->SetVisibility(false);
1862 myIdPreview.SetPointsLabeled(false);
1865 void SMESHGUI_SewingDlg::BorderGroupDisplayer::ShowGroup( bool wholeBorders )
1867 std::vector<int> ids;
1868 std::list<gp_XYZ> coords;
1869 for ( size_t i = 0; i < myPartActors.size(); ++i )
1870 if ( myPartActors[ i ])
1872 myPartActors[ i ]->SetPointRepresentation( wholeBorders );
1873 myPartActors[ i ]->SetVisibility( true );
1875 getPartEnds( i, ids, coords );
1878 myIdPreview.SetElemsData( ids, coords );
1879 myIdPreview.SetPointsLabeled( wholeBorders, true );
1882 void SMESHGUI_SewingDlg::BorderGroupDisplayer::ShowPart( int partIndex, bool toEdit )
1884 if ( partIndex < (int) myPartActors.size() )
1886 myPartActors[partIndex]->SetVisibility(true);
1887 myPartActors[partIndex]->SetPointRepresentation(toEdit);
1891 std::vector<int> ids;
1892 std::list<gp_XYZ> coords;
1893 getPartEnds( partIndex, ids, coords );
1895 myIdPreview.SetElemsData( ids, coords );
1896 myIdPreview.SetPointsLabeled( true, /*show=*/true );
1901 void SMESHGUI_SewingDlg::BorderGroupDisplayer::getPartEnds( int partIndex,
1902 std::vector<int> & ids,
1903 std::list<gp_XYZ>& coords)
1905 const SMESH::FreeBorderPart& aPART = myGroup [ partIndex ];
1906 const SMESH::FreeBorder& aBRD = myBorders[ aPART.border ];
1908 ids.push_back( aBRD.nodeIDs[ aPART.node1 ]);
1909 ids.push_back( aBRD.nodeIDs[ aPART.nodeLast ]);
1911 SMDS_Mesh* mesh = myPartActors[ partIndex ]->GetObject()->GetMesh();
1913 coords.push_back( SMESH_TNodeXYZ( mesh->FindNode( aPART.node1+1 )));
1914 coords.push_back( SMESH_TNodeXYZ( mesh->FindNode( aPART.nodeLast+1 )));
1917 void SMESHGUI_SewingDlg::BorderGroupDisplayer::Update()
1920 myPartActors.resize( myGroup.length(), 0 );
1922 for ( size_t i = 0; i < myPartActors.size(); ++i )
1925 if ( myPartActors[ i ])
1926 obj = myPartActors[ i ]->GetObject();
1928 obj = TVisualObjPtr( new SMESHGUI_PreVisualObj() );
1929 SMDS_Mesh* mesh = obj->GetMesh();
1933 const SMESH::FreeBorderPart& aPRT = myGroup[ i ];
1934 const SMESH::FreeBorder& aBRD = myBorders[ aPRT.border ];
1935 for ( CORBA::ULong iN = 0; iN < aBRD.nodeIDs.length(); ++iN )
1937 SMESH::double_array_var xyz = myMesh->GetNodeXYZ( aBRD.nodeIDs[ iN ]);
1938 if ( xyz->length() == 3 )
1939 mesh->AddNode( xyz[0], xyz[1], xyz[2] );
1943 bool isFwd = ( Abs( aPRT.node2 - aPRT.node1 ) == 1 ) ? aPRT.node2 > aPRT.node1 : aPRT.node2 < aPRT.node1;
1944 int dn = isFwd ? +1 : -1;
1945 int size = (int) aBRD.nodeIDs.length();
1946 int n2, n1 = aPRT.node1;
1947 for ( n2 = n1 + dn; ( n2 >= 0 && n2 < size ); n2 += dn )
1949 mesh->AddEdgeWithID( n1+1, n2+1, mesh->NbEdges() + 1 );
1951 if ( n2 == aPRT.nodeLast )
1954 if ( n2 % size != aPRT.nodeLast )
1956 if ( n2 < 0 ) n1 = size;
1958 for ( n2 = n1 + dn; ( n2 >= 0 && n2 < size ); n2 += dn )
1960 mesh->AddEdgeWithID( n1+1, n2+1, mesh->NbEdges() + 1 );
1962 if ( n2 == aPRT.nodeLast )
1967 if ( !myPartActors[ i ]) // TVisualObj must be filled before actor creation
1969 myPartActors[ i ] = SMESH_Actor::New( obj, "", "", 1 );
1970 myPartActors[ i ]->SetEdgeColor( myColor.redF(), myColor.greenF(), myColor.blueF() );
1971 myPartActors[ i ]->SetLineWidth( 3 * SMESH::GetFloat("SMESH:element_width",1));
1972 myPartActors[ i ]->SetPickable( false );
1973 myPartActors[ i ]->SetNodeColor( myColor.redF(), myColor.greenF(), myColor.blueF() );
1974 myPartActors[ i ]->SetMarkerStd( VTK::MT_POINT, 13 );
1975 myViewWindow->AddActor( myPartActors[ i ]);
1976 myViewWindow->Repaint();