-// SMESH SMESHGUI : GUI for SMESH component
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_SmoothingDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S.
-//
-
// SMESH includes
+//
#include "SMESHGUI_SmoothingDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myFilterDlg(0)
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
GroupArgumentsLayout->setSpacing(SPACING);
GroupArgumentsLayout->setMargin(MARGIN);
+ myIdValidator = new SMESHGUI_IdValidator(this);
+
// Controls for elements selection
TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
SelectElementsButton->setIcon(image1);
LineEditElements = new QLineEdit(GroupArguments);
- LineEditElements->setValidator(new SMESHGUI_IdValidator(this));
+ LineEditElements->setValidator(myIdValidator);
+ QPushButton* filterElemBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+ connect(filterElemBtn, SIGNAL(clicked()), this, SLOT(setElemFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
SelectNodesButton->setIcon(image1);
LineEditNodes = new QLineEdit(GroupArguments);
- LineEditNodes->setValidator(new SMESHGUI_IdValidator(this));
+ LineEditNodes->setValidator(myIdValidator);
+ QPushButton* filterNodeBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+ connect(filterNodeBtn, SIGNAL(clicked()), this, SLOT(setNodeFilters()));
// Controls for method selection
TextLabelMethod = new QLabel(tr("METHOD"), GroupArguments);
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
- GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 3);
+ GroupArgumentsLayout->addWidget(filterElemBtn, 0, 3);
+ GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelNodes, 2, 0);
GroupArgumentsLayout->addWidget(SelectNodesButton, 2, 1);
GroupArgumentsLayout->addWidget(LineEditNodes, 2, 2);
+ GroupArgumentsLayout->addWidget(filterNodeBtn, 2, 3);
GroupArgumentsLayout->addWidget(TextLabelMethod, 3, 0);
- GroupArgumentsLayout->addWidget(ComboBoxMethod, 3, 2);
+ GroupArgumentsLayout->addWidget(ComboBoxMethod, 3, 2, 1, 2);
GroupArgumentsLayout->addWidget(TextLabelLimit, 4, 0);
- GroupArgumentsLayout->addWidget(SpinBox_IterationLimit, 4, 2);
+ GroupArgumentsLayout->addWidget(SpinBox_IterationLimit, 4, 2, 1, 2);
GroupArgumentsLayout->addWidget(TextLabelAspectRatio, 5, 0);
- GroupArgumentsLayout->addWidget(SpinBox_AspectRatio, 5, 2);
- GroupArgumentsLayout->addWidget(CheckBoxParametric, 6, 0, 1, 3);
+ GroupArgumentsLayout->addWidget(SpinBox_AspectRatio, 5, 2, 1, 2);
+ GroupArgumentsLayout->addWidget(CheckBoxParametric, 6, 0, 1, 4);
/***************************************************************/
GroupButtons = new QGroupBox(this);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
SMESHGUI_SmoothingDlg::~SMESHGUI_SmoothingDlg()
{
// no need to delete child widgets, Qt does it all for us
+ if ( myFilterDlg != 0 ) {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ }
}
//=================================================================================
if (mySMESHGUI->isActiveStudyLocked())
return;
- if (myNbOkElements &&
- (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
+ if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
QStringList aListNodesId = LineEditNodes->text().split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListElementsId.count(); i++)
anElementsId[i] = aListElementsId[i].toInt();
- if (myNbOkNodes) {
+ if ( myNbOkNodes && aListNodesId.count() > 0 ) {
aNodesId->length(aListNodesId.count());
for (int i = 0; i < aListNodesId.count(); i++)
aNodesId[i] = aListNodesId[i].toInt();
bool aResult = false;
try {
+ SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- QApplication::setOverrideCursor(Qt::WaitCursor);
+
if ( CheckBoxParametric->isChecked() )
aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
anIterationLimit, aMaxAspectRatio, aMethod);
else
aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
anIterationLimit, aMaxAspectRatio, aMethod);
- QApplication::restoreOverrideCursor();
} catch (...) {
}
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
- SMESH::SetPickable(); // ???
- SMESH::SetPointRepresentation(false);
+ if (SMESH::GetCurrentVtkView()) {
+ SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+ SMESH::SetPointRepresentation(false);
+ SMESH::SetPickable();
+ }
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
if (myBusy) return;
// clear
- myActor = 0;
QString aString = "";
myBusy = true;
- if (myEditCurrentArgument == (QWidget*)LineEditElements) {
- LineEditElements->setText(aString);
- myNbOkElements = 0;
+ if (myEditCurrentArgument == LineEditElements ||
+ myEditCurrentArgument == LineEditNodes) {
+ myEditCurrentArgument->setText(aString);
+ if (myEditCurrentArgument == LineEditElements)
+ myNbOkElements = 0;
+ else
+ myNbOkNodes = 0;
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
+ myActor = 0;
}
myBusy = false;
myBusy = true;
myEditCurrentArgument->setText(aString);
+ myEditCurrentArgument->repaint();
+ myEditCurrentArgument->setEnabled(false); // to update lineedit IPAL 19809
+ myEditCurrentArgument->setEnabled(true);
myBusy = false;
// OK
if (myEditCurrentArgument == LineEditElements)
- myNbOkElements = true;
+ myNbOkElements = aNbUnits;
else if (myEditCurrentArgument == LineEditNodes)
- myNbOkNodes = true;
+ myNbOkNodes = aNbUnits;
- if (myNbOkElements) {
+ if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
}
myEditCurrentArgument = LineEditElements;
SMESH::SetPointRepresentation(false);
if (CheckBoxMesh->isChecked()) {
- mySelectionMgr->setSelectionModes(ActorSelection);
- mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+ // mySelectionMgr->setSelectionModes(ActorSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
+ mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
} else {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(FaceSelection);
}
- } else if (send == SelectNodesButton) {
+ } else if (send == SelectNodesButton) {
+ LineEditNodes->clear();
myEditCurrentArgument = LineEditNodes;
SMESH::SetPointRepresentation(true);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
aViewWindow->SetSelectionMode(NodeSelection);
+ }
}
myEditCurrentArgument->setFocus();
mySMESHGUI->SetActiveDialogBox(this);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(FaceSelection);
SelectionIntoArgument();
}
else
TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
- if (myEditCurrentArgument != LineEditElements) {
+ if (myEditCurrentArgument != LineEditElements &&
+ myEditCurrentArgument != LineEditNodes) {
LineEditElements->clear();
+ LineEditNodes->clear();
return;
}
SMESH::SetPointRepresentation(false);
if (toSelectMesh) {
- mySelectionMgr->setSelectionModes(ActorSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
+ // mySelectionMgr->setSelectionModes(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
- LineEditElements->setReadOnly(true);
+ myEditCurrentArgument->setReadOnly(true);
+ myEditCurrentArgument->setValidator(0);
} else {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
- LineEditElements->setReadOnly(false);
- onTextChange(LineEditElements->text());
+ aViewWindow->SetSelectionMode(myEditCurrentArgument == LineEditElements ? FaceSelection
+ : NodeSelection );
+ myEditCurrentArgument->setReadOnly(false);
+ LineEditElements->setValidator(myIdValidator);
+ onTextChange(myEditCurrentArgument->text());
}
SelectionIntoArgument();
ClickOnHelp();
}
}
+
+//=================================================================================
+// function : setFilters()
+// purpose : activate filter dialog
+//=================================================================================
+void SMESHGUI_SmoothingDlg::setFilters( const bool theIsElem )
+{
+ if ( !myFilterDlg )
+ {
+ QList<int> types;
+ types.append( SMESH::NODE );
+ types.append( SMESH::ALL );
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
+ }
+ myFilterDlg->Init( theIsElem ? SMESH::ALL : SMESH::NODE );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( theIsElem ? LineEditElements : LineEditNodes );
+
+ myFilterDlg->show();
+}
+
+//=================================================================================
+// function : setElemFilters()
+// purpose : SLOT. Called when element "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_SmoothingDlg::setElemFilters()
+{
+ setFilters( true );
+}
+
+//=================================================================================
+// function : setNodeFilters()
+// purpose : SLOT. Called when node "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_SmoothingDlg::setNodeFilters()
+{
+ setFilters( false );
+}