]> OCCT Git - occt-copy.git/commitdiff
0031794: Visualization - Highlighting of AIS_Shape works incorrectly when AddChild... CR31794_740
authorkgv <kgv@opencascade.com>
Wed, 24 Feb 2021 16:07:07 +0000 (19:07 +0300)
committerkgv <kgv@opencascade.com>
Thu, 27 May 2021 14:21:26 +0000 (17:21 +0300)
PrsMgr_PresentationManager::Display(), PrsMgr_PresentationManager::Color(),
and SelectMgr_SelectionManager::Activate() now skip children in Erased state.

src/PrsMgr/PrsMgr_PresentationManager.cxx
src/SelectMgr/SelectMgr_SelectionManager.cxx
tests/bugs/vis/bug31794 [new file with mode: 0644]

index 56bb28898ea961489bacc382716fcf694854d179..cef99dbfa409e05bdeee7565bbf079c45992a4ca 100644 (file)
@@ -73,7 +73,11 @@ void PrsMgr_PresentationManager::Display (const Handle(PrsMgr_PresentableObject)
   {
     for (PrsMgr_ListOfPresentableObjectsIter anIter(thePrsObj->Children()); anIter.More(); anIter.Next())
     {
-      Display(anIter.Value(), theMode);
+      const Handle(PrsMgr_PresentableObject)& aChild = anIter.Value();
+      if (aChild->DisplayStatus() != PrsMgr_DisplayStatus_Erased)
+      {
+        Display(anIter.Value(), theMode);
+      }
     }
   }
 }
@@ -157,7 +161,12 @@ void PrsMgr_PresentationManager::SetVisibility (const Handle(PrsMgr_PresentableO
   {
     for (PrsMgr_ListOfPresentableObjectsIter anIter(thePrsObj->Children()); anIter.More(); anIter.Next())
     {
-      SetVisibility(anIter.Value(), theMode, theValue);
+      const Handle(PrsMgr_PresentableObject)& aChild = anIter.Value();
+      if (!theValue
+        || aChild->DisplayStatus() != PrsMgr_DisplayStatus_Erased)
+      {
+        SetVisibility (anIter.Value(), theMode, theValue);
+      }
     }
   }
   if (!thePrsObj->HasOwnPresentations())
@@ -614,7 +623,11 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
   {
     for (PrsMgr_ListOfPresentableObjectsIter anIter(thePrsObj->Children()); anIter.More(); anIter.Next())
     {
-      Color(anIter.Value(), theStyle, theMode, NULL, theImmediateStructLayerId);
+      const Handle(PrsMgr_PresentableObject)& aChild = anIter.Value();
+      if (aChild->DisplayStatus() != PrsMgr_DisplayStatus_Erased)
+      {
+        Color (aChild, theStyle, theMode, NULL, theImmediateStructLayerId);
+      }
     }
   }
   if (!thePrsObj->HasOwnPresentations())
index aeb445aa912b17dd0e4be53bf6287109a21f14d6..34285ae1ebc2aec67b1b2fb37e758977a932fcf5 100644 (file)
@@ -112,7 +112,11 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
 
   for (PrsMgr_ListOfPresentableObjectsIter anChildIter (theObject->Children()); anChildIter.More(); anChildIter.Next())
   {
-    Activate (Handle(SelectMgr_SelectableObject)::DownCast (anChildIter.Value()), theMode);
+    Handle(SelectMgr_SelectableObject) aChild = Handle(SelectMgr_SelectableObject)::DownCast (anChildIter.Value());
+    if (aChild->DisplayStatus() != PrsMgr_DisplayStatus_Erased)
+    {
+      Activate (aChild, theMode);
+    }
   }
   if (!theObject->HasOwnPresentations())
     return;
diff --git a/tests/bugs/vis/bug31794 b/tests/bugs/vis/bug31794
new file mode 100644 (file)
index 0000000..5f4ab5f
--- /dev/null
@@ -0,0 +1,22 @@
+puts "============"
+puts "0031794: Visualization - Highlighting of AIS_Shape works incorrectly when AddChild() used"
+puts "============"
+puts ""
+
+pload MODELING VISUALIZATION
+vinit View1
+box b   10 10 10
+box p1 -100 -100  0 200 200 0 -preview
+box p2  100 -100  0 200 200 0 -preview
+vdisplay b -dispMode 1
+vdisplay p1 p2 -dispMode 1 -highMode 1
+vfit
+vselmode b 0 0
+verase p1
+vchild b -add p1
+vchild b -add p2
+vselmode b 0 1
+vmoveto 100 200
+if {[vreadpixel 100 200 -rgb -name] != "BLACK"} { puts "Error" }
+
+vdump ${imagedir}/${casename}.png