]> OCCT Git - occt.git/commitdiff
0032180: Visualization - StdSelect_BRepOwner::SetLocation() does not update selected...
authorkgv <kgv@opencascade.com>
Sat, 27 Feb 2021 07:48:32 +0000 (10:48 +0300)
committerkgv <kgv@opencascade.com>
Sat, 27 Feb 2021 12:36:19 +0000 (15:36 +0300)
StdSelect_BRepOwner::SetLocation() now propagates location to sub-shape presentation instead of invalidating it.

src/StdSelect/StdSelect_BRepOwner.cxx
tests/bugs/vis/bug27986_2

index 7498a784fa1c18a8889eef543a1a9f4707660746..0e19f0c5ee1f308cf37fcaf09fe869610432b456 100644 (file)
@@ -114,21 +114,13 @@ void StdSelect_BRepOwner::HilightWithColor (const Handle(PrsMgr_PresentationMana
   // generate new presentable shape
   if (myPrsSh.IsNull())
   {
-    if (HasLocation())
-    {
-      TopLoc_Location lbid = Location() * myShape.Location();
-      TopoDS_Shape ShBis = myShape.Located(lbid);
-      myPrsSh = new StdSelect_Shape (ShBis, theStyle);
-    }
-    else
-    {
-      myPrsSh = new StdSelect_Shape (myShape, theStyle);
-    }
+    myPrsSh = new StdSelect_Shape (myShape, theStyle);
   }
 
   // initialize presentation attributes of child presentation
   myPrsSh->SetZLayer               (aSel->ZLayer());
   myPrsSh->SetTransformPersistence (aSel->TransformPersistence());
+  myPrsSh->SetLocalTransformation  (Location());
   myPrsSh->Attributes()->SetLink                (theStyle);
   myPrsSh->Attributes()->SetColor               (theStyle->Color());
   myPrsSh->Attributes()->SetTransparency        (theStyle->Transparency());
@@ -162,11 +154,10 @@ void StdSelect_BRepOwner::Clear(const Handle(PrsMgr_PresentationManager)& PM,
 void StdSelect_BRepOwner::SetLocation(const TopLoc_Location& aLoc)
 {
   SelectMgr_EntityOwner::SetLocation(aLoc);
-  // we must not nullify the myPrsSh here, because unhilight method
-  // will be working with wrong entity in this case, the best is to
-  // set the update flag and then recompute myPrsSh on hilighting
   if (!myPrsSh.IsNull())
-    myPrsSh->SetToUpdate();
+  {
+    myPrsSh->SetLocalTransformation  (Location());
+  }
 }
 
 //=======================================================================
@@ -177,10 +168,10 @@ void StdSelect_BRepOwner::UpdateHighlightTrsf (const Handle(V3d_Viewer)& theView
                                                const Handle(PrsMgr_PresentationManager)& theManager,
                                                const Standard_Integer theDispMode)
 {
-  if (myPrsSh.IsNull() && Selectable().IsNull())
-    return;
-
-  theManager->UpdateHighlightTrsf (theViewer, Selectable(), theDispMode, myPrsSh);
+  if (!myPrsSh.IsNull() || HasSelectable())
+  {
+    theManager->UpdateHighlightTrsf (theViewer, Selectable(), theDispMode, myPrsSh);
+  }
 }
 
 // =======================================================================
index 14e37a9cff608fb1ee9cfae29c5e8e3793661bf3..5ab52da6786b2a53f3c2cd44848f27569b7c0e92 100644 (file)
@@ -1,6 +1,5 @@
 puts "==========="
-puts "OCC27986"
-puts "Visualization - AIS_InteractiveContext::SetLocation() does not update dynamic highlighting"
+puts "0027986: Visualization - AIS_InteractiveContext::SetLocation() does not update dynamic highlighting"
 puts "Test local selection"
 puts "==========="
 puts ""
@@ -15,10 +14,12 @@ vdisplay -dispMode 0 -highMode 1 b
 vfit
 vzoom 0.5
 vselmode b 4 1
+vselect 150 150
 vmoveto 250 250
 vsetlocation b 2 1 0
 set aColor1 [vreadpixel 220 200 rgb name]
 set aColor2 [vreadpixel 350 220 rgb name]
 if { "$aColor1" != "BLACK" || "$aColor2" != "CYAN2" } { puts "Error: dynamic highlighting is not updated" }
+if { "[vreadpixel 150 150 rgb name]" != "BLACK" } { puts "Error: sub-shape highlighting is not updated" }
 
 vdump $imagedir/${casename}.png