From: nds Date: Tue, 31 Dec 2019 10:35:32 +0000 (+0300) Subject: 0030268: Inspectors - improvements in VInspector plugin X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=a79a22879b02f72fd5299c8c86c17504169326ea;p=occt-copy.git 0030268: Inspectors - improvements in VInspector plugin # shift selection in VInspector to visualize multiple preview, # dump for primitive array parameters and buffer parameters # display attach point of transform persistent --- diff --git a/src/Graphic3d/Graphic3d_BoundBuffer.hxx b/src/Graphic3d/Graphic3d_BoundBuffer.hxx index 5aafd1cf14..03c0ff9850 100644 --- a/src/Graphic3d/Graphic3d_BoundBuffer.hxx +++ b/src/Graphic3d/Graphic3d_BoundBuffer.hxx @@ -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 diff --git a/src/Graphic3d/Graphic3d_Buffer.cxx b/src/Graphic3d/Graphic3d_Buffer.cxx index 2d46aef4f4..f677b4fa77 100644 --- a/src/Graphic3d/Graphic3d_Buffer.cxx +++ b/src/Graphic3d/Graphic3d_Buffer.cxx @@ -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 diff --git a/src/Graphic3d/Graphic3d_Buffer.hxx b/src/Graphic3d/Graphic3d_Buffer.hxx index 103d185298..f7c6a776eb 100644 --- a/src/Graphic3d/Graphic3d_Buffer.hxx +++ b/src/Graphic3d/Graphic3d_Buffer.hxx @@ -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 diff --git a/src/Graphic3d/Graphic3d_IndexBuffer.hxx b/src/Graphic3d/Graphic3d_IndexBuffer.hxx index 7e0c5a1556..ae37ffc3c1 100644 --- a/src/Graphic3d/Graphic3d_IndexBuffer.hxx +++ b/src/Graphic3d/Graphic3d_IndexBuffer.hxx @@ -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); + } }; diff --git a/src/Graphic3d/Graphic3d_TransformPers.cxx b/src/Graphic3d/Graphic3d_TransformPers.cxx index 87e18d494d..afe2446c67 100644 --- a/src/Graphic3d/Graphic3d_TransformPers.cxx +++ b/src/Graphic3d/Graphic3d_TransformPers.cxx @@ -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); } diff --git a/src/Graphic3d/Graphic3d_TransformPers.hxx b/src/Graphic3d/Graphic3d_TransformPers.hxx index 24d267e0af..f04742a4c4 100644 --- a/src/Graphic3d/Graphic3d_TransformPers.hxx +++ b/src/Graphic3d/Graphic3d_TransformPers.hxx @@ -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: diff --git a/src/NCollection/NCollection_Buffer.hxx b/src/NCollection/NCollection_Buffer.hxx index aca2b7d1b0..bd2be5f8ec 100644 --- a/src/NCollection/NCollection_Buffer.hxx +++ b/src/NCollection/NCollection_Buffer.hxx @@ -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); diff --git a/src/OpenGl/OpenGl_Element.cxx b/src/OpenGl/OpenGl_Element.cxx index 2e708a8802..43769009b4 100755 --- a/src/OpenGl/OpenGl_Element.cxx +++ b/src/OpenGl/OpenGl_Element.cxx @@ -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); } diff --git a/src/OpenGl/OpenGl_IndexBuffer.cxx b/src/OpenGl/OpenGl_IndexBuffer.cxx index 30cf5f4687..db21ecd142 100644 --- a/src/OpenGl/OpenGl_IndexBuffer.cxx +++ b/src/OpenGl/OpenGl_IndexBuffer.cxx @@ -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); +} diff --git a/src/OpenGl/OpenGl_IndexBuffer.hxx b/src/OpenGl/OpenGl_IndexBuffer.hxx index 8189677c33..fe5c35fac1 100644 --- a/src/OpenGl/OpenGl_IndexBuffer.hxx +++ b/src/OpenGl/OpenGl_IndexBuffer.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_PrimitiveArray.cxx b/src/OpenGl/OpenGl_PrimitiveArray.cxx index 5573c7ff1d..b71dd848f3 100644 --- a/src/OpenGl/OpenGl_PrimitiveArray.cxx +++ b/src/OpenGl/OpenGl_PrimitiveArray.cxx @@ -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); } diff --git a/src/OpenGl/OpenGl_VertexBuffer.cxx b/src/OpenGl/OpenGl_VertexBuffer.cxx index 1d4034c3a1..9271f57ce1 100644 --- a/src/OpenGl/OpenGl_VertexBuffer.cxx +++ b/src/OpenGl/OpenGl_VertexBuffer.cxx @@ -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); diff --git a/src/OpenGl/OpenGl_VertexBuffer.hxx b/src/OpenGl/OpenGl_VertexBuffer.hxx index 5e012681fb..b2ff2b9ed8 100644 --- a/src/OpenGl/OpenGl_VertexBuffer.hxx +++ b/src/OpenGl/OpenGl_VertexBuffer.hxx @@ -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: diff --git a/tools/MessageView/MessageView_Window.cxx b/tools/MessageView/MessageView_Window.cxx index 59b7b5d801..14c000b7d6 100644 --- a/tools/MessageView/MessageView_Window.cxx +++ b/tools/MessageView/MessageView_Window.cxx @@ -757,7 +757,6 @@ void MessageView_Window::updatePreviewPresentation() return; NCollection_List aPresentations; - MessageModel_ItemRootPtr aRootItem; QModelIndexList aSelectedIndices = myTreeView->selectionModel()->selectedIndexes(); for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++) { diff --git a/tools/VInspector/VInspector_Window.cxx b/tools/VInspector/VInspector_Window.cxx index e57f627774..4d813c729f 100644 --- a/tools/VInspector/VInspector_Window.cxx +++ b/tools/VInspector/VInspector_Window.cxx @@ -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 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);