-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myFilterDlg(0),
- mySelectedObject(SMESH::SMESH_IDSource::_nil())
+ mySelectedObject(SMESH::SMESH_IDSource::_nil()),
+ myFilterDlg(0)
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
// Costruction of the logical filter for the elements: mesh/sub-mesh/group
QList<SUIT_SelectionFilter*> aListOfFilters;
- aListOfFilters << new SMESH_TypeFilter(MESHorSUBMESH) << new SMESH_TypeFilter(GROUP);
+ aListOfFilters << new SMESH_TypeFilter(SMESH::MESHorSUBMESH) << new SMESH_TypeFilter(SMESH::GROUP);
myMeshOrSubMeshOrGroupFilter =
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
- myHelpFileName = "smoothing_page.html";
+ myHelpFileName = "smoothing.html";
Init();
/***************************************************************/
// signals and slots connections
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
- connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* to close dialog if study change */
- connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+ connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject()));
+ connect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView()));
+ connect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView()));
connect(LineEditElements, SIGNAL(textChanged(const QString&)),
SLOT(onTextChange(const QString&)));
connect(LineEditNodes, SIGNAL(textChanged(const QString&)),
//=================================================================================
bool SMESHGUI_SmoothingDlg::ClickOnApply()
{
- if (mySMESHGUI->isActiveStudyLocked())
+ if (SMESHGUI::isStudyLocked())
return false;
if (!isValid())
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+ myMesh->SetParameters( aParameters.join(":").toUtf8().constData() );
if ( CheckBoxParametric->isChecked() ) {
if(CheckBoxMesh->isChecked())
if (aResult) {
SMESH::Update(myIO, SMESH::eDisplay);
+ SMESH::RepaintCurrentView();
SMESHGUI::Modified();
- Init();
+ //Init();
- mySelectedObject = SMESH::SMESH_IDSource::_nil();
+ //mySelectedObject = SMESH::SMESH_IDSource::_nil();
}
}
void SMESHGUI_SmoothingDlg::ClickOnOk()
{
if( ClickOnApply() )
- ClickOnCancel();
+ reject();
}
//=================================================================================
-// function : ClickOnCancel()
+// function : reject()
// purpose : Called when dialog box is closed
//=================================================================================
-void SMESHGUI_SmoothingDlg::ClickOnCancel()
+void SMESHGUI_SmoothingDlg::reject()
{
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
- reject();
+ QDialog::reject();
+}
+
+//=================================================================================
+// function : onOpenView()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::onOpenView()
+{
+ if ( mySelector ) {
+ SMESH::SetPointRepresentation(false);
+ }
+ else {
+ mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
+ ActivateThisDialog();
+ }
+}
+
+//=================================================================================
+// function : onCloseView()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::onCloseView()
+{
+ DeactivateActiveDialog();
+ mySelector = 0;
}
//=================================================================================
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
- // hilight entered elements/nodes
+ // highlight entered elements/nodes
SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
//=================================================================================
// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
+// purpose : Called when selection has changed or other cases
//=================================================================================
void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
{
if (myBusy) return;
+ if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
// clear
QString aString = "";
BusyLocker lock( myBusy );
if (myEditCurrentArgument == LineEditElements ||
- myEditCurrentArgument == LineEditNodes) {
+ myEditCurrentArgument == LineEditNodes)
+ {
myEditCurrentArgument->setText(aString);
if (myEditCurrentArgument == LineEditElements) {
myNbOkElements = 0;
// get selected mesh
SALOME_ListIO aList;
- mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+ mySelectionMgr->selectedObjects(aList);
int nbSel = aList.Extent();
- if (nbSel != 1)
- return;
-
- Handle(SALOME_InteractiveObject) IO = aList.First();
-
- if (myEditCurrentArgument == LineEditElements) {
- myMesh = SMESH::GetMeshByIO(IO);
- if (myMesh->_is_nil())
- return;
- myIO = IO;
- myActor = SMESH::FindActorByObject(myMesh);
-
- if (CheckBoxMesh->isChecked()) {
- SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+ if (nbSel == 1)
+ {
+ Handle(SALOME_InteractiveObject) IO = aList.First();
- SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( myIO );
- if ( !CORBA::is_nil( obj ) )
- mySelectedObject = obj;
- else
+ if (myEditCurrentArgument == LineEditElements) {
+ myMesh = SMESH::GetMeshByIO(IO);
+ if (myMesh->_is_nil())
return;
- myNbOkElements = true;
- } else {
- // get indices of selected elements
- TColStd_IndexedMapOfInteger aMapIndex;
- mySelector->GetIndex(IO,aMapIndex);
- myNbOkElements = aMapIndex.Extent();
+ myIO = IO;
+ myActor = SMESH::FindActorByObject(myMesh);
- if (myNbOkElements < 1)
- return;
-
- QStringList elements;
- for ( int i = 0; i < myNbOkElements; ++i )
- elements << QString::number( aMapIndex( i+1 ) );
- aString = elements.join(" ");
+ if (CheckBoxMesh->isChecked()) {
+ SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+
+ SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( myIO );
+ if ( !CORBA::is_nil( obj ) )
+ mySelectedObject = obj;
+ else
+ return;
+ myNbOkElements = true;
+ } else {
+ // get indices of selected elements
+ TColStd_IndexedMapOfInteger aMapIndex;
+ mySelector->GetIndex(IO,aMapIndex);
+ myNbOkElements = aMapIndex.Extent();
+
+ if (myNbOkElements < 1)
+ return;
+
+ QStringList elements;
+ for ( int i = 0; i < myNbOkElements; ++i )
+ elements << QString::number( aMapIndex( i+1 ) );
+ aString = elements.join(" ");
+ }
+ } else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myIO->isSame(IO) )
+ {
+ myNbOkNodes = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
}
- } else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myIO == IO ) {
- myNbOkNodes = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
}
myEditCurrentArgument->setText(aString);
myEditCurrentArgument->repaint();
myEditCurrentArgument->setEnabled(false); // to update lineedit IPAL 19809
- myEditCurrentArgument->setEnabled(true);
+ myEditCurrentArgument->setEnabled(true);
if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
buttonOk->setEnabled(true);
//=================================================================================
void SMESHGUI_SmoothingDlg::enterEvent (QEvent*)
{
- if (!GroupConstructors->isEnabled())
+ if (!GroupConstructors->isEnabled()) {
+ SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
+ if ( aViewWindow && !mySelector) {
+ mySelector = aViewWindow->GetSelector();
+ }
ActivateThisDialog();
-}
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_SmoothingDlg::closeEvent (QCloseEvent*)
-{
- /* same than click on cancel button */
- ClickOnCancel();
-}
-
-//=======================================================================
-// function : hideEvent()
-// purpose : caused by ESC key
-//=======================================================================
-void SMESHGUI_SmoothingDlg::hideEvent (QHideEvent*)
-{
- if (!isMinimized())
- ClickOnCancel();
+ }
}
//=======================================================================