From 4206dac88c6ff4c78659a4c1fa28a63077d2edab Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 23 Jun 2016 16:27:04 +0300 Subject: [PATCH] #1549 Remove sub-shapes: wrong faces removed. SetSelected should be called for each owner only one time for correct work. Another case: create compsolid, create group, select a solid, Apply, Edit of the created group. Activate control -> it is not deselect the object. --- src/XGUI/XGUI_Displayer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index e2c7460f6..7e017c7d5 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -1407,8 +1407,19 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th aLContext->MainSelector()->ActiveOwners(anActiveOwners); NCollection_List::Iterator anOwnersIt (anActiveOwners); Handle(SelectMgr_EntityOwner) anOwner; + + /// It is very important to check that the owner is processed only once and has a map of + /// processed owners because SetSelected works as a switch. + /// If count of calls setSelectec is even, the object stays in the previous state + /// (selected, deselected) + /// OCCT: to write about the problem that active owners method returns one owner several times + QList aSelectedIds; // Remember of selected address in order to avoid duplicates for (; anOwnersIt.More(); anOwnersIt.Next()) { anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value()); + if (aSelectedIds.contains((long)anOwner.Access())) + continue; + aSelectedIds.append((long)anOwner.Access()); + Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(anOwner); if (!BROwnr.IsNull() && BROwnr->HasShape()) { const TopoDS_Shape& aShape = BROwnr->Shape(); -- 2.39.2