]> OCCT Git - occt-copy.git/commitdiff
XCAF: assembly item ref driver added, file name typo correction
authorsnn <snn@opencascade.com>
Mon, 20 Feb 2017 10:35:39 +0000 (13:35 +0300)
committersnn <snn@opencascade.com>
Mon, 20 Feb 2017 11:12:36 +0000 (14:12 +0300)
src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx
src/XCAFDoc/XCAFDoc_AssemblyItemRef.hxx
src/XCAFDoc/XCAFDoc_Note.cxx
src/XCAFDoc/XCAFDoc_NoteBinData.cxx
src/XCAFDoc/XCAFDoc_NoteBinData.hxx
src/XCAFDoc/XCAFDoc_NoteComment.cxx
src/XCAFDoc/XCAFDoc_NoteComment.hxx
src/XCAFDoc/XCAFDoc_NotesTool.cxx

index 0bb89d64209ea01ee3c1209e4a37a205f9cf1d26..52709afb76268dd2f6dd00e02b33e140ae12b175 100644 (file)
@@ -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)
 {
index 9ef44c79be6413d5b39f54c684bd93036c1bdb26..c162a5ec48e0f4552211cf1f423ee8194c026328 100644 (file)
@@ -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,
index 9a69acac5c3fa37345e5ec436f787b98c4276446..b127b49048cd9a1ea03a77818ae5c620c1dd1227 100644 (file)
@@ -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;
 }
index c772c4260350c142dcde87011e6b15f927e99740..e8c7fa12bdfd3e4cbd5b975c16ee0d33a9959e3e 100644 (file)
 
 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"
index 6b3f2dbccef92e06799e91406570d7583bb2dd32..27160988f7cd1828ce3026164503a691a8f82895 100644 (file)
@@ -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,
index 3e6f2d68f9854340a33fae26efdde1a10cfe9578..b88f721bb4e69f7bd6d078db38afc6be2f41e9be 100644 (file)
 
 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"
index 04f6a15865e37be1d0719a664f20d2474bec5f8b..a8154a919af27441bf964646cd3d4d009925cd04 100644 (file)
@@ -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,
index e70dbfaea00753b4242d17c88e97f00ec5a285f2..bfdd95ea26603d20bb7105d1cefa9e87a564c69b 100644 (file)
@@ -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();
 }