mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0027970: Improvement of standard attributes usability - containers.
This commit is contained in:
@@ -140,7 +140,14 @@ public:
|
||||
|
||||
//! Returns the ID of the attribute.
|
||||
Standard_EXPORT virtual const Standard_GUID& ID() const = 0;
|
||||
|
||||
|
||||
//! Sets specific ID of the attribute (supports several attributes
|
||||
//! of one type at the same label feature).
|
||||
Standard_EXPORT virtual void SetID(const Standard_GUID& theGuid);
|
||||
|
||||
//! Sets default ID defined in nested class (to be used for attributes having User ID feature).
|
||||
Standard_EXPORT virtual void SetID();
|
||||
|
||||
//! Returns the label to which the attribute is
|
||||
//! attached. If the label is not included in a DF,
|
||||
//! the label is null. See Label.
|
||||
|
@@ -57,5 +57,13 @@ inline Standard_Boolean TDF_Attribute::IsForgotten() const
|
||||
|
||||
// operator <<
|
||||
inline Standard_OStream& operator << (Standard_OStream& anOS,
|
||||
const Handle(TDF_Attribute)& anAtt)
|
||||
const Handle(TDF_Attribute)& anAtt)
|
||||
{ return anAtt->Dump(anOS); }
|
||||
|
||||
//=======================================================================
|
||||
inline void TDF_Attribute::SetID(const Standard_GUID& )
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
inline void TDF_Attribute::SetID()
|
||||
{}
|
@@ -108,7 +108,7 @@ void TDF_CopyTool::Copy
|
||||
if (theLabMap.IsBound(sLab)) {
|
||||
TDF_Label tIns(theLabMap.Find(sLab));
|
||||
TDF_CopyTool::CopyLabels(sLab,tIns,
|
||||
theLabMap,theAttMap,srcLabs,srcAtts);
|
||||
theLabMap,theAttMap,srcLabs,srcAtts);
|
||||
}
|
||||
// if not bound : do nothing!
|
||||
}
|
||||
@@ -127,7 +127,7 @@ void TDF_CopyTool::Copy
|
||||
// 2 - The target attribute is present BUT its privilege over the
|
||||
// source one must be ignored. The source attribute can be copied.
|
||||
if ((sAtt != tAtt) && aPrivilegeFilter.IsIgnored(tAtt->ID()))
|
||||
sAtt->Paste(tAtt,aRelocationTable);
|
||||
sAtt->Paste(tAtt,aRelocationTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ void TDF_CopyTool::CopyLabels
|
||||
const TDF_AttributeMap& aSrcAttributeMap)
|
||||
{
|
||||
TDF_CopyTool::CopyAttributes(aSLabel,aTargetLabel,
|
||||
aAttMap,aSrcAttributeMap);
|
||||
aAttMap,aSrcAttributeMap);
|
||||
|
||||
// Does the same for the children.
|
||||
for (TDF_ChildIterator childItr(aSLabel); childItr.More(); childItr.Next()){
|
||||
@@ -157,13 +157,12 @@ void TDF_CopyTool::CopyLabels
|
||||
TDF_Label childTIns = aTargetLabel.FindChild(childSLab.Tag());
|
||||
aLabMap.Bind(childSLab,childTIns);
|
||||
TDF_CopyTool::CopyLabels(childSLab,childTIns,
|
||||
aLabMap,aAttMap,
|
||||
aSrcLabelMap,aSrcAttributeMap);
|
||||
aLabMap,aAttMap,
|
||||
aSrcLabelMap,aSrcAttributeMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CopyAttributes
|
||||
//purpose : Internal attribute copy method.
|
||||
@@ -184,17 +183,19 @@ void TDF_CopyTool::CopyAttributes
|
||||
if (aSrcAttributeMap.Contains(sAtt)) {
|
||||
const Standard_GUID& id = sAtt->ID();
|
||||
if (!aTargetLabel.FindAttribute(id,tAtt)) {
|
||||
tAtt = sAtt->NewEmpty();
|
||||
aTargetLabel.AddAttribute(tAtt);
|
||||
aAttMap.Bind(sAtt,tAtt);
|
||||
tAtt = sAtt->NewEmpty();
|
||||
if(tAtt->ID() != id)
|
||||
tAtt->SetID(id);//
|
||||
aTargetLabel.AddAttribute(tAtt);
|
||||
aAttMap.Bind(sAtt,tAtt);
|
||||
}
|
||||
else {
|
||||
// Some attributes have the same ID, but are different and
|
||||
// exclusive. This obliged to test the dynamic type identity.
|
||||
if (tAtt->IsInstance(sAtt->DynamicType()))
|
||||
aAttMap.Bind(sAtt,tAtt);
|
||||
else
|
||||
throw Standard_TypeMismatch("TDF_CopyTool: Cannot paste to a different type attribute.");
|
||||
// Some attributes have the same ID, but are different and
|
||||
// exclusive. This obliged to test the dynamic type identity.
|
||||
if (tAtt->IsInstance(sAtt->DynamicType()))
|
||||
aAttMap.Bind(sAtt,tAtt);
|
||||
else
|
||||
throw Standard_TypeMismatch("TDF_CopyTool: Cannot paste to a different type attribute.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user