]> OCCT Git - occt.git/commitdiff
0033575: Visualization - Volume selection of labels add repeated instances of the... CR33575
authordrochalo <diogo.lopes@opencascade.com>
Fri, 19 Jan 2024 12:32:34 +0000 (12:32 +0000)
committerdrochalo <diogo.lopes@opencascade.com>
Fri, 19 Jan 2024 12:32:34 +0000 (12:32 +0000)
Modified logic to add selectable object in SelectMgr_ViewerSelector::checkOverlap.

src/SelectMgr/SelectMgr_ViewerSelector.cxx

index 42c8028fba9c5f76db22e656366e3fbf740b4fd3..c0651484acd8686ff60aab6a7a545ccfca25a10b 100644 (file)
@@ -296,7 +296,24 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(Select3D_SensitiveEnti
   {
     aCriterion.NbOwnerMatches = 1;
     updatePoint3d (aCriterion, aPickResult, theEntity, theInversedTrsf, theMgr);
-    mystored.Add (anOwner, aCriterion);
+    Standard_Boolean anExists = Standard_False;
+    for (Standard_Integer aStoredIter = 1; aStoredIter <= mystored.Extent(); ++aStoredIter)
+    {
+      const SelectMgr_SortCriterion& aSearchCriterion = mystored.FindFromIndex (aStoredIter);
+      const Handle(SelectMgr_EntityOwner)& aSearchOwner = aSearchCriterion.Entity->OwnerId();
+      Handle(SelectMgr_SelectableObject) aSearchSelectable = !aSearchOwner.IsNull() ? aSearchOwner->Selectable() : Handle(SelectMgr_SelectableObject)();
+      if (!aSearchSelectable.IsNull() && !aSelectable.IsNull())
+      {
+        if (aSearchSelectable == aSelectable)
+        {
+          anExists = Standard_True;
+        }
+      }
+    }
+    if(!anExists)
+    {
+      mystored.Add (anOwner, aCriterion);
+    }
   }
 }