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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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"
57 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
60 #include <TColStd_MapOfInteger.hxx>
63 #include <qapplication.h>
64 #include <qbuttongroup.h>
65 #include <qgroupbox.h>
67 #include <qlineedit.h>
69 #include <qlistview.h>
70 #include <qpushbutton.h>
71 #include <qradiobutton.h>
72 #include <qcheckbox.h>
79 //=================================================================================
80 // class : SMESHGUI_MergeNodesDlg()
82 //=================================================================================
83 SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( SMESHGUI* theModule, const char* name,
84 bool modal, WFlags fl)
85 : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
86 WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
87 mySMESHGUI( theModule ),
88 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
90 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_MERGE_NODES")));
91 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
94 setName("SMESHGUI_MergeNodesDlg");
96 setCaption(tr("SMESH_MERGE_NODES"));
97 setSizeGripEnabled(TRUE);
98 SMESHGUI_MergeNodesDlgLayout = new QGridLayout(this);
99 SMESHGUI_MergeNodesDlgLayout->setSpacing(6);
100 SMESHGUI_MergeNodesDlgLayout->setMargin(11);
102 /***************************************************************/
103 GroupConstructors = new QButtonGroup(this, "GroupConstructors");
104 GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
105 (QSizePolicy::SizeType)0, 0, 0,
106 GroupConstructors->sizePolicy().hasHeightForWidth()));
107 GroupConstructors->setTitle(tr("SMESH_MERGE_NODES" ));
108 GroupConstructors->setExclusive(TRUE);
109 GroupConstructors->setColumnLayout(0, Qt::Vertical);
110 GroupConstructors->layout()->setSpacing(0);
111 GroupConstructors->layout()->setMargin(0);
112 GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
113 GroupConstructorsLayout->setAlignment(Qt::AlignTop);
114 GroupConstructorsLayout->setSpacing(6);
115 GroupConstructorsLayout->setMargin(11);
116 QHBoxLayout* RBLayout = new QHBoxLayout(0, 0, 6, "Layout2");
117 RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
118 RadioButton1->setText(tr("" ));
119 RadioButton1->setPixmap(image0);
120 RBLayout->addWidget(RadioButton1);
121 GroupConstructorsLayout->addLayout(RBLayout, 0, 0);
122 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupConstructors, 0, 0);
124 /***************************************************************/
125 GroupButtons = new QGroupBox(this, "GroupButtons");
126 GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
127 (QSizePolicy::SizeType)0, 0, 0,
128 GroupButtons->sizePolicy().hasHeightForWidth()));
129 GroupButtons->setGeometry(QRect(10, 10, 281, 48));
130 GroupButtons->setTitle(tr("" ));
131 GroupButtons->setColumnLayout(0, Qt::Vertical);
132 GroupButtons->layout()->setSpacing(0);
133 GroupButtons->layout()->setMargin(0);
134 GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
135 GroupButtonsLayout->setAlignment(Qt::AlignTop);
136 GroupButtonsLayout->setSpacing(6);
137 GroupButtonsLayout->setMargin(11);
138 buttonHelp = new QPushButton(GroupButtons, "buttonHelp");
139 buttonHelp->setText(tr("SMESH_BUT_HELP" ));
140 buttonHelp->setAutoDefault(TRUE);
141 GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
142 buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
143 buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
144 buttonCancel->setAutoDefault(TRUE);
145 GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
146 buttonApply = new QPushButton(GroupButtons, "buttonApply");
147 buttonApply->setText(tr("SMESH_BUT_APPLY" ));
148 buttonApply->setAutoDefault(TRUE);
149 GroupButtonsLayout->addWidget(buttonApply, 0, 1);
150 QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
151 GroupButtonsLayout->addItem(spacer_9, 0, 2);
152 buttonOk = new QPushButton(GroupButtons, "buttonOk");
153 buttonOk->setText(tr("SMESH_BUT_OK" ));
154 buttonOk->setAutoDefault(TRUE);
155 buttonOk->setDefault(TRUE);
156 GroupButtonsLayout->addWidget(buttonOk, 0, 0);
157 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupButtons, 4, 0);
159 /***************************************************************/
161 // Controls for mesh defining
162 GroupMesh = new QGroupBox(this, "GroupMesh");
163 GroupMesh->setTitle(tr("SMESH_MESH"));
164 GroupMesh->setColumnLayout(0, Qt::Vertical);
165 GroupMesh->layout()->setSpacing(0);
166 GroupMesh->layout()->setMargin(0);
167 GroupMeshLayout = new QGridLayout(GroupMesh->layout());
168 GroupMeshLayout->setAlignment(Qt::AlignTop);
169 GroupMeshLayout->setSpacing(6);
170 GroupMeshLayout->setMargin(11);
172 TextLabelName = new QLabel(GroupMesh, "TextLabelName");
173 TextLabelName->setText(tr("SMESH_NAME"));
174 GroupMeshLayout->addWidget(TextLabelName, 0, 0);
176 SelectMeshButton = new QPushButton(GroupMesh, "SelectMeshButton");
177 SelectMeshButton->setPixmap(image1);
178 GroupMeshLayout->addWidget(SelectMeshButton, 0, 1);
180 LineEditMesh = new QLineEdit(GroupMesh, "LineEditMesh");
181 LineEditMesh->setReadOnly(true);
182 GroupMeshLayout->addWidget(LineEditMesh, 0, 2);
184 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupMesh, 1, 0);
186 // Controls for coincident nodes detecting
187 GroupCoincident = new QGroupBox(this, "GroupCoincident");
188 GroupCoincident->setTitle(tr("COINCIDENT_NODES"));
189 GroupCoincident->setColumnLayout(0, Qt::Vertical);
190 GroupCoincident->layout()->setSpacing(0);
191 GroupCoincident->layout()->setMargin(0);
192 QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincident->layout());
193 GroupCoincidentLayout->setAlignment(Qt::AlignTop);
194 GroupCoincidentLayout->setSpacing(6);
195 GroupCoincidentLayout->setMargin(11);
197 TextLabelTolerance = new QLabel(GroupCoincident, "TextLabelTolerance");
198 TextLabelTolerance->setText(tr("SMESH_TOLERANCE"));
199 GroupCoincidentLayout->addWidget(TextLabelTolerance, 0, 0);
201 SpinBoxTolerance = new SMESHGUI_SpinBox(GroupCoincident, "SpinBoxTolerance");
202 GroupCoincidentLayout->addWidget(SpinBoxTolerance, 0, 1);
204 QPushButton* DetectButton = new QPushButton(GroupCoincident, "DetectButton");
205 DetectButton->setText(tr("DETECT"));
206 GroupCoincidentLayout->addWidget(DetectButton, 0, 2);
208 ListCoincident = new QListView(GroupCoincident);
209 ListCoincident->setSorting(-1);
210 ListCoincident->addColumn("Nodes");
211 ListCoincident->header()->hide();
213 GroupCoincidentLayout->addMultiCellWidget(ListCoincident, 1, 1, 0, 1);
215 SelectAllCB = new QCheckBox(GroupCoincident, "SelectAllCB");
216 SelectAllCB->setText(tr("SELECT_ALL"));
217 GroupCoincidentLayout->addWidget(SelectAllCB, 2, 0);
219 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupCoincident, 2, 0);
221 // Controls for editing group of nodes
222 GroupEdit = new QGroupBox(this, "GroupEdit");
223 GroupEdit->setTitle(tr("EDIT_GROUP_OF_NODES"));
224 GroupEdit->setColumnLayout(0, Qt::Vertical);
225 GroupEdit->layout()->setSpacing(0);
226 GroupEdit->layout()->setMargin(0);
227 QGridLayout* GroupEditLayout = new QGridLayout(GroupEdit->layout());
228 GroupEditLayout->setAlignment(Qt::AlignTop);
229 GroupEditLayout->setSpacing(6);
230 GroupEditLayout->setMargin(11);
232 ListEdit = new QListBox(GroupEdit, "ListEdit");
233 ListEdit->setColumnMode(QListBox::FitToHeight);
234 ListEdit->setSelectionMode(QListBox::Extended);
235 GroupEditLayout->addMultiCellWidget(ListEdit, 0, 2, 0, 0);
237 QPushButton* AddButton = new QPushButton(GroupEdit, "AddButton");
238 AddButton->setText(tr("SMESH_BUT_ADD"));
239 GroupEditLayout->addWidget(AddButton, 0, 1);
241 QPushButton* RemoveButton = new QPushButton(GroupEdit, "RemoveButton");
242 RemoveButton->setText(tr("SMESH_BUT_REMOVE"));
243 GroupEditLayout->addWidget(RemoveButton, 1, 1);
245 QSpacerItem* spacer = new QSpacerItem(20, 200, QSizePolicy::Minimum, QSizePolicy::Expanding);
246 GroupEditLayout->addItem(spacer, 2, 1);
248 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupEdit, 3, 0);
250 /* Initialisations */
251 SpinBoxTolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.1, 3);
252 SpinBoxTolerance->SetValue(1e-05);
254 RadioButton1->setChecked(TRUE);
256 myEditCurrentArgument = (QWidget*)LineEditMesh;
260 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
262 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
264 myMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
266 /* signals and slots connections */
267 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
268 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
269 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
270 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
272 connect(SelectMeshButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
273 connect(DetectButton, SIGNAL (clicked()), this, SLOT(onDetect()));
274 connect(ListCoincident, SIGNAL (selectionChanged()), this, SLOT(onSelectNodesGroup()));
275 connect(ListCoincident, SIGNAL (pressed(QListViewItem*)), this, SLOT(updateControls()));
276 connect(ListCoincident, SIGNAL (currentChanged(QListViewItem*)), this, SLOT(updateControls()));
277 connect(SelectAllCB, SIGNAL(toggled(bool)), this, SLOT(onSelectAll(bool)));
278 connect(ListEdit, SIGNAL (selectionChanged()), this, SLOT(onSelectNodesFromGroup()));
279 connect(AddButton, SIGNAL (clicked()), this, SLOT(onAdd()));
280 connect(RemoveButton, SIGNAL (clicked()), this, SLOT(onRemove()));
282 connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
283 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
284 /* to close dialog if study change */
285 connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
287 this->show(); /* displays Dialog */
290 buttonOk->setEnabled(false);
291 buttonApply->setEnabled(false);
293 // Init Mesh field from selection
294 SelectionIntoArgument();
296 myHelpFileName = "/files/merging_nodes.htm";
299 //=================================================================================
300 // function : ~SMESHGUI_MergeNodesDlg()
301 // purpose : Destroys the object and frees any allocated resources
302 //=================================================================================
303 SMESHGUI_MergeNodesDlg::~SMESHGUI_MergeNodesDlg()
305 // no need to delete child widgets, Qt does it all for us
308 //=================================================================================
309 // function : ClickOnApply()
311 //=================================================================================
312 bool SMESHGUI_MergeNodesDlg::ClickOnApply()
314 if (mySMESHGUI->isActiveStudyLocked() || myMesh->_is_nil())
318 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
320 QApplication::setOverrideCursor(Qt::waitCursor);
321 SMESH::array_of_long_array_var aGroupsOfNodes = new SMESH::array_of_long_array;
322 aGroupsOfNodes->length(ListCoincident->childCount());
323 QListViewItem* item = ListCoincident->firstChild();
327 QStringList aListIds = QStringList("");
328 if (((QCheckListItem*) item)->isOn())
329 aListIds = QStringList::split(" ", item->text(0), false);
331 SMESH::long_array_var anIds = new SMESH::long_array;
332 anIds->length(aListIds.count());
334 for (int i = 0; i < aListIds.count(); i++)
335 anIds[i] = aListIds[i].toInt();
337 aGroupsOfNodes[anArrayNum++] = anIds.inout();
339 item = item->itemBelow();
342 aMeshEditor->MergeNodes (aGroupsOfNodes.inout());
343 QApplication::restoreOverrideCursor();
347 //mySelectionMgr->clearSelected();
354 //=================================================================================
355 // function : ClickOnOk()
357 //=================================================================================
358 void SMESHGUI_MergeNodesDlg::ClickOnOk()
364 //=================================================================================
365 // function : ClickOnCancel()
367 //=================================================================================
368 void SMESHGUI_MergeNodesDlg::ClickOnCancel()
370 mySelectionMgr->clearFilters();
371 //mySelectionMgr->clearSelected();
372 SMESH::SetPointRepresentation(false);
373 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
374 aViewWindow->SetSelectionMode(ActorSelection);
375 disconnect(mySelectionMgr, 0, this, 0);
376 mySMESHGUI->ResetState();
380 //=================================================================================
381 // function : ClickOnHelp()
383 //=================================================================================
384 void SMESHGUI_MergeNodesDlg::ClickOnHelp()
386 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
388 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
390 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
391 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
392 arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName),
393 QObject::tr("BUT_OK"));
397 //=================================================================================
398 // function : onEditNodesGroup()
400 //=================================================================================
401 void SMESHGUI_MergeNodesDlg::onEditNodesGroup()
403 if (ListCoincident->childCount() < 1)
406 QString aNewIds = "";
408 QListBoxItem* anItem;
409 for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next())
410 aNewIds+=QString(" %1").arg(anItem->text());
412 ListCoincident->currentItem()->setText(0, aNewIds);
415 //=================================================================================
416 // function : updateControls()
418 //=================================================================================
419 void SMESHGUI_MergeNodesDlg::updateControls()
421 if (ListCoincident->childCount() < 1) {
422 SMESH::SetPointRepresentation(false);
423 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
424 aViewWindow->SetSelectionMode(ActorSelection);
428 bool hasChecked = false, hasUnchecked = false;
430 QListViewItem* item = ListCoincident->firstChild();
432 while (item && (!hasChecked || !hasUnchecked)) {
433 if (((QCheckListItem*) item)->isOn())
438 item = item->itemBelow();
442 SelectAllCB->setChecked(false);
444 bool enable = !(myMesh->_is_nil()) && hasChecked;
446 buttonOk->setEnabled(enable);
447 buttonApply->setEnabled(enable);
450 //=================================================================================
451 // function : onDetect()
453 //=================================================================================
454 void SMESHGUI_MergeNodesDlg::onDetect()
456 if (myMesh->_is_nil())
460 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
462 QApplication::setOverrideCursor(Qt::waitCursor);
463 ListCoincident->clear();
466 SMESH::array_of_long_array_var aNodeGroups;
467 aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aNodeGroups);
469 for (int i = 0; i < aNodeGroups->length(); i++) {
470 SMESH::long_array& aGroup = aNodeGroups[i];
473 for (int j = 0; j < aGroup.length(); j++)
474 aNodeIds+=QString(" %1").arg(aGroup[j]);
476 new QCheckListItem (ListCoincident, aNodeIds, QCheckListItem::CheckBox);
478 QApplication::restoreOverrideCursor();
485 //=================================================================================
486 // function : onSelectNodesGroup()
488 //=================================================================================
489 void SMESHGUI_MergeNodesDlg::onSelectNodesGroup()
494 myEditCurrentArgument = (QWidget*)ListCoincident;
496 QListViewItem* aSelectedItem = ListCoincident->selectedItem();
500 QStringList aListId = QStringList::split(" ", aSelectedItem->text(0), false);
503 ListEdit->insertStringList(aListId);
505 //mySelectionMgr->clearSelected();
506 //mySelectionMgr->AddIObject(myActor->getIO());
508 aList.Append(myActor->getIO());
509 mySelectionMgr->setSelectedObjects(aList, false);
511 SMESH::SetPointRepresentation(true);
512 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
513 aViewWindow->SetSelectionMode(NodeSelection);
515 ListEdit->selectAll(true);
518 //=================================================================================
519 // function : onSelectAll()
521 //=================================================================================
522 void SMESHGUI_MergeNodesDlg::onSelectAll (bool isToggled)
526 QListViewItem* item = ListCoincident->firstChild();
529 if (!((QCheckListItem*) item)->isOn())
530 ((QCheckListItem*) item)->setOn(true);
531 item = item->itemBelow();
535 buttonOk->setEnabled(true);
536 buttonApply->setEnabled(true);
541 //=================================================================================
542 // function : onSelectNodesFromGroup()
544 //=================================================================================
545 void SMESHGUI_MergeNodesDlg::onSelectNodesFromGroup()
550 TColStd_MapOfInteger aIndexes;
551 QListBoxItem* anItem;
552 for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next()) {
553 if (anItem->isSelected()) {
554 int anId = anItem->text().toInt();
559 mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false);
561 aList.Append(myActor->getIO());
562 mySelectionMgr->setSelectedObjects(aList);
565 //=================================================================================
566 // function : onAdd()
568 //=================================================================================
569 void SMESHGUI_MergeNodesDlg::onAdd()
574 QString aListStr = "";
577 aNbNnodes = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
581 QStringList aNodes = QStringList::split(" ", aListStr);
582 QListBoxItem* anItem = 0;
584 for (QStringList::iterator it = aNodes.begin(); it != aNodes.end(); ++it) {
585 anItem = ListEdit->findItem(*it, Qt::ExactMatch);
587 anItem = new QListBoxText(*it);
588 ListEdit->insertItem(anItem);
590 ListEdit->setSelected(anItem, true);
596 //=================================================================================
597 // function : onRemove()
599 //=================================================================================
600 void SMESHGUI_MergeNodesDlg::onRemove()
602 if (myEditCurrentArgument != (QWidget*)ListCoincident)
605 for (int i = ListEdit->count(); i > 0; i--) {
606 if (ListEdit->isSelected(i-1))
607 ListEdit->removeItem(i-1);
612 //=================================================================================
613 // function : SetEditCurrentArgument()
615 //=================================================================================
616 void SMESHGUI_MergeNodesDlg::SetEditCurrentArgument()
618 QPushButton* send = (QPushButton*)sender();
620 disconnect(mySelectionMgr, 0, this, 0);
621 mySelectionMgr->clearSelected();
622 mySelectionMgr->clearFilters();
624 if (send == SelectMeshButton) {
625 myEditCurrentArgument = (QWidget*)LineEditMesh;
626 SMESH::SetPointRepresentation(false);
627 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
628 aViewWindow->SetSelectionMode(ActorSelection);
629 mySelectionMgr->installFilter(myMeshOrSubMeshFilter);
632 myEditCurrentArgument->setFocus();
633 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
634 SelectionIntoArgument();
637 //=================================================================================
638 // function : SelectionIntoArgument()
639 // purpose : Called when selection as changed or other case
640 //=================================================================================
641 void SMESHGUI_MergeNodesDlg::SelectionIntoArgument()
643 if (myEditCurrentArgument == (QWidget*)LineEditMesh) {
644 QString aString = "";
645 LineEditMesh->setText(aString);
647 ListCoincident->clear();
650 int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
655 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
657 Handle(SALOME_InteractiveObject) IO = aList.First();
658 myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
659 myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
660 if (myMesh->_is_nil() || !myActor)
663 LineEditMesh->setText(aString);
667 //=================================================================================
668 // function : DeactivateActiveDialog()
670 //=================================================================================
671 void SMESHGUI_MergeNodesDlg::DeactivateActiveDialog()
673 if (GroupConstructors->isEnabled()) {
674 GroupConstructors->setEnabled(false);
675 GroupMesh->setEnabled(false);
676 GroupCoincident->setEnabled(false);
677 GroupEdit->setEnabled(false);
678 GroupButtons->setEnabled(false);
679 mySMESHGUI->ResetState();
680 mySMESHGUI->SetActiveDialogBox(0);
684 //=================================================================================
685 // function : ActivateThisDialog()
687 //=================================================================================
688 void SMESHGUI_MergeNodesDlg::ActivateThisDialog()
690 /* Emit a signal to deactivate the active dialog */
691 mySMESHGUI->EmitSignalDeactivateDialog();
692 GroupConstructors->setEnabled(true);
693 GroupMesh->setEnabled(true);
694 GroupCoincident->setEnabled(true);
695 GroupEdit->setEnabled(true);
696 GroupButtons->setEnabled(true);
698 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
700 SelectionIntoArgument();
703 //=================================================================================
704 // function : enterEvent()
706 //=================================================================================
707 void SMESHGUI_MergeNodesDlg::enterEvent (QEvent*)
709 if (!GroupConstructors->isEnabled())
710 ActivateThisDialog();
713 //=================================================================================
714 // function : closeEvent()
716 //=================================================================================
717 void SMESHGUI_MergeNodesDlg::closeEvent (QCloseEvent*)
719 /* same than click on cancel button */
723 //=======================================================================
724 //function : hideEvent()
725 //purpose : caused by ESC key
726 //=======================================================================
727 void SMESHGUI_MergeNodesDlg::hideEvent (QHideEvent*)
733 //=================================================================================
734 // function : keyPressEvent()
736 //=================================================================================
737 void SMESHGUI_MergeNodesDlg::keyPressEvent( QKeyEvent* e )
739 QDialog::keyPressEvent( e );
740 if ( e->isAccepted() )
743 if ( e->key() == Key_F1 )