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_MergeNodesDlg.cxx
25 // Author : Michael ZORIN
29 #include "SMESHGUI_MergeNodesDlg.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_IdValidator.h"
35 #include "SMESHGUI_SpinBox.h"
37 #include "SMESH_Actor.h"
38 #include "SMESH_TypeFilter.hxx"
39 #include "SMDS_Mesh.hxx"
43 #include "SUIT_ResourceMgr.h"
44 #include "SUIT_Session.h"
45 #include "SUIT_MessageBox.h"
47 #include "LightApp_Application.h"
49 #include "SVTK_ViewModel.h"
50 #include "SVTK_ViewWindow.h"
51 #include "SVTK_Selector.h"
52 #include "SVTK_Selection.h"
53 #include "SALOME_ListIO.hxx"
55 #include "utilities.h"
58 #include <TColStd_MapOfInteger.hxx>
61 #include <qapplication.h>
62 #include <qbuttongroup.h>
63 #include <qgroupbox.h>
65 #include <qlineedit.h>
67 #include <qlistview.h>
68 #include <qpushbutton.h>
69 #include <qradiobutton.h>
70 #include <qcheckbox.h>
77 //=================================================================================
78 // class : SMESHGUI_MergeNodesDlg()
80 //=================================================================================
81 SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( SMESHGUI* theModule, const char* name,
82 bool modal, WFlags fl)
83 : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
84 WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
85 mySMESHGUI( theModule ),
86 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
88 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_MERGE_NODES")));
89 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
92 setName("SMESHGUI_MergeNodesDlg");
94 setCaption(tr("SMESH_MERGE_NODES"));
95 setSizeGripEnabled(TRUE);
96 SMESHGUI_MergeNodesDlgLayout = new QGridLayout(this);
97 SMESHGUI_MergeNodesDlgLayout->setSpacing(6);
98 SMESHGUI_MergeNodesDlgLayout->setMargin(11);
100 /***************************************************************/
101 GroupConstructors = new QButtonGroup(this, "GroupConstructors");
102 GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
103 (QSizePolicy::SizeType)0, 0, 0,
104 GroupConstructors->sizePolicy().hasHeightForWidth()));
105 GroupConstructors->setTitle(tr("SMESH_MERGE_NODES" ));
106 GroupConstructors->setExclusive(TRUE);
107 GroupConstructors->setColumnLayout(0, Qt::Vertical);
108 GroupConstructors->layout()->setSpacing(0);
109 GroupConstructors->layout()->setMargin(0);
110 GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
111 GroupConstructorsLayout->setAlignment(Qt::AlignTop);
112 GroupConstructorsLayout->setSpacing(6);
113 GroupConstructorsLayout->setMargin(11);
114 QHBoxLayout* RBLayout = new QHBoxLayout(0, 0, 6, "Layout2");
115 RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
116 RadioButton1->setText(tr("" ));
117 RadioButton1->setPixmap(image0);
118 RBLayout->addWidget(RadioButton1);
119 GroupConstructorsLayout->addLayout(RBLayout, 0, 0);
120 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupConstructors, 0, 0);
122 /***************************************************************/
123 GroupButtons = new QGroupBox(this, "GroupButtons");
124 GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
125 (QSizePolicy::SizeType)0, 0, 0,
126 GroupButtons->sizePolicy().hasHeightForWidth()));
127 GroupButtons->setGeometry(QRect(10, 10, 281, 48));
128 GroupButtons->setTitle(tr("" ));
129 GroupButtons->setColumnLayout(0, Qt::Vertical);
130 GroupButtons->layout()->setSpacing(0);
131 GroupButtons->layout()->setMargin(0);
132 GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
133 GroupButtonsLayout->setAlignment(Qt::AlignTop);
134 GroupButtonsLayout->setSpacing(6);
135 GroupButtonsLayout->setMargin(11);
136 buttonHelp = new QPushButton(GroupButtons, "buttonHelp");
137 buttonHelp->setText(tr("SMESH_BUT_HELP" ));
138 buttonHelp->setAutoDefault(TRUE);
139 GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
140 buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
141 buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
142 buttonCancel->setAutoDefault(TRUE);
143 GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
144 buttonApply = new QPushButton(GroupButtons, "buttonApply");
145 buttonApply->setText(tr("SMESH_BUT_APPLY" ));
146 buttonApply->setAutoDefault(TRUE);
147 GroupButtonsLayout->addWidget(buttonApply, 0, 1);
148 QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
149 GroupButtonsLayout->addItem(spacer_9, 0, 2);
150 buttonOk = new QPushButton(GroupButtons, "buttonOk");
151 buttonOk->setText(tr("SMESH_BUT_OK" ));
152 buttonOk->setAutoDefault(TRUE);
153 buttonOk->setDefault(TRUE);
154 GroupButtonsLayout->addWidget(buttonOk, 0, 0);
155 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupButtons, 4, 0);
157 /***************************************************************/
159 // Controls for mesh defining
160 GroupMesh = new QGroupBox(this, "GroupMesh");
161 GroupMesh->setTitle(tr("SMESH_MESH"));
162 GroupMesh->setColumnLayout(0, Qt::Vertical);
163 GroupMesh->layout()->setSpacing(0);
164 GroupMesh->layout()->setMargin(0);
165 GroupMeshLayout = new QGridLayout(GroupMesh->layout());
166 GroupMeshLayout->setAlignment(Qt::AlignTop);
167 GroupMeshLayout->setSpacing(6);
168 GroupMeshLayout->setMargin(11);
170 TextLabelName = new QLabel(GroupMesh, "TextLabelName");
171 TextLabelName->setText(tr("SMESH_NAME"));
172 GroupMeshLayout->addWidget(TextLabelName, 0, 0);
174 SelectMeshButton = new QPushButton(GroupMesh, "SelectMeshButton");
175 SelectMeshButton->setPixmap(image1);
176 GroupMeshLayout->addWidget(SelectMeshButton, 0, 1);
178 LineEditMesh = new QLineEdit(GroupMesh, "LineEditMesh");
179 LineEditMesh->setReadOnly(true);
180 GroupMeshLayout->addWidget(LineEditMesh, 0, 2);
182 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupMesh, 1, 0);
184 // Controls for coincident nodes detecting
185 GroupCoincident = new QGroupBox(this, "GroupCoincident");
186 GroupCoincident->setTitle(tr("COINCIDENT_NODES"));
187 GroupCoincident->setColumnLayout(0, Qt::Vertical);
188 GroupCoincident->layout()->setSpacing(0);
189 GroupCoincident->layout()->setMargin(0);
190 QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincident->layout());
191 GroupCoincidentLayout->setAlignment(Qt::AlignTop);
192 GroupCoincidentLayout->setSpacing(6);
193 GroupCoincidentLayout->setMargin(11);
195 TextLabelTolerance = new QLabel(GroupCoincident, "TextLabelTolerance");
196 TextLabelTolerance->setText(tr("SMESH_TOLERANCE"));
197 GroupCoincidentLayout->addWidget(TextLabelTolerance, 0, 0);
199 SpinBoxTolerance = new SMESHGUI_SpinBox(GroupCoincident, "SpinBoxTolerance");
200 GroupCoincidentLayout->addWidget(SpinBoxTolerance, 0, 1);
202 QPushButton* DetectButton = new QPushButton(GroupCoincident, "DetectButton");
203 DetectButton->setText(tr("DETECT"));
204 GroupCoincidentLayout->addWidget(DetectButton, 0, 2);
206 ListCoincident = new QListView(GroupCoincident);
207 ListCoincident->setSorting(-1);
208 ListCoincident->addColumn("Nodes");
209 ListCoincident->header()->hide();
211 GroupCoincidentLayout->addMultiCellWidget(ListCoincident, 1, 1, 0, 1);
213 SelectAllCB = new QCheckBox(GroupCoincident, "SelectAllCB");
214 SelectAllCB->setText(tr("SELECT_ALL"));
215 GroupCoincidentLayout->addWidget(SelectAllCB, 2, 0);
217 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupCoincident, 2, 0);
219 // Controls for editing group of nodes
220 GroupEdit = new QGroupBox(this, "GroupEdit");
221 GroupEdit->setTitle(tr("EDIT_GROUP_OF_NODES"));
222 GroupEdit->setColumnLayout(0, Qt::Vertical);
223 GroupEdit->layout()->setSpacing(0);
224 GroupEdit->layout()->setMargin(0);
225 QGridLayout* GroupEditLayout = new QGridLayout(GroupEdit->layout());
226 GroupEditLayout->setAlignment(Qt::AlignTop);
227 GroupEditLayout->setSpacing(6);
228 GroupEditLayout->setMargin(11);
230 ListEdit = new QListBox(GroupEdit, "ListEdit");
231 ListEdit->setColumnMode(QListBox::FitToHeight);
232 ListEdit->setSelectionMode(QListBox::Extended);
233 GroupEditLayout->addMultiCellWidget(ListEdit, 0, 2, 0, 0);
235 QPushButton* AddButton = new QPushButton(GroupEdit, "AddButton");
236 AddButton->setText(tr("SMESH_BUT_ADD"));
237 GroupEditLayout->addWidget(AddButton, 0, 1);
239 QPushButton* RemoveButton = new QPushButton(GroupEdit, "RemoveButton");
240 RemoveButton->setText(tr("SMESH_BUT_REMOVE"));
241 GroupEditLayout->addWidget(RemoveButton, 1, 1);
243 QSpacerItem* spacer = new QSpacerItem(20, 200, QSizePolicy::Minimum, QSizePolicy::Expanding);
244 GroupEditLayout->addItem(spacer, 2, 1);
246 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupEdit, 3, 0);
248 /* Initialisations */
249 SpinBoxTolerance->RangeStepAndValidator(0.0, 999999.999, 0.1, 3);
250 SpinBoxTolerance->SetValue(1e-05);
252 RadioButton1->setChecked(TRUE);
254 myEditCurrentArgument = (QWidget*)LineEditMesh;
258 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
260 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
262 myMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
264 /* signals and slots connections */
265 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
266 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
267 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
268 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
270 connect(SelectMeshButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
271 connect(DetectButton, SIGNAL (clicked()), this, SLOT(onDetect()));
272 connect(ListCoincident, SIGNAL (selectionChanged()), this, SLOT(onSelectNodesGroup()));
273 connect(ListCoincident, SIGNAL (pressed(QListViewItem*)), this, SLOT(updateControls()));
274 connect(ListCoincident, SIGNAL (currentChanged(QListViewItem*)), this, SLOT(updateControls()));
275 connect(SelectAllCB, SIGNAL(toggled(bool)), this, SLOT(onSelectAll(bool)));
276 connect(ListEdit, SIGNAL (selectionChanged()), this, SLOT(onSelectNodesFromGroup()));
277 connect(AddButton, SIGNAL (clicked()), this, SLOT(onAdd()));
278 connect(RemoveButton, SIGNAL (clicked()), this, SLOT(onRemove()));
280 connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
281 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
282 /* to close dialog if study change */
283 connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
285 this->show(); /* displays Dialog */
288 buttonOk->setEnabled(false);
289 buttonApply->setEnabled(false);
291 // Init Mesh field from selection
292 SelectionIntoArgument();
294 myHelpFileName = "/files/merging_nodes.htm";
297 //=================================================================================
298 // function : ~SMESHGUI_MergeNodesDlg()
299 // purpose : Destroys the object and frees any allocated resources
300 //=================================================================================
301 SMESHGUI_MergeNodesDlg::~SMESHGUI_MergeNodesDlg()
303 // no need to delete child widgets, Qt does it all for us
306 //=================================================================================
307 // function : ClickOnApply()
309 //=================================================================================
310 bool SMESHGUI_MergeNodesDlg::ClickOnApply()
312 if (mySMESHGUI->isActiveStudyLocked() || myMesh->_is_nil())
316 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
318 QApplication::setOverrideCursor(Qt::waitCursor);
319 SMESH::array_of_long_array_var aGroupsOfNodes = new SMESH::array_of_long_array;
320 aGroupsOfNodes->length(ListCoincident->childCount());
321 QListViewItem* item = ListCoincident->firstChild();
325 QStringList aListIds = QStringList("");
326 if (((QCheckListItem*) item)->isOn())
327 aListIds = QStringList::split(" ", item->text(0), false);
329 SMESH::long_array_var anIds = new SMESH::long_array;
330 anIds->length(aListIds.count());
332 for (int i = 0; i < aListIds.count(); i++)
333 anIds[i] = aListIds[i].toInt();
335 aGroupsOfNodes[anArrayNum++] = anIds.inout();
337 item = item->itemBelow();
340 aMeshEditor->MergeNodes (aGroupsOfNodes.inout());
341 QApplication::restoreOverrideCursor();
345 //mySelectionMgr->clearSelected();
352 //=================================================================================
353 // function : ClickOnOk()
355 //=================================================================================
356 void SMESHGUI_MergeNodesDlg::ClickOnOk()
362 //=================================================================================
363 // function : ClickOnCancel()
365 //=================================================================================
366 void SMESHGUI_MergeNodesDlg::ClickOnCancel()
368 mySelectionMgr->clearFilters();
369 //mySelectionMgr->clearSelected();
370 SMESH::SetPointRepresentation(false);
371 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
372 aViewWindow->SetSelectionMode(ActorSelection);
373 disconnect(mySelectionMgr, 0, this, 0);
374 mySMESHGUI->ResetState();
378 //=================================================================================
379 // function : ClickOnHelp()
381 //=================================================================================
382 void SMESHGUI_MergeNodesDlg::ClickOnHelp()
384 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
386 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
388 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
389 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
390 arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName),
391 QObject::tr("BUT_OK"));
395 //=================================================================================
396 // function : onEditNodesGroup()
398 //=================================================================================
399 void SMESHGUI_MergeNodesDlg::onEditNodesGroup()
401 if (ListCoincident->childCount() < 1)
404 QString aNewIds = "";
406 QListBoxItem* anItem;
407 for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next())
408 aNewIds+=QString(" %1").arg(anItem->text());
410 ListCoincident->currentItem()->setText(0, aNewIds);
413 //=================================================================================
414 // function : updateControls()
416 //=================================================================================
417 void SMESHGUI_MergeNodesDlg::updateControls()
419 if (ListCoincident->childCount() < 1) {
420 SMESH::SetPointRepresentation(false);
421 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
422 aViewWindow->SetSelectionMode(ActorSelection);
426 bool hasChecked = false, hasUnchecked = false;
428 QListViewItem* item = ListCoincident->firstChild();
430 while (item && (!hasChecked || !hasUnchecked)) {
431 if (((QCheckListItem*) item)->isOn())
436 item = item->itemBelow();
440 SelectAllCB->setChecked(false);
442 bool enable = !(myMesh->_is_nil()) && hasChecked;
444 buttonOk->setEnabled(enable);
445 buttonApply->setEnabled(enable);
448 //=================================================================================
449 // function : onDetect()
451 //=================================================================================
452 void SMESHGUI_MergeNodesDlg::onDetect()
454 if (myMesh->_is_nil())
458 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
460 QApplication::setOverrideCursor(Qt::waitCursor);
461 ListCoincident->clear();
464 SMESH::array_of_long_array_var aNodeGroups;
465 aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aNodeGroups);
467 for (int i = 0; i < aNodeGroups->length(); i++) {
468 SMESH::long_array& aGroup = aNodeGroups[i];
471 for (int j = 0; j < aGroup.length(); j++)
472 aNodeIds+=QString(" %1").arg(aGroup[j]);
474 new QCheckListItem (ListCoincident, aNodeIds, QCheckListItem::CheckBox);
476 QApplication::restoreOverrideCursor();
483 //=================================================================================
484 // function : onSelectNodesGroup()
486 //=================================================================================
487 void SMESHGUI_MergeNodesDlg::onSelectNodesGroup()
492 myEditCurrentArgument = (QWidget*)ListCoincident;
494 QListViewItem* aSelectedItem = ListCoincident->selectedItem();
498 QStringList aListId = QStringList::split(" ", aSelectedItem->text(0), false);
501 ListEdit->insertStringList(aListId);
503 //mySelectionMgr->clearSelected();
504 //mySelectionMgr->AddIObject(myActor->getIO());
506 aList.Append(myActor->getIO());
507 mySelectionMgr->setSelectedObjects(aList, false);
509 SMESH::SetPointRepresentation(true);
510 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
511 aViewWindow->SetSelectionMode(NodeSelection);
513 ListEdit->selectAll(true);
516 //=================================================================================
517 // function : onSelectAll()
519 //=================================================================================
520 void SMESHGUI_MergeNodesDlg::onSelectAll (bool isToggled)
524 QListViewItem* item = ListCoincident->firstChild();
527 if (!((QCheckListItem*) item)->isOn())
528 ((QCheckListItem*) item)->setOn(true);
529 item = item->itemBelow();
533 buttonOk->setEnabled(true);
534 buttonApply->setEnabled(true);
539 //=================================================================================
540 // function : onSelectNodesFromGroup()
542 //=================================================================================
543 void SMESHGUI_MergeNodesDlg::onSelectNodesFromGroup()
548 TColStd_MapOfInteger aIndexes;
549 QListBoxItem* anItem;
550 for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next()) {
551 if (anItem->isSelected()) {
552 int anId = anItem->text().toInt();
557 mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false);
559 aList.Append(myActor->getIO());
560 mySelectionMgr->setSelectedObjects(aList);
563 //=================================================================================
564 // function : onAdd()
566 //=================================================================================
567 void SMESHGUI_MergeNodesDlg::onAdd()
572 QString aListStr = "";
575 aNbNnodes = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
579 QStringList aNodes = QStringList::split(" ", aListStr);
580 QListBoxItem* anItem = 0;
582 for (QStringList::iterator it = aNodes.begin(); it != aNodes.end(); ++it) {
583 anItem = ListEdit->findItem(*it, Qt::ExactMatch);
585 anItem = new QListBoxText(*it);
586 ListEdit->insertItem(anItem);
588 ListEdit->setSelected(anItem, true);
594 //=================================================================================
595 // function : onRemove()
597 //=================================================================================
598 void SMESHGUI_MergeNodesDlg::onRemove()
600 if (myEditCurrentArgument != (QWidget*)ListCoincident)
603 for (int i = ListEdit->count(); i > 0; i--) {
604 if (ListEdit->isSelected(i-1))
605 ListEdit->removeItem(i-1);
610 //=================================================================================
611 // function : SetEditCurrentArgument()
613 //=================================================================================
614 void SMESHGUI_MergeNodesDlg::SetEditCurrentArgument()
616 QPushButton* send = (QPushButton*)sender();
618 disconnect(mySelectionMgr, 0, this, 0);
619 mySelectionMgr->clearSelected();
620 mySelectionMgr->clearFilters();
622 if (send == SelectMeshButton) {
623 myEditCurrentArgument = (QWidget*)LineEditMesh;
624 SMESH::SetPointRepresentation(false);
625 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
626 aViewWindow->SetSelectionMode(ActorSelection);
627 mySelectionMgr->installFilter(myMeshOrSubMeshFilter);
630 myEditCurrentArgument->setFocus();
631 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
632 SelectionIntoArgument();
635 //=================================================================================
636 // function : SelectionIntoArgument()
637 // purpose : Called when selection as changed or other case
638 //=================================================================================
639 void SMESHGUI_MergeNodesDlg::SelectionIntoArgument()
641 if (myEditCurrentArgument == (QWidget*)LineEditMesh) {
642 QString aString = "";
643 LineEditMesh->setText(aString);
645 ListCoincident->clear();
648 int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
653 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
655 Handle(SALOME_InteractiveObject) IO = aList.First();
656 myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
657 myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
658 if (myMesh->_is_nil() || !myActor)
661 LineEditMesh->setText(aString);
665 //=================================================================================
666 // function : DeactivateActiveDialog()
668 //=================================================================================
669 void SMESHGUI_MergeNodesDlg::DeactivateActiveDialog()
671 if (GroupConstructors->isEnabled()) {
672 GroupConstructors->setEnabled(false);
673 GroupMesh->setEnabled(false);
674 GroupCoincident->setEnabled(false);
675 GroupEdit->setEnabled(false);
676 GroupButtons->setEnabled(false);
677 mySMESHGUI->ResetState();
678 mySMESHGUI->SetActiveDialogBox(0);
682 //=================================================================================
683 // function : ActivateThisDialog()
685 //=================================================================================
686 void SMESHGUI_MergeNodesDlg::ActivateThisDialog()
688 /* Emit a signal to deactivate the active dialog */
689 mySMESHGUI->EmitSignalDeactivateDialog();
690 GroupConstructors->setEnabled(true);
691 GroupMesh->setEnabled(true);
692 GroupCoincident->setEnabled(true);
693 GroupEdit->setEnabled(true);
694 GroupButtons->setEnabled(true);
696 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
698 SelectionIntoArgument();
701 //=================================================================================
702 // function : enterEvent()
704 //=================================================================================
705 void SMESHGUI_MergeNodesDlg::enterEvent (QEvent*)
707 if (!GroupConstructors->isEnabled())
708 ActivateThisDialog();
711 //=================================================================================
712 // function : closeEvent()
714 //=================================================================================
715 void SMESHGUI_MergeNodesDlg::closeEvent (QCloseEvent*)
717 /* same than click on cancel button */
721 //=======================================================================
722 //function : hideEvent()
723 //purpose : caused by ESC key
724 //=======================================================================
725 void SMESHGUI_MergeNodesDlg::hideEvent (QHideEvent*)