]> OCCT Git - occt-copy.git/commitdiff
Saving notes in the view
authorema <elena.mozokhina@opencascade.com>
Mon, 17 Apr 2017 12:16:47 +0000 (15:16 +0300)
committerema <elena.mozokhina@opencascade.com>
Tue, 12 Sep 2017 11:25:48 +0000 (14:25 +0300)
src/XCAFDoc/XCAFDoc.cxx
src/XCAFDoc/XCAFDoc.hxx
src/XCAFDoc/XCAFDoc_ViewTool.cxx
src/XCAFDoc/XCAFDoc_ViewTool.hxx

index 5beed49b8c1fcbf7a55d9d4028568d39bdb4fb22..0ea3f39981a87a8d0a59a45b0f81cec16570d3ab 100644 (file)
@@ -250,6 +250,17 @@ Standard_GUID XCAFDoc::ViewRefPlaneGUID()
   return ID;
 }
 
+//=======================================================================
+//function : ViewRefNoteGUID
+//purpose  : 
+//=======================================================================
+
+Standard_GUID XCAFDoc::ViewRefNoteGUID()
+{
+  static Standard_GUID ID("efd213e2-6dfd-11d4-b9c8-0060b0ee281b");
+  return ID;
+}
+
 //=======================================================================
 //function : ViewRefEnabledShapesGUID
 //purpose  : 
index 43497c751b456a3ac83afc296346c7f4b07bb5dd..a506a9c38bde452221bf700f631298511f74e15d 100644 (file)
@@ -120,6 +120,9 @@ public:
   
   //! Return GUIDs for TreeNode representing specified types of View
   Standard_EXPORT static Standard_GUID ViewRefPlaneGUID();
+  
+  //! Return GUIDs for TreeNode representing specified types of View
+  Standard_EXPORT static Standard_GUID ViewRefNoteGUID();
  
   //! Return GUIDs for TreeNode representing specified types of View
   Standard_EXPORT static Standard_GUID ViewRefEnabledShapesGUID();
index 5b79c884306a5efcb510879060d33a8291195e9a..cafd73484a817102ed38c84cfb51b3ec912f3cb1 100644 (file)
@@ -287,11 +287,10 @@ void XCAFDoc_ViewTool::SetView(const TDF_LabelSequence& theShapeLabels,
       aPlaneGNode = aChGNode->GetFather(1);
       aPlaneGNode->UnSetChild(aChGNode);
       if (aPlaneGNode->NbChildren() == 0)
-        aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID());
+        aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefPlaneGUID());
     }
     theViewL.ForgetAttribute(XCAFDoc::ViewRefPlaneGUID());
   }
-  
   if (!theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aChGNode) && theShapeLabels.Length() > 0) {
     aChGNode = new XCAFDoc_GraphNode;
     aChGNode = XCAFDoc_GraphNode::Set(theViewL);
@@ -426,7 +425,7 @@ void XCAFDoc_ViewTool::SetClippingPlanes(const TDF_LabelSequence& theClippingPla
       aPlaneGNode = aChGNode->GetFather(1);
       aPlaneGNode->UnSetChild(aChGNode);
       if (aPlaneGNode->NbChildren() == 0)
-        aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID());
+        aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefPlaneGUID());
     }
     theViewL.ForgetAttribute(XCAFDoc::ViewRefPlaneGUID());
   }
@@ -458,14 +457,14 @@ void XCAFDoc_ViewTool::SetEnabledShapes(const TDF_LabelSequence& theShapesTransp
     return;
 
   Handle(XCAFDoc_GraphNode) aChGNode;
-  Handle(XCAFDoc_GraphNode) aPlaneGNode;
+  Handle(XCAFDoc_GraphNode) aShapeGNode;
 
   if (theViewL.FindAttribute(XCAFDoc::ViewRefEnabledShapesGUID(), aChGNode)) {
     while (aChGNode->NbFathers() > 0) {
-      aPlaneGNode = aChGNode->GetFather(1);
-      aPlaneGNode->UnSetChild(aChGNode);
-      if (aPlaneGNode->NbChildren() == 0)
-        aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefEnabledShapesGUID());
+      aShapeGNode = aChGNode->GetFather(1);
+      aShapeGNode->UnSetChild(aChGNode);
+      if (aShapeGNode->NbChildren() == 0)
+        aShapeGNode->ForgetAttribute(XCAFDoc::ViewRefEnabledShapesGUID());
     }
     theViewL.ForgetAttribute(XCAFDoc::ViewRefEnabledShapesGUID());
   }
@@ -478,16 +477,55 @@ void XCAFDoc_ViewTool::SetEnabledShapes(const TDF_LabelSequence& theShapesTransp
   }
   for (Standard_Integer i = theShapesTransparencyLabels.Lower(); i <= theShapesTransparencyLabels.Upper(); i++)
   {
-    if (!theShapesTransparencyLabels.Value(i).FindAttribute(XCAFDoc::ViewRefEnabledShapesGUID(), aPlaneGNode)) {
-      aPlaneGNode = new XCAFDoc_GraphNode;
-      aPlaneGNode = XCAFDoc_GraphNode::Set(theShapesTransparencyLabels.Value(i));
+    if (!theShapesTransparencyLabels.Value(i).FindAttribute(XCAFDoc::ViewRefEnabledShapesGUID(), aShapeGNode)) {
+      aShapeGNode = new XCAFDoc_GraphNode;
+      aShapeGNode = XCAFDoc_GraphNode::Set(theShapesTransparencyLabels.Value(i));
     }
-    aPlaneGNode->SetGraphID(XCAFDoc::ViewRefEnabledShapesGUID());
-    aPlaneGNode->SetChild(aChGNode);
-    aChGNode->SetFather(aPlaneGNode);
+    aShapeGNode->SetGraphID(XCAFDoc::ViewRefEnabledShapesGUID());
+    aShapeGNode->SetChild(aChGNode);
+    aChGNode->SetFather(aShapeGNode);
   }
 }
+//=======================================================================
+//function : SetNotes
+//purpose  : 
+//=======================================================================
+void XCAFDoc_ViewTool::SetNotes(const TDF_LabelSequence& theNoteLabels,
+                                const TDF_Label& theViewL) const
+{
+  if (!IsView(theViewL))
+    return;
+
+  Handle(XCAFDoc_GraphNode) aChGNode;
+  Handle(XCAFDoc_GraphNode) aNoteGNode;
 
+  if (theViewL.FindAttribute(XCAFDoc::ViewRefNoteGUID(), aChGNode)) {
+    while (aChGNode->NbFathers() > 0) {
+      aNoteGNode = aChGNode->GetFather(1);
+      aNoteGNode->UnSetChild(aChGNode);
+      if (aNoteGNode->NbChildren() == 0)
+        aNoteGNode->ForgetAttribute(XCAFDoc::ViewRefNoteGUID());
+    }
+    theViewL.ForgetAttribute(XCAFDoc::ViewRefNoteGUID());
+  }
+
+
+  if (!theViewL.FindAttribute(XCAFDoc::ViewRefNoteGUID(), aChGNode) && theNoteLabels.Length() > 0) {
+    aChGNode = new XCAFDoc_GraphNode;
+    aChGNode = XCAFDoc_GraphNode::Set(theViewL);
+    aChGNode->SetGraphID(XCAFDoc::ViewRefNoteGUID());
+  }
+  for (Standard_Integer i = theNoteLabels.Lower(); i <= theNoteLabels.Upper(); i++)
+  {
+    if (!theNoteLabels.Value(i).FindAttribute(XCAFDoc::ViewRefNoteGUID(), aNoteGNode)) {
+      aNoteGNode = new XCAFDoc_GraphNode;
+      aNoteGNode = XCAFDoc_GraphNode::Set(theNoteLabels.Value(i));
+    }
+    aNoteGNode->SetGraphID(XCAFDoc::ViewRefNoteGUID());
+    aNoteGNode->SetChild(aChGNode);
+    aChGNode->SetFather(aNoteGNode);
+  }
+}
 //=======================================================================
 //function : RemoveView
 //purpose  : 
index 453024dc37b3a4899f5e8f9a6356fe44ea55daba..e1c952651fbff60a82d8bdcaea23d99a56f04c1b 100644 (file)
@@ -86,10 +86,13 @@ public:
   //! Set Clipping planes to  given View
   Standard_EXPORT void SetClippingPlanes(const TDF_LabelSequence& theClippingPlaneLabels,
                                          const TDF_Label& theViewL) const;
-
   Standard_EXPORT void  SetEnabledShapes(const TDF_LabelSequence& theShapesTransparencyLabels,
                                          const TDF_Label& theViewL) const;
 
+  //! Set Notes to  given View
+  Standard_EXPORT void SetNotes(const TDF_LabelSequence& theNoteLabels,
+                                const TDF_Label& theViewL) const;
+
   //! Remove View
   Standard_EXPORT void RemoveView(const TDF_Label& theViewL);
 
@@ -110,6 +113,9 @@ public:
 
   //! Returns all View labels defined for label Shapes transparency
   Standard_EXPORT Standard_Boolean GetViewLabelsForEnabledShapesLabel(const TDF_Label& theShapesTransparencyL, TDF_LabelSequence& theViews) const;
+  
+  //! Returns all View labels defined for label NotesL
+  Standard_EXPORT Standard_Boolean GetViewLabelsForNote(const TDF_Label& theNoteL, TDF_LabelSequence& theViews) const;
 
   //! Adds a view definition to a View table and returns its label
   Standard_EXPORT TDF_Label AddView() ;