From 2fbe6abd18d0512ebe7e82e00dbe63adb35d932d Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 28 Dec 2016 17:50:16 +0300 Subject: [PATCH] Issue # 1929: Fix for stayed selection of point after middle constraint creating. Result of porting to SALOME 8. --- src/XGUI/XGUI_Displayer.cpp | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index eeeb8d2e7..4984664e8 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -91,8 +91,6 @@ const int MOUSE_SENSITIVITY_IN_PIXEL = 10; //#define DEBUG_OCCT_SHAPE_SELECTION -//#define DEBUG_OCCT_26172 - void displayedObjects(const Handle(AIS_InteractiveContext)& theAIS, AIS_ListOfInteractive& theList) { // Get from null point @@ -109,6 +107,29 @@ QString qIntListInfo(const QIntList& theValues, const QString& theSeparator = QS return anInfo.join(theSeparator); } +void deselectPresentation(const Handle(AIS_InteractiveObject) theObject, + const Handle(AIS_InteractiveContext)& theContext) +{ + NCollection_List aResultOwners; + + for (theContext->InitSelected(); theContext->MoreSelected(); theContext->NextSelected()) { + Handle(SelectMgr_EntityOwner) anOwner = theContext->SelectedOwner(); + if (anOwner.IsNull()) // TODO: check why it is possible + continue; + if (anOwner->Selectable() == theObject && anOwner->IsSelected()) + aResultOwners.Append(anOwner); + + aResultOwners.Append(anOwner); + } + NCollection_List::Iterator anOwnersIt (aResultOwners); + Handle(SelectMgr_EntityOwner) anOwner; + for (; anOwnersIt.More(); anOwnersIt.Next()) { + anOwner = Handle(SelectMgr_EntityOwner)::DownCast(anOwnersIt.Value()); + if (!anOwner.IsNull()) + theContext->AddOrRemoveSelected(anOwner, false); + } +} + XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop) : myWorkshop(theWorkshop), myNeedUpdate(false), myIsTrihedronActive(true), myViewerBlockedRecursiveCount(0), @@ -356,6 +377,7 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer) if (aNeedToRestoreSelection) myWorkshop->module()->storeSelection(); + deselectPresentation(aAISIO, aContext); aContext->Redisplay(aAISIO, false); #ifdef VINSPECTOR @@ -1295,13 +1317,6 @@ bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO, } } if (isDeactivated) { -#ifdef DEBUG_OCCT_26172 - // the selection from the previous activation modes should be cleared manually (#26172) - theIO->ClearSelected(); - #ifdef VINSPECTOR - if (getCallBack()) getCallBack()->ClearSelected(theIO); - #endif -#endif // For performance issues //if (theUpdateViewer) // updateViewer(); -- 2.39.2