{
Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
anObj->SetContext (aNullContext);
+ for (anObj->Init(); anObj->More(); anObj->Next())
+ {
+ anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew);
+ }
}
MMgt_TShared::Delete();
}
return Standard_False;
}
+//=======================================================================
+//function : IsHilighted
+//purpose : Returns true if the objects global status is set to highlighted.
+// theIsCustomColor flag defines if highlight color is not equal to OCCT's
+// default Quantity_NOC_WHITE color. If theIsCustomColor is true,
+// custom highlight color name will be stored to theCustomColorName
+//=======================================================================
+Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner,
+ Standard_Boolean& theIsCustomColor,
+ Quantity_NameOfColor& theCustomColorName) const
+{
+ if (theOwner.IsNull() || !theOwner->HasSelectable())
+ return Standard_False;
+
+ const Handle(AIS_InteractiveObject) anObj =
+ Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
+
+ if (!myObjects.IsBound (anObj))
+ return Standard_False;
+
+ const Handle(AIS_GlobalStatus)& anObjStatus = myObjects (anObj);
+ if (anObjStatus->IsHilighted())
+ {
+ if (anObjStatus->HilightColor() != Quantity_NOC_WHITE)
+ {
+ theIsCustomColor = Standard_True;
+ theCustomColorName = anObjStatus->HilightColor();
+ }
+ else
+ {
+ theIsCustomColor = Standard_False;
+ }
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
//=======================================================================
//function : IsDisplayed
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
myMainPM->Display (anObj, theMode);
+ if (!myLastPicked.IsNull() && myLastPicked->Selectable() == anObj)
+ {
+ myMainPM->BeginImmediateDraw();
+ myMainPM->Unhighlight (anObj, myDisplayMode);
+ myMainPM->EndImmediateDraw (myMainVwr);
+ }
if (aStatus->IsSubIntensityOn())
{
myMainPM->Color (anObj, mySubIntensity, theMode);
theIObj->SetWidth (theWidth);
redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ if (!myLastinMain.IsNull() && myLastinMain->Selectable() == theIObj)
+ {
+ if (myLastinMain->IsAutoHilight())
+ {
+ const Standard_Integer aHiMode =
+ theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
+ myLastinMain->HilightWithColor (myMainPM, myLastinMain->IsSelected() ? mySelectionColor : myHilightColor, aHiMode);
+ }
+ else
+ {
+ theIObj->HilightOwnerWithColor (myMainPM, myLastinMain->IsSelected() ? mySelectionColor : myHilightColor, myLastinMain);
+ }
+ }
}
//=======================================================================
theStatus += TCollection_AsciiString (aDispModeIter.Value());
theStatus += "\n";
}
- if (IsCurrent (theIObj)) theStatus +="\t| Current\n";
if (IsSelected(theIObj)) theStatus +="\t| Selected\n";
theStatus += "\t| Active Selection Modes in the MainViewer :\n";
? myDisplayMode
: 0);
theHiMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
- theSelMode = theIObj->HasSelectionMode() ? theIObj->SelectionMode() : -1;
+ theSelMode = theIObj->GlobalSelectionMode();
}
//=======================================================================
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
}
- if (IsCurrent (theIObj)
+ if (IsSelected (theIObj)
&& !aStatus->IsDModeIn (aDispMode))
{
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
{
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
}
+ aStatus->ClearSelectionModes();
aStatus->SetGraphicStatus (AIS_DS_Erased);
if (theToUpdateviewer)
}
}
+//=======================================================================
+//function : unhighlightOwners
+//purpose :
+//=======================================================================
+void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
+{
+ Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
+ aSel->Init();
+ while (aSel->More())
+ {
+ const Handle(SelectMgr_EntityOwner) anOwner =
+ Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
+ if (anOwner->Selectable() == theObject)
+ {
+ if (anOwner->IsSelected())
+ {
+ AddOrRemoveSelected (anOwner, Standard_False);
+ aSel->Init();
+ continue;
+ }
+ }
+ aSel->Next();
+ }
+}
+
//=======================================================================
//function : ClearGlobal
//purpose :
}
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
+ unhighlightOwners (theIObj);
for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
{
- if (aStatus->IsHilighted())
- {
- if (IsCurrent (theIObj))
- {
- AddOrRemoveCurrentObject (theIObj, theToUpdateviewer);
- }
- else if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
- {
- myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
- }
- }
myMainPM->Erase (theIObj, aDispModeIter.Value());
myMainPM->Clear (theIObj, aDispModeIter.Value());
- if (theIObj->HasHilightMode())
- {
- Standard_Integer im = theIObj->HilightMode();
- myMainPM->Unhighlight (theIObj, im);
- myMainPM->Erase (theIObj, im);
- }
}
// Object removes from Detected sequence
}
}
- if (myLastinMain == theIObj)
- {
- myLastinMain.Nullify();
- }
- if (myLastPicked == theIObj)
- {
- myLastPicked.Nullify();
- }
-
// remove IO from the selection manager to avoid memory leaks
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
mgrSelector->Remove (anObj);
myMainVwr->DefinedView()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
}
- if (theToUpdateviewer
- && aStatus->GraphicStatus() == AIS_DS_Displayed)
+ if (!myLastinMain.IsNull() && myLastinMain->Selectable() == theIObj)
+ myLastinMain.Nullify();
+ if (!myLastPicked.IsNull() && myLastPicked->Selectable() == theIObj)
+ myLastPicked.Nullify();
+ myMainPM->ClearImmediateDraw();
+
+ if (theToUpdateviewer && aStatus->GraphicStatus() == AIS_DS_Displayed)
{
myMainVwr->Update();
}
return myDefaultDrawer->IsoOnPlane();
}
-//=======================================================================
-//function : SetSelectionMode
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::SetSelectionMode (const Handle(AIS_InteractiveObject)& ,
- const Standard_Integer )
-{
- //
-}
-
-//=======================================================================
-//function : UnsetSelectionMode
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::UnsetSelectionMode (const Handle(AIS_InteractiveObject)& )
-{
- //
-}
-
//=======================================================================
//function : SetPixelTolerance
//purpose : Disables the mechanism of adaptive tolerance calculation in