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
22 // File : SMESHGUI_SmoothingDlg.cxx
23 // Author : Michael ZORIN, Open CASCADE S.A.S.
27 #include "SMESHGUI_SmoothingDlg.h"
30 #include "SMESHGUI_Utils.h"
31 #include "SMESHGUI_VTKUtils.h"
32 #include "SMESHGUI_MeshUtils.h"
33 #include "SMESHGUI_SpinBox.h"
34 #include "SMESHGUI_IdValidator.h"
36 #include <SMESH_Actor.h>
37 #include <SMESH_TypeFilter.hxx>
38 #include <SMESH_LogicalFilter.hxx>
40 #include <SMDS_Mesh.hxx>
42 // SALOME GUI includes
43 #include <SUIT_ResourceMgr.h>
44 #include <SUIT_OverrideCursor.h>
45 #include <SUIT_Desktop.h>
46 #include <SUIT_Session.h>
47 #include <SUIT_MessageBox.h>
49 #include <LightApp_Application.h>
50 #include <LightApp_SelectionMgr.h>
52 #include <SalomeApp_IntSpinBox.h>
54 #include <SVTK_ViewModel.h>
55 #include <SVTK_Selector.h>
56 #include <SVTK_ViewWindow.h>
57 #include <SVTK_Selection.h>
58 #include <SALOME_ListIO.hxx>
61 #include <TColStd_MapOfInteger.hxx>
64 #include <QApplication>
68 #include <QPushButton>
69 #include <QRadioButton>
72 #include <QHBoxLayout>
73 #include <QVBoxLayout>
74 #include <QGridLayout>
76 #include <QButtonGroup>
79 #include <SALOMEconfig.h>
80 #include CORBA_SERVER_HEADER(SMESH_Group)
81 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
86 //=================================================================================
87 // function : SMESHGUI_SmoothingDlg()
88 // purpose : constructor
89 //=================================================================================
90 SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
91 : QDialog( SMESH::GetDesktop( theModule ) ),
92 mySMESHGUI( theModule ),
93 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
94 mySelectedObject(SMESH::SMESH_IDSource::_nil())
96 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
97 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
100 setAttribute(Qt::WA_DeleteOnClose, true);
101 setWindowTitle(tr("SMESH_SMOOTHING"));
102 setSizeGripEnabled(true);
104 /***************************************************************/
105 QVBoxLayout* SMESHGUI_SmoothingDlgLayout = new QVBoxLayout(this);
106 SMESHGUI_SmoothingDlgLayout->setSpacing(SPACING);
107 SMESHGUI_SmoothingDlgLayout->setMargin(MARGIN);
109 /***************************************************************/
110 GroupConstructors = new QGroupBox(tr("SMESH_SMOOTHING"), this);
111 QButtonGroup* ButtonGroup = new QButtonGroup(this);
112 QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors);
113 GroupConstructorsLayout->setSpacing(SPACING);
114 GroupConstructorsLayout->setMargin(MARGIN);
116 Constructor1 = new QRadioButton(GroupConstructors);
117 Constructor1->setIcon(image0);
118 Constructor1->setChecked(true);
119 GroupConstructorsLayout->addWidget(Constructor1);
120 ButtonGroup->addButton(Constructor1, 0);
122 /***************************************************************/
123 GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this);
124 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
125 GroupArgumentsLayout->setSpacing(SPACING);
126 GroupArgumentsLayout->setMargin(MARGIN);
128 myIdValidator = new SMESHGUI_IdValidator(this);
130 // Controls for elements selection
131 TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
133 SelectElementsButton = new QPushButton(GroupArguments);
134 SelectElementsButton->setIcon(image1);
136 LineEditElements = new QLineEdit(GroupArguments);
137 LineEditElements->setValidator(myIdValidator);
139 // Control for the whole mesh selection
140 CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
142 // Controls for nodes selection
143 TextLabelNodes = new QLabel(tr("FIXED_NODES_IDS"), GroupArguments);
145 SelectNodesButton = new QPushButton(GroupArguments);
146 SelectNodesButton->setIcon(image1);
148 LineEditNodes = new QLineEdit(GroupArguments);
149 LineEditNodes->setValidator(myIdValidator);
151 // Controls for method selection
152 TextLabelMethod = new QLabel(tr("METHOD"), GroupArguments);
154 ComboBoxMethod = new QComboBox(GroupArguments);
156 // Controls for iteration limit defining
157 TextLabelLimit = new QLabel(tr("ITERATION_LIMIT"), GroupArguments);
159 SpinBox_IterationLimit = new SalomeApp_IntSpinBox(GroupArguments);
161 // Controls for max. aspect ratio defining
162 TextLabelAspectRatio = new QLabel(tr("MAX_ASPECT_RATIO"), GroupArguments);
164 SpinBox_AspectRatio = new SMESHGUI_SpinBox(GroupArguments);
166 // Check box "Is Parametric"
167 CheckBoxParametric = new QCheckBox( tr("IS_PARAMETRIC"), GroupArguments );
169 GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
170 GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
171 GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
172 GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 3);
173 GroupArgumentsLayout->addWidget(TextLabelNodes, 2, 0);
174 GroupArgumentsLayout->addWidget(SelectNodesButton, 2, 1);
175 GroupArgumentsLayout->addWidget(LineEditNodes, 2, 2);
176 GroupArgumentsLayout->addWidget(TextLabelMethod, 3, 0);
177 GroupArgumentsLayout->addWidget(ComboBoxMethod, 3, 2);
178 GroupArgumentsLayout->addWidget(TextLabelLimit, 4, 0);
179 GroupArgumentsLayout->addWidget(SpinBox_IterationLimit, 4, 2);
180 GroupArgumentsLayout->addWidget(TextLabelAspectRatio, 5, 0);
181 GroupArgumentsLayout->addWidget(SpinBox_AspectRatio, 5, 2);
182 GroupArgumentsLayout->addWidget(CheckBoxParametric, 6, 0, 1, 3);
184 /***************************************************************/
185 GroupButtons = new QGroupBox(this);
186 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
187 GroupButtonsLayout->setSpacing(SPACING);
188 GroupButtonsLayout->setMargin(MARGIN);
190 buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
191 buttonOk->setAutoDefault(true);
192 buttonOk->setDefault(true);
193 buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
194 buttonApply->setAutoDefault(true);
195 buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
196 buttonCancel->setAutoDefault(true);
197 buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
198 buttonHelp->setAutoDefault(true);
200 GroupButtonsLayout->addWidget(buttonOk);
201 GroupButtonsLayout->addSpacing(10);
202 GroupButtonsLayout->addWidget(buttonApply);
203 GroupButtonsLayout->addSpacing(10);
204 GroupButtonsLayout->addStretch();
205 GroupButtonsLayout->addWidget(buttonCancel);
206 GroupButtonsLayout->addWidget(buttonHelp);
208 /***************************************************************/
209 SMESHGUI_SmoothingDlgLayout->addWidget(GroupConstructors);
210 SMESHGUI_SmoothingDlgLayout->addWidget(GroupArguments);
211 SMESHGUI_SmoothingDlgLayout->addWidget(GroupButtons);
213 /***************************************************************/
214 /* Initialisations */
215 ComboBoxMethod->addItem(tr("LAPLACIAN"));
216 ComboBoxMethod->addItem(tr("CENTROIDAL"));
218 ComboBoxMethod->setCurrentIndex(0);
220 CheckBoxParametric->setChecked( true );
222 SpinBox_IterationLimit->setRange(1, 999999);
223 SpinBox_IterationLimit->setValue(20);
224 SpinBox_AspectRatio->RangeStepAndValidator(0.0, +999999.999, 0.1, 3);
225 SpinBox_AspectRatio->SetValue(1.1);
227 GroupArguments->show();
229 Constructor1->setChecked(true);
231 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
233 mySMESHGUI->SetActiveDialogBox(this);
235 // Costruction of the logical filter for the elements: mesh/sub-mesh/group
236 SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
237 SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
239 QList<SUIT_SelectionFilter*> aListOfFilters;
240 if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
241 if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
243 myMeshOrSubMeshOrGroupFilter =
244 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
246 myHelpFileName = "smoothing_page.html";
250 /***************************************************************/
251 // signals and slots connections
252 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
253 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
254 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
255 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
257 connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
258 connect(SelectNodesButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
259 connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
260 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
261 /* to close dialog if study change */
262 connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
263 connect(LineEditElements, SIGNAL(textChanged(const QString&)),
264 SLOT(onTextChange(const QString&)));
265 connect(LineEditNodes, SIGNAL(textChanged(const QString&)),
266 SLOT(onTextChange(const QString&)));
267 connect(CheckBoxMesh, SIGNAL(toggled(bool)),
268 SLOT(onSelectMesh(bool)));
271 //=================================================================================
272 // function : ~SMESHGUI_SmoothingDlg()
273 // purpose : destructor
274 //=================================================================================
275 SMESHGUI_SmoothingDlg::~SMESHGUI_SmoothingDlg()
277 // no need to delete child widgets, Qt does it all for us
280 //=================================================================================
282 // purpose : initialization
283 //=================================================================================
284 void SMESHGUI_SmoothingDlg::Init()
288 // ComboBoxMethod->setCurrentItem(0);
290 // SpinBox_IterationLimit->setValue(20);
291 // SpinBox_AspectRatio->SetValue(1.1);
293 myEditCurrentArgument = LineEditElements;
294 LineEditElements->setFocus();
295 LineEditElements->clear();
296 LineEditNodes->clear();
301 myMesh = SMESH::SMESH_Mesh::_nil();
303 CheckBoxMesh->setChecked(false);
307 //=================================================================================
308 // function : ClickOnApply()
309 // purpose : Called when user presses <Apply> button
310 //=================================================================================
311 bool SMESHGUI_SmoothingDlg::ClickOnApply()
313 if (mySMESHGUI->isActiveStudyLocked())
319 if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
320 QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
321 QStringList aListNodesId = LineEditNodes->text().split(" ", QString::SkipEmptyParts);
323 SMESH::long_array_var anElementsId = new SMESH::long_array;
324 SMESH::long_array_var aNodesId = new SMESH::long_array;
326 anElementsId->length(aListElementsId.count());
327 for (int i = 0; i < aListElementsId.count(); i++)
328 anElementsId[i] = aListElementsId[i].toInt();
330 if ( myNbOkNodes && aListNodesId.count() > 0 ) {
331 aNodesId->length(aListNodesId.count());
332 for (int i = 0; i < aListNodesId.count(); i++)
333 aNodesId[i] = aListNodesId[i].toInt();
338 long anIterationLimit = (long)SpinBox_IterationLimit->value();
339 double aMaxAspectRatio = SpinBox_AspectRatio->GetValue();
341 QStringList aParameters;
342 aParameters << SpinBox_IterationLimit->text();
343 aParameters << SpinBox_AspectRatio->text();
345 SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH;
346 if (ComboBoxMethod->currentIndex() > 0)
347 aMethod = SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;
349 bool aResult = false;
351 SUIT_OverrideCursor aWaitCursor;
352 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
354 if ( CheckBoxParametric->isChecked() ) {
355 if(CheckBoxMesh->isChecked())
356 aResult = aMeshEditor->SmoothParametricObject(mySelectedObject, aNodesId.inout(),
357 anIterationLimit, aMaxAspectRatio, aMethod);
359 aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
360 anIterationLimit, aMaxAspectRatio, aMethod);
363 if(CheckBoxMesh->isChecked())
364 aResult = aMeshEditor->SmoothObject(mySelectedObject, aNodesId.inout(),
365 anIterationLimit, aMaxAspectRatio, aMethod);
367 aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
368 anIterationLimit, aMaxAspectRatio, aMethod);
371 myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
377 Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
381 mySelectionMgr->setSelectedObjects(aList, false);
385 mySelectedObject = SMESH::SMESH_IDSource::_nil();
392 //=================================================================================
393 // function : ClickOnOk()
394 // purpose : Called when user presses <OK> button
395 //=================================================================================
396 void SMESHGUI_SmoothingDlg::ClickOnOk()
402 //=================================================================================
403 // function : ClickOnCancel()
404 // purpose : Called when dialog box is closed
405 //=================================================================================
406 void SMESHGUI_SmoothingDlg::ClickOnCancel()
408 disconnect(mySelectionMgr, 0, this, 0);
409 mySelectionMgr->clearFilters();
410 //mySelectionMgr->clearSelected();
411 SMESH::SetPickable(); // ???
412 SMESH::SetPointRepresentation(false);
413 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
414 aViewWindow->SetSelectionMode(ActorSelection);
415 mySMESHGUI->ResetState();
419 //=================================================================================
420 // function : ClickOnHelp()
422 //=================================================================================
423 void SMESHGUI_SmoothingDlg::ClickOnHelp()
425 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
427 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
431 platform = "winapplication";
433 platform = "application";
435 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
436 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
437 arg(app->resourceMgr()->stringValue("ExternalBrowser",
439 arg(myHelpFileName));
443 //=======================================================================
444 // function : onTextChange()
446 //=======================================================================
447 void SMESHGUI_SmoothingDlg::onTextChange (const QString& theNewText)
449 QLineEdit* send = (QLineEdit*)sender();
457 if (send == LineEditElements)
459 else if (send == LineEditNodes)
462 buttonOk->setEnabled(false);
463 buttonApply->setEnabled(false);
465 // hilight entered elements/nodes
466 SMDS_Mesh* aMesh = 0;
468 aMesh = myActor->GetObject()->GetMesh();
472 QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
474 if (send == LineEditElements) {
475 const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO();
476 TColStd_MapOfInteger newIndices;
477 for (int i = 0; i < aListId.count(); i++) {
478 const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
480 newIndices.Add(e->GetID());
483 mySelector->AddOrRemoveIndex(anIO, newIndices, false);
484 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
485 aViewWindow->highlight( anIO, true, true );
486 myElementsId = theNewText;
488 } else if (send == LineEditNodes) {
489 TColStd_MapOfInteger newIndices;
491 for (int i = 0; i < aListId.count(); i++) {
492 const SMDS_MeshNode * n = aMesh->FindNode(aListId[ i ].toInt());
494 newIndices.Add(n->GetID());
497 mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
498 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
499 aViewWindow->highlight( myActor->getIO(), true, true );
503 if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
504 buttonOk->setEnabled(true);
505 buttonApply->setEnabled(true);
511 //=================================================================================
512 // function : SelectionIntoArgument()
513 // purpose : Called when selection as changed or other case
514 //=================================================================================
515 void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
520 QString aString = "";
523 if (myEditCurrentArgument == (QWidget*)LineEditElements) {
524 LineEditElements->setText(aString);
526 buttonOk->setEnabled(false);
527 buttonApply->setEnabled(false);
532 if (!GroupButtons->isEnabled()) // inactive
537 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
538 int nbSel = aList.Extent();
542 Handle(SALOME_InteractiveObject) IO = aList.First();
543 myMesh = SMESH::GetMeshByIO(IO);
544 if (myMesh->_is_nil())
547 myActor = SMESH::FindActorByObject(myMesh);
553 if (myEditCurrentArgument == LineEditElements) {
556 if (CheckBoxMesh->isChecked()) {
557 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
559 if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
560 mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
564 aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
565 myElementsId = aString;
569 } else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myActor) {
571 aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
576 myEditCurrentArgument->setText(aString);
580 if (myEditCurrentArgument == LineEditElements)
581 myNbOkElements = true;
582 else if (myEditCurrentArgument == LineEditNodes)
585 if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
586 buttonOk->setEnabled(true);
587 buttonApply->setEnabled(true);
591 //=================================================================================
592 // function : SetEditCurrentArgument()
594 //=================================================================================
595 void SMESHGUI_SmoothingDlg::SetEditCurrentArgument()
597 QPushButton* send = (QPushButton*)sender();
599 switch (myConstructorId) {
600 case 0: /* default constructor */
602 disconnect(mySelectionMgr, 0, this, 0);
603 mySelectionMgr->clearSelected();
604 mySelectionMgr->clearFilters();
606 if (send == SelectElementsButton) {
607 myEditCurrentArgument = LineEditElements;
608 SMESH::SetPointRepresentation(false);
609 if (CheckBoxMesh->isChecked()) {
610 // mySelectionMgr->setSelectionModes(ActorSelection);
611 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
612 aViewWindow->SetSelectionMode(ActorSelection);
613 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
615 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
616 aViewWindow->SetSelectionMode(FaceSelection);
618 } else if (send == SelectNodesButton) {
619 LineEditNodes->clear();
620 myEditCurrentArgument = LineEditNodes;
621 SMESH::SetPointRepresentation(true);
622 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
623 aViewWindow->SetSelectionMode(NodeSelection);
627 myEditCurrentArgument->setFocus();
628 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
629 SelectionIntoArgument();
635 //=================================================================================
636 // function : DeactivateActiveDialog()
637 // purpose : Deactivates this dialog
638 //=================================================================================
639 void SMESHGUI_SmoothingDlg::DeactivateActiveDialog()
641 if (GroupConstructors->isEnabled()) {
642 GroupConstructors->setEnabled(false);
643 GroupArguments->setEnabled(false);
644 GroupButtons->setEnabled(false);
645 mySMESHGUI->ResetState();
646 mySMESHGUI->SetActiveDialogBox(0);
650 //=================================================================================
651 // function : ActivateThisDialog()
652 // purpose : Activates this dialog
653 //=================================================================================
654 void SMESHGUI_SmoothingDlg::ActivateThisDialog()
656 // Emit a signal to deactivate the active dialog
657 mySMESHGUI->EmitSignalDeactivateDialog();
658 GroupConstructors->setEnabled(true);
659 GroupArguments->setEnabled(true);
660 GroupButtons->setEnabled(true);
662 mySMESHGUI->SetActiveDialogBox(this);
663 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
664 aViewWindow->SetSelectionMode(FaceSelection);
665 SelectionIntoArgument();
668 //=================================================================================
669 // function : enterEvent()
670 // purpose : Mouse enter event
671 //=================================================================================
672 void SMESHGUI_SmoothingDlg::enterEvent (QEvent*)
674 if (!GroupConstructors->isEnabled())
675 ActivateThisDialog();
678 //=================================================================================
679 // function : closeEvent()
681 //=================================================================================
682 void SMESHGUI_SmoothingDlg::closeEvent (QCloseEvent*)
684 /* same than click on cancel button */
688 //=======================================================================
689 // function : hideEvent()
690 // purpose : caused by ESC key
691 //=======================================================================
692 void SMESHGUI_SmoothingDlg::hideEvent (QHideEvent*)
698 //=======================================================================
699 // function : onSelectMesh()
701 //=======================================================================
702 void SMESHGUI_SmoothingDlg::onSelectMesh (bool toSelectMesh)
705 TextLabelElements->setText(tr("SMESH_NAME"));
707 TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
709 if (myEditCurrentArgument != LineEditElements) {
710 LineEditElements->clear();
714 mySelectionMgr->clearFilters();
715 SMESH::SetPointRepresentation(false);
718 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
719 aViewWindow->SetSelectionMode(ActorSelection);
720 // mySelectionMgr->setSelectionModes(ActorSelection);
721 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
722 LineEditElements->setReadOnly(true);
723 LineEditElements->setValidator(0);
725 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
726 aViewWindow->SetSelectionMode(FaceSelection);
727 LineEditElements->setReadOnly(false);
728 LineEditElements->setValidator(myIdValidator);
729 onTextChange(LineEditElements->text());
732 SelectionIntoArgument();
735 //=================================================================================
736 // function : keyPressEvent()
738 //=================================================================================
739 void SMESHGUI_SmoothingDlg::keyPressEvent( QKeyEvent* e )
741 QDialog::keyPressEvent( e );
742 if ( e->isAccepted() )
745 if ( e->key() == Qt::Key_F1 ) {
751 //=================================================================================
752 // function : isValid
754 //=================================================================================
755 bool SMESHGUI_SmoothingDlg::isValid()
759 ok = SpinBox_IterationLimit->isValid( msg, true ) && ok;
760 ok = SpinBox_AspectRatio->isValid( msg, true ) && ok;
763 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
764 if ( !msg.isEmpty() )
766 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );