0027986: Visualization - AIS_InteractiveContext::SetLocation() does not update dynami...
authorkgv <kgv@opencascade.com>
Thu, 20 Oct 2016 09:07:54 +0000 (12:07 +0300)
committerapn <apn@opencascade.com>
Thu, 27 Oct 2016 14:11:33 +0000 (17:11 +0300)
AIS_InteractiveContext::SetLocation() - update HilightMode instead of DisplayMode.
PrsMgr_PresentationManager::UpdateHighlightTrsf() - fix accessing NULL presentation.

src/AIS/AIS_InteractiveContext.cxx
src/PrsMgr/PrsMgr_PresentationManager.cxx
tests/bugs/vis/bug27986_1 [new file with mode: 0644]
tests/bugs/vis/bug27986_2 [new file with mode: 0644]

index 268e838..83089b8 100644 (file)
@@ -1331,9 +1331,10 @@ void AIS_InteractiveContext::SetLocation (const Handle(AIS_InteractiveObject)& t
   // to its highlight structure immediately
   if (!myLastPicked.IsNull() && myLastPicked->IsSameSelectable (theIObj))
   {
+    const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
     myLastPicked->UpdateHighlightTrsf (myMainVwr,
                                        myMainPM,
-                                       theIObj->HasDisplayMode() ? theIObj->DisplayMode() : 0);
+                                       aHiMod);
   }
 }
 
index e637bd5..50f3463 100644 (file)
@@ -641,12 +641,15 @@ void PrsMgr_PresentationManager::UpdateHighlightTrsf (const Handle(V3d_Viewer)&
   if (theObj.IsNull())
     return;
 
-  const Handle(Prs3d_Presentation)& aBasePrs = Presentation (theObj, theMode, Standard_False)->Presentation();
-  const Handle(Prs3d_Presentation)& aParentPrs = theSelObj.IsNull() ?
-    aBasePrs : Presentation (theSelObj, theMode, Standard_False)->Presentation();
-  const Standard_Integer aParentId = aParentPrs->CStructure()->Id;
+  Handle(PrsMgr_Presentation) aPrs = Presentation (!theSelObj.IsNull() ? theSelObj : theObj, theMode, Standard_False);
+  if (aPrs.IsNull())
+  {
+    return;
+  }
 
-  updatePrsTransformation (myImmediateList, aParentId, aBasePrs->CStructure()->Transformation());
+  Handle(Geom_Transformation) aTrsf = theObj->LocalTransformationGeom();
+  const Standard_Integer aParentId = aPrs->Presentation()->CStructure()->Id;
+  updatePrsTransformation (myImmediateList, aParentId, aTrsf);
 
   if (!myViewDependentImmediateList.IsEmpty())
   {
@@ -658,7 +661,7 @@ void PrsMgr_PresentationManager::UpdateHighlightTrsf (const Handle(V3d_Viewer)&
       {
         updatePrsTransformation (myViewDependentImmediateList,
                                  aViewDepParentPrs->CStructure()->Id,
-                                 aBasePrs->CStructure()->Transformation());
+                                 aTrsf);
       }
     }
   }
diff --git a/tests/bugs/vis/bug27986_1 b/tests/bugs/vis/bug27986_1
new file mode 100644 (file)
index 0000000..8da4963
--- /dev/null
@@ -0,0 +1,23 @@
+puts "==========="
+puts "OCC27986"
+puts "Visualization - AIS_InteractiveContext::SetLocation() does not update dynamic highlighting"
+puts "Test global selection"
+puts "==========="
+puts ""
+
+pload MODELING VISUALIZATION
+box b 1 2 3
+
+vclear
+vinit View1
+vaxo
+vdisplay -dispMode 0 -highMode 1 b
+vfit
+vzoom 0.5
+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" != "DARKTURQUOISE" } { puts "Error: dynamic highlighting is not updated" }
+
+vdump $imagedir/${casename}.png
diff --git a/tests/bugs/vis/bug27986_2 b/tests/bugs/vis/bug27986_2
new file mode 100644 (file)
index 0000000..055f0e1
--- /dev/null
@@ -0,0 +1,24 @@
+puts "==========="
+puts "OCC27986"
+puts "Visualization - AIS_InteractiveContext::SetLocation() does not update dynamic highlighting"
+puts "Test local selection"
+puts "==========="
+puts ""
+
+pload MODELING VISUALIZATION
+box b 1 2 3
+
+vclear
+vinit View1
+vaxo
+vdisplay -dispMode 0 -highMode 1 b
+vfit
+vzoom 0.5
+vselmode b 4 1
+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" != "DARKTURQUOISE" } { puts "Error: dynamic highlighting is not updated" }
+
+vdump $imagedir/${casename}.png