]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#1549 Remove sub-shapes: wrong faces removed.
authornds <nds@opencascade.com>
Thu, 23 Jun 2016 13:27:04 +0000 (16:27 +0300)
committernds <nds@opencascade.com>
Thu, 23 Jun 2016 13:27:04 +0000 (16:27 +0300)
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

index e2c7460f6749ec23856c2614078ee7a50f662097..7e017c7d531d35af7b0fba987d4135102478930d 100644 (file)
@@ -1407,8 +1407,19 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th
   aLContext->MainSelector()->ActiveOwners(anActiveOwners);
   NCollection_List<Handle(SelectBasics_EntityOwner)>::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<long> 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();