X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_SelectionMgr.cpp;h=8304179726f246d4106c5cef7f06256dd71a53b5;hb=d77e6639d89abdcbf327cc73d13bf955064b8524;hp=0cdaecf9ba94fdd830f7faefff3d03f0855f22c4;hpb=3f19a9c3fb9c6fc844229db1f925a8a2b0b8a96f;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 0cdaecf9b..830417972 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -18,6 +18,8 @@ #include #include +#include + XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent) : QObject(theParent), myWorkshop(theParent) @@ -41,14 +43,46 @@ void XGUI_SelectionMgr::connectViewers() } //************************************************************** -void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners) +void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners, + bool isUpdateViewer) { + SelectMgr_IndexedMapOfOwner aSelectedOwners; + selection()->selectedOwners(aSelectedOwners); + Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) { - aContext->AddOrRemoveSelected(theSelectedOwners(i), false); + Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i); + if (aSelectedOwners.FindIndex(anOwner) > 0) + continue; + + aContext->AddOrRemoveSelected(anOwner, isUpdateViewer); } } +//************************************************************** +void XGUI_SelectionMgr::updateSelectedOwners(bool isUpdateViewer) +{ + Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); + const SelectMgr_ListOfFilter& aFilters = aContext->Filters(); + + SelectMgr_IndexedMapOfOwner anOwnersToDeselect; + + SelectMgr_ListIteratorOfListOfFilter anIt(aFilters); + for (; anIt.More(); anIt.Next()) { + Handle(SelectMgr_Filter) aFilter = anIt.Value(); + for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { + Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner(); + if (!aFilter->IsOk(anOwner)) + anOwnersToDeselect.Add(aContext->SelectedOwner()); + } + } + + setSelectedOwners(anOwnersToDeselect, false); + + if (isUpdateViewer) + aContext->UpdateCurrentViewer(); +} + //************************************************************** void XGUI_SelectionMgr::onObjectBrowserSelection() {