mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0030341: Unset child/parent links bugs fix
(cherry picked from commit 014eaedd30
)
Conflicts:
src/XCAFDoc/XCAFDoc_GraphNode.cxx
This commit is contained in:
@@ -93,7 +93,6 @@ XCAFDoc_GraphNode::XCAFDoc_GraphNode ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetGraphID
|
||||
//purpose :
|
||||
@@ -105,8 +104,6 @@ void XCAFDoc_GraphNode::SetGraphID (const Standard_GUID& explicitID)
|
||||
myGraphID = explicitID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetFather
|
||||
//purpose :
|
||||
@@ -142,8 +139,10 @@ void XCAFDoc_GraphNode::UnSetFather(const Handle(XCAFDoc_GraphNode)& F)
|
||||
{
|
||||
Standard_Integer Findex = FatherIndex(F);
|
||||
if (Findex != 0)
|
||||
F->UnSetChildlink(this);
|
||||
UnSetFatherlink(F);
|
||||
{
|
||||
F->UnSetChildlink(this);
|
||||
UnSetFatherlink(F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,10 +154,11 @@ void XCAFDoc_GraphNode::UnSetFather(const Handle(XCAFDoc_GraphNode)& F)
|
||||
void XCAFDoc_GraphNode::UnSetFather(const Standard_Integer Findex)
|
||||
{
|
||||
if (Findex != 0)
|
||||
UnSetFather( GetFather(Findex) );
|
||||
{
|
||||
UnSetFather( GetFather(Findex) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UnSetFatherlink
|
||||
//purpose : Remove link finily
|
||||
@@ -167,7 +167,11 @@ void XCAFDoc_GraphNode::UnSetFather(const Standard_Integer Findex)
|
||||
void XCAFDoc_GraphNode::UnSetFatherlink(const Handle(XCAFDoc_GraphNode)& F)
|
||||
{
|
||||
Backup();
|
||||
myFathers.Remove( FatherIndex(F) );
|
||||
Standard_Integer Findex = FatherIndex(F);
|
||||
if (Findex != 0)
|
||||
{
|
||||
myFathers.Remove(Findex);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -178,12 +182,13 @@ void XCAFDoc_GraphNode::UnSetFatherlink(const Handle(XCAFDoc_GraphNode)& F)
|
||||
void XCAFDoc_GraphNode::UnSetChild(const Handle(XCAFDoc_GraphNode)& Ch)
|
||||
{
|
||||
Standard_Integer Chindex = ChildIndex(Ch);
|
||||
if (Chindex != 0)
|
||||
Ch->UnSetFatherlink(this);
|
||||
UnSetChildlink(Ch);
|
||||
if (Chindex != 0)
|
||||
{
|
||||
Ch->UnSetFatherlink(this);
|
||||
UnSetChildlink(Ch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UnSetChild
|
||||
//purpose :
|
||||
@@ -191,11 +196,12 @@ void XCAFDoc_GraphNode::UnSetChild(const Handle(XCAFDoc_GraphNode)& Ch)
|
||||
|
||||
void XCAFDoc_GraphNode::UnSetChild(const Standard_Integer Chindex)
|
||||
{
|
||||
if (Chindex != 0 )
|
||||
UnSetChild( GetChild(Chindex) );
|
||||
if (Chindex != 0)
|
||||
{
|
||||
UnSetChild( GetChild(Chindex) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UnSetChildlink
|
||||
//purpose : Remove link finily
|
||||
@@ -204,7 +210,11 @@ void XCAFDoc_GraphNode::UnSetChild(const Handle(XCAFDoc_GraphNode)& Ch)
|
||||
void XCAFDoc_GraphNode::UnSetChildlink(const Handle(XCAFDoc_GraphNode)& Ch)
|
||||
{
|
||||
Backup();
|
||||
myChildren.Remove( ChildIndex(Ch) );
|
||||
Standard_Integer Chindex = ChildIndex(Ch);
|
||||
if (Chindex != 0)
|
||||
{
|
||||
myChildren.Remove(Chindex);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -348,7 +358,9 @@ void XCAFDoc_GraphNode::Paste(const Handle(TDF_Attribute)& into,
|
||||
if (!RT->HasRelocation(myFathers(i), func) && RT->AfterRelocate()) {
|
||||
func.Nullify();
|
||||
}
|
||||
intof->SetFather(func);
|
||||
if (!func.IsNull()) {
|
||||
intof->SetFather(func);
|
||||
}
|
||||
}
|
||||
|
||||
i = 1;
|
||||
@@ -356,7 +368,9 @@ void XCAFDoc_GraphNode::Paste(const Handle(TDF_Attribute)& into,
|
||||
if (!RT->HasRelocation(myChildren(i), func) && RT->AfterRelocate()) {
|
||||
func.Nullify();
|
||||
}
|
||||
intof->SetFather(func);
|
||||
if (!func.IsNull()) {
|
||||
intof->SetChild(func);
|
||||
}
|
||||
}
|
||||
intof->SetGraphID(myGraphID);
|
||||
}
|
||||
|
Reference in New Issue
Block a user