1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

2 Commits

Author SHA1 Message Date
snn
014eaedd30 0030341: Unset child/parent links bugs fix 2018-11-07 14:04:33 +03:00
snn
498fc86d8e 0030341: XCAFDoc_GraphNode doesn't copy children upon pasting 2018-11-06 11:32:32 +03:00

View File

@@ -93,7 +93,6 @@ XCAFDoc_GraphNode::XCAFDoc_GraphNode ()
{ {
} }
//======================================================================= //=======================================================================
//function : SetGraphID //function : SetGraphID
//purpose : //purpose :
@@ -105,8 +104,6 @@ void XCAFDoc_GraphNode::SetGraphID (const Standard_GUID& explicitID)
myGraphID = explicitID; myGraphID = explicitID;
} }
//======================================================================= //=======================================================================
//function : SetFather //function : SetFather
//purpose : //purpose :
@@ -142,8 +139,10 @@ void XCAFDoc_GraphNode::UnSetFather(const Handle(XCAFDoc_GraphNode)& F)
{ {
Standard_Integer Findex = FatherIndex(F); Standard_Integer Findex = FatherIndex(F);
if (Findex != 0) 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) void XCAFDoc_GraphNode::UnSetFather(const Standard_Integer Findex)
{ {
if (Findex != 0) if (Findex != 0)
UnSetFather( GetFather(Findex) ); {
UnSetFather( GetFather(Findex) );
}
} }
//======================================================================= //=======================================================================
//function : UnSetFatherlink //function : UnSetFatherlink
//purpose : Remove link finily //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) void XCAFDoc_GraphNode::UnSetFatherlink(const Handle(XCAFDoc_GraphNode)& F)
{ {
Backup(); 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) void XCAFDoc_GraphNode::UnSetChild(const Handle(XCAFDoc_GraphNode)& Ch)
{ {
Standard_Integer Chindex = ChildIndex(Ch); Standard_Integer Chindex = ChildIndex(Ch);
if (Chindex != 0) if (Chindex != 0)
Ch->UnSetFatherlink(this); {
UnSetChildlink(Ch); Ch->UnSetFatherlink(this);
UnSetChildlink(Ch);
}
} }
//======================================================================= //=======================================================================
//function : UnSetChild //function : UnSetChild
//purpose : //purpose :
@@ -191,11 +196,12 @@ void XCAFDoc_GraphNode::UnSetChild(const Handle(XCAFDoc_GraphNode)& Ch)
void XCAFDoc_GraphNode::UnSetChild(const Standard_Integer Chindex) void XCAFDoc_GraphNode::UnSetChild(const Standard_Integer Chindex)
{ {
if (Chindex != 0 ) if (Chindex != 0)
UnSetChild( GetChild(Chindex) ); {
UnSetChild( GetChild(Chindex) );
}
} }
//======================================================================= //=======================================================================
//function : UnSetChildlink //function : UnSetChildlink
//purpose : Remove link finily //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) void XCAFDoc_GraphNode::UnSetChildlink(const Handle(XCAFDoc_GraphNode)& Ch)
{ {
Backup(); 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()) { if (!RT->HasRelocation(myFathers(i), func) && RT->AfterRelocate()) {
func.Nullify(); func.Nullify();
} }
intof->SetFather(func); if (!func.IsNull()) {
intof->SetFather(func);
}
} }
i = 1; i = 1;
@@ -356,7 +368,9 @@ void XCAFDoc_GraphNode::Paste(const Handle(TDF_Attribute)& into,
if (!RT->HasRelocation(myChildren(i), func) && RT->AfterRelocate()) { if (!RT->HasRelocation(myChildren(i), func) && RT->AfterRelocate()) {
func.Nullify(); func.Nullify();
} }
intof->SetFather(func); if (!func.IsNull()) {
intof->SetChild(func);
}
} }
intof->SetGraphID(myGraphID); intof->SetGraphID(myGraphID);
} }