mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0023047: Behaviour of XDE sample is non-stable
Changed behavior of XCAFDoc_ShapeTool::RemoveShape(const TDF_Label& L) function. Now if L is a location for a shape then function will also removes the label with a shape. Added Boolean argument to the XCAFDoc_ShapeTool::RemoveShape function which allow to choose either to delete an instance or a complete shape. (Standard_True by default, removes complete shape).
This commit is contained in:
@@ -607,10 +607,27 @@ TDF_Label XCAFDoc_ShapeTool::AddShape (const TopoDS_Shape& theShape,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean XCAFDoc_ShapeTool::RemoveShape (const TDF_Label& L) const
|
||||
Standard_Boolean XCAFDoc_ShapeTool::RemoveShape (const TDF_Label& L,
|
||||
const Standard_Boolean removeCompletely) const
|
||||
{
|
||||
if ( ! IsTopLevel ( L ) || ! IsFree ( L ) ) return Standard_False;
|
||||
|
||||
Handle(TDataStd_TreeNode) aNode;
|
||||
TDF_Label aLabel;
|
||||
if (removeCompletely &&
|
||||
L.FindAttribute (XCAFDoc::ShapeRefGUID(), aNode) &&
|
||||
aNode->HasFather() &&
|
||||
L.IsAttribute (XCAFDoc_Location::GetID()))
|
||||
{
|
||||
aLabel = aNode->Father()->Label();
|
||||
}
|
||||
|
||||
L.ForgetAllAttributes (Standard_True);
|
||||
|
||||
if (removeCompletely && !aLabel.IsNull())
|
||||
{
|
||||
return RemoveShape(aLabel);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user