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:
parent
918b022dae
commit
ac5eea5d0e
@ -27,15 +27,6 @@ XCAFDoc_AssemblyItemRef::GetID()
|
||||
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)
|
||||
XCAFDoc_AssemblyItemRef::Get(const TDF_Label& theLabel)
|
||||
{
|
||||
|
@ -36,8 +36,6 @@ public:
|
||||
|
||||
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) Set(const TDF_Label& theLabel,
|
||||
|
@ -38,7 +38,7 @@ XCAFDoc_Note::Get(const TDF_Label& theLabel)
|
||||
Handle(XCAFDoc_Note) aNote;
|
||||
if (!theLabel.IsNull() &&
|
||||
(theLabel.FindAttribute(XCAFDoc_NoteComment::GetID(), aNote) ||
|
||||
theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), aNote)))
|
||||
theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), aNote)))
|
||||
return aNote;
|
||||
return aNote;
|
||||
}
|
||||
|
@ -20,16 +20,19 @@
|
||||
|
||||
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");
|
||||
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;
|
||||
return (!theLabel.IsNull() && theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), anAttr));
|
||||
Handle(XCAFDoc_NoteBinData) aThis;
|
||||
theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), aThis);
|
||||
return aThis;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteBinData)
|
||||
@ -76,9 +79,10 @@ XCAFDoc_NoteBinData::XCAFDoc_NoteBinData()
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Boolean XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
OSD_File& theFile)
|
||||
Standard_Boolean
|
||||
XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
OSD_File& theFile)
|
||||
{
|
||||
if (!theFile.IsOpen() || !theFile.IsReadable())
|
||||
return Standard_False;
|
||||
@ -100,9 +104,10 @@ Standard_Boolean XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theT
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
void XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
const Handle(TColStd_HArray1OfByte)& theData)
|
||||
void
|
||||
XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
const Handle(TColStd_HArray1OfByte)& theData)
|
||||
{
|
||||
Backup();
|
||||
|
||||
@ -111,37 +116,44 @@ void XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
|
||||
myMIMEtype = theMIMEtype;
|
||||
}
|
||||
|
||||
const TCollection_ExtendedString& XCAFDoc_NoteBinData::Title() const
|
||||
const TCollection_ExtendedString&
|
||||
XCAFDoc_NoteBinData::Title() const
|
||||
{
|
||||
return myTitle;
|
||||
}
|
||||
|
||||
const TCollection_AsciiString& XCAFDoc_NoteBinData::MIMEtype() const
|
||||
const TCollection_AsciiString&
|
||||
XCAFDoc_NoteBinData::MIMEtype() const
|
||||
{
|
||||
return myMIMEtype;
|
||||
}
|
||||
|
||||
Standard_Integer XCAFDoc_NoteBinData::Size() const
|
||||
Standard_Integer
|
||||
XCAFDoc_NoteBinData::Size() const
|
||||
{
|
||||
return (!myData.IsNull() ? myData->Length() : 0);
|
||||
}
|
||||
|
||||
const Handle(TColStd_HArray1OfByte)& XCAFDoc_NoteBinData::Data() const
|
||||
const Handle(TColStd_HArray1OfByte)&
|
||||
XCAFDoc_NoteBinData::Data() const
|
||||
{
|
||||
return myData;
|
||||
}
|
||||
|
||||
const Standard_GUID& XCAFDoc_NoteBinData::ID() const
|
||||
const
|
||||
Standard_GUID& XCAFDoc_NoteBinData::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
Handle(TDF_Attribute) XCAFDoc_NoteBinData::NewEmpty() const
|
||||
Handle(TDF_Attribute)
|
||||
XCAFDoc_NoteBinData::NewEmpty() const
|
||||
{
|
||||
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);
|
||||
|
||||
@ -154,8 +166,9 @@ void XCAFDoc_NoteBinData::Restore(const Handle(TDF_Attribute)& theAttr)
|
||||
}
|
||||
}
|
||||
|
||||
void XCAFDoc_NoteBinData::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const
|
||||
void
|
||||
XCAFDoc_NoteBinData::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const
|
||||
{
|
||||
XCAFDoc_Note::Paste(theAttrInto, theRT);
|
||||
|
||||
@ -164,7 +177,8 @@ void XCAFDoc_NoteBinData::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
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);
|
||||
theOS << "\n"
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
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,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
|
@ -19,22 +19,26 @@
|
||||
|
||||
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");
|
||||
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;
|
||||
return (!theLabel.IsNull() && theLabel.FindAttribute(XCAFDoc_NoteComment::GetID(), anAttr));
|
||||
Handle(XCAFDoc_NoteComment) aThis;
|
||||
theLabel.FindAttribute(XCAFDoc_NoteComment::GetID(), aThis);
|
||||
return aThis;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteComment) XCAFDoc_NoteComment::Set(const TDF_Label& theLabel,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment)
|
||||
Handle(XCAFDoc_NoteComment)
|
||||
XCAFDoc_NoteComment::Set(const TDF_Label& theLabel,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment)
|
||||
{
|
||||
Handle(XCAFDoc_NoteComment) aNoteComment;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_NoteComment::GetID(), aNoteComment))
|
||||
@ -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();
|
||||
|
||||
myComment = theComment;
|
||||
}
|
||||
|
||||
const TCollection_ExtendedString& XCAFDoc_NoteComment::Comment() const
|
||||
const TCollection_ExtendedString&
|
||||
XCAFDoc_NoteComment::Comment() const
|
||||
{
|
||||
return myComment;
|
||||
}
|
||||
|
||||
const Standard_GUID& XCAFDoc_NoteComment::ID() const
|
||||
const Standard_GUID&
|
||||
XCAFDoc_NoteComment::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
Handle(TDF_Attribute) XCAFDoc_NoteComment::NewEmpty() const
|
||||
Handle(TDF_Attribute)
|
||||
XCAFDoc_NoteComment::NewEmpty() const
|
||||
{
|
||||
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);
|
||||
|
||||
@ -82,8 +91,9 @@ void XCAFDoc_NoteComment::Restore(const Handle(TDF_Attribute)& theAttr)
|
||||
myComment = aMine->myComment;
|
||||
}
|
||||
|
||||
void XCAFDoc_NoteComment::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const
|
||||
void
|
||||
XCAFDoc_NoteComment::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const
|
||||
{
|
||||
XCAFDoc_Note::Paste(theAttrInto, theRT);
|
||||
|
||||
@ -92,7 +102,8 @@ void XCAFDoc_NoteComment::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
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);
|
||||
theOS << "\n"
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
|
||||
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,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <TDF_ChildIDIterator.hxx>
|
||||
#include <TDF_LabelSequence.hxx>
|
||||
#include <XCAFDoc.hxx>
|
||||
#include <XCAFDoc_GraphNode.hxx>
|
||||
@ -76,7 +76,7 @@ XCAFDoc_NotesTool::NbNotes() const
|
||||
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
if (XCAFDoc_Note::IsMine(aLabel))
|
||||
if (!XCAFDoc_Note::Get(aLabel).IsNull())
|
||||
++nbNotes;
|
||||
}
|
||||
return nbNotes;
|
||||
@ -86,10 +86,8 @@ Standard_Integer
|
||||
XCAFDoc_NotesTool::NbAnnotatedItems() const
|
||||
{
|
||||
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;
|
||||
}
|
||||
return nbItems;
|
||||
@ -101,7 +99,7 @@ XCAFDoc_NotesTool::GetNotes(TDF_LabelSequence& theNoteLabels) const
|
||||
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
if (XCAFDoc_Note::IsMine(aLabel))
|
||||
if (!XCAFDoc_Note::Get(aLabel).IsNull())
|
||||
theNoteLabels.Append(aLabel);
|
||||
}
|
||||
}
|
||||
@ -109,11 +107,9 @@ XCAFDoc_NotesTool::GetNotes(TDF_LabelSequence& theNoteLabels) const
|
||||
void
|
||||
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();
|
||||
if (XCAFDoc_AssemblyItemRef::IsMine(aLabel))
|
||||
theItemLabels.Append(aLabel);
|
||||
theItemLabels.Append(anIter.Value()->Label());
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,12 +122,11 @@ XCAFDoc_NotesTool::IsAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) cons
|
||||
TDF_Label
|
||||
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 = XCAFDoc_AssemblyItemRef::Get(aLabel);
|
||||
Handle(XCAFDoc_AssemblyItemRef) anItemRef = Handle(XCAFDoc_AssemblyItemRef)::DownCast(anIter.Value());
|
||||
if (!anItemRef.IsNull() && anItemRef->Get().IsEqual(theItemId))
|
||||
return aLabel;
|
||||
return anItemRef->Label();
|
||||
}
|
||||
return TDF_Label();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user