X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_RemoveElementsDlg.cxx;h=e60f386b61e11d0bd57bd49d8f62e774222fc247;hp=2b7fbbdc454e23a88badb0563ce5edede0f7703c;hb=3c33b141570dd9eee180f7149b5f97a0a30884db;hpb=bd8f1aee7c78f7d2eb82bd4fec5e08c9e3d280ce diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx index 2b7fbbdc4..e60f386b6 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 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 @@ -6,7 +6,7 @@ // 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 @@ -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 : @@ -332,6 +365,11 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText) aViewWindow->highlight(anIO,true,true); } } + else + { + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); + myNbOkElements = aListId.count(); + } myBusy = false; updateButtons(); @@ -344,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 @@ -453,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(); + } } //================================================================================= @@ -483,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 );