mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +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:
@@ -239,8 +239,12 @@ is
|
||||
---Purpose: Adds a new top-level (creates and returns a new label)
|
||||
-- For internal use. Used by public method AddShape.
|
||||
|
||||
RemoveShape (me; L: Label from TDF) returns Boolean;
|
||||
RemoveShape (me; L: Label from TDF;
|
||||
removeCompletely: Boolean = Standard_True)
|
||||
returns Boolean;
|
||||
---Purpose: Removes shape (whole label and all its sublabels)
|
||||
-- If removeCompletely is true, removes complete shape
|
||||
-- If removeCompletely is false, removes instance(location) only
|
||||
-- Returns False (and does nothing) if shape is not free
|
||||
-- or is not top-level shape
|
||||
|
||||
|
@@ -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