X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_SelectionMgr.cpp;h=f4a0b397b85659a18874ef03da944f99875bb3af;hb=9a4d4f7656940b825054919eee921869b44d1b6f;hp=894198d3dc5e0a8ddd4ea0e7baa5d238c35af70b;hpb=b912c517a85602b2e6e2045262d4ac1d7152fbfd;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 894198d3d..f4a0b397b 100755 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -8,6 +8,7 @@ #include "XGUI_ViewerProxy.h" #include "XGUI_Displayer.h" #include "XGUI_Selection.h" +#include "XGUI_OperationMgr.h" #ifndef HAVE_SALOME #include @@ -26,8 +27,8 @@ #include -#ifdef VINSPECTOR -#include +#ifdef TINSPECTOR +#include #endif XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent) @@ -56,52 +57,22 @@ void XGUI_SelectionMgr::connectViewers() void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners, bool isUpdateViewer) { - SelectMgr_IndexedMapOfOwner aSelectedOwners; - selection()->selectedOwners(aSelectedOwners); - Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { + /// previous selection should be cleared, else there will be decomposition of selections: + /// as AddOrRemoveSelected inverts current selection + aContext->ClearSelected(false); + for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) { Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i); - if (aSelectedOwners.FindIndex(anOwner) > 0) - continue; aContext->AddOrRemoveSelected(anOwner, isUpdateViewer); - #ifdef VINSPECTOR + #ifdef TINSPECTOR if (myWorkshop->displayer()->getCallBack()) myWorkshop->displayer()->getCallBack()->AddOrRemoveSelected(anOwner); #endif } } - ModuleBase_Tools::selectionInfo(aContext, - "XGUI_SelectionMgr::setSelectedOwners -- AddOrRemoveSelected"); -} - -//************************************************************** -void XGUI_SelectionMgr::updateSelectedOwners(bool isUpdateViewer) -{ - Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); - if (aContext.IsNull()) - return; - - 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(); } //************************************************************** @@ -151,6 +122,7 @@ void XGUI_SelectionMgr::onViewerSelection() QObjectPtrList aFeatures; ResultPtr aResult; FeaturePtr aFeature; + bool aHasOperation = (myWorkshop->operationMgr()->currentOperation() != 0); Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { QList aPresentations = @@ -159,7 +131,7 @@ void XGUI_SelectionMgr::onViewerSelection() if (aPrs->object().get()) { if (!aFeatures.contains(aPrs->object())) aFeatures.append(aPrs->object()); - if (aPrs->shape().get()) { + if (aPrs->shape().get() && (!aHasOperation)) { aResult = std::dynamic_pointer_cast(aPrs->object()); if (aResult.get()) { aFeature = anActiveDocument->producedByFeature(aResult, aPrs->shape());