mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0027957: Visualization, AIS_InteractiveContext - protect from displaying the same AIS_InteractiveObject within multiple contexts
AIS_InteractiveContext methods adding object to the context now throws Standard_ProgramError exception if object has been already displayed in another context. AIS_InteractiveContext::Remove() now NULLifies context assigned to the object. AIS_InteractiveContext now inherits from Standard_Transient instead of deprecated MMgt_TShared and defines C++ destructor instead of method Delete(). AIS_InteractiveObject - undocumented property State() has been removed. Undocumented property Users() has been moved to AIS_IdenticRelation. Draw Harness command vclose now clear AIS_InteractiveContext content before nullifying it to ensure that objects have been properly removed. AIS_MultipleConnectedInteractive now overrides method ::SetContext() to assign context for children objects.
This commit is contained in:
@@ -259,17 +259,13 @@ void AIS_MultipleConnectedInteractive::Compute (const Handle(PrsMgr_Presentation
|
||||
const Handle(Prs3d_Presentation)& /*thePrs*/,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aCtx = GetContext();
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||
if (aChild.IsNull())
|
||||
if (!aChild.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!aChild->HasInteractiveContext())
|
||||
{
|
||||
aChild->SetContext (GetContext());
|
||||
aChild->SetContext (aCtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -374,3 +370,20 @@ Standard_Boolean AIS_MultipleConnectedInteractive::HasSelection (const Standard_
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_MultipleConnectedInteractive::SetContext (const Handle(AIS_InteractiveContext)& theCtx)
|
||||
{
|
||||
AIS_InteractiveObject::SetContext (theCtx);
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||
if (!aChild.IsNull())
|
||||
{
|
||||
aChild->SetContext (theCtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user