X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_RemoveElementsDlg.cxx;h=067eb5f49e734f6c2d48e900f21e4fcb784dbbd3;hp=9164ac57bcb0997c2c60e6b0dee2c2ce265dcef6;hb=ccb5e3c25bf204e839c0094f50f543eacedba5e6;hpb=6c4a9f32ed7b4416d79e0d0d293919609a8eb178 diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx index 9164ac57b..067eb5f49 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 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 @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -80,8 +81,8 @@ SMESHGUI_RemoveElementsDlg ::SMESHGUI_RemoveElementsDlg(SMESHGUI* theModule) : QDialog(SMESH::GetDesktop(theModule)), - mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), + mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySMESHGUI(theModule), myBusy(false), myFilterDlg(0) @@ -204,7 +205,9 @@ void SMESHGUI_RemoveElementsDlg::Init() 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(reject())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); + connect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView())); + connect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView())); connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); @@ -223,7 +226,10 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply() if (mySMESHGUI->isActiveStudyLocked()) return; - if (myNbOkElements) { + if (myNbOkElements) + { + SUIT_OverrideCursor wc; + QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts); SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; anArrayOfIdeces->length(aListId.count()); @@ -231,9 +237,14 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply() anArrayOfIdeces[i] = aListId[ i ].toInt(); bool aResult = false; - try { + try + { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.in()); + + if ( myActor && myMesh->NbElements() == 0 ) + myActor->SetRepresentation(SMESH_Actor::ePoint); + } catch (const SALOME::SALOME_Exception& S_ex) { SalomeApp_Tools::QtCatchCorbaException(S_ex); myEditCurrentArgument->clear(); @@ -277,6 +288,28 @@ void SMESHGUI_RemoveElementsDlg::reject() QDialog::reject(); } +//================================================================================= +// function : onOpenView() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::onOpenView() +{ + if(!mySelector) { + mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector(); + ActivateThisDialog(); + } +} + +//================================================================================= +// function : onCloseView() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::onCloseView() +{ + DeactivateActiveDialog(); + mySelector = 0; +} + //================================================================================= // function : ClickOnHelp() // purpose : @@ -349,7 +382,7 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText) void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument() { if (myBusy) return; // busy - if (myFilterDlg && myFilterDlg->isVisible()) return; // filter digl active + if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active if (!GroupButtons->isEnabled()) return; // inactive // clear @@ -458,8 +491,13 @@ void SMESHGUI_RemoveElementsDlg::ActivateThisDialog() //================================================================================= void SMESHGUI_RemoveElementsDlg::enterEvent(QEvent*) { - if (!GroupConstructors->isEnabled()) + if (!GroupConstructors->isEnabled()) { + SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ); + if ( aViewWindow && !mySelector) { + mySelector = aViewWindow->GetSelector(); + } ActivateThisDialog(); + } } //================================================================================= @@ -488,11 +526,20 @@ void SMESHGUI_RemoveElementsDlg::setFilters() SUIT_MessageBox::critical(this, tr("SMESH_ERROR"), tr("NO_MESH_SELECTED")); - return; + return; } if ( !myFilterDlg ) myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL ); + QList types; + if ( myMesh->NbEdges() ) types << SMESH::EDGE; + if ( myMesh->NbFaces() ) types << SMESH::FACE; + if ( myMesh->NbVolumes() ) types << SMESH::VOLUME; + if ( myMesh->NbBalls() ) types << SMESH::BALL; + if ( myMesh->Nb0DElements()) types << SMESH::ELEM0D; + if ( types.count() > 1 ) types << SMESH::ALL; + + myFilterDlg->Init( types ); myFilterDlg->SetSelection(); myFilterDlg->SetMesh( myMesh ); myFilterDlg->SetSourceWg( LineEditC1A1 );