mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-11 10:44:53 +03:00
refs #314: Get notes attached to sub-shapes/attributes of an assembly item
This commit is contained in:
parent
8f469cc38b
commit
1bebdb9c92
@ -132,7 +132,7 @@ XCAFDoc_NotesTool::FindAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) co
|
||||
}
|
||||
|
||||
TDF_Label
|
||||
XCAFDoc_NotesTool::FindAnnotatedItemGUID(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
XCAFDoc_NotesTool::FindAnnotatedItemAttr(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID) const
|
||||
{
|
||||
for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
|
||||
@ -218,6 +218,53 @@ XCAFDoc_NotesTool::GetNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
return theNoteLabels.Length();
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::GetAttrNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID,
|
||||
TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItemAttr(theItemId, theGUID);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
return 0;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
if (!anAnnotatedItem.FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
return 0;
|
||||
|
||||
Standard_Integer nbFathers = aChild->NbFathers();
|
||||
for (Standard_Integer iFather = 1; iFather <= nbFathers; ++iFather)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aFather = aChild->GetFather(iFather);
|
||||
theNoteLabels.Append(aFather->Label());
|
||||
}
|
||||
|
||||
return theNoteLabels.Length();
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::GetSubshapeNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex,
|
||||
TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItemSubshape(theItemId, theSubshapeIndex);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
return 0;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
if (!anAnnotatedItem.FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
return 0;
|
||||
|
||||
Standard_Integer nbFathers = aChild->NbFathers();
|
||||
for (Standard_Integer iFather = 1; iFather <= nbFathers; ++iFather)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aFather = aChild->GetFather(iFather);
|
||||
theNoteLabels.Append(aFather->Label());
|
||||
}
|
||||
|
||||
return theNoteLabels.Length();
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_NotesTool::AddNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId)
|
||||
@ -276,7 +323,7 @@ XCAFDoc_NotesTool::AddNoteToAttr(const TDF_Label& theNoteLabel,
|
||||
return anItemRef;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItemGUID(theItemId, theGUID);
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItemAttr(theItemId, theGUID);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
{
|
||||
TDF_TagSource aTag;
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const;
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const;
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItemGUID(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItemAttr(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID) const;
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItemSubshape(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex) const;
|
||||
@ -80,6 +80,12 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Integer GetNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
TDF_LabelSequence& theNoteLabels) const;
|
||||
Standard_EXPORT Standard_Integer GetAttrNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID,
|
||||
TDF_LabelSequence& theNoteLabels) const;
|
||||
Standard_EXPORT Standard_Integer GetSubshapeNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex,
|
||||
TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user