mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +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:
@@ -65,11 +65,8 @@ myCurrentFacingModel(Aspect_TOFM_BOTH_SIDE),
|
||||
myRecomputeEveryPrs(Standard_True),
|
||||
myCTXPtr(NULL),
|
||||
mySelPriority(-1),
|
||||
myDisplayMode (-1),
|
||||
mystate(0)
|
||||
myDisplayMode (-1)
|
||||
{
|
||||
Handle (AIS_InteractiveContext) Bid;
|
||||
myCTXPtr = Bid.operator->();
|
||||
SetCurrentFacingModel();
|
||||
}
|
||||
|
||||
@@ -109,16 +106,6 @@ Standard_Integer AIS_InteractiveObject::Signature() const
|
||||
Standard_Boolean AIS_InteractiveObject::RecomputeEveryPrs() const
|
||||
{return myRecomputeEveryPrs;}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveObject::HasInteractiveContext() const
|
||||
{
|
||||
Handle (AIS_InteractiveContext) aNull;
|
||||
return (myCTXPtr != aNull.operator->());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@@ -129,15 +116,21 @@ Handle(AIS_InteractiveContext) AIS_InteractiveObject::GetContext() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//function : SetContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetContext(const Handle(AIS_InteractiveContext)& aCtx)
|
||||
void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& theCtx)
|
||||
{
|
||||
myCTXPtr = aCtx.operator->();
|
||||
if( aCtx.IsNull())
|
||||
if (myCTXPtr == theCtx.get())
|
||||
{
|
||||
return;
|
||||
myDrawer->Link(aCtx->DefaultDrawer());
|
||||
}
|
||||
|
||||
myCTXPtr = theCtx.get();
|
||||
if (!theCtx.IsNull())
|
||||
{
|
||||
myDrawer->Link (theCtx->DefaultDrawer());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -160,35 +153,6 @@ void AIS_InteractiveObject::ClearOwner()
|
||||
myOwner.Nullify();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveObject::HasUsers() const
|
||||
{
|
||||
return (!myUsers.IsEmpty());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::AddUser(const Handle(Standard_Transient)& aUser)
|
||||
{
|
||||
myUsers.Append(aUser);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::ClearUsers()
|
||||
{
|
||||
myUsers.Clear();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
|
Reference in New Issue
Block a user