// Does the same for the children.
for (TDF_ChildIterator childItr(aSLabel); childItr.More(); childItr.Next()){
const TDF_Label& childSLab = childItr.Value();
- if (aSrcLabelMap.Contains(childSLab)) {
- TDF_Label childTIns = aTargetLabel.FindChild(childSLab.Tag());
- aLabMap.Bind(childSLab,childTIns);
- TDF_CopyTool::CopyLabels(childSLab,childTIns,
- aLabMap,aAttMap,
- aSrcLabelMap,aSrcAttributeMap);
+ if (aSrcLabelMap.Contains(childSLab))
+ {
+ TDF_Label childTIns;
+ if (aLabMap.IsBound (childSLab))
+ {
+ childTIns = aLabMap.Find (childSLab);
+ }
+ else
+ {
+ childTIns = aTargetLabel.FindChild (childSLab.Tag ());
+ aLabMap.Bind (childSLab, childTIns);
+ }
+
+ TDF_CopyTool::CopyLabels
+ (
+ childSLab,childTIns,
+ aLabMap,aAttMap,
+ aSrcLabelMap,aSrcAttributeMap
+ );
}
}
}
{
Standard_Integer Findex = FatherIndex(F);
if (Findex != 0)
- F->UnSetChildlink(this);
- UnSetFatherlink(F);
+ {
+ F->UnSetChildlink (this);
+ UnSetFatherlink (F);
+ }
}
void XCAFDoc_GraphNode::UnSetFather(const Standard_Integer Findex)
{
if (Findex != 0)
- UnSetFather( GetFather(Findex) );
+ {
+ UnSetFather (GetFather (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 );
+ }
}
//=======================================================================
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);
+ }
}
void XCAFDoc_GraphNode::UnSetChild(const Standard_Integer Chindex)
{
- if (Chindex != 0 )
- UnSetChild( GetChild(Chindex) );
+ if (Chindex != 0)
+ {
+ UnSetChild (GetChild (Chindex));
+ }
}
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);
+ }
}
//=======================================================================
Standard_Integer XCAFDoc_GraphNode::FatherIndex(const Handle(XCAFDoc_GraphNode)& F) const
{
Standard_Integer Findex = 0;
- if (NbFathers()!=0) {
- for (Findex = 1 ; Findex <= NbFathers(); Findex++) {
- if ( F == myFathers.Value(Findex)) return Findex;
+ if (NbFathers() != 0)
+ {
+ for (Findex = 1 ; Findex <= NbFathers(); Findex++)
+ {
+ if (F == myFathers.Value (Findex))
+ {
+ return Findex;
+ }
}
}
return 0;
Standard_Integer XCAFDoc_GraphNode::ChildIndex(const Handle(XCAFDoc_GraphNode)& Ch) const
{
Standard_Integer Chindex;
- if (NbChildren()!=0) {
- for (Chindex = 1; Chindex <= NbChildren(); Chindex++) {
- if ( Ch == myChildren.Value(Chindex)) return Chindex;
+ if (NbChildren() != 0)
+ {
+ for (Chindex = 1; Chindex <= NbChildren(); Chindex++)
+ {
+ if (Ch == myChildren.Value (Chindex))
+ {
+ return Chindex;
+ }
}
}
return 0;
Handle(XCAFDoc_GraphNode) func;
Standard_Integer i = 1;
for (; i <= NbFathers(); i++) {
- if (!RT->HasRelocation(myFathers(i), func) && RT->AfterRelocate()) {
+ if (!RT->HasRelocation(myFathers(i), func) && RT->AfterRelocate())
+ {
func.Nullify();
}
- intof->SetFather(func);
+ if (!func.IsNull())
+ {
+ intof->SetFather(func);
+ }
}
i = 1;
- for (; i <= NbChildren(); i++) {
- if (!RT->HasRelocation(myChildren(i), func) && RT->AfterRelocate()) {
+ for (; i <= NbChildren(); i++)
+ {
+ if (!RT->HasRelocation(myChildren(i), func) && RT->AfterRelocate())
+ {
func.Nullify();
}
- intof->SetFather(func);
+ if (!func.IsNull())
+ {
+ intof->SetChild(func);
+ }
}
intof->SetGraphID(myGraphID);
}
void XCAFDoc_GraphNode::BeforeForget()
{
- while ( myFathers.Length() > 0 )
- UnSetFather(1);
- while ( myChildren.Length() > 0 )
- UnSetChild(1);
+ while (myFathers.Length () > 0)
+ {
+ UnSetFather (1);
+ }
+ while (myChildren.Length () > 0)
+ {
+ UnSetChild (1);
+ }
}