1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-06 10:36:12 +03:00

XCAF: assembly item ref driver added, file name typo correction

This commit is contained in:
snn 2017-02-20 13:35:39 +03:00
parent 918b022dae
commit ac5eea5d0e
8 changed files with 73 additions and 64 deletions

View File

@ -27,15 +27,6 @@ XCAFDoc_AssemblyItemRef::GetID()
return s_ID; return s_ID;
} }
Standard_Boolean
XCAFDoc_AssemblyItemRef::IsMine(const TDF_Label& theLabel)
{
Handle(XCAFDoc_AssemblyItemRef) aThis;
return !theLabel.IsNull() &&
theLabel.FindAttribute(XCAFDoc_AssemblyItemRef::GetID(), aThis) &&
!aThis.IsNull();
}
Handle(XCAFDoc_AssemblyItemRef) Handle(XCAFDoc_AssemblyItemRef)
XCAFDoc_AssemblyItemRef::Get(const TDF_Label& theLabel) XCAFDoc_AssemblyItemRef::Get(const TDF_Label& theLabel)
{ {

View File

@ -36,8 +36,6 @@ public:
Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT static Standard_Boolean IsMine(const TDF_Label& theLabel);
Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Get(const TDF_Label& theLabel); Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Get(const TDF_Label& theLabel);
Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Set(const TDF_Label& theLabel, Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Set(const TDF_Label& theLabel,

View File

@ -20,16 +20,19 @@
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NoteBinData, XCAFDoc_Note) IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NoteBinData, XCAFDoc_Note)
const Standard_GUID& XCAFDoc_NoteBinData::GetID() const Standard_GUID&
XCAFDoc_NoteBinData::GetID()
{ {
static Standard_GUID s_ID("E9055501-F0FC-4864-BE4B-284FDA7DDEAC"); static Standard_GUID s_ID("E9055501-F0FC-4864-BE4B-284FDA7DDEAC");
return s_ID; return s_ID;
} }
Standard_Boolean XCAFDoc_NoteBinData::IsMine(const TDF_Label& theLabel) Handle(XCAFDoc_NoteBinData)
XCAFDoc_NoteBinData::Get(const TDF_Label& theLabel)
{ {
Handle(XCAFDoc_NoteBinData) anAttr; Handle(XCAFDoc_NoteBinData) aThis;
return (!theLabel.IsNull() && theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), anAttr)); theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), aThis);
return aThis;
} }
Handle(XCAFDoc_NoteBinData) Handle(XCAFDoc_NoteBinData)
@ -76,7 +79,8 @@ XCAFDoc_NoteBinData::XCAFDoc_NoteBinData()
{ {
} }
Standard_Boolean XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle, Standard_Boolean
XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
const TCollection_AsciiString& theMIMEtype, const TCollection_AsciiString& theMIMEtype,
OSD_File& theFile) OSD_File& theFile)
{ {
@ -100,7 +104,8 @@ Standard_Boolean XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theT
return Standard_True; return Standard_True;
} }
void XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle, void
XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
const TCollection_AsciiString& theMIMEtype, const TCollection_AsciiString& theMIMEtype,
const Handle(TColStd_HArray1OfByte)& theData) const Handle(TColStd_HArray1OfByte)& theData)
{ {
@ -111,37 +116,44 @@ void XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
myMIMEtype = theMIMEtype; myMIMEtype = theMIMEtype;
} }
const TCollection_ExtendedString& XCAFDoc_NoteBinData::Title() const const TCollection_ExtendedString&
XCAFDoc_NoteBinData::Title() const
{ {
return myTitle; return myTitle;
} }
const TCollection_AsciiString& XCAFDoc_NoteBinData::MIMEtype() const const TCollection_AsciiString&
XCAFDoc_NoteBinData::MIMEtype() const
{ {
return myMIMEtype; return myMIMEtype;
} }
Standard_Integer XCAFDoc_NoteBinData::Size() const Standard_Integer
XCAFDoc_NoteBinData::Size() const
{ {
return (!myData.IsNull() ? myData->Length() : 0); return (!myData.IsNull() ? myData->Length() : 0);
} }
const Handle(TColStd_HArray1OfByte)& XCAFDoc_NoteBinData::Data() const const Handle(TColStd_HArray1OfByte)&
XCAFDoc_NoteBinData::Data() const
{ {
return myData; return myData;
} }
const Standard_GUID& XCAFDoc_NoteBinData::ID() const const
Standard_GUID& XCAFDoc_NoteBinData::ID() const
{ {
return GetID(); return GetID();
} }
Handle(TDF_Attribute) XCAFDoc_NoteBinData::NewEmpty() const Handle(TDF_Attribute)
XCAFDoc_NoteBinData::NewEmpty() const
{ {
return new XCAFDoc_NoteBinData(); return new XCAFDoc_NoteBinData();
} }
void XCAFDoc_NoteBinData::Restore(const Handle(TDF_Attribute)& theAttr) void
XCAFDoc_NoteBinData::Restore(const Handle(TDF_Attribute)& theAttr)
{ {
XCAFDoc_Note::Restore(theAttr); XCAFDoc_Note::Restore(theAttr);
@ -154,7 +166,8 @@ void XCAFDoc_NoteBinData::Restore(const Handle(TDF_Attribute)& theAttr)
} }
} }
void XCAFDoc_NoteBinData::Paste(const Handle(TDF_Attribute)& theAttrInto, void
XCAFDoc_NoteBinData::Paste(const Handle(TDF_Attribute)& theAttrInto,
const Handle(TDF_RelocationTable)& theRT) const const Handle(TDF_RelocationTable)& theRT) const
{ {
XCAFDoc_Note::Paste(theAttrInto, theRT); XCAFDoc_Note::Paste(theAttrInto, theRT);
@ -164,7 +177,8 @@ void XCAFDoc_NoteBinData::Paste(const Handle(TDF_Attribute)& theAttrInto,
aMine->Set(myTitle, myMIMEtype, myData); aMine->Set(myTitle, myMIMEtype, myData);
} }
Standard_OStream& XCAFDoc_NoteBinData::Dump(Standard_OStream& theOS) const Standard_OStream&
XCAFDoc_NoteBinData::Dump(Standard_OStream& theOS) const
{ {
XCAFDoc_Note::Dump(theOS); XCAFDoc_Note::Dump(theOS);
theOS << "\n" theOS << "\n"

View File

@ -34,7 +34,7 @@ public:
Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT static Standard_Boolean IsMine(const TDF_Label& theLabel); Standard_EXPORT static Handle(XCAFDoc_NoteBinData) Get(const TDF_Label& theLabel);
Standard_EXPORT static Handle(XCAFDoc_NoteBinData) Set(const TDF_Label& theLabel, Standard_EXPORT static Handle(XCAFDoc_NoteBinData) Set(const TDF_Label& theLabel,
const TCollection_ExtendedString& theUserName, const TCollection_ExtendedString& theUserName,

View File

@ -19,19 +19,23 @@
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NoteComment, XCAFDoc_Note) IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NoteComment, XCAFDoc_Note)
const Standard_GUID& XCAFDoc_NoteComment::GetID() const Standard_GUID&
XCAFDoc_NoteComment::GetID()
{ {
static Standard_GUID s_ID("FDEA4C52-0F54-484c-B590-579E18F7B5D4"); static Standard_GUID s_ID("FDEA4C52-0F54-484c-B590-579E18F7B5D4");
return s_ID; return s_ID;
} }
Standard_Boolean XCAFDoc_NoteComment::IsMine(const TDF_Label& theLabel) Handle(XCAFDoc_NoteComment)
XCAFDoc_NoteComment::Get(const TDF_Label& theLabel)
{ {
Handle(XCAFDoc_NoteComment) anAttr; Handle(XCAFDoc_NoteComment) aThis;
return (!theLabel.IsNull() && theLabel.FindAttribute(XCAFDoc_NoteComment::GetID(), anAttr)); theLabel.FindAttribute(XCAFDoc_NoteComment::GetID(), aThis);
return aThis;
} }
Handle(XCAFDoc_NoteComment) XCAFDoc_NoteComment::Set(const TDF_Label& theLabel, Handle(XCAFDoc_NoteComment)
XCAFDoc_NoteComment::Set(const TDF_Label& theLabel,
const TCollection_ExtendedString& theUserName, const TCollection_ExtendedString& theUserName,
const TCollection_ExtendedString& theTimeStamp, const TCollection_ExtendedString& theTimeStamp,
const TCollection_ExtendedString& theComment) const TCollection_ExtendedString& theComment)
@ -51,29 +55,34 @@ XCAFDoc_NoteComment::XCAFDoc_NoteComment()
{ {
} }
void XCAFDoc_NoteComment::Set(const TCollection_ExtendedString& theComment) void
XCAFDoc_NoteComment::Set(const TCollection_ExtendedString& theComment)
{ {
Backup(); Backup();
myComment = theComment; myComment = theComment;
} }
const TCollection_ExtendedString& XCAFDoc_NoteComment::Comment() const const TCollection_ExtendedString&
XCAFDoc_NoteComment::Comment() const
{ {
return myComment; return myComment;
} }
const Standard_GUID& XCAFDoc_NoteComment::ID() const const Standard_GUID&
XCAFDoc_NoteComment::ID() const
{ {
return GetID(); return GetID();
} }
Handle(TDF_Attribute) XCAFDoc_NoteComment::NewEmpty() const Handle(TDF_Attribute)
XCAFDoc_NoteComment::NewEmpty() const
{ {
return new XCAFDoc_NoteComment(); return new XCAFDoc_NoteComment();
} }
void XCAFDoc_NoteComment::Restore(const Handle(TDF_Attribute)& theAttr) void
XCAFDoc_NoteComment::Restore(const Handle(TDF_Attribute)& theAttr)
{ {
XCAFDoc_Note::Restore(theAttr); XCAFDoc_Note::Restore(theAttr);
@ -82,7 +91,8 @@ void XCAFDoc_NoteComment::Restore(const Handle(TDF_Attribute)& theAttr)
myComment = aMine->myComment; myComment = aMine->myComment;
} }
void XCAFDoc_NoteComment::Paste(const Handle(TDF_Attribute)& theAttrInto, void
XCAFDoc_NoteComment::Paste(const Handle(TDF_Attribute)& theAttrInto,
const Handle(TDF_RelocationTable)& theRT) const const Handle(TDF_RelocationTable)& theRT) const
{ {
XCAFDoc_Note::Paste(theAttrInto, theRT); XCAFDoc_Note::Paste(theAttrInto, theRT);
@ -92,7 +102,8 @@ void XCAFDoc_NoteComment::Paste(const Handle(TDF_Attribute)& theAttrInto,
aMine->Set(myComment); aMine->Set(myComment);
} }
Standard_OStream& XCAFDoc_NoteComment::Dump(Standard_OStream& theOS) const Standard_OStream&
XCAFDoc_NoteComment::Dump(Standard_OStream& theOS) const
{ {
XCAFDoc_Note::Dump(theOS); XCAFDoc_Note::Dump(theOS);
theOS << "\n" theOS << "\n"

View File

@ -29,7 +29,7 @@ public:
Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT static Standard_Boolean IsMine(const TDF_Label& theLabel); Standard_EXPORT static Handle(XCAFDoc_NoteComment) Get(const TDF_Label& theLabel);
Standard_EXPORT static Handle(XCAFDoc_NoteComment) Set(const TDF_Label& theLabel, Standard_EXPORT static Handle(XCAFDoc_NoteComment) Set(const TDF_Label& theLabel,
const TCollection_ExtendedString& theUserName, const TCollection_ExtendedString& theUserName,

View File

@ -18,7 +18,7 @@
#include <TColStd_HArray1OfByte.hxx> #include <TColStd_HArray1OfByte.hxx>
#include <TDF_Label.hxx> #include <TDF_Label.hxx>
#include <TDF_LabelMapHasher.hxx> #include <TDF_LabelMapHasher.hxx>
#include <TDF_ChildIterator.hxx> #include <TDF_ChildIDIterator.hxx>
#include <TDF_LabelSequence.hxx> #include <TDF_LabelSequence.hxx>
#include <XCAFDoc.hxx> #include <XCAFDoc.hxx>
#include <XCAFDoc_GraphNode.hxx> #include <XCAFDoc_GraphNode.hxx>
@ -76,7 +76,7 @@ XCAFDoc_NotesTool::NbNotes() const
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next()) for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
{ {
const TDF_Label aLabel = anIter.Value(); const TDF_Label aLabel = anIter.Value();
if (XCAFDoc_Note::IsMine(aLabel)) if (!XCAFDoc_Note::Get(aLabel).IsNull())
++nbNotes; ++nbNotes;
} }
return nbNotes; return nbNotes;
@ -86,10 +86,8 @@ Standard_Integer
XCAFDoc_NotesTool::NbAnnotatedItems() const XCAFDoc_NotesTool::NbAnnotatedItems() const
{ {
Standard_Integer nbItems = 0; Standard_Integer nbItems = 0;
for (TDF_ChildIterator anIter(GetAnnotatedItemsLabel()); anIter.More(); anIter.Next()) for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
{ {
const TDF_Label aLabel = anIter.Value();
if (XCAFDoc_AssemblyItemRef::IsMine(aLabel))
++nbItems; ++nbItems;
} }
return nbItems; return nbItems;
@ -101,7 +99,7 @@ XCAFDoc_NotesTool::GetNotes(TDF_LabelSequence& theNoteLabels) const
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next()) for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
{ {
const TDF_Label aLabel = anIter.Value(); const TDF_Label aLabel = anIter.Value();
if (XCAFDoc_Note::IsMine(aLabel)) if (!XCAFDoc_Note::Get(aLabel).IsNull())
theNoteLabels.Append(aLabel); theNoteLabels.Append(aLabel);
} }
} }
@ -109,11 +107,9 @@ XCAFDoc_NotesTool::GetNotes(TDF_LabelSequence& theNoteLabels) const
void void
XCAFDoc_NotesTool::GetAnnotatedItems(TDF_LabelSequence& theItemLabels) const XCAFDoc_NotesTool::GetAnnotatedItems(TDF_LabelSequence& theItemLabels) const
{ {
for (TDF_ChildIterator anIter(GetAnnotatedItemsLabel()); anIter.More(); anIter.Next()) for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
{ {
const TDF_Label aLabel = anIter.Value(); theItemLabels.Append(anIter.Value()->Label());
if (XCAFDoc_AssemblyItemRef::IsMine(aLabel))
theItemLabels.Append(aLabel);
} }
} }
@ -126,12 +122,11 @@ XCAFDoc_NotesTool::IsAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) cons
TDF_Label TDF_Label
XCAFDoc_NotesTool::FindAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const XCAFDoc_NotesTool::FindAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const
{ {
for (TDF_ChildIterator anIter(GetAnnotatedItemsLabel()); anIter.More(); anIter.Next()) for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
{ {
const TDF_Label aLabel = anIter.Value(); Handle(XCAFDoc_AssemblyItemRef) anItemRef = Handle(XCAFDoc_AssemblyItemRef)::DownCast(anIter.Value());
Handle(XCAFDoc_AssemblyItemRef) anItemRef = XCAFDoc_AssemblyItemRef::Get(aLabel);
if (!anItemRef.IsNull() && anItemRef->Get().IsEqual(theItemId)) if (!anItemRef.IsNull() && anItemRef->Get().IsEqual(theItemId))
return aLabel; return anItemRef->Label();
} }
return TDF_Label(); return TDF_Label();
} }