mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0028908: Improvement on attachment of attributes to the label
This commit is contained in:
@@ -186,7 +186,7 @@ void TDF_CopyTool::CopyAttributes
|
||||
tAtt = sAtt->NewEmpty();
|
||||
if(tAtt->ID() != id)
|
||||
tAtt->SetID(id);//
|
||||
aTargetLabel.AddAttribute(tAtt);
|
||||
aTargetLabel.AddAttribute(tAtt, Standard_True);
|
||||
aAttMap.Bind(sAtt,tAtt);
|
||||
}
|
||||
else {
|
||||
|
@@ -412,8 +412,9 @@ Standard_Boolean TDF_Label::HasGreaterNode(const TDF_Label& aLabel) const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDF_Label::AddAttribute (const Handle(TDF_Attribute)& anAttribute) const
|
||||
{ AddToNode(myLabelNode,anAttribute); }
|
||||
void TDF_Label::AddAttribute (const Handle(TDF_Attribute)& anAttribute,
|
||||
const Standard_Boolean append/* = Standard_False*/) const
|
||||
{ AddToNode(myLabelNode,anAttribute,append); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@@ -532,7 +533,8 @@ void TDF_Label::ResumeAttribute (const Handle(TDF_Attribute)& anAttribute) cons
|
||||
//=======================================================================
|
||||
|
||||
void TDF_Label::AddToNode (const TDF_LabelNodePtr& toNode,
|
||||
const Handle(TDF_Attribute)& anAttribute) const
|
||||
const Handle(TDF_Attribute)& anAttribute,
|
||||
const Standard_Boolean append) const
|
||||
{
|
||||
// check that modification is allowed
|
||||
if ( !toNode->Data()->IsModificationAllowed() ) {
|
||||
@@ -555,8 +557,10 @@ void TDF_Label::AddToNode (const TDF_LabelNodePtr& toNode,
|
||||
|
||||
//append to the end of the attribute list
|
||||
dummyAtt.Nullify();
|
||||
for (TDF_AttributeIterator itr (toNode); itr.More(); itr.Next())
|
||||
dummyAtt = itr.Value();
|
||||
if (append) {
|
||||
for (TDF_AttributeIterator itr (toNode); itr.More(); itr.Next())
|
||||
dummyAtt = itr.Value();
|
||||
}
|
||||
|
||||
toNode->AddAttribute(dummyAtt,anAttribute);
|
||||
toNode->AttributesModified(anAttribute->myTransaction != 0);
|
||||
@@ -605,7 +609,7 @@ void TDF_Label::ForgetFromNode (const TDF_LabelNodePtr& fromNode,
|
||||
anAttribute->BeforeRemoval();
|
||||
}
|
||||
fromNode->RemoveAttribute(lastAtt,anAttribute);
|
||||
anAttribute->Forget(fromNode->Data()->Transaction()); // vro
|
||||
anAttribute->Forget(fromNode->Data()->Transaction());
|
||||
break;
|
||||
}
|
||||
lastAtt = itr.Value();
|
||||
@@ -638,7 +642,7 @@ void TDF_Label::ResumeToNode (const TDF_LabelNodePtr& toNode,
|
||||
if (!anAttribute->IsForgotten())
|
||||
throw Standard_DomainError("Cannot resume an unforgotten attribute.");
|
||||
|
||||
AddToNode(toNode, anAttribute); // vro
|
||||
AddToNode(toNode, anAttribute, Standard_False);
|
||||
anAttribute->Resume();
|
||||
if (toNode->Data()->NotUndoMode()) anAttribute->AfterResume();
|
||||
}
|
||||
|
@@ -117,7 +117,7 @@ public:
|
||||
|
||||
//! Adds an Attribute to the current label. Raises if
|
||||
//! there is already one.
|
||||
Standard_EXPORT void AddAttribute (const Handle(TDF_Attribute)& anAttribute) const;
|
||||
Standard_EXPORT void AddAttribute (const Handle(TDF_Attribute)& anAttribute, const Standard_Boolean append = Standard_False) const;
|
||||
|
||||
//! Forgets an Attribute from the current label,
|
||||
//! setting its forgotten status true and its valid
|
||||
@@ -283,7 +283,7 @@ private:
|
||||
|
||||
//! Adds an Attribute to <toNode>. Raises if there is
|
||||
//! already one.
|
||||
Standard_EXPORT void AddToNode (const TDF_LabelNodePtr& toNode, const Handle(TDF_Attribute)& anAttribute) const;
|
||||
Standard_EXPORT void AddToNode (const TDF_LabelNodePtr& toNode, const Handle(TDF_Attribute)& anAttribute, const Standard_Boolean append) const;
|
||||
|
||||
//! Forgets an Attribute from <fromNode>. Raises if
|
||||
//! the attribute is not in the structure.
|
||||
|
Reference in New Issue
Block a user