mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0029716: Some TDF and XCAFDoc labels-related issues
1. "Descendants" closure mode is not taken into account by TDF closure tool 2. CopyTool always creates a new label at the target ignoring the relocation table 3. XCAFDoc_GraphNode throws an exception if Child of Father is not found during the unsetting
This commit is contained in:
parent
cf4bee7c0c
commit
6e7791948b
@ -72,6 +72,7 @@ void TDF_ClosureTool::Closure
|
|||||||
const TDF_Label& lab = labLItr.Value();
|
const TDF_Label& lab = labLItr.Value();
|
||||||
if (lab.HasAttribute())
|
if (lab.HasAttribute())
|
||||||
TDF_ClosureTool::LabelAttributes(lab,labMap,attMap,aFilter,aMode);
|
TDF_ClosureTool::LabelAttributes(lab,labMap,attMap,aFilter,aMode);
|
||||||
|
if (aMode.Descendants())
|
||||||
TDF_ClosureTool::Closure(lab,labMap,attMap,aFilter,aMode);
|
TDF_ClosureTool::Closure(lab,labMap,attMap,aFilter,aMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,12 +153,25 @@ void TDF_CopyTool::CopyLabels
|
|||||||
// Does the same for the children.
|
// Does the same for the children.
|
||||||
for (TDF_ChildIterator childItr(aSLabel); childItr.More(); childItr.Next()){
|
for (TDF_ChildIterator childItr(aSLabel); childItr.More(); childItr.Next()){
|
||||||
const TDF_Label& childSLab = childItr.Value();
|
const TDF_Label& childSLab = childItr.Value();
|
||||||
if (aSrcLabelMap.Contains(childSLab)) {
|
if (aSrcLabelMap.Contains(childSLab))
|
||||||
TDF_Label childTIns = aTargetLabel.FindChild(childSLab.Tag());
|
{
|
||||||
aLabMap.Bind(childSLab,childTIns);
|
TDF_Label childTIns;
|
||||||
TDF_CopyTool::CopyLabels(childSLab,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,
|
aLabMap,aAttMap,
|
||||||
aSrcLabelMap,aSrcAttributeMap);
|
aSrcLabelMap,aSrcAttributeMap
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,8 +142,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,7 +157,9 @@ 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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -167,7 +171,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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -179,8 +187,10 @@ 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -191,8 +201,10 @@ 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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -204,7 +216,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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -237,9 +253,14 @@ void XCAFDoc_GraphNode::UnSetChildlink(const Handle(XCAFDoc_GraphNode)& Ch)
|
|||||||
Standard_Integer XCAFDoc_GraphNode::FatherIndex(const Handle(XCAFDoc_GraphNode)& F) const
|
Standard_Integer XCAFDoc_GraphNode::FatherIndex(const Handle(XCAFDoc_GraphNode)& F) const
|
||||||
{
|
{
|
||||||
Standard_Integer Findex = 0;
|
Standard_Integer Findex = 0;
|
||||||
if (NbFathers()!=0) {
|
if (NbFathers() != 0)
|
||||||
for (Findex = 1 ; Findex <= NbFathers(); Findex++) {
|
{
|
||||||
if ( F == myFathers.Value(Findex)) return Findex;
|
for (Findex = 1 ; Findex <= NbFathers(); Findex++)
|
||||||
|
{
|
||||||
|
if (F == myFathers.Value (Findex))
|
||||||
|
{
|
||||||
|
return Findex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -253,9 +274,14 @@ Standard_Integer XCAFDoc_GraphNode::FatherIndex(const Handle(XCAFDoc_GraphNode)&
|
|||||||
Standard_Integer XCAFDoc_GraphNode::ChildIndex(const Handle(XCAFDoc_GraphNode)& Ch) const
|
Standard_Integer XCAFDoc_GraphNode::ChildIndex(const Handle(XCAFDoc_GraphNode)& Ch) const
|
||||||
{
|
{
|
||||||
Standard_Integer Chindex;
|
Standard_Integer Chindex;
|
||||||
if (NbChildren()!=0) {
|
if (NbChildren() != 0)
|
||||||
for (Chindex = 1; Chindex <= NbChildren(); Chindex++) {
|
{
|
||||||
if ( Ch == myChildren.Value(Chindex)) return Chindex;
|
for (Chindex = 1; Chindex <= NbChildren(); Chindex++)
|
||||||
|
{
|
||||||
|
if (Ch == myChildren.Value (Chindex))
|
||||||
|
{
|
||||||
|
return Chindex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -345,18 +371,27 @@ void XCAFDoc_GraphNode::Paste(const Handle(TDF_Attribute)& into,
|
|||||||
Handle(XCAFDoc_GraphNode) func;
|
Handle(XCAFDoc_GraphNode) func;
|
||||||
Standard_Integer i = 1;
|
Standard_Integer i = 1;
|
||||||
for (; i <= NbFathers(); i++) {
|
for (; i <= NbFathers(); i++) {
|
||||||
if (!RT->HasRelocation(myFathers(i), func) && RT->AfterRelocate()) {
|
if (!RT->HasRelocation(myFathers(i), func) && RT->AfterRelocate())
|
||||||
|
{
|
||||||
func.Nullify();
|
func.Nullify();
|
||||||
}
|
}
|
||||||
|
if (!func.IsNull())
|
||||||
|
{
|
||||||
intof->SetFather(func);
|
intof->SetFather(func);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
for (; i <= NbChildren(); i++) {
|
for (; i <= NbChildren(); i++)
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -436,8 +471,12 @@ Standard_OStream& XCAFDoc_GraphNode::Dump (Standard_OStream& anOS) const
|
|||||||
|
|
||||||
void XCAFDoc_GraphNode::BeforeForget()
|
void XCAFDoc_GraphNode::BeforeForget()
|
||||||
{
|
{
|
||||||
while ( myFathers.Length() > 0 )
|
while (myFathers.Length () > 0)
|
||||||
UnSetFather(1);
|
{
|
||||||
while ( myChildren.Length() > 0 )
|
UnSetFather (1);
|
||||||
UnSetChild(1);
|
}
|
||||||
|
while (myChildren.Length () > 0)
|
||||||
|
{
|
||||||
|
UnSetChild (1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user