1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0030784: Visualization - check if selectable of owner in internal container in AIS_InteractiveContext before using

This commit is contained in:
nds 2020-09-07 23:00:50 +03:00 committed by bugmaster
parent 4637000015
commit b19cde437e

View File

@ -172,8 +172,8 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
{ {
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value(); const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable()); const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Handle(AIS_GlobalStatus) aStatus; Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anInteractive);
if (!myObjects.Find (anInteractive, aStatus)) if (!aStatusPtr)
{ {
continue; continue;
} }
@ -183,9 +183,9 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
anOwner->Unhilight (myMainPM); anOwner->Unhilight (myMainPM);
if (theIsToHilightSubIntensity) if (theIsToHilightSubIntensity)
{ {
if (aStatus->IsSubIntensityOn()) if ((*aStatusPtr)->IsSubIntensityOn())
{ {
const Standard_Integer aHiMode = getHilightMode (anInteractive, aStatus->HilightStyle(), aStatus->DisplayMode()); const Standard_Integer aHiMode = getHilightMode (anInteractive, (*aStatusPtr)->HilightStyle(), (*aStatusPtr)->DisplayMode());
highlightWithSubintensity (anOwner, aHiMode); highlightWithSubintensity (anOwner, aHiMode);
} }
} }
@ -196,7 +196,7 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
} }
if (anOwner == anInteractive->GlobalSelOwner()) if (anOwner == anInteractive->GlobalSelOwner())
{ {
aStatus->SetHilightStatus (Standard_False); (*aStatusPtr)->SetHilightStatus (Standard_False);
} }
} }
for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next()) for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
@ -746,11 +746,15 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
continue; continue;
const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner); const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner);
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind(anObj); Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
if (!aStatusPtr)
{
continue;
}
if (anOwner == anObj->GlobalSelOwner()) if (anOwner == anObj->GlobalSelOwner())
{ {
aState->SetHilightStatus (Standard_True); (*aStatusPtr)->SetHilightStatus (Standard_True);
aState->SetHilightStyle (anObjSelStyle); (*aStatusPtr)->SetHilightStyle (anObjSelStyle);
} }
if (!anOwner->IsAutoHilight()) if (!anOwner->IsAutoHilight())
{ {
@ -768,7 +772,7 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
} }
else else
{ {
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, aState->DisplayMode()); const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, (*aStatusPtr)->DisplayMode());
anOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode); anOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode);
} }
} }
@ -872,7 +876,10 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
} }
if (aSelOwner == aSelectable->GlobalSelOwner()) if (aSelOwner == aSelectable->GlobalSelOwner())
{ {
myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False); if (Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (aSelectable))
{
(*aStatusPtr)->SetHilightStatus (Standard_False);
}
} }
} }
@ -990,7 +997,12 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
if (myAutoHilight) if (myAutoHilight)
{ {
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()); const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj); Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
if (!aStatusPtr)
{
return;
}
if (theOwner->IsSelected()) if (theOwner->IsSelected())
{ {
highlightSelected (theOwner); highlightSelected (theOwner);
@ -1001,7 +1013,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
anOwners.Append (theOwner); anOwners.Append (theOwner);
unhighlightOwners (anOwners); unhighlightOwners (anOwners);
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)()); (*aStatusPtr)->SetHilightStyle (Handle(Prs3d_Drawer)());
} }
} }