0027530: Visualization - AIS_InteractiveContext::HilightNextDetected() doesn't work...
[occt.git] / src / AIS / AIS_InteractiveContext.cxx
index 268e838..75c2c9c 100644 (file)
@@ -92,7 +92,8 @@ myPreselectionColor(Quantity_NOC_GREEN),
 mySubintStyle(new Graphic3d_HighlightStyle (Aspect_TOHM_COLOR, Quantity_NOC_GRAY40)),
 myDisplayMode(0),
 myCurLocalIndex(0),
-myAISCurDetected(0),
+myCurDetected(0),
+myCurHighlighted(0),
 myZDetectionFlag(0),
 myIsAutoActivateSelMode(Standard_True)
 { 
@@ -1331,9 +1332,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);
   }
 }
 
@@ -2353,13 +2355,13 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
   myMainPM->Erase (theIObj, -1);
 
   // Object removes from Detected sequence
-  for(Standard_Integer aDetIter = 1; aDetIter < myAISDetectedSeq.Length(); ++aDetIter)
+  for (Standard_Integer aDetIter = myDetectedSeq.Lower(); aDetIter <= myDetectedSeq.Upper(); ++aDetIter)
   {
     Handle(AIS_InteractiveObject) anObj = DetectedCurrentObject();
     if (!anObj.IsNull()
       && anObj != theIObj)
     {
-      myAISDetectedSeq.Remove (aDetIter);
+      myDetectedSeq.Remove (aDetIter);
     }
   }
 
@@ -2375,11 +2377,15 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
     aDefViewIter.Value()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
   }
 
-  if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
-    myLastinMain.Nullify();
-  if (!myLastPicked.IsNull() && myLastPicked->IsSameSelectable (theIObj))
-    myLastPicked.Nullify();
-  myMainPM->ClearImmediateDraw();
+  if (!myLastinMain.IsNull())
+  {
+    if (myLastinMain->IsSameSelectable (theIObj)
+     || myLastPicked->IsSameSelectable(theIObj))
+    {
+      myLastinMain.Nullify();
+      myMainPM->ClearImmediateDraw();
+    }
+  }
 
   if (theToUpdateviewer && aStatus->GraphicStatus() == AIS_DS_Displayed)
   {