]> OCCT Git - occt-copy.git/commitdiff
0030268: Inspectors - improvements in VInspector plugin
authornds <nds@opencascade.com>
Tue, 31 Dec 2019 10:35:32 +0000 (13:35 +0300)
committernds <nds@opencascade.com>
Tue, 31 Dec 2019 10:35:32 +0000 (13:35 +0300)
# shift selection in VInspector to visualize multiple preview,
# dump for primitive array parameters and buffer parameters
# display attach point of transform persistent

15 files changed:
src/Graphic3d/Graphic3d_BoundBuffer.hxx
src/Graphic3d/Graphic3d_Buffer.cxx
src/Graphic3d/Graphic3d_Buffer.hxx
src/Graphic3d/Graphic3d_IndexBuffer.hxx
src/Graphic3d/Graphic3d_TransformPers.cxx
src/Graphic3d/Graphic3d_TransformPers.hxx
src/NCollection/NCollection_Buffer.hxx
src/OpenGl/OpenGl_Element.cxx
src/OpenGl/OpenGl_IndexBuffer.cxx
src/OpenGl/OpenGl_IndexBuffer.hxx
src/OpenGl/OpenGl_PrimitiveArray.cxx
src/OpenGl/OpenGl_VertexBuffer.cxx
src/OpenGl/OpenGl_VertexBuffer.hxx
tools/MessageView/MessageView_Window.cxx
tools/VInspector/VInspector_Window.cxx

index 5aafd1cf146222cf847231a1153d1e0434ccdb9e..03c0ff98507bbd5ff0c9b42aa740facb58afa052 100644 (file)
@@ -61,6 +61,19 @@ public:
     return true;
   }
 
+  //! Dumps the content of me into the stream
+  virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE
+  {
+    OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_BoundBuffer);
+    OCCT_DUMP_BASE_CLASS (theOStream, theDepth, NCollection_Buffer);
+
+    OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, Colors);
+    OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, Bounds);
+
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, NbBounds);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, NbMaxBounds);
+  }
+
 public:
 
   Graphic3d_Vec4*   Colors;      //!< pointer to facet color values
index 2d46aef4f4f1793eb711ea8e53ba3f0839cd3bf6..f677b4fa77c04acba34aff90f2f1ae37ca1aeddd 100644 (file)
@@ -19,3 +19,17 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Buffer,      NCollection_Buffer)
 IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_IndexBuffer, Graphic3d_Buffer)
 IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_BoundBuffer, NCollection_Buffer)
 IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_MutableIndexBuffer, Graphic3d_IndexBuffer)
+
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
+void Graphic3d_Buffer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Buffer);
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, NCollection_Buffer);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Stride);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, NbElements);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, NbAttributes);
+}
\ No newline at end of file
index 103d185298a985a760709f3e5c5a82ae5664639c..f7c6a776eb2f199b6458bf2a6b4aa47b77c77226 100644 (file)
@@ -315,6 +315,9 @@ public:
   //! Invalidate entire buffer.
   virtual void Invalidate() {}
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
+
 public:
 
   Standard_Integer Stride;       //!< the distance to the attributes of the next vertex within interleaved array
index 7e0c5a1556ccf4f8e17e12e1de02abb2741e9058..ae37ffc3c1cf0fad9534db4377051a364ab0cec9 100644 (file)
@@ -77,6 +77,12 @@ public:
     }
   }
 
+  //! Dumps the content of me into the stream
+  virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE
+  {
+    OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_IndexBuffer);
+    OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Graphic3d_Buffer);
+  }
 
 };
 
index 87e18d494d45e843a86a000860431ce719755d0f..afe2446c67808853a609e6c0e961ea65d55a97f3 100644 (file)
@@ -56,12 +56,33 @@ Handle(Graphic3d_TransformPers) Graphic3d_TransformPers::FromDeprecatedParams (G
 // function : DumpJson
 // purpose  :
 // =======================================================================
-void Graphic3d_TransformPers::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
+void Graphic3d_TransformPers::PersParams3d::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  gp_Pnt anAttachPoint (PntX, PntY, PntZ);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &anAttachPoint);
+}
+
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
+void Graphic3d_TransformPers::PersParams2d::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
+{
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, OffsetX);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, OffsetY);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Corner);
+}
+
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
+void Graphic3d_TransformPers::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_TransformPers);
 
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMode)
 
-  OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "Params3d", 3, myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ)
-  OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "Params2d", 3, myParams.Params2d.OffsetX, myParams.Params2d.OffsetY, myParams.Params2d.Corner)
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myParams.Params3d);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myParams.Params2d);
 }
index 24d267e0afa40f4ec0b42d66f6049490cdbde713..f04742a4c4a121c791f1b288fcb72f7712759440 100644 (file)
@@ -294,6 +294,9 @@ private:
     Standard_Real PntX;
     Standard_Real PntY;
     Standard_Real PntZ;
+
+    //! Dumps the content of me into the stream
+    Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
   };
 
   //! 2d/trihedron transformation persistence parameters.
@@ -302,6 +305,9 @@ private:
     Standard_Integer OffsetX;
     Standard_Integer OffsetY;
     Aspect_TypeOfTriedronPosition Corner;
+
+    //! Dumps the content of me into the stream
+    Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
   };
 
 private:
index aca2b7d1b02c53833c7597ba9be648fc71a5f4eb..bd2be5f8ecdb2d0152cc65473a26eea9f5283081 100644 (file)
@@ -124,7 +124,7 @@ public:
   }
 
   //! Dumps the content of me into the stream
-  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
   {
     (void)theDepth;
     OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myData);
index 2e708a88021ec4117ea51959a833460fc6428235..43769009b46d32f6657d4c7d16149562150e82ba 100755 (executable)
@@ -41,5 +41,6 @@ OpenGl_Element::~OpenGl_Element()
 // =======================================================================
 void OpenGl_Element::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
 {
+  OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_Element);
   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, this);
 }
index 30cf5f468799557a4dea912e0700ea4ec8eff83c..db21ecd142d2ba3627305b77050263f662b4f275 100644 (file)
@@ -35,3 +35,13 @@ GLenum OpenGl_IndexBuffer::GetTarget() const
 {
   return GL_ELEMENT_ARRAY_BUFFER;
 }
+
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
+void OpenGl_IndexBuffer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_IndexBuffer)
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, OpenGl_VertexBuffer);
+}
index 8189677c33e4c998d42e818900ea0f63aef3e582..fe5c35fac111c20740363cc18b4df5488eed161b 100644 (file)
@@ -25,6 +25,9 @@ public:
   Standard_EXPORT OpenGl_IndexBuffer();
   Standard_EXPORT virtual GLenum GetTarget() const Standard_OVERRIDE;
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
+
 public:
 
   DEFINE_STANDARD_RTTIEXT(OpenGl_IndexBuffer,OpenGl_VertexBuffer) // Type definition
index 5573c7ff1df45b9db50f233ad224938abef35eca..b71dd848f38a83d1197ee0d93fe64dd3282872a5 100644 (file)
@@ -1139,15 +1139,15 @@ void OpenGl_PrimitiveArray::DumpJson (Standard_OStream& theOStream, const Standa
 
   OCCT_DUMP_BASE_CLASS (theOStream, theDepth, OpenGl_Element);
 
-  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get());
-  //OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShadingModel);
-  //mutable Handle(OpenGl_VertexBuffer)   myVboIndices;
-  //mutable Handle(OpenGl_VertexBuffer)   myVboAttribs;
-  //mutable Handle(Graphic3d_IndexBuffer) myIndices;
-  //mutable Handle(Graphic3d_Buffer)      myAttribs;
-  //mutable Handle(Graphic3d_BoundBuffer) myBounds;
-  //GLshort                               myDrawMode;
-  //mutable Standard_Boolean              myIsFillType;
-  //mutable Standard_Boolean              myIsVboInit;
-  //Standard_Size                         myUID; //!< Unique ID of primitive array. 
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myVboIndices.get());
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myVboAttribs.get());
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myIndices.get());
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAttribs.get());
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myBounds.get());
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDrawMode);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsFillType);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsVboInit);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUID);
 }
index 1d4034c3a181de7d7e51b38166408bdf8bed1a9a..9271f57ce16019a6e12147c0bbce00ea7799d5c3 100644 (file)
@@ -256,9 +256,10 @@ void OpenGl_VertexBuffer::unbindFixedColor (const Handle(OpenGl_Context)& theCtx
 // function : DumpJson
 // purpose  :
 // =======================================================================
-void OpenGl_VertexBuffer::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
+void OpenGl_VertexBuffer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_VertexBuffer)
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, OpenGl_Resource);
 
   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myOffset);
 
index 5e012681fb96b097e529a6bbf8615746b370f877..b2ff2b9ed87c6ecf5e50ce3ac8c9a66206ad51bf 100644 (file)
@@ -337,7 +337,7 @@ public: //! @name methods for interleaved attributes array
   Standard_EXPORT virtual void UnbindAllAttributes (const Handle(OpenGl_Context)& theGlCtx) const;
 
   //! Dumps the content of me into the stream
-  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
 
 protected:
 
index 59b7b5d801bc5a1a073d8ab4e0f1460400d7b946..14c000b7d6fa6153f0e8de5b8dcc8f38dfdde518 100644 (file)
@@ -757,7 +757,6 @@ void MessageView_Window::updatePreviewPresentation()
     return;
 
   NCollection_List<Handle(Standard_Transient)> aPresentations;
-  MessageModel_ItemRootPtr aRootItem;
   QModelIndexList aSelectedIndices = myTreeView->selectionModel()->selectedIndexes();
   for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
   {
index e57f62777435f4aab2b96eb6bcf68f6a4bfce9ea..4d813c729f5c1397f38d930fe52047c0ea27c52c 100644 (file)
@@ -838,17 +838,26 @@ void VInspector_Window::onTreeViewSelectionChanged (const QItemSelection&,
   if (myPropertyPanelWidget->toggleViewAction()->isChecked())
     updatePropertyPanelBySelection();
 
-  QModelIndex aTreeItemIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0);
-  TreeModel_ItemBasePtr aTreeItemSelected = TreeModel_ModelBase::GetItemByIndex (aTreeItemIndex);
-  if (!aTreeItemSelected)
-    return;
-
   NCollection_List<Handle(Standard_Transient)> aSelPresentations;
 
-  Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->Properties ();
-  if (anItemProperties)
-    anItemProperties->GetPresentations (-1, -1, aSelPresentations);
-  //else
+  QModelIndexList aSelectedIndices = myTreeView->selectionModel()->selectedIndexes();
+  for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+  {
+    QModelIndex anIndex = *aSelIt;
+    if (anIndex.column() != 0)
+      continue;
+
+    TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+    if (!anItemBase)
+      continue;
+
+    Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->Properties();
+    if (anItemProperties)
+    {
+      anItemProperties->GetPresentations (-1, -1, aSelPresentations);
+    }
+  }
+
   GetSelectedShapes (aSelPresentations);
   myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, aSelPresentations);