]> OCCT Git - occt-copy.git/commitdiff
0030268: Inspectors - improvements in VInspector plugin CR0_DMUReviewer_30268_1
authornds <nds@opencascade.com>
Sun, 8 Dec 2019 19:08:19 +0000 (22:08 +0300)
committernds <nds@opencascade.com>
Sun, 8 Dec 2019 19:08:19 +0000 (22:08 +0300)
# Dump for OCCT objects

149 files changed:
src/AIS/AIS_InteractiveContext.hxx
src/AIS/AIS_InteractiveContext_3.cxx
src/Bnd/Bnd_Box.cxx
src/Bnd/Bnd_Box.hxx
src/Bnd/Bnd_OBB.cxx
src/Bnd/Bnd_OBB.hxx
src/Graphic3d/Graphic3d_AspectFillCapping.cxx
src/Graphic3d/Graphic3d_AspectFillCapping.hxx
src/Graphic3d/Graphic3d_Aspects.cxx
src/Graphic3d/Graphic3d_BSDF.cxx
src/Graphic3d/Graphic3d_BSDF.hxx
src/Graphic3d/Graphic3d_CStructure.cxx
src/Graphic3d/Graphic3d_Camera.cxx
src/Graphic3d/Graphic3d_Camera.hxx
src/Graphic3d/Graphic3d_ClipPlane.cxx
src/Graphic3d/Graphic3d_HatchStyle.cxx
src/Graphic3d/Graphic3d_HatchStyle.hxx
src/Graphic3d/Graphic3d_Layer.cxx
src/Graphic3d/Graphic3d_Layer.hxx
src/Graphic3d/Graphic3d_MaterialAspect.cxx
src/Graphic3d/Graphic3d_MaterialAspect.hxx
src/Graphic3d/Graphic3d_TransformPers.cxx
src/Graphic3d/Graphic3d_ZLayerSettings.hxx
src/Message/Message_AttributeStream.cxx
src/Message/Message_Report.cxx
src/Message/Message_Report.hxx
src/NCollection/NCollection_Buffer.hxx
src/NCollection/NCollection_Vec3.hxx
src/NCollection/NCollection_Vec4.hxx
src/OpenGl/OpenGl_CappingAlgo.cxx
src/Prs3d/Prs3d_Drawer.cxx
src/Quantity/Quantity_Color.cxx
src/Quantity/Quantity_Color.hxx
src/Quantity/Quantity_ColorRGBA.cxx
src/Quantity/Quantity_ColorRGBA.hxx
src/Select3D/Select3D_InteriorSensitivePointSet.hxx
src/Select3D/Select3D_SensitiveBox.cxx
src/Select3D/Select3D_SensitiveBox.hxx
src/Select3D/Select3D_SensitiveFace.cxx
src/Select3D/Select3D_SensitiveFace.hxx
src/Select3D/Select3D_SensitiveGroup.cxx
src/Select3D/Select3D_SensitiveGroup.hxx
src/Select3D/Select3D_SensitivePoint.cxx
src/Select3D/Select3D_SensitivePoint.hxx
src/Select3D/Select3D_SensitivePoly.cxx
src/Select3D/Select3D_SensitivePoly.hxx
src/Select3D/Select3D_SensitivePrimitiveArray.cxx
src/Select3D/Select3D_SensitivePrimitiveArray.hxx
src/Select3D/Select3D_SensitiveSegment.cxx
src/Select3D/Select3D_SensitiveSegment.hxx
src/Select3D/Select3D_SensitiveSet.cxx
src/Select3D/Select3D_SensitiveSet.hxx
src/Select3D/Select3D_SensitiveTriangle.cxx
src/Select3D/Select3D_SensitiveTriangle.hxx
src/Select3D/Select3D_SensitiveTriangulation.cxx
src/Select3D/Select3D_SensitiveTriangulation.hxx
src/Select3D/Select3D_SensitiveWire.hxx
src/SelectBasics/SelectBasics_SelectingVolumeManager.hxx
src/SelectMgr/SelectMgr_EntityOwner.cxx
src/SelectMgr/SelectMgr_SelectableObjectSet.cxx
src/SelectMgr/SelectMgr_SelectableObjectSet.hxx
src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx
src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx
src/SelectMgr/SelectMgr_ViewClipRange.cxx
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/Standard/Standard_Dump.cxx
src/Standard/Standard_Dump.hxx
src/StdSelect/StdSelect_Shape.cxx
src/StdSelect/StdSelect_ViewerSelector3d.cxx
src/StdSelect/StdSelect_ViewerSelector3d.hxx
src/TopoDS/TopoDS_TShape.cxx
src/V3d/V3d_Viewer.cxx
src/V3d/V3d_Viewer.hxx
src/gp/gp_Ax1.cxx
src/gp/gp_Ax1.hxx
src/gp/gp_Ax2.cxx
src/gp/gp_Ax2.hxx
src/gp/gp_Ax3.cxx
src/gp/gp_Ax3.hxx
src/gp/gp_Dir.cxx
src/gp/gp_Dir.hxx
src/gp/gp_Pnt.cxx
src/gp/gp_Pnt.hxx
src/gp/gp_Trsf.cxx
src/gp/gp_Trsf.hxx
src/gp/gp_XYZ.cxx
src/gp/gp_XYZ.hxx
tools/Convert/Convert_Tools.cxx
tools/Convert/Convert_Tools.hxx
tools/MessageModel/MessageModel_Actions.cxx
tools/MessageModel/MessageModel_ItemAlert.cxx
tools/MessageModel/MessageModel_ItemAlert.hxx
tools/MessageModel/MessageModel_ItemReport.cxx
tools/MessageModel/MessageModel_ItemReport.hxx
tools/MessageView/MessageView_VisibilityState.cxx
tools/MessageView/MessageView_Window.cxx
tools/MessageView/MessageView_Window.hxx
tools/TInspectorEXE/TInspectorEXE.cxx
tools/TKTInspectorAPI/EXTERNLIB
tools/TreeModel/TreeModel_ItemBase.cxx
tools/TreeModel/TreeModel_ItemBase.hxx
tools/TreeModel/TreeModel_ItemProperties.cxx
tools/TreeModel/TreeModel_ItemProperties.hxx
tools/TreeModel/TreeModel_ItemStream.cxx
tools/TreeModel/TreeModel_ItemStream.hxx
tools/VInspector/VInspector_ItemBVHTree.cxx
tools/VInspector/VInspector_ItemBVHTree.hxx
tools/VInspector/VInspector_ItemContext.cxx
tools/VInspector/VInspector_ItemContext.hxx
tools/VInspector/VInspector_ItemGraphic3dCamera.cxx
tools/VInspector/VInspector_ItemGraphic3dCamera.hxx
tools/VInspector/VInspector_ItemGraphic3dGroup.cxx
tools/VInspector/VInspector_ItemPresentableObject.cxx
tools/VInspector/VInspector_ItemPrs3dDrawer.cxx
tools/VInspector/VInspector_ItemPrs3dDrawer.hxx
tools/VInspector/VInspector_ItemPrs3dPresentation.cxx
tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.cxx
tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.cxx
tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.cxx
tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.hxx
tools/VInspector/VInspector_ItemSelectMgrSelectableObjectSet.cxx
tools/VInspector/VInspector_ItemSelectMgrSelectableObjectSet.hxx
tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.cxx
tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx
tools/VInspector/VInspector_ItemSelectMgrSelection.cxx
tools/VInspector/VInspector_ItemSelectMgrSensitiveEntity.cxx
tools/VInspector/VInspector_ItemSelectMgrSensitiveEntity.hxx
tools/VInspector/VInspector_ItemSelectMgrViewerSelector.cxx
tools/VInspector/VInspector_ItemSelectMgrViewerSelector.hxx
tools/VInspector/VInspector_ItemV3dViewer.cxx
tools/VInspector/VInspector_ItemV3dViewer.hxx
tools/VInspector/VInspector_Tools.cxx
tools/VInspector/VInspector_Tools.hxx
tools/VInspector/VInspector_Window.cxx
tools/View/View_DisplayPreview.cxx
tools/View/View_DisplayPreview.hxx
tools/View/View_PreviewParameters.cxx
tools/View/View_PreviewParameters.hxx
tools/View/View_ToolBar.cxx
tools/View/View_ToolBar.hxx
tools/View/View_Tools.cxx
tools/View/View_Viewer.cxx
tools/View/View_Widget.cxx
tools/ViewControl/ViewControl_PropertyView.cxx
tools/ViewControl/ViewControl_PropertyView.hxx
tools/ViewControl/ViewControl_Table.cxx
tools/ViewControl/ViewControl_Table.hxx
tools/ViewControl/ViewControl_TableModel.cxx
tools/ViewControl/ViewControl_TableModelValues.cxx

index d45772c49778f3ee8b7144395f91240cc96a8963..c58f2c94ab73c37c9077d184211762ee4d97163f 100644 (file)
@@ -1254,6 +1254,9 @@ public: //! @name sub-intensity management (deprecated)
   //! @param theSelection an instance of the selection
   void SetSelection (const Handle(AIS_Selection)& theSelection) { mySelection = theSelection; }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 protected: //! @name internal methods
 
   Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
index 91357cdf2878bcb815e2b667b4acc11fc25e948d..cb48d3c3f4df8dfb8203c23c9bb9350844dced67 100644 (file)
@@ -86,3 +86,42 @@ void AIS_InteractiveContext::PolygonOffsets(
     anObj->PolygonOffsets( aMode, aFactor, aUnits );
 }
 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets 
+
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void AIS_InteractiveContext::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, AIS_InteractiveContext);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myObjects.Size());
+
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mgrSelector.get());
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainPM.get());
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainVwr.get());
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainSel.get());
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLastActiveView);
+
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLastPicked.get());
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToHilightSelected);
+
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mySelection.get());
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myFilters.get());
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myDefaultDrawer.get());
+
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_Selected]);
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_Dynamic]);
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_LocalSelected]);
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_LocalDynamic]);
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_SubIntensity]);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedSeq.Size());
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurDetected);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurHighlighted);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPickingStrategy);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAutoHilight);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsAutoActivateSelMode);
+}
index 2942963a731080b53e6d99a484f261756a7b8f33..12f15e2e328a0fa090c23db554825396a6b2361d 100644 (file)
@@ -977,11 +977,30 @@ void Bnd_Box::Dump () const
 //=======================================================================
 void Bnd_Box::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
 {
-  OCCT_DUMP_CLASS_BEGIN (theOStream, Bnd_Box);
-
+  //OCCT_DUMP_CLASS_BEGIN (theOStream, Bnd_Box);
   OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "CornerMin", 3, Xmin, Ymin, Zmin)
   OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "CornerMax", 3, Xmax, Ymax, Zmax)
 
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Gap);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Flags);
 }
+
+//=======================================================================
+//function : InitJson
+//purpose  : 
+//=======================================================================
+Standard_Boolean Bnd_Box::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  Standard_Integer aPos = theStreamPos;
+
+  OCCT_INIT_VECTOR_CLASS (theSStream, CornerMin, aPos, 3, &Xmin, &Ymin, &Zmin)
+  OCCT_INIT_VECTOR_CLASS (theSStream, CornerMax, aPos, 3, &Xmax, &Ymax, &Zmax)
+
+  OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, Gap);
+  Standard_Real myFlags;
+  OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, myFlags);
+  Flags = (Standard_Integer)myFlags;
+
+  theStreamPos = aPos;
+  return Standard_True;
+}
index 4d220df02a78718983d5ee4d0d25263063574c7b..bac2a2c8484de39212d883541958121f0b188a6a 100644 (file)
@@ -305,6 +305,9 @@ public:
   //! Dumps the content of me into the stream
   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
+
 protected:
 
   //! Bit flags.
index 4846ace7838c97208fc2ce45a89394e29e6aaa52..d8b41888f2b32c34b73c9004ee159eadbc7c4fbf 100644 (file)
@@ -1011,3 +1011,12 @@ void Bnd_OBB::DumpJson (Standard_OStream& theOStream, const Standard_Integer the
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHDims[2]);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsAABox);
 }
+
+//=======================================================================
+//function : InitJson
+//purpose  : 
+//=======================================================================
+Standard_Boolean Bnd_OBB::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  return Standard_False;
+}
index 7844eaecfd21a735b940205d1712b5ff8514aede..eec2808d14b6e028ad5d30b036179a54cc8af781 100644 (file)
@@ -285,6 +285,9 @@ public:
   //! Dumps the content of me into the stream
   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
+
 protected:
 
     void ProcessOnePoint(const gp_Pnt& theP)
index 3f6bff80428e05011a8830a19737d21d037b4edd..153f5e055232acd3e728b8ae992f79112bc79d5f 100644 (file)
@@ -108,3 +108,27 @@ void Graphic3d_AspectFillCapping::SetHatchRotationPeristent (const Standard_Bool
   setFlag (theToSet, Flags_HatchRotationPersistent);
   myHatchingState++;
 }
+
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void Graphic3d_AspectFillCapping::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_AspectFillCapping);
+
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Graphic3d_Aspects);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myMaterial);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myMaterial);
+
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myTexture);
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myShader);
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStippleHatch);
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myTextureHatch);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myHatchMaterial);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFlags);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHatchingState);
+}
index 7df72d60a62ba1a34bbb9075f3a8d94374231c40..d37088dfb1de71e067dd757d584d519351db98fa 100644 (file)
@@ -121,6 +121,9 @@ public:
   //! Returns modification counter for hatching state.
   Standard_Size HatchingState() const { return myHatchingState; }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 private:
 
   enum Flags
index 667b7732e0c54847884ff8cca5cb345316399844..00f86b95f6dabb5a2af1e7f33280974f350c4fa3 100644 (file)
@@ -70,6 +70,14 @@ void Graphic3d_Aspects::DumpJson (Standard_OStream& theOStream, const Standard_I
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Aspects);
 
+  /*Handle(Graphic3d_ShaderProgram)  myProgram;
+  Handle(Graphic3d_TextureSet)     myTextureSet;
+  Handle(Graphic3d_MarkerImage)    myMarkerImage;
+  Handle(Graphic3d_HatchStyle)     myHatchStyle;
+  Handle(TCollection_HAsciiString) myTextFont;
+  Graphic3d_MaterialAspect         myFrontMaterial;
+  Graphic3d_MaterialAspect         myBackMaterial;*/
+
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myInteriorColor);
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBackInteriorColor);
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEdgeColor);
@@ -82,4 +90,23 @@ void Graphic3d_Aspects::DumpJson (Standard_OStream& theOStream, const Standard_I
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToSuppressBackFaces);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToMapTexture);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsTextZoomable);
+
+  /*Aspect_InteriorStyle       myInteriorStyle;
+  Graphic3d_TypeOfShadingModel myShadingModel;
+  Graphic3d_AlphaMode          myAlphaMode;
+  Standard_ShortReal           myAlphaCutoff;
+
+  Aspect_TypeOfLine            myLineType;
+  Standard_ShortReal           myLineWidth;
+
+  Aspect_TypeOfMarker          myMarkerType;
+  Standard_ShortReal           myMarkerScale;*/
+
+  if (!myTextFont.IsNull())
+  OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myTextFont->String());
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextStyle);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextDisplayType);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextFontAspect);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextAngle);
 }
index 4421e9c2d52a6a6a1a782cad3d36bdae134e3a8a..3958bec3097ea9ec029732ff7ed5c0f8ef184421 100644 (file)
@@ -58,6 +58,18 @@ Graphic3d_Fresnel Graphic3d_Fresnel::CreateConductor (const Graphic3d_Vec3& theR
   return Graphic3d_Fresnel (Graphic3d_FM_SCHLICK, aFresnel);
 }
 
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void Graphic3d_Fresnel::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Fresnel);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFresnelType);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myFresnelData);
+}
+
 // =======================================================================
 // function : Graphic3d_BSDF
 // purpose  :
@@ -189,4 +201,23 @@ Graphic3d_BSDF Graphic3d_BSDF::CreateGlass (const Graphic3d_Vec3& theWeight,
                                      theAbsorptionCoeff);
 
   return aBSDF;
-}
\ No newline at end of file
+}
+
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void Graphic3d_BSDF::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_BSDF);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Kc);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Kd);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Ks);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Kt);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Le);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Absorption);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &FresnelCoat);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &FresnelBase);
+}
index 7919089dd971c50641ea8d1360efd4b235a42019..6e750209ea5809ef0f9a0678624aa9dd4b3b1ff9 100644 (file)
@@ -87,6 +87,9 @@ public:
     return myFresnelType;
   }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 protected:
 
   //! Creates new Fresnel reflectance factor.
@@ -180,6 +183,9 @@ public:
   //! Performs comparison of two BSDFs.
   Standard_EXPORT bool operator== (const Graphic3d_BSDF& theOther) const;
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 };
 
 #endif // _Graphic3d_BSDF_HeaderFile
index 85a2d5f5d9bbbd24d0d8df7ee59c8c94f4ba5d87..9372ff32b0380f03607a18487cf2ef710eec331f 100644 (file)
@@ -60,6 +60,24 @@ void Graphic3d_CStructure::DumpJson (Standard_OStream& theOStream, const Standar
     OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aGroup.get());
   }
 
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Id);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayer);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Priority);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, PreviousPriority);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ContainsFacet);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &ViewAffinity);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsInfinite);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, stick);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, highlight);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, visible);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, HLRValidation);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsForHighlight);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsMutable);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Is2dText);
+
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBndBox);
 
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTrsf.get());
index 916d08048b84565d2f309f5192f0b3f87576406e..2877dfe23d570a63d28da8daa22ea104bbc3a43c 100644 (file)
@@ -1546,3 +1546,41 @@ void Graphic3d_Camera::FrustumPoints (NCollection_Array1<Graphic3d_Vec3d>& thePo
   aTmpPnt = anInvWorldView * aLeftBottomFar;
   thePoints.SetValue (FrustumVert_LeftBottomFar,   aTmpPnt.xyz() / aTmpPnt.w());
 }
+
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void Graphic3d_Camera::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Camera);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUp);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myDirection);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEye);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDistance);
+
+  /*gp_XYZ myAxialScale; //!< World axial scale.
+
+  Projection    myProjType; //!< Projection type used for rendering.
+  Standard_Real myFOVy;     //!< Field Of View in y axis.
+  Standard_Real myFOVyTan;  //!< Field Of View as Tan(DTR_HALF * myFOVy)
+  Standard_Real myZNear;    //!< Distance to near clipping plane.
+  Standard_Real myZFar;     //!< Distance to far clipping plane.
+  Standard_Real myAspect;   //!< Width to height display ratio.
+
+  Standard_Real myScale;      //!< Specifies parallel scale for orthographic projection.
+  Standard_Real myZFocus;     //!< Stereographic focus value.
+  FocusType     myZFocusType; //!< Stereographic focus definition type.
+
+  Standard_Real myIOD;     //!< Intraocular distance value.
+  IODType       myIODType; //!< Intraocular distance definition type.
+
+  Graphic3d_CameraTile myTile;//!< Tile defining sub-area for drawing
+
+  mutable TransformMatrices<Standard_Real>      myMatricesD;
+  mutable TransformMatrices<Standard_ShortReal> myMatricesF;
+
+  mutable Graphic3d_WorldViewProjState myWorldViewProjState;*/
+}
index 62fc9f77d8d8aa46593702f38b3eb5ce59c788b2..ce07f2d8b6ec241b3a9d0874089d05563a3948bc 100644 (file)
@@ -552,6 +552,9 @@ public:
   //! The matrix will be updated on request.
   Standard_EXPORT void InvalidateOrientation();
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 //! @name Managing projection and orientation cache
 private:
 
index 9edaf4d8de6fb7e30e1ccad6bc722736057492e6..117d537a797443995041d4d844b04623af508aa4 100755 (executable)
@@ -268,6 +268,8 @@ void Graphic3d_ClipPlane::SetChainNextPlane (const Handle(Graphic3d_ClipPlane)&
 // =======================================================================
 void Graphic3d_ClipPlane::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
+  OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_ClipPlane);
+
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySectionStyle.get());
 
   OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myEntityUID);
index ebf108cfe2f37bbd4cf316604998c08a091ac388..5990a189a1772403f77e90c48d3429d6256b6d0f 100644 (file)
@@ -516,3 +516,15 @@ const Standard_Byte* Graphic3d_HatchStyle::Pattern() const
       ? (const Standard_Byte*)myPredefinedPatterns[myHatchType]
       : NULL);
 }
+
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void Graphic3d_HatchStyle::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_HatchStyle);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPattern.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHatchType);
+}
index c29a3ab03d817fa0f898cdb4b6e1d75f5eb0a245..b79b03e89e932a43bc9285cb926ebfd2268ea1a3 100644 (file)
@@ -49,6 +49,9 @@ public:
     return myHatchType;
   }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 private:
 
   Handle(NCollection_Buffer) myPattern;   //!< Image bitmap with custom hatch pattern
index 70a4eaf439e70396d266eb5a4379bf8ee4d0411e..3859b60aad99fbafef11883f5b32559fab8a34cc 100644 (file)
@@ -626,3 +626,41 @@ void Graphic3d_Layer::SetLayerSettings (const Graphic3d_ZLayerSettings& theSetti
     }
   }
 }
+
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
+void Graphic3d_Layer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Layer);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLayerId);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructures);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructuresNotCulled);
+
+  const Standard_Integer aNbPriorities = myArray.Length();
+  for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
+  {
+    const Graphic3d_IndexedMapOfStructure& aStructures = myArray (aPriorityIter);
+    for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next())
+    {
+      const Graphic3d_CStructure* aStructure = aStructIter.Value();
+      OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aStructure);
+    }
+  }
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myLayerSettings);
+
+  //mutable Graphic3d_BvhCStructureSet myBVHPrimitives;
+  //mutable Graphic3d_BvhCStructureSetTrsfPers myBVHPrimitivesTrsfPers;
+  //mutable NCollection_IndexedMap<const Graphic3d_CStructure*> myAlwaysRenderedMap;
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myBVHIsLeftChildQueuedFirst);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsBVHPrimitivesNeedsReset);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsBoundingBoxNeedsReset[0]);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsBoundingBoxNeedsReset[1]);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBoundingBox[0]);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBoundingBox[1]);
+}
index 820113e13fd0ac78e935364836e8ba6a7a42d07b..0954d247063bec717b4cefd7013e3d23377eab10 100644 (file)
@@ -144,6 +144,9 @@ public:
   //! Returns indexed map of always rendered structures.
   const NCollection_IndexedMap<const Graphic3d_CStructure*>& NonCullableStructures() const { return myAlwaysRenderedMap; }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 protected:
 
   //! Updates BVH trees if their state has been invalidated.
index 8888c83a649853a0933fed384d08956af0ba25c9..91c735dd54c6c870c6ee7567a3c82593dc36d390 100644 (file)
@@ -840,3 +840,28 @@ Graphic3d_TypeOfMaterial Graphic3d_MaterialAspect::MaterialType (const Standard_
   const RawMaterial& aMat = THE_MATERIALS[theRank - 1];
   return aMat.MaterialType;
 }
+
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void Graphic3d_MaterialAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_MaterialAspect);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBSDF);
+  OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myStringName);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColors[Graphic3d_TOR_AMBIENT]);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColors[Graphic3d_TOR_DIFFUSE]);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColors[Graphic3d_TOR_SPECULAR]);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColors[Graphic3d_TOR_EMISSION]);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTransparencyCoef);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRefractionIndex);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShininess);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaterialType);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaterialName);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRequestedMaterialName);
+}
index 9d4ee83e5221237d6bfaf11234050a3284042d3c..6274a371cd3f1d6d6d3fe2aea2e4bd6f9e00f071 100644 (file)
@@ -244,6 +244,9 @@ public:
   //! Returns TRUE if this material is identical to specified one.
   Standard_Boolean operator== (const Graphic3d_MaterialAspect& theOther) const { return IsEqual (theOther); }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 private:
 
   //! Initialize the standard material.
index 4fe9e7cac67ae7137a48949efebedece0940eff9..87e18d494d45e843a86a000860431ce719755d0f 100644 (file)
@@ -58,6 +58,8 @@ Handle(Graphic3d_TransformPers) Graphic3d_TransformPers::FromDeprecatedParams (G
 // =======================================================================
 void Graphic3d_TransformPers::DumpJson (Standard_OStream& theOStream, const Standard_Integer) 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)
index b61c0a3070ea4f977b30e79b1f33364ee9512bab..408afc0b9af59248e571b2bbc9982da390dc1de9 100644 (file)
@@ -19,6 +19,7 @@
 #include <Graphic3d_LightSet.hxx>
 #include <Graphic3d_PolygonOffset.hxx>
 #include <Precision.hxx>
+#include <Standard_Dump.hxx>
 #include <TCollection_AsciiString.hxx>
 
 enum Graphic3d_ZLayerSetting
@@ -208,6 +209,31 @@ struct Graphic3d_ZLayerSettings
     myPolygonOffset.Units  =-1.0f;
   }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
+  {
+    OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_ZLayerSettings);
+
+    OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myName);
+    //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myLights.get());
+    OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myOriginTrsf.get());
+    OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myOrigin);
+
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCullingDistance);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCullingSize);
+
+    OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPolygonOffset);
+
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsImmediate);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToRaytrace);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUseEnvironmentTexture);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToEnableDepthTest);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToEnableDepthWrite);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToClearDepth);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToRenderInDepthPrepass);
+
+  }
+
 protected:
 
   TCollection_AsciiString     myName;                  //!< user-provided name
index 0e4ed5f0c07e478e93473fe689d0a428544a6e40..20c38b79b14aaecdbaf2c58832f1440f5e5eeac4 100644 (file)
@@ -41,6 +41,8 @@ Message_AttributeStream::Message_AttributeStream (const Standard_SStream& theStr
 
 void Message_AttributeStream::SetStream (const Standard_SStream& theStream)
 {
+  myStream.str ("");
+
   TCollection_AsciiString aStreamStr (theStream.str().c_str());
   myStream << aStreamStr;
 }
index 344c7fbf04ac8dbb8eba08bc7813498666b053eb..b0bc7948746505045f5a1fd56c927e45cf10906d 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <NCollection_Map.hxx>
 #include <Precision.hxx>
+#include <Standard_Dump.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(Message_Report,Standard_Transient)
 
@@ -500,3 +501,33 @@ void Message_Report::SetActive (const Standard_Boolean theActive, const Standard
                           "Set active report with gravity not in valid range", );
   myIsActive[theGravity] = theActive;
 }
+
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void Message_Report::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
+{
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPerfMeterMode);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLimit);
+}
+
+//=======================================================================
+//function : InitJson
+//purpose  : 
+//=======================================================================
+Standard_Boolean Message_Report::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  Standard_Integer aPos = theStreamPos;
+
+  Standard_Real PerfMeterMode;
+  OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, PerfMeterMode);
+  myPerfMeterMode = (Message_PerfMeterMode)((Standard_Integer)PerfMeterMode);
+
+  Standard_Real Limit;
+  OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, Limit);
+  myLimit = (Standard_Integer)Limit;
+
+  theStreamPos = aPos;
+  return Standard_True;
+}
index b8c1df512b4e9434c17605b679e716dcd4e253d7..9fc0708cf3157b7d2391286c5cf75e7b53428a41 100644 (file)
@@ -149,6 +149,12 @@ public:
   //! Returns listener of the reports events
   const Handle(Message_ReportCallBack)& GetCallBack() const { return myCallBack; }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
+
   // OCCT RTTI
   DEFINE_STANDARD_RTTIEXT(Message_Report,Standard_Transient)
 
index b51e514a4ee4b0cedca5514cbfdb087ccd8c85d1..aca2b7d1b02c53833c7597ba9be648fc71a5f4eb 100644 (file)
@@ -17,6 +17,7 @@
 #define _NCollection_Buffer_HeaderFile
 
 #include <NCollection_BaseAllocator.hxx>
+#include <Standard_Dump.hxx>
 #include <Standard_Transient.hxx>
 
 //! Low-level buffer object.
@@ -122,6 +123,15 @@ public:
     mySize = 0;
   }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
+  {
+    (void)theDepth;
+    OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myData);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySize);
+    OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myAllocator.get());
+  }
+
 protected:
 
   Standard_Byte*                    myData;      //!< data pointer
index fc2b48155b0d68b92f78e8ac37778a97de813c02..c9230c582e658302acdb9de413a7b355da16ff50 100644 (file)
@@ -18,6 +18,7 @@
 #include <cstring>
 #include <cmath>
 #include <NCollection_Vec2.hxx>
+#include <Standard_Dump.hxx>
 
 //! Auxiliary macros to define couple of similar access components as vector methods
 #define NCOLLECTION_VEC_COMPONENTS_3D(theX, theY, theZ) \
@@ -403,6 +404,13 @@ public:
     return NCollection_Vec3 (Element_t(0), Element_t(0), Element_t(1));
   }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
+  {
+    (void)theDepth;
+    OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "Vec3", 3, v[0], v[1], v[2]);
+  }
+
 private:
 
   Element_t v[3]; //!< define the vector as array to avoid structure alignment issues
index b3c84aea9a38256fe8684c8f79506657cc82cd4e..1be616fa31de1b77dd0364e9dcb4b81999e19b77 100644 (file)
@@ -16,6 +16,7 @@
 #define _NCollection_Vec4_H__
 
 #include <NCollection_Vec3.hxx>
+#include <Standard_Dump.hxx>
 
 //! Generic 4-components vector.
 //! To be used as RGBA color vector or XYZW 3D-point with special W-component
@@ -375,6 +376,13 @@ public:
     return aResult /= theRight;
   }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
+  {
+    (void)theDepth;
+    OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "Vec4", 4, v[0], v[1], v[2], v[3]);
+  }
+
 private:
 
   Element_t v[4]; //!< define the vector as array to avoid structure alignment issues
index 1d77c45ca5ac787c8c3cbfc960c02d74f253e012..377f87023507ee8394e4d2c5039068b633124fe5 100755 (executable)
@@ -341,9 +341,14 @@ namespace
 // function : RenderCapping
 // purpose  :
 // =======================================================================
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
 void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorkspace,
                                         const OpenGl_Structure&         theStructure)
 {
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO ("RenderCapping", "", &aPerfMeter, NULL);
+
   const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
   if (!aContext->Clipping().IsCappingOn())
   {
@@ -380,12 +385,17 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks
   {
     // get plane being rendered
     const Handle(Graphic3d_ClipPlane)& aClipChain = aCappingIt.Value();
+
     if (!aClipChain->IsCapping()
       || aCappingIt.IsDisabled())
     {
       continue;
     }
 
+    Standard_SStream aStream;
+    aClipChain->DumpJson (aStream);
+    MESSAGE_INFO_STREAM(aStream, "ClipChain", "", &aPerfMeter, NULL);
+
     Standard_Integer aSubPlaneIndex = 1;
     for (const Graphic3d_ClipPlane* aSubPlaneIter = aClipChain.get(); aSubPlaneIter != NULL; aSubPlaneIter = aSubPlaneIter->ChainNextPlane().get(), ++aSubPlaneIndex)
     {
index a03fa3d36f5fef4536d946886a0b0bfc5b025bd8..59da3959f1f76d4f305eab43d3e9a7522ebda977 100644 (file)
@@ -1442,5 +1442,110 @@ bool Prs3d_Drawer::SetShadingModel (Graphic3d_TypeOfShadingModel theModel,
 void Prs3d_Drawer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Prs3d_Drawer);
+
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLink.get());
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnNbPoints);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaximalParameterValue);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnMaximalParameterValue);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myChordialDeviation);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnChordialDeviation);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeOfDeflection);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTypeOfDeflection);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeOfHLR);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDeviationCoefficient);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousDeviationCoefficient);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDeviationCoefficient);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHLRDeviationCoefficient);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnHLRDeviationCoefficient);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousHLRDeviationCoefficient);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDeviationAngle);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDeviationAngle);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousDeviationAngle);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHLRAngle);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnHLRDeviationAngle);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousHLRDeviationAngle);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsoOnPlane);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnIsoOnPlane);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsoOnTriangulation);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnIsoOnTriangulation);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsAutoTriangulated);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnIsAutoTriangulated);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myUIsoAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnUIsoAspect);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myVIsoAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnVIsoAspect);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myWireAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnWireAspect);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myWireDraw);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnWireDraw);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPointAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnPointAspect);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myLineAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnLineAspect);
+
+  //OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTextAspect);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get());
+
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myShadingAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnShadingAspect);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPlaneAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnPlaneAspect);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySeenLineAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSeenLineAspect);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myArrowAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnArrowAspect);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLineArrowDraw);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnLineArrowDraw);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myHiddenLineAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnHiddenLineAspect);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDrawHiddenLine);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDrawHiddenLine);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myVectorAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnVectorAspect);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVertexDrawMode);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDatumAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDatumAspect);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySectionAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSectionAspect);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFreeBoundaryAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFreeBoundaryAspect);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFreeBoundaryDraw);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFreeBoundaryDraw);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myUnFreeBoundaryAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnUnFreeBoundaryAspect);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUnFreeBoundaryDraw);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnUnFreeBoundaryDraw);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFaceBoundaryAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceBoundaryUpperContinuity);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFaceBoundaryAspect);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceBoundaryDraw);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFaceBoundaryDraw);
+
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDimensionAspect.get());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimensionAspect);
+  //OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDimensionModelUnits);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimLengthModelUnits);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimAngleModelUnits);
+  //OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDimensionDisplayUnits);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimLengthDisplayUnits);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimAngleDisplayUnits);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFillCappingAspect);
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFillCappingAspect.get());
 }
index 69e94fdf28b49b2864e3b319d776577df23b6182..1d81b262b1b30b3a247aad8dc9d0b149005e159e 100644 (file)
@@ -3932,6 +3932,19 @@ void call_rgbhls (float r, float g, float b, float& h, float& l, float& s)
 //=======================================================================
 void Quantity_Color::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
 {
-  OCCT_DUMP_CLASS_BEGIN (theOStream, Quantity_Color);
   OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "RGB", 3, MyRed, MyGreen, MyBlue)
 }
+
+//=======================================================================
+//function : InitJson
+//purpose  : 
+//=======================================================================
+Standard_Boolean Quantity_Color::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  Standard_Integer aPos = theStreamPos;
+  Standard_Real  aRed, aGreen, aBlue;
+  OCCT_INIT_VECTOR_CLASS (theSStream, RGB, aPos, 3, &aRed, &aGreen, &aBlue)
+
+  SetValues ((Standard_ShortReal)aRed, (Standard_ShortReal)aGreen, (Standard_ShortReal)aBlue, Quantity_TOC_RGB);
+  return Standard_True;
+}
index 914ef8b8e9b8f22977c075ff2a21b7f93d52987f..d6a33f157de722a2ad35d6044b8d6773a33830fc 100644 (file)
@@ -267,6 +267,9 @@ Standard_Boolean operator == (const Quantity_Color& Other) const
   //! Dumps the content of me into the stream
   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
+
 private:
 
   //! Converts HLS components into RGB ones.
index 3db480fa39ac768b77d2ba9ae08f170ab98a4304..19beb28c7cbbfeb9e6b266c9905494beba4a683a 100644 (file)
@@ -204,10 +204,22 @@ bool Quantity_ColorRGBA::ColorFromHex (const char* const   theHexColorString,
 //function : DumpJson
 //purpose  : 
 //=======================================================================
-void Quantity_ColorRGBA::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+void Quantity_ColorRGBA::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
 {
-  OCCT_DUMP_CLASS_BEGIN (theOStream, Quantity_ColorRGBA);
+  OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "RGBA", 4, myRgb.Red(), myRgb.Green(), myRgb.Blue(), myAlpha)
+}
+
+//=======================================================================
+//function : InitJson
+//purpose  : 
+//=======================================================================
+Standard_Boolean Quantity_ColorRGBA::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  Standard_Integer aPos = theStreamPos;
+
+  Standard_Real aRed, aGreen, aBlue, anAlpha;
+  OCCT_INIT_VECTOR_CLASS (theSStream, RGBA, aPos, 4, &aRed, &aGreen, &aBlue, &anAlpha)
 
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myRgb);
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlpha);
+  SetValues ((Standard_ShortReal)aRed, (Standard_ShortReal)aGreen, (Standard_ShortReal)aBlue, (Standard_ShortReal)anAlpha);
+  return Standard_True;
 }
index a1e070962683571e8717580d13c22203f580d6cb..a91a4b5296ffb23a18ab2af38e2836f012df21a6 100644 (file)
@@ -124,6 +124,9 @@ public:
   //! Dumps the content of me into the stream
   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
+
 private:
 
   static void myTestSize3() { Standard_STATIC_ASSERT (sizeof(float) * 3 == sizeof(Quantity_Color)); }
index 0cb2fe615a5c34b668cb1118387d6e4f054fdd31..6f9d7ebd5be85806073a96f4d665809c8eb09145 100644 (file)
@@ -71,7 +71,7 @@ public:
   Standard_EXPORT virtual Standard_Integer NbSubElements() 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_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
 
   DEFINE_STANDARD_RTTIEXT(Select3D_InteriorSensitivePointSet,Select3D_SensitiveSet)
 
index 81f0bdb0858ea193f7d34c8bed84c3068b00b036..bef2dd1b84a72e5f9a4dab397d2b563e5d5df929 100644 (file)
@@ -128,6 +128,7 @@ Select3D_BndBox3d Select3D_SensitiveBox::BoundingBox()
 void Select3D_SensitiveBox::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveBox);
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
 
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBox);
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCenter3d);
index 36515f2b41445412dcb676508e94065abf3c362a..cb735264c2a9d7be51b7d0179f56379a88728126 100644 (file)
@@ -71,7 +71,7 @@ public:
   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() 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_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
 
 private:
 
index 4ad62a1044411fd66f3c6264ff0dcddb10263652..6feff18373fcfcda1cda37a1f17d6b87c7289923 100644 (file)
@@ -151,6 +151,7 @@ Standard_Integer Select3D_SensitiveFace::NbSubElements()
 void Select3D_SensitiveFace::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveFace);
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
 
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySensType);
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFacePoints.get());
index 5fdf9f27b5feb037a25275372a891c78ccfab86f..2a0af16113004d4037e11c4104ead6bc0677b48a 100644 (file)
@@ -74,7 +74,7 @@ public:
   Standard_EXPORT virtual Standard_Integer NbSubElements() 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_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
 
 private:
 
index b3571adcbf35d63b65062725878098c865eafb6e..89c5e12cbf987d1b43f0913850a7bb9712b95c9d 100644 (file)
@@ -369,7 +369,6 @@ Standard_Real Select3D_SensitiveGroup::distanceToCOG (SelectBasics_SelectingVolu
 void Select3D_SensitiveGroup::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveGroup);
-
   OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet);
 
   for (Select3D_IndexedMapOfEntity::Iterator anIterator (myEntities); anIterator.More(); anIterator.Next())
index 3b6f28a2397e9442288d3b70922202700992c7cd..307d6a6c585e42607f1958a8517853402acbb6da 100644 (file)
@@ -144,7 +144,7 @@ public:
   Standard_EXPORT virtual Standard_Integer Size() 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_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
 
 protected:
 
index a995296a88b7be1e0ff8beee3b5d770bcf538f83..72facedce07c1cb1cffbff692a14bd1d5a706ee5 100644 (file)
@@ -93,6 +93,7 @@ Standard_Integer Select3D_SensitivePoint::NbSubElements()
 void Select3D_SensitivePoint::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitivePoint);
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
 
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPoint);
 }
index c45c129ddb7f3645c72a0a4093f1f052ff193d45..5906c5181dc742f07217bae4e1c1a273eeea780a 100644 (file)
@@ -51,7 +51,7 @@ public:
   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() 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_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
 
 private:
 
index 37c79bcde67c7c5949b4bec3397bdb565ecae236..80d6ab40867969b3eff52def7ead471ae186c184 100644 (file)
@@ -318,7 +318,6 @@ gp_Pnt Select3D_SensitivePoly::CenterOfGeometry() const
 void Select3D_SensitivePoly::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitivePoly);
-
   OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet);
 
   //Select3D_PointData              myPolyg;              //!< Points of the poly
index 120db6a2d28bffaa245a97ce056f412fafba7190..7b71d10920163480f94abb78e5e35e7c0d666e6b 100644 (file)
@@ -93,7 +93,7 @@ public:
                                      const Standard_Integer theIdx2) 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_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
 
 protected:
 
index 220c9a429fee850e13a075b3ccddae599ae9479a..897035ad2f7a2a9bfa6cf07bd54e4c384a09a6dc 100644 (file)
@@ -1226,7 +1226,6 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::elementIsInside (SelectBasics
 void Select3D_SensitivePrimitiveArray::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitivePrimitiveArray);
-
   OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet);
 
   //Handle(Select3D_PrimArraySubGroupArray) myGroups;         //!< sub-groups of sensitive entities
index a78ac8033737806ec4b662727b04f8a21bfb2fc0..b06a1a269aa655b994b5816961b929cdb337d625 100644 (file)
@@ -198,7 +198,7 @@ public:
   Standard_Integer LastDetectedEdgeNode2() const { return myDetectedEdgeNode2; }
 
   //! 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;
 
 public:
 
index 24b19e4d0a1cf0a81cf76d8dbfd215f9c678077c..7d707139cce171f07f6daca4c6551baa56831010 100644 (file)
@@ -110,6 +110,7 @@ Standard_Integer Select3D_SensitiveSegment::NbSubElements()
 void Select3D_SensitiveSegment::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveSegment);
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
 
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myStart);
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEnd);
index e4bf0a7990bd80247f1865f8110d0f06d61b062a..17ff4c3b96f45252be3a6930234c5bd5fb8d63ad 100644 (file)
@@ -71,7 +71,7 @@ public:
   void EndPoint (const gp_Pnt& thePnt) { myEnd = thePnt; }
 
   //! 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;
 
 private:
 
index f9ff7ff1717c46ed26d67305b9b027258da97686..bb1f80ab2d2ab5b39cac044c775d5a31acb5f2a7 100644 (file)
@@ -237,9 +237,10 @@ void Select3D_SensitiveSet::Clear()
 //function : DumpJson
 //purpose  :
 //=======================================================================
-void Select3D_SensitiveSet::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
+void Select3D_SensitiveSet::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveSet);
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
 
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedIdx);
 }
index 6cf1b03ec1af79f3967490026a64a85524be2876..261c4cb315fc49358e18b7b5fce7ff24eef543bb 100644 (file)
@@ -97,7 +97,7 @@ public:
   Standard_Integer GetLeafNodeSize() const { return myContent.Builder()->LeafNodeSize(); }
 
   //! 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 6eaa8243b112cf5f6160e6f37be7ff054a9cbc2c..c3d0002e2deb7f28245b5ff8c9ec3986b36f0ef0 100644 (file)
@@ -101,6 +101,7 @@ Select3D_BndBox3d Select3D_SensitiveTriangle::BoundingBox()
 void Select3D_SensitiveTriangle::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveTriangle);
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
 
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySensType);
 
index e6ad159dcf32f56e71ec91494bf764a796431913..6e0b789769827b8d0537657de0f589059af7e483 100644 (file)
@@ -68,7 +68,7 @@ public:
   virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE { return myCentroid; }
 
   //! 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;
 
 public:
 
index 4f9ed233275c2a2775710d56ab97ed7539c54699..9bc774af08f65cbc3900afb44b4c8dd9db30569a 100644 (file)
@@ -451,7 +451,6 @@ gp_GTrsf Select3D_SensitiveTriangulation::InvInitLocation() const
 void Select3D_SensitiveTriangulation::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveTriangulation);
-
   OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet);
 
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTriangul.get());
index 752504a3187e94fc352a8a5040414c92de574fc5..92ef699d55ef2d810daa0931102b2b1bc4c890f6 100644 (file)
@@ -94,7 +94,7 @@ public:
   const TopLoc_Location& GetInitLocation() const { return myInitLocation; }
 
   //! 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 55463188ab39c511f304c9c4ada38f4b98146c6a..eca3ac58e72d814538442c2bf46bbea5f4a5e7f8 100644 (file)
@@ -69,7 +69,7 @@ public:
                                      const Standard_Integer theIdx2) 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_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
 
   DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveWire,Select3D_SensitiveSet)
 
index eb93e1c8998ecac1c812db179a9013cb9fa95391..043de02bb424879317cfc0d066a9846789cda319 100644 (file)
@@ -20,6 +20,7 @@
 #include <gp_Pnt.hxx>
 #include <TColgp_HArray1OfPnt.hxx>
 #include <SelectBasics_PickResult.hxx>
+#include <Standard_Dump.hxx>
 
 class Bnd_Box;
 class gp_Pnt;
@@ -116,6 +117,10 @@ public:
   //! Ax + By + Cz + D = 0) to the given vector
   virtual void GetPlanes (NCollection_Vector<NCollection_Vec4<Standard_Real> >& thePlaneEquations) const = 0;
 
+  //! Dumps the content of me into the stream
+  virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
+  { (void)theDepth; OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myActiveSelectionType) }
+
 protected:
   SelectionType myActiveSelectionType;      //!< Active selection type: point, box or polyline
 };
index ed1cedb3c50fe86cfb7a66b9491918592a33b8eb..55c3b252b93afc14948ce3a73a40650760bb0618 100644 (file)
@@ -91,6 +91,8 @@ void SelectMgr_EntityOwner::DumpJson (Standard_OStream& theOStream, const Standa
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_EntityOwner);
 
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, this);
+
   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mySelectable);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mypriority);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsSelected);
index 68c8060da943739f3c1aa9499297b27a8a9d6910..da1e6616ed0e88a467a1f62ce33ab21ce6e86503 100644 (file)
@@ -389,3 +389,31 @@ void SelectMgr_SelectableObjectSet::MarkDirty()
   myIsDirty[BVHSubset_3dPersistent] = Standard_True;
   myIsDirty[BVHSubset_2dPersistent] = Standard_True;
 }
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void SelectMgr_SelectableObjectSet::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const 
+{
+  for (Standard_Integer aSubsetIdx = 0; aSubsetIdx < BVHSubsetNb; ++aSubsetIdx)
+  {
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aSubsetIdx);
+
+    Standard_Boolean IsDirty = myIsDirty[aSubsetIdx];
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsDirty);
+
+    for (NCollection_IndexedMap<Handle(SelectMgr_SelectableObject)>::Iterator anObjectIt (myObjects[aSubsetIdx]);
+         anObjectIt.More(); anObjectIt.Next())
+    {
+      Handle(SelectMgr_SelectableObject) SelectableObject = anObjectIt.Value();
+      OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, SelectableObject.get());
+    }
+
+    TCollection_AsciiString separator;
+    OCCT_DUMP_FIELD_VALUE_STRING (theOStream, separator);
+
+  }
+  //Graphic3d_WorldViewProjState                               myLastViewState; //!< Last view-projection state used for construction of BVH
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLastWidth);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLastHeight);
+}
index 242abdc7e3950dd357ef86d55f7d5abeb526d778..9dc6fe569f37691b441e265124dd1cd86328be73 100644 (file)
@@ -180,6 +180,9 @@ public:
     return myBVH[theSubset];
   }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 private:
 
   //! Returns an appropriate subset of theObject given depending on its persistence type.
index 2ef7b60606271913821f9b39f1c21b8d5ff6566d..0510b99170b72bb0e8fc5d979ba3d335d50bdd53 100644 (file)
@@ -14,6 +14,7 @@
 // commercial license or contractual agreement.
 
 #include <SelectMgr_SelectingVolumeManager.hxx>
+#include <Standard_Dump.hxx>
 
 //=======================================================================
 // function : SelectMgr_SelectingVolumeManager
@@ -482,3 +483,24 @@ void SelectMgr_SelectingVolumeManager::SetViewClipping (const SelectMgr_Selectin
   myObjectClipPlanes = theOther.myObjectClipPlanes;
   myViewClipRange    = theOther.myViewClipRange;
 }
+
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void SelectMgr_SelectingVolumeManager::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const 
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, SelectBasics_SelectingVolumeManager);
+
+  for (Standard_Integer anIdx = 0; anIdx < VolumeTypesNb; ++anIdx)
+  {
+    const Handle(SelectMgr_BaseFrustum)& aSelectingVolume = mySelectingVolumes[anIdx];
+    OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aSelectingVolume.get());
+  }
+
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myViewClipPlanes.get());
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myObjectClipPlanes.get());
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myViewClipRange);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToAllowOverlap);
+}
index d0d0ddc67395c93043f5c47bb7d474cbd34f1b5e..dcdbe03ca5cc503113102ad694bba4090e6ae1b8 100644 (file)
@@ -236,6 +236,9 @@ public:
     return mySelectingVolumes[myActiveSelectionType / 2]->GetPlanes (thePlaneEquations);
   }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
+
 private:
   enum { Frustum, FrustumSet, VolumeTypesNb };       //!< Defines the amount of available selecting volumes
 
index 57fd7680b91c5c57065f1ca7fdca08d14b287e2e..bb67df000609fdba928e43117b029aa6de1e80c7 100644 (file)
@@ -111,9 +111,9 @@ void SelectMgr_ViewClipRange::DumpJson (Standard_OStream& theOStream, const Stan
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_ViewClipRange);
 
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUnclipRange);
   for (size_t aRangeIter = 0; aRangeIter < myClipRanges.size(); ++aRangeIter)
   {
     OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myClipRanges[aRangeIter]);
   }
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUnclipRange);
 }
index 97471d557e7d8cc3aa8999d16145b6b3fae82191..6c73304dc921984b3f2d7ab8da088f5972ecec89 100644 (file)
@@ -1051,7 +1051,7 @@ void SelectMgr_ViewerSelector::AllowOverlapDetection (const Standard_Boolean the
 //function : DumpJson
 //purpose  : 
 //=======================================================================
-void SelectMgr_ViewerSelector::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const 
+void SelectMgr_ViewerSelector::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const 
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_ViewerSelector);
 
@@ -1059,13 +1059,30 @@ void SelectMgr_ViewerSelector::DumpJson (Standard_OStream& theOStream, const Sta
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToUpdateTolerance);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mystored.Extent());
 
-  Standard_Integer aNbOfSelected = 0;
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, &mySelectingVolumeMgr);
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, &mySelectableObjects);
+
+  Standard_Integer aNbOfSelectableObjects = 0;
   for (SelectMgr_SelectableObjectSet::Iterator aSelectableIt (mySelectableObjects); aSelectableIt.More(); aSelectableIt.Next())
   {
-    aNbOfSelected++;
+    aNbOfSelectableObjects++;
   }
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aNbOfSelected);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aNbOfSelectableObjects);
+
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerances.Tolerance());
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerances.CustomTolerance());
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayerOrderMap.Size());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayerOrderMap.Extent());
+
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myEntitySetBuilder.get());
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCameraEye);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCameraDir);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCameraScale);
+
+  if (!myIndexes.IsNull())
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIndexes->Size());
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurRank);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsLeftChildQueuedFirst);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myEntityIdx);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMapOfObjectSensitives.Extent());
 }
index 4a36e19b8fa386e813f42d68b422e2620b2931d5..3157ba55810b6a79da4c12f8f88a477e6a44565e 100644 (file)
 // function : Constructor
 // purpose :
 // =======================================================================
-Standard_DumpSentry::Standard_DumpSentry (Standard_OStream& theOStream, const char* theClassName)
+Standard_DumpSentry::Standard_DumpSentry (Standard_OStream& theOStream, const char*)
 : myOStream (&theOStream)
 {
-  (*myOStream) << "\"" << theClassName << "\": {";
+  //(*myOStream) << "\"" << theClassName << "\": {";
 }
 
 // =======================================================================
@@ -31,7 +31,7 @@ Standard_DumpSentry::Standard_DumpSentry (Standard_OStream& theOStream, const ch
 // =======================================================================
 Standard_DumpSentry::~Standard_DumpSentry()
 {
-  (*myOStream) << "}";
+  //(*myOStream) << "}";
 }
 
 // =======================================================================
@@ -43,7 +43,7 @@ void Standard_Dump::AddValuesSeparator (Standard_OStream& theOStream)
   Standard_SStream aStream;
   aStream << theOStream.rdbuf();
   TCollection_AsciiString aStreamStr = Standard_Dump::Text (aStream);
-  if (!aStreamStr.EndsWith ("{"))
+  if (!aStreamStr.IsEmpty() && !aStreamStr.EndsWith ("{"))
     theOStream << ", ";
 }
 
@@ -52,7 +52,7 @@ void Standard_Dump::AddValuesSeparator (Standard_OStream& theOStream)
 //purpose  : 
 //=======================================================================
 void Standard_Dump::DumpKeyToClass (Standard_OStream& theOStream,
-                                    const char* theKey,
+                                    const TCollection_AsciiString& theKey,
                                     const TCollection_AsciiString& theField)
 {
   AddValuesSeparator (theOStream);
@@ -104,9 +104,52 @@ Standard_Boolean Standard_Dump::ProcessStreamName (const Standard_SStream& theSt
   TCollection_AsciiString aText = Text (theStream);
   if (aText.IsEmpty())
     return Standard_False;
+
+  if (aText.Length () < theStreamPos)
+    return Standard_False;
+
+  TCollection_AsciiString aSubText = aText.SubString (theStreamPos, aText.Length());
+  if (aSubText.StartsWith (JsonKeyToString (Standard_JsonKey_SeparatorValueToValue)))
+  {
+    theStreamPos += JsonKeyLength (Standard_JsonKey_SeparatorValueToValue);
+    aSubText = aText.SubString (theStreamPos, aText.Length());
+  }
+  TCollection_AsciiString aKeyName = TCollection_AsciiString (JsonKeyToString (Standard_JsonKey_Quote))
+    + theName
+    + TCollection_AsciiString (JsonKeyToString (Standard_JsonKey_Quote))
+    + JsonKeyToString (Standard_JsonKey_SeparatorKeyToValue);
+  Standard_Boolean aResult = aSubText.StartsWith (aKeyName);
+  if (aResult)
+    theStreamPos += aKeyName.Length();
+
+  return aResult;
+}
+
+//=======================================================================
+//function : ProcessFieldName
+//purpose  : 
+//=======================================================================
+Standard_Boolean Standard_Dump::ProcessFieldName (const Standard_SStream& theStream,
+                                                  const TCollection_AsciiString& theName,
+                                                  Standard_Integer& theStreamPos)
+{
+  TCollection_AsciiString aText = Text (theStream);
+  if (aText.IsEmpty())
+    return Standard_False;
+
   TCollection_AsciiString aSubText = aText.SubString (theStreamPos, aText.Length());
+  if (aSubText.StartsWith (JsonKeyToString (Standard_JsonKey_SeparatorValueToValue)))
+  {
+    theStreamPos += JsonKeyLength (Standard_JsonKey_SeparatorValueToValue);
+    aSubText = aText.SubString (theStreamPos, aText.Length());
+  }
+
+  TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (theName.ToCString());
+  TCollection_AsciiString aKeyName = TCollection_AsciiString (JsonKeyToString (Standard_JsonKey_Quote))
+    + aName
+    + TCollection_AsciiString (JsonKeyToString (Standard_JsonKey_Quote))
+    + JsonKeyToString (Standard_JsonKey_SeparatorKeyToValue);
 
-  TCollection_AsciiString aKeyName = theName + JsonKeyToString (Standard_JsonKey_SeparatorKeyToValue);
   Standard_Boolean aResult = aSubText.StartsWith (aKeyName);
   if (aResult)
     theStreamPos += aKeyName.Length();
@@ -122,14 +165,15 @@ Standard_Boolean Standard_Dump::InitRealValues (const Standard_SStream& theStrea
                                                 Standard_Integer& theStreamPos,
                                                 int theCount, ...)
 {
-  Standard_Integer aStreamPos = theStreamPos + JsonKeyLength (Standard_JsonKey_OpenContainer) + 1;
+  Standard_Integer aStreamPos = theStreamPos + JsonKeyLength (Standard_JsonKey_OpenContainer);
 
   TCollection_AsciiString aText = Text (theStream);
   TCollection_AsciiString aSubText = aText.SubString (aStreamPos, aText.Length());
-  Standard_Integer aClosePos = aSubText.Location (JsonKeyToString (Standard_JsonKey_CloseContainer), aStreamPos, aSubText.Length());
 
   va_list  vl;
   va_start(vl, theCount);
+  aStreamPos = 1;
+  Standard_Integer aClosePos = aSubText.Location (JsonKeyToString (Standard_JsonKey_CloseContainer), aStreamPos, aSubText.Length());
   for(int i = 0; i < theCount; ++i)
   {
     //if (i < theCount -1)
@@ -142,13 +186,49 @@ Standard_Boolean Standard_Dump::InitRealValues (const Standard_SStream& theStrea
     if (!aValueText.IsRealValue())
       return Standard_False;
 
-    va_arg(vl, Standard_Real) = aValueText.RealValue();
+    *(va_arg(vl, Standard_Real*)) = aValueText.RealValue();
 
-    aStreamPos = aNextPos + 1;
+    aStreamPos = aNextPos + JsonKeyLength (Standard_JsonKey_SeparatorValueToValue);
     //theOStream << va_arg(vl, Standard_Real);
   }
   va_end(vl);
+  aClosePos = aText.Location (JsonKeyToString (Standard_JsonKey_CloseContainer), theStreamPos, aText.Length());
+  theStreamPos = aClosePos + JsonKeyLength (Standard_JsonKey_CloseContainer);
+
+  return Standard_True;
+}
+
+//=======================================================================
+//function : InitRealValue
+//purpose  : 
+//=======================================================================
+Standard_Boolean Standard_Dump::InitRealValue (const Standard_SStream& theStream,
+                                               Standard_Integer& theStreamPos,
+                                               Standard_Real& theValue)
+{
+  Standard_Integer aStreamPos = theStreamPos;
+
+  TCollection_AsciiString aText = Text (theStream);
+  TCollection_AsciiString aSubText = aText.SubString (aStreamPos, aText.Length());
+
+  aStreamPos = 1;
+  Standard_Integer aNextPos = aSubText.Location (JsonKeyToString (Standard_JsonKey_SeparatorValueToValue), aStreamPos, aSubText.Length());
+  Standard_JsonKey aNextKey = Standard_JsonKey_SeparatorValueToValue;
+
+  Standard_Integer aCloseChildPos = aSubText.Location (JsonKeyToString (Standard_JsonKey_CloseChild), aStreamPos, aSubText.Length());
+  Standard_Boolean isUseClosePos = (aNextPos > 0 && aCloseChildPos > 0 && aCloseChildPos < aNextPos) || !aNextPos;
+  if (isUseClosePos)
+  {
+    aNextPos = aCloseChildPos;
+    aNextKey = Standard_JsonKey_CloseChild;
+  }
+
+  TCollection_AsciiString aValueText = aNextPos ? aSubText.SubString (aStreamPos, aNextPos - 1) : aSubText;
+  if (!aValueText.IsRealValue())
+    return Standard_False;
 
+  theValue = aValueText.RealValue();
+  theStreamPos = aNextPos ? (theStreamPos + (aNextPos - aStreamPos) + JsonKeyLength (aNextKey)) : aText.Length();
 
   return Standard_True;
 }
@@ -196,17 +276,26 @@ TCollection_AsciiString Standard_Dump::GetPointerInfo (const void* thePointer, c
 // =======================================================================
 // DumpFieldToName
 // =======================================================================
-const char* Standard_Dump::DumpFieldToName (const char* theField)
+TCollection_AsciiString Standard_Dump::DumpFieldToName (const TCollection_AsciiString theField)
 {
-  const char* aName = theField;
+  TCollection_AsciiString aName = theField;
+  if (theField.StartsWith ('&'))
+  {
+    aName.Remove (1, 1);
+  }
 
-  if (aName[0] == '&')
+  if (::LowerCase (aName.Value(1)) == 'm' && aName.Value (2) == 'y')
   {
-    aName = aName + 1;
+    aName.Remove (1, 2);
   }
-  if (::LowerCase (aName[0]) == 'm' && aName[1] == 'y')
+  
+  if (TCollection_AsciiString (aName).EndsWith (".get()"))
   {
-    aName = aName + 2;
+    aName = aName.SubString (1, aName.Length() - TCollection_AsciiString (".get()").Length());
+  }
+  else if (TCollection_AsciiString (aName).EndsWith ("()"))
+  {
+    aName = aName.SubString (1, aName.Length() - TCollection_AsciiString ("()").Length());
   }
   return aName;
 }
@@ -290,7 +379,7 @@ TCollection_AsciiString Standard_Dump::FormatJson (const Standard_SStream& theSt
 // SplitJson
 // ----------------------------------------------------------------------------
 Standard_Boolean Standard_Dump::SplitJson (const TCollection_AsciiString& theStreamStr,
-                                           NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues)
+                                           NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& theKeyToValues)
 {
   Standard_Integer /*anIndex = 1, */aNextIndex = 1;
   while (aNextIndex < theStreamStr.Length())
@@ -305,7 +394,7 @@ Standard_Boolean Standard_Dump::SplitJson (const TCollection_AsciiString& theStr
     {
       case Standard_JsonKey_Quote:
       {
-        aProcessed = splitKeyToValue (theStreamStr, aNextIndex/*anIndex*/, aNextIndex, theValues);
+        aProcessed = splitKeyToValue (theStreamStr, aNextIndex/*anIndex*/, aNextIndex, theKeyToValues);
         //anIndex = aNextIndex;
       }
       break;
@@ -319,7 +408,7 @@ Standard_Boolean Standard_Dump::SplitJson (const TCollection_AsciiString& theStr
           return Standard_False;
 
         TCollection_AsciiString aSubStreamStr = theStreamStr.SubString (aStartIndex + JsonKeyLength (aKey), aNextIndex - 2);
-        if (!SplitJson (aSubStreamStr, theValues))
+        if (!SplitJson (aSubStreamStr, theKeyToValues))
           return Standard_False;
 
         aNextIndex/*anIndex*/ = aClosePos + Standard_Integer (JsonKeyLength (Standard_JsonKey_CloseChild));
@@ -339,15 +428,6 @@ Standard_Boolean Standard_Dump::SplitJson (const TCollection_AsciiString& theStr
   return Standard_True;
 }
 
-// ----------------------------------------------------------------------------
-// JoinJson
-// ----------------------------------------------------------------------------
-void Standard_Dump::JoinJson (Standard_OStream& theOStream,
-                              const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues)
-{
-
-}
-
 // ----------------------------------------------------------------------------
 // HierarchicalValueIndices
 // ----------------------------------------------------------------------------
@@ -370,7 +450,7 @@ NCollection_List<Standard_Integer> Standard_Dump::HierarchicalValueIndices (
 Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString& theStreamStr,
                                                  Standard_Integer theStartIndex,
                                                  Standard_Integer& theNextIndex,
-                                                 NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues)
+                                                 NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& theValues)
 {
   // find key value: "key"
   Standard_Integer aStartIndex = theStartIndex;
@@ -457,11 +537,13 @@ Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString&
     break;
     case Standard_JsonKey_None:
     {
-      Standard_Integer aCloseIndex1 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_CloseChild) - 1;
-      Standard_Integer aCloseIndex2 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_SeparatorValueToValue) - 1;
-      aCloseIndex = aCloseIndex1 < aCloseIndex2 ? aCloseIndex1 : aCloseIndex2;
-
-      aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex);
+      //if (aCloseIndex != aStartIndex) // case if the value is numerical and need not be closed
+      {
+        Standard_Integer aCloseIndex1 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_CloseChild) - 1;
+        Standard_Integer aCloseIndex2 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_SeparatorValueToValue) - 1;
+        aCloseIndex = aCloseIndex1 < aCloseIndex2 ? aCloseIndex1 : aCloseIndex2;
+      }
+      aSplitValue = aStartIndex <= aCloseIndex ? theStreamStr.SubString (aStartIndex, aCloseIndex) : "";
       theNextIndex = aCloseIndex + 1;
     }
     break;
@@ -472,7 +554,7 @@ Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString&
   //TCollection_AsciiString aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex - 1);
   //theNextIndex = aCloseIndex + 1;
 
-  TCollection_AsciiString aValue;
+  Standard_DumpValue aValue;
   if (theValues.FindFromKey (aSplitKey, aValue))
   {
     Standard_Integer anIndex = 1;
@@ -486,7 +568,7 @@ Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString&
     aSplitKey = aSplitKey + anIndexedSuffix;
   }
 
-  theValues.Add (aSplitKey, aSplitValue);
+  theValues.Add (aSplitKey, Standard_DumpValue (aSplitValue, aStartIndex));
   return Standard_True;
 }
 
index c4f46ef4f0a32014f2f1d81243753bacb4e81094..3fb31eabf3a1d60495d82fa968d64f358dcffba9 100644 (file)
@@ -33,7 +33,7 @@ class Standard_DumpSentry;
 //!     It creates "key": { result of dump of the field }
 //! - OCCT_DUMP_FIELD_VALUES_NUMERICAL. Use it for unlimited list of fields of C++ double type.
 //!     It creates massive of values [value_1, value_2, ...]
-//! - OCCT_DUMP_FIELD_VALUES_STRING. Use it for unlimited list of fields of TCollection_AsciiString types.
+//! - OCCT_DUMP_FIELD_VALUES_STRING. Use it for unlimited list of fields of TCollection_AsciiString types.F
 //!     It creates massive of values ["value_1", "value_2", ...]
 //! - OCCT_DUMP_BASE_CLASS. Use if Dump implementation of the class is virtual, to perform ClassName::Dump() of the parent class,
 //!     expected parameter is the parent class name.
@@ -59,16 +59,30 @@ class Standard_DumpSentry;
 //! Append into output value: "Name": Field
 #define OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, theField) \
 { \
-  const char* aName = Standard_Dump::DumpFieldToName (#theField); \
+  TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \
   Standard_Dump::AddValuesSeparator (theOStream); \
   theOStream << "\"" << aName << "\": " << theField; \
 }
 
+//! @def OCCT_INIT_FIELD_VALUE_NUMERICAL
+//! Append vector values into output value: "Name": [value_1, value_2, ...]
+//! This macro is intended to have only one row for dumped object in Json.
+//! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call, but pay attention that it should be only one row in the object dump.
+#define OCCT_INIT_FIELD_VALUE_NUMERICAL(theOStream, theStreamPos, theField) \
+{ \
+  Standard_Integer aStreamPos = theStreamPos; \
+  if (!Standard_Dump::ProcessFieldName (theOStream, #theField, aStreamPos)) \
+    return Standard_False; \
+  if (!Standard_Dump::InitRealValue (theOStream, aStreamPos, theField)) \
+    return Standard_False; \
+  theStreamPos = aStreamPos; \
+}
+
 //! @def OCCT_DUMP_FIELD_VALUE_STRING
 //! Append into output value: "Name": "Field"
 #define OCCT_DUMP_FIELD_VALUE_STRING(theOStream, theField) \
 { \
-  const char* aName = Standard_Dump::DumpFieldToName (#theField); \
+  TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \
   Standard_Dump::AddValuesSeparator (theOStream); \
   theOStream << "\"" << aName << "\": \"" << theField << "\""; \
 }
@@ -77,7 +91,7 @@ class Standard_DumpSentry;
 //! Append into output value: "Name": "address of the pointer"
 #define OCCT_DUMP_FIELD_VALUE_POINTER(theOStream, theField) \
 { \
-  const char* aName = Standard_Dump::DumpFieldToName (#theField); \
+  TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \
   Standard_Dump::AddValuesSeparator (theOStream); \
   theOStream << "\"" << aName << "\": \"" << Standard_Dump::GetPointerInfo (theField) << "\""; \
 }
@@ -90,16 +104,27 @@ class Standard_DumpSentry;
 //! Depth = -1 is the default value, dump here is unlimited.
 #define OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, theField) \
 { \
-  if (theDepth != 0) \
+  if (theDepth != 0 && (theField) != NULL) \
   { \
     Standard_SStream aFieldStream; \
-    if ((theField) != NULL) \
-      (theField)->DumpJson (aFieldStream, theDepth - 1); \
-    const char* aName = Standard_Dump::DumpFieldToName (#theField); \
+    (theField)->DumpJson (aFieldStream, theDepth - 1); \
+    TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \
     Standard_Dump::DumpKeyToClass (theOStream, aName, Standard_Dump::Text (aFieldStream)); \
   } \
 }
 
+//! @def OCCT_INIT_FIELD_VALUES_DUMPED
+//! Append into output value: "Name": { field dumped values }
+//! It computes Dump of the fields. The expected field is a pointer.
+//! Use this macro for fields of the dumped class which has own Dump implementation.
+//! The macros is recursive. Recursion is stopped when the depth value becomes equal to zero.
+//! Depth = -1 is the default value, dump here is unlimited.
+#define OCCT_INIT_FIELD_VALUES_DUMPED(theSStream, theStreamPos, theField) \
+{ \
+  if ((theField) == NULL || !(theField)->InitJson (theSStream, theStreamPos)) \
+    return Standard_False; \
+}
+
 //! @def OCCT_DUMP_FIELD_VALUES_NUMERICAL
 //! Append real values into output values in an order: [value_1, value_2, ...]
 //! It computes Dump of the parent. The expected field is a parent class name to call ClassName::Dump.
@@ -143,21 +168,24 @@ class Standard_DumpSentry;
 //! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call, but pay attention that it should be only one row in the object dump.
 #define OCCT_DUMP_VECTOR_CLASS(theOStream, theName, theCount, ...) \
 { \
+  Standard_Dump::AddValuesSeparator (theOStream); \
   theOStream << "\"" << OCCT_CLASS_NAME(theName) << "\": ["; \
   Standard_Dump::DumpRealValues (theOStream, theCount, __VA_ARGS__);\
   theOStream << "]"; \
 }
 
-//! @def OCCT_DUMP_VECTOR_CLASS
+//! @def OCCT_INIT_VECTOR_CLASS
 //! Append vector values into output value: "Name": [value_1, value_2, ...]
 //! This macro is intended to have only one row for dumped object in Json.
 //! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call, but pay attention that it should be only one row in the object dump.
 #define OCCT_INIT_VECTOR_CLASS(theOStream, theName, theStreamPos, theCount, ...) \
 { \
-  if (!Standard_Dump::ProcessStreamName (theOStream, OCCT_CLASS_NAME(theName), theStreamPos)) \
+  Standard_Integer aStreamPos = theStreamPos; \
+  if (!Standard_Dump::ProcessStreamName (theOStream, OCCT_CLASS_NAME(theName), aStreamPos)) \
     return Standard_False; \
-  if (!Standard_Dump::InitRealValues (theOStream, theStreamPos, theCount, __VA_ARGS__)) \
+  if (!Standard_Dump::InitRealValues (theOStream, aStreamPos, theCount, __VA_ARGS__)) \
     return Standard_False; \
+  theStreamPos = aStreamPos; \
 }
 
 //! @brief Simple sentry class providing convenient interface to dump.
@@ -190,6 +218,17 @@ enum Standard_JsonKey
   Standard_JsonKey_SeparatorValueToValue //!< ", "
 };
 
+//! Type for storing a dump value with the stream position
+struct Standard_DumpValue
+{
+  Standard_DumpValue() {}
+  Standard_DumpValue (const TCollection_AsciiString& theValue, const Standard_Integer& theStartPos)
+    : myValue (theValue), myStartPosition (theStartPos) {}
+
+  TCollection_AsciiString myValue; //!< current string value
+  Standard_Integer myStartPosition; //!< position of the value first char in the whole stream
+};
+
 //! This interface has some tool methods for stream (in JSON format) processing.
 class Standard_Dump
 {
@@ -219,13 +258,9 @@ public:
   //! The last value might be processed later using the same method.
   //!
   //! \param theStream stream value
-  //! \param theValues [out] container of split values
+  //! \param theKeyToValues [out] container of split values
   Standard_EXPORT static Standard_Boolean SplitJson (const TCollection_AsciiString& theStreamStr,
-                                                     NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues);
-
-  //! Unites container of values into Json output in form: key_1 : value_1, key_2: value_2, ... key_n: value_n
-  Standard_EXPORT static void JoinJson (Standard_OStream& theOStream,
-                                        const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues);
+                                                     NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& theKeyToValues);
 
   //! Returns container of indices in values, that has hierarchical value
   Standard_EXPORT static NCollection_List<Standard_Integer> HierarchicalValueIndices (
@@ -265,7 +300,7 @@ public:
   //! @param theKey a source value
   //! @param theField stream value
   Standard_EXPORT static void DumpKeyToClass (Standard_OStream& theOStream,
-                                              const char* theKey,
+                                              const TCollection_AsciiString& theKey,
                                               const TCollection_AsciiString& theField);
 
   //! Unite values in one value using template: "value_1", "value_2", ..., "value_n"
@@ -286,6 +321,14 @@ public:
                                                              const TCollection_AsciiString& theName,
                                                              Standard_Integer& theStreamPos);
 
+  //! Check whether the field name is equal to the name in the stream at position
+  //! @param theSStream stream with values
+  //! @param theName stream key field value
+  //! @param theStreamPos current position in the stream
+  Standard_EXPORT static Standard_Boolean ProcessFieldName (const Standard_SStream& theStream,
+                                                             const TCollection_AsciiString& theName,
+                                                             Standard_Integer& theStreamPos);
+
   //! Unite values in one value using template: value_1, value_2, ..., value_n
   //! @param theSStream stream with values
   //! @param theStreamPos current position in the stream
@@ -294,11 +337,19 @@ public:
                                                           Standard_Integer& theStreamPos,
                                                           int theCount, ...);
 
+  //! Returns real value
+  //! @param theSStream stream with values
+  //! @param theStreamPos current position in the stream
+  //! @param theValue stream value
+  Standard_EXPORT static Standard_Boolean InitRealValue (const Standard_SStream& theStream,
+                                                         Standard_Integer& theStreamPos,
+                                                         Standard_Real& theValue);
+
   //! Convert field name into dump text value, removes "&" and "my" prefixes
   //! An example, for field myValue, theName is Value, for &myCLass, the name is Class
   //! @param theField a source value 
   //! @param theName [out] an updated name 
-  Standard_EXPORT static const char* DumpFieldToName (const char* theField);
+  Standard_EXPORT static TCollection_AsciiString DumpFieldToName (const TCollection_AsciiString theField);
 
 private:
   //! Extracts from the string value a pair (key, value), add it into output container, update index value
@@ -310,7 +361,7 @@ private:
   Standard_EXPORT static Standard_Boolean splitKeyToValue (const TCollection_AsciiString& theStreamStr,
                                                            Standard_Integer theStartIndex,
                                                            Standard_Integer& theNextIndex,
-                                                           NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues);
+                                                           NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& theValues);
 
 
   //! Returns key of json in the index position. Incement the index position to the next symbol in the row
index 0a94438e63fae7c8879716403c7da98131170f0b..d92d44992736b359f03091c3c690695ba88842d1 100644 (file)
@@ -76,5 +76,7 @@ void StdSelect_Shape::DumpJson (Standard_OStream& theOStream, const Standard_Int
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, StdSelect_Shape);
 
+  OCCT_DUMP_BASE_CLASS (theOStream, theDepth, PrsMgr_PresentableObject);
+
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &mysh);
 }
index 51a5286e32512f904d8e005c7aa71a938f0c1850..caa75ae7126772af56fa66591c577ce955a650fa 100644 (file)
@@ -1086,3 +1086,19 @@ Standard_Boolean StdSelect_ViewerSelector3d::ToPixMap (Image_PixMap&
   aFiller->Flush();
   return Standard_True;
 }
+
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void StdSelect_ViewerSelector3d::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const 
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_ViewerSelector);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myStructs.Length())
+  for (Graphic3d_SequenceOfStructure::Iterator aStructsIt (myStructs); aStructsIt.More(); aStructsIt.Next())
+  {
+    const Handle(Graphic3d_Structure)& aStructure = aStructsIt.Value();
+    OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aStructure)
+  }
+}
index 6004c9aa70504e1bbf7b21caa7ac1e48dd644f12..9715b8201fe7dcc686136ca4f2cc6c66df735500 100644 (file)
@@ -93,6 +93,9 @@ public:
                                          const Handle(V3d_View)& theView,
                                          const Standard_Boolean theToClearOthers = Standard_True);
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
   DEFINE_STANDARD_RTTIEXT(StdSelect_ViewerSelector3d,SelectMgr_ViewerSelector)
 
 protected:
index 3ae9e1f6b21372acf85d8ca108bc33c03473e0e1..5451b966229be0700630badeed61f141da9e890b 100644 (file)
@@ -29,4 +29,25 @@ void TopoDS_TShape::DumpJson (Standard_OStream& theOStream, const Standard_Integ
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, TopoDS_TShape);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFlags);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ShapeType());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, NbChildren());
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Free());
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Free());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Locked());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Modified());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Checked());
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Orientable());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Closed());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Infinite());
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Convex());
+
+  //for (TopoDS_ListIteratorOfListOfShape anIterator (myShapes); anIterator.More(); anIterator.Next())
+  //{
+  //  const TopoDS_Shape& subShape = anIterator.Value();
+  //  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &subShape);
+  //}
 }
index 951df3752dfed939870c523fd8259617710cd962..9b3d6639097256b4e84fdb49780a326178840aec 100644 (file)
@@ -573,3 +573,14 @@ void V3d_Viewer::DisplayPrivilegedPlane (const Standard_Boolean theOnOff, const
 
   myPlaneStructure->Display();
 }
+
+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================
+void V3d_Viewer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, V3d_Viewer);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPrivilegedPlane);
+}
index 51e2db182f4310e58572dd32bbe189d5b912f1a5..8f62a1bdb51f914362739f39f464d44d1cc0ede2 100644 (file)
@@ -480,6 +480,9 @@ public: //! @name deprecated methods
     aColor.Values (theV1, theV2, theV3, theType) ;
   }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 private:
 
   //! Returns the default background colour.
index af08f0b87d9ffb2adae2862e9d19393efcf3a1d3..3421373befae748694857dfbba70df4af4e7488f 100644 (file)
@@ -86,8 +86,22 @@ gp_Ax1 gp_Ax1::Mirrored (const gp_Ax2& A2) const
   return A1;
 }
 
-void gp_Ax1::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+void gp_Ax1::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
 {
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc);
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vdir);
+  OCCT_DUMP_VECTOR_CLASS (theOStream, Location, 3, loc.X(), loc.Y(), loc.Z())
+  OCCT_DUMP_VECTOR_CLASS (theOStream, Direction, 3, vdir.X(), vdir.Y(), vdir.Z())
+}
+
+Standard_Boolean gp_Ax1::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  Standard_Integer aPos = theStreamPos;
+
+  gp_XYZ& anXYZLoc = loc.ChangeCoord();
+  OCCT_INIT_VECTOR_CLASS (theSStream, Location, aPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
+  gp_XYZ aDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, Direction, aPos, 3, &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
+  SetDirection (aDir);
+
+  theStreamPos = aPos;
+  return Standard_True;
 }
index be1461741971ec2f3f0abc8c54e618b239ac5b27..30ebcd3a62074c7e21bdecbff1ea1d48065837cc 100644 (file)
@@ -208,6 +208,8 @@ public:
   //! Dumps the content of me into the stream
   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
 
 protected:
 
index 4c1fc2a130224ba56b14cdbafb430bfee586f8e5..537c251b8a937a6062a504fe24b1c06f81a54f88 100644 (file)
@@ -114,11 +114,36 @@ gp_Ax2 gp_Ax2::Mirrored(const gp_Ax2& A2) const
   return Temp;
 }
 
-void gp_Ax2::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+void gp_Ax2::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
 {
-  OCCT_DUMP_CLASS_BEGIN (theOStream, gp_Ax2);
+  OCCT_DUMP_VECTOR_CLASS (theOStream, Location, 3, axis.Location().X(), axis.Location().Y(), axis.Location().Z())
+  OCCT_DUMP_VECTOR_CLASS (theOStream, Direction, 3, axis.Direction().X(), axis.Direction().Y(), axis.Direction().Z())
 
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &axis);
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vydir);
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vxdir);
+  OCCT_DUMP_VECTOR_CLASS (theOStream, XDirection, 3, vxdir.X(), vxdir.Y(), vxdir.Z())
+  OCCT_DUMP_VECTOR_CLASS (theOStream, YDirection, 3, vydir.X(), vydir.Y(), vydir.Z())
+}
+
+Standard_Boolean gp_Ax2::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  Standard_Integer aPos = theStreamPos;
+
+  gp_XYZ anXYZLoc;
+  OCCT_INIT_VECTOR_CLASS (theSStream, Location, aPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
+  SetLocation (anXYZLoc);
+
+  gp_XYZ aDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, Direction, aPos, 3, &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
+  gp_XYZ aXDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, XDirection, aPos, 3, &aXDir.ChangeCoord (1), &aXDir.ChangeCoord (2), &aXDir.ChangeCoord (3))
+  gp_XYZ anYDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, YDirection, aPos, 3, &anYDir.ChangeCoord (1), &anYDir.ChangeCoord (2), &anYDir.ChangeCoord (3))
+
+  SetXDirection (aXDir);
+  SetYDirection (anYDir);
+
+  if (!Direction().IsEqual (aDir, Precision::Confusion()))
+    return Standard_False;
+
+  theStreamPos = aPos;
+  return Standard_True;
 }
index 6984cd825257821d012e15dd321fb9872efac52a..1777bd2fd574287cdf9a2bd35aaac7c10080ec91 100644 (file)
@@ -326,6 +326,8 @@ public:
   //! Dumps the content of me into the stream
   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
 
 
 protected:
index 7ae671a26a490a06ee22bab7015934436ca910f0..e2ed05513b8cea36082a6f3215a3f1480d55d0db 100644 (file)
@@ -107,9 +107,33 @@ gp_Ax3  gp_Ax3::Mirrored(const gp_Ax2& A2)const
 }
 
 
-void  gp_Ax3::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+void  gp_Ax3::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
 {
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &axis);
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vydir);
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vxdir);
+  OCCT_DUMP_VECTOR_CLASS (theOStream, Location, 3, Location().X(), Location().Y(), Location().Z())
+  OCCT_DUMP_VECTOR_CLASS (theOStream, Direction, 3, Direction().X(), Direction().Y(), Direction().Z())
+
+  OCCT_DUMP_VECTOR_CLASS (theOStream, XDirection, 3, XDirection().X(), XDirection().Y(), XDirection().Z())
+  OCCT_DUMP_VECTOR_CLASS (theOStream, YDirection, 3, YDirection().X(), YDirection().Y(), YDirection().Z())
+}
+
+Standard_Boolean  gp_Ax3::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  Standard_Integer aPos = theStreamPos;
+
+  gp_XYZ anXYZLoc;
+  OCCT_INIT_VECTOR_CLASS (theSStream, Location, aPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
+  SetLocation (anXYZLoc);
+
+  gp_XYZ aDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, Direction, aPos, 3, &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
+  gp_XYZ aXDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, XDirection, aPos, 3, &aXDir.ChangeCoord (1), &aXDir.ChangeCoord (2), &aXDir.ChangeCoord (3))
+  gp_XYZ anYDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, YDirection, aPos, 3, &anYDir.ChangeCoord (1), &anYDir.ChangeCoord (2), &anYDir.ChangeCoord (3))
+
+  SetXDirection (aXDir);
+  SetYDirection (anYDir);
+
+  theStreamPos = aPos;
+  return Standard_True;
 }
index 49268f3eb132fdcbb78f81de22ead7aa836dddff..60756a67d7f83509618e669ab300416cad4380cc 100644 (file)
@@ -293,6 +293,8 @@ public:
   //! Dumps the content of me into the stream
   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
 
 protected:
 
index a6c679ccc91e9e2c9f0b39d40fcfd3b7f0e65890..f58d8cc5dfc371c160c9af3148c919e84c317b23 100644 (file)
@@ -142,5 +142,15 @@ gp_Dir gp_Dir::Mirrored (const gp_Ax2& A2) const
 
 void gp_Dir::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &coord);
+  OCCT_DUMP_VECTOR_CLASS (theOStream, gp_Dir, 3, coord.X(), coord.Y(), coord.Z())
+}
+
+Standard_Boolean gp_Dir::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  Standard_Integer aPos = theStreamPos;
+
+  OCCT_INIT_VECTOR_CLASS (theSStream, gp_Dir, aPos, 3, &coord.ChangeCoord (1), &coord.ChangeCoord (2), &coord.ChangeCoord (3))
+
+  theStreamPos = aPos;
+  return Standard_True;
 }
index de1944db5e1b2f4563b681d7ac60168938c5f292..528371425d8f20a8f1d6729067cc895a113edf6c 100644 (file)
@@ -266,6 +266,9 @@ public:
   //! Dumps the content of me into the stream
   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
+
 
 protected:
 
index a3543dd7b17940077233b118390a311055fa63b8..515267108d526e3925a43185357f0cd7b503ecf7 100644 (file)
@@ -88,5 +88,15 @@ gp_Pnt gp_Pnt::Mirrored (const gp_Ax2& A2) const
 
 void gp_Pnt::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &coord);
+  OCCT_DUMP_VECTOR_CLASS (theOStream, gp_Pnt, 3, coord.X(), coord.Y(), coord.Z())
+}
+
+Standard_Boolean gp_Pnt::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  Standard_Integer aPos = theStreamPos;
+
+  OCCT_INIT_VECTOR_CLASS (theSStream, gp_Pnt, aPos, 3, &coord.ChangeCoord (1), &coord.ChangeCoord (2), &coord.ChangeCoord (3))
+
+  theStreamPos = aPos;
+  return Standard_True;
 }
index 58894f45e7e12cf1d93f20a4539b9827eb9dded2..11452adf6985b1c2b1ed2bfbd0b8fae0c4e7f6f7 100644 (file)
@@ -177,6 +177,8 @@ public:
   //! Dumps the content of me into the stream
   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
 
 protected:
 
index 7c4a4c9cd9c18ff10ee129977c80d5936960e426..9ad34a3a80f098a8b830b822b10f332c53aada60 100644 (file)
@@ -857,11 +857,54 @@ void gp_Trsf::Orthogonalize()
 //=======================================================================
 void gp_Trsf::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
 {
-  OCCT_DUMP_CLASS_BEGIN (theOStream, gp_Trsf);
-
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc);
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &matrix);
+  OCCT_DUMP_VECTOR_CLASS (theOStream, Location, 3, loc.X(), loc.Y(), loc.Z())
+  OCCT_DUMP_VECTOR_CLASS (theOStream, Matrix, 9, matrix.Value(1, 1), matrix.Value(1, 2), matrix.Value(1, 3),
+                                                 matrix.Value(2, 1), matrix.Value(2, 2), matrix.Value(2, 3),
+                                                 matrix.Value(3, 1), matrix.Value(3, 2), matrix.Value(3, 3))
 
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, shape);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, scale);
 }
+
+//=======================================================================
+//function : InitJson
+//purpose  : 
+//=======================================================================
+Standard_Boolean  gp_Trsf::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+{
+  Standard_Integer aPos = theStreamPos;
+
+  gp_XYZ anXYZLoc;
+  OCCT_INIT_VECTOR_CLASS (theSStream, Location, aPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
+  SetTranslation (anXYZLoc);
+
+  //OCCT_INIT_VECTOR_CLASS (theSStream, Matrix, aPos, 9, matrix.ChangeValue (1, 1), matrix.ChangeValue (1, 2), matrix.ChangeValue (1, 3),
+  //                                                     matrix.ChangeValue (2, 1), matrix.ChangeValue (2, 2), matrix.ChangeValue (2, 3),
+  //                                                     matrix.ChangeValue (3, 1), matrix.ChangeValue (3, 2), matrix.ChangeValue (3, 3))
+
+  Standard_Real mymatrix[3][3];
+  //Standard_Real M00, M01, M02, M10, M11, M12, M20, M21, M22;
+  //OCCT_INIT_VECTOR_CLASS (theSStream, Matrix, aPos, 9, &mymatrix[0][0], &mymatrix[0][1], &mymatrix[0][2],
+  //                                                     &mymatrix[1][0], &mymatrix[1][1], &mymatrix[1][2],
+  //                                                     &mymatrix[2][0], &mymatrix[2][1], &mymatrix[2][2])
+
+  OCCT_INIT_VECTOR_CLASS (theSStream, Matrix, aPos, 9, &mymatrix[0][0], &mymatrix[0][1], &mymatrix[0][2],
+                                                       &mymatrix[1][0], &mymatrix[1][1], &mymatrix[1][2],
+                                                       &mymatrix[2][0], &mymatrix[2][1], &mymatrix[2][2])
+  for (int i = 0; i < 3; i++)
+  {
+    for (int j = 0; j < 3; j++)
+    {
+      matrix.SetValue (i + 1, j + 1, mymatrix[i][j]);
+    }
+  }
+
+  Standard_Real myshape;
+  OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, myshape);
+  shape = (gp_TrsfForm)((Standard_Integer)myshape);
+
+  OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, scale);
+
+  theStreamPos = aPos;
+  return Standard_True;
+}
index 85e258c67f97cab066f4342b9e6732f03282b3c5..2eb97d860e2c17758cf2a579e61e95e8cc6751d6 100644 (file)
@@ -353,6 +353,9 @@ void operator *= (const gp_Trsf& T)
   //! Dumps the content of me into the stream
   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
+
 friend class gp_GTrsf;
 
 protected:
index aaf9a3e5363d9a40fc39e1d0ab979e21ecc19f2a..72317f4fbe2bc3c081f822932d9629b23434438c 100644 (file)
@@ -47,30 +47,12 @@ void gp_XYZ::DumpJson (Standard_OStream& theOStream, const Standard_Integer) con
 //function : InitJson
 //purpose  : 
 //=======================================================================
-Standard_Boolean gp_XYZ::InitJson (Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+Standard_Boolean gp_XYZ::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
 {
-  OCCT_INIT_VECTOR_CLASS (theSStream, gp_XYZ, theStreamPos, 3, &x, &y, &z)
-
-  //NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
-  //if (!Standard_Dump::SplitJson (Standard_Dump::Text (theSStream), aValues) || aValues.Size() > 1)
-  //  return Standard_False;
-
-  //if (aValues.FindKey (1).IsEqual (OCCT_CLASS_NAME(gp_XYZ)))
-  //  return Standard_False;
-
-  //NCollection_IndexedMap<TCollection_AsciiString> aValuesList;
-
-  //TCollection_AsciiString aValue = aValues.FindFromIndex (1);
-  //aValue.Split (Standard_Dump::JsonKeyToString (Standard_JsonKey_SeparatorValueToValue), aValuesList);
-
-  //if (aValuesList.Size() != 3 ||
-  //   !aValuesList.FindKey(1).IsRealValue() || !aValuesList.FindKey(2).IsRealValue() || !aValuesList.FindKey(3).IsRealValue())
-  //  return Standard_False;
-
-  //x = aValuesList.FindKey(1).RealValue();
-  //y = aValuesList.FindKey(2).RealValue();
-  //z = aValuesList.FindKey(3).RealValue();
+  Standard_Integer aPos = theStreamPos;
+  OCCT_INIT_VECTOR_CLASS (theSStream, gp_XYZ, aPos, 3, &x, &y, &z)
 
+  theStreamPos = aPos;
   return Standard_True;
 }
 
index da45bc41d1cfbca5a27ef34dff0d5e4b8844804d..6225402b639afb5e3095b2be61915d6db666de71 100644 (file)
@@ -332,7 +332,7 @@ public:
   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
   //! Inits the content of me into the stream
-  Standard_EXPORT Standard_Boolean InitJson (Standard_SStream& theSStream, Standard_Integer& theStreamPos);
+  Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
 
 protected:
 
index e455a7cbeb0aeae257dad02a363746abdbecce98..2cf944f29e1c763c334eaaa63d2e2b6737584f18 100644 (file)
 // commercial license or contractual agreement. 
 
 #include <inspector/Convert_Tools.hxx>
+#include <inspector/Convert_TransientShape.hxx>
 
+#include <AIS_Plane.hxx>
+#include <AIS_Shape.hxx>
+#include <Geom_Plane.hxx>
+#include <Prs3d_PlaneAspect.hxx>
 #include <TColgp_Array1OfPnt.hxx>
 #include <Standard_Dump.hxx>
 #include <BRep_Builder.hxx>
 //function : CreateShape
 //purpose  :
 //=======================================================================
-TopoDS_Shape Convert_Tools::CreateShape (const Bnd_Box& theBoundingBox)
+void Convert_Tools::ConvertStreamToPresentations (const Standard_SStream& theSStream,
+                                                  const Standard_Integer theStartPos,
+                                                  const Standard_Integer /*theLastPos*/,
+                                                  NCollection_List<Handle(Standard_Transient)>& thePresentations)
+{
+  int aStartPos = theStartPos;
+  gp_XYZ aPoint;
+  if (aPoint.InitJson (theSStream, aStartPos))
+  {
+    thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPoint)));
+    return;
+  }
+
+  gp_Pnt aPnt;
+  if (aPnt.InitJson (theSStream, aStartPos))
+  {
+    thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPnt)));
+    return;
+  }
+
+  gp_Dir aDir;
+  if (aDir.InitJson (theSStream, aStartPos))
+  {
+    thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeEdge (gp::Origin(), aDir.XYZ())));
+    return;
+  }
+
+  gp_Ax2 anAx2;
+  if (anAx2.InitJson (theSStream, aStartPos))
+  {
+    Handle(Geom_Plane) aGeomPlane = new Geom_Plane (gp_Ax3 (anAx2));
+    CreatePresentation (aGeomPlane, thePresentations);
+    return;
+  }
+
+  gp_Ax3 anAx3; // should be after gp_Ax2
+  if (anAx3.InitJson (theSStream, aStartPos))
+  {
+    Handle(Geom_Plane) aGeomPlane = new Geom_Plane (anAx3);
+    CreatePresentation (aGeomPlane, thePresentations);
+    return;
+  }
+
+  // should be after gp_Ax3
+  gp_Ax1 anAxis;
+  if (anAxis.InitJson (theSStream, aStartPos))
+  {
+    thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeEdge (anAxis.Location(), anAxis.Location().Coord() + anAxis.Direction().XYZ())));
+    return;
+  }
+
+  gp_Trsf aTrsf;
+  if (aTrsf.InitJson (theSStream, aStartPos))
+  {
+    CreatePresentation (aTrsf, thePresentations);
+    return;
+  }
+
+  Bnd_Box aBox;
+  if (aBox.InitJson (theSStream, aStartPos))
+  {
+    TopoDS_Shape aShape;
+    if (Convert_Tools::CreateShape (aBox, aShape))
+      thePresentations.Append (new Convert_TransientShape (aShape));
+    return;
+  }
+}
+
+//=======================================================================
+//function : ConvertStreamToColor
+//purpose  :
+//=======================================================================
+Standard_Boolean Convert_Tools::ConvertStreamToColor (const Standard_SStream& theSStream,
+                                                      Quantity_Color& theColor)
+{
+  Standard_Integer aStartPos = 1;
+  Quantity_ColorRGBA aColorRGBA;
+  if (aColorRGBA.InitJson (theSStream, aStartPos))
+  {
+    theColor = aColorRGBA.GetRGB();
+    return Standard_True;
+  }
+
+  Quantity_Color aColor;
+  if (aColor.InitJson (theSStream, aStartPos))
+  {
+    theColor = aColor;
+    return Standard_True;
+  }
+
+  return Standard_False;
+}
+
+//=======================================================================
+//function : CreateShape
+//purpose  :
+//=======================================================================
+Standard_Boolean Convert_Tools::CreateShape (const Bnd_Box& theBoundingBox, TopoDS_Shape& theShape)
 {
   if (theBoundingBox.IsVoid() || theBoundingBox.IsWhole())
-    return TopoDS_Shape();
+    return Standard_False;
 
   Standard_Real aXmin, anYmin, aZmin, aXmax, anYmax, aZmax;
   theBoundingBox.Get (aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
@@ -38,17 +140,17 @@ TopoDS_Shape Convert_Tools::CreateShape (const Bnd_Box& theBoundingBox)
   gp_Pnt aPntMin = gp_Pnt (aXmin, anYmin, aZmin);
   gp_Pnt aPntMax = gp_Pnt (aXmax, anYmax, aZmax);
 
-  return CreateBoxShape (aPntMin, aPntMax);
+  return CreateBoxShape (aPntMin, aPntMax, theShape);
 }
 
 //=======================================================================
 //function : CreateShape
 //purpose  :
 //=======================================================================
-TopoDS_Shape Convert_Tools::CreateShape (const Bnd_OBB& theBoundingBox)
+Standard_Boolean Convert_Tools::CreateShape (const Bnd_OBB& theBoundingBox, TopoDS_Shape& theShape)
 {
   if (theBoundingBox.IsVoid())
-    return TopoDS_Shape();
+    return Standard_False;
 
   TColgp_Array1OfPnt anArrPnts(0, 8);
   theBoundingBox.GetVertex(&anArrPnts(0));
@@ -62,14 +164,15 @@ TopoDS_Shape Convert_Tools::CreateShape (const Bnd_OBB& theBoundingBox)
   aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(1)), gp_Pnt (anArrPnts.Value(3))));
   aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(2)), gp_Pnt (anArrPnts.Value(3))));
 
-  return aCompound;
+  theShape = aCompound;
+  return Standard_True;
 }
 
 //=======================================================================
 //function : CreateBoxShape
 //purpose  :
 //=======================================================================
-TopoDS_Shape Convert_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax)
+Standard_Boolean Convert_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax, TopoDS_Shape& theShape)
 {
   Standard_Boolean aThinOnX = fabs (thePntMin.X() - thePntMax.X()) < Precision::Confusion();
   Standard_Boolean aThinOnY = fabs (thePntMin.Y() - thePntMax.Y()) < Precision::Confusion();
@@ -81,7 +184,8 @@ TopoDS_Shape Convert_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pn
     TopoDS_Compound aCompound;
     aBuilder.MakeCompound (aCompound);
     aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (thePntMin));
-    return aCompound;
+    theShape = aCompound;
+    return Standard_True;
   }
 
   if (aThinOnX || aThinOnY || aThinOnZ)
@@ -116,11 +220,66 @@ TopoDS_Shape Convert_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pn
     aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt3, aPnt4));
     aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt4, aPnt1));
 
-    return aCompound;
+    theShape = aCompound;
+    return Standard_True;
   }
   else
   {
     BRepPrimAPI_MakeBox aBoxBuilder (thePntMin, thePntMax);
-    return aBoxBuilder.Shape();
+    theShape = aBoxBuilder.Shape();
+    return Standard_True;
   }
 }
+
+//=======================================================================
+//function : CreatePresentation
+//purpose  :
+//=======================================================================
+void Convert_Tools::CreatePresentation (const Handle(Geom_Plane)& thePlane,
+                                        NCollection_List<Handle(Standard_Transient)>& thePresentations)
+{
+  Handle(AIS_Plane) aPlanePrs = new AIS_Plane (thePlane);
+
+  // TODO - default fields to be defined in another place
+  aPlanePrs->Attributes()->SetPlaneAspect (new Prs3d_PlaneAspect());
+  Handle (Prs3d_PlaneAspect) aPlaneAspect = aPlanePrs->Attributes()->PlaneAspect();
+  aPlaneAspect->SetPlaneLength (100, 100);
+  aPlaneAspect->SetDisplayCenterArrow (Standard_True);
+  aPlaneAspect->SetDisplayEdgesArrows (Standard_True);
+  aPlaneAspect->SetArrowsSize (100);
+  aPlaneAspect->SetArrowsLength (100);
+  aPlaneAspect->SetDisplayCenterArrow (Standard_True);
+  aPlaneAspect->SetDisplayEdges (Standard_True);
+
+  aPlanePrs->SetColor (Quantity_NOC_WHITE);
+  aPlanePrs->SetTransparency (0);
+
+  thePresentations.Append (aPlanePrs);
+}
+
+//=======================================================================
+//function : CreatePresentation
+//purpose  :
+//=======================================================================
+void Convert_Tools::CreatePresentation (const gp_Trsf& theTrsf,
+                                        NCollection_List<Handle(Standard_Transient)>& thePresentations)
+{
+  Bnd_Box aBox (gp_Pnt(), gp_Pnt(10., 10., 10));
+
+  TopoDS_Shape aBoxShape;
+  if (!Convert_Tools::CreateShape (aBox, aBoxShape))
+    return;
+
+  Handle(AIS_Shape) aSourcePrs = new AIS_Shape (aBoxShape);
+  // TODO - default fields to be defined in another place
+  aSourcePrs->SetColor (Quantity_NOC_WHITE);
+  aSourcePrs->SetTransparency (0.5);
+  thePresentations.Append (aSourcePrs);
+
+  Handle(AIS_Shape) aTransformedPrs = new AIS_Shape (aBoxShape);
+  // TODO - default fields to be defined in another place
+  aTransformedPrs->SetColor (Quantity_NOC_TOMATO);
+  aTransformedPrs->SetTransparency (0.5);
+  aTransformedPrs->SetLocalTransformation (theTrsf);
+  thePresentations.Append (aTransformedPrs);
+}
index ecce1fdc5f72569e3f6fe5fa32726a2df1d7fba1..2d4a08a08b32d583adcf1fb318ba8d2971338e8c 100644 (file)
@@ -22,6 +22,8 @@
 #include <gp_XYZ.hxx>
 #include <Bnd_Box.hxx>
 #include <Bnd_OBB.hxx>
+#include <NCollection_List.hxx>
+#include <Quantity_Color.hxx>
 #include <Standard.hxx>
 #include <Standard_Macro.hxx>
 #include <TColgp_HArray1OfPnt.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TopLoc_Location.hxx>
 #include <TopoDS_Shape.hxx> 
+#include <Standard_SStream.hxx>
 
 #include <Standard_WarningsDisable.hxx>
 #include <QString>
 #include <QVariant>
 #include <Standard_WarningsRestore.hxx>
 
+class Geom_Plane;
 class Geom_Transformation;
 
 //! \class Convert_Tools
@@ -42,21 +46,48 @@ class Geom_Transformation;
 class Convert_Tools
 {
 public:
+  //! Creates shape presentations on the stream if possible. Tries to init some OCCT base for a new presentation
+  //! \param theStream source of presentation
+  //! \param thePresentations container to collect new presentation/s
+  Standard_EXPORT static void ConvertStreamToPresentations (const Standard_SStream& theSStream,
+                                                            const Standard_Integer theStartPos,
+                                                            const Standard_Integer theLastPos,
+                                                            NCollection_List<Handle(Standard_Transient)>& thePresentations);
+
+  //! Converts stream to color if possible. It processes Quantity_Color, Quantity_ColorRGBA
+  //! \param theStream source of presentation
+  //! \param theColor [out] converted color
+  //! \returns true if done
+  Standard_EXPORT static Standard_Boolean ConvertStreamToColor (const Standard_SStream& theSStream,
+                                                                Quantity_Color& theColor);
+
   //! Creates box shape
   //! \param theBoundingBox box shape parameters
   //! \return created shape
-  Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_Box& theBoundingBox);
+  Standard_EXPORT static Standard_Boolean CreateShape (const Bnd_Box& theBoundingBox, TopoDS_Shape& theShape);
 
   //! Creates box shape
   //! \param theBoundingBox box shape parameters
   //! \return created shape
-  Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_OBB& theBoundingBox);
+  Standard_EXPORT static Standard_Boolean CreateShape (const Bnd_OBB& theBoundingBox, TopoDS_Shape& theShape);
 
   //! Creates box shape
   //! \param thePntMin minimum point on the bounding box
   //! \param thePntMax maximum point on the bounding box
   //! \return created shape
-  Standard_EXPORT static TopoDS_Shape CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax);
+  Standard_EXPORT static Standard_Boolean CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax, TopoDS_Shape& theShape);
+
+  //! Creates presentation AIS_Plane
+  //! \param thePlane source plane
+  //! \param thePresentations container to collect new presentation/s
+  Standard_EXPORT static void CreatePresentation (const Handle(Geom_Plane)& thePlane,
+    NCollection_List<Handle(Standard_Transient)>& thePresentations);
+
+  //! Creates two presentations base on gp_Trsf: box in initial place and transformed box
+  //! \param thePlane source plane
+  //! \param thePresentations container to collect new presentation/s
+  Standard_EXPORT static void CreatePresentation (const gp_Trsf& theTrsf,
+    NCollection_List<Handle(Standard_Transient)>& thePresentations);
 
 };
 
index 03115c1a2f0faadc5712eff47a6fab2b7e71681a..0b56179b08fd102493c31e8aa45c9c9f1682aa7a 100644 (file)
@@ -26,6 +26,9 @@
 
 #include <Message_AlertExtended.hxx>
 
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <Quantity_Color.hxx>
+#include <Quantity_ColorRGBA.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TopoDS_AlertAttribute.hxx>
 
@@ -347,6 +350,45 @@ void MessageModel_Actions::OnTestPropertyPanel()
     aCoords.DumpJson (aStream);
     MESSAGE_INFO_STREAM(aStream, "gp_XYZ", "", &aPerfMeter, NULL);
   }
+  // gp_Dir
+  {
+    gp_Dir aDir (0.3, 0.3, 0.4);
+    Standard_SStream aStream;
+    aDir.DumpJson (aStream);
+    MESSAGE_INFO_STREAM(aStream, "gp_Dir", "", &aPerfMeter, NULL);
+  }
+  // gp_Ax1
+  {
+    gp_Ax1 aCoords (gp_Pnt (1.3, 2.3, 3.4), gp_Dir (0.3, 0.3, 0.4));
+    Standard_SStream aStream;
+    aCoords.DumpJson (aStream);
+    MESSAGE_INFO_STREAM(aStream, "gp_Ax1", "", &aPerfMeter, NULL);
+  }
+  // gp_Ax2
+  {
+    gp_Ax2 aCoords (gp_Pnt (10.3, 20.3, 30.4), gp_Dir (0.3, 0.3, 0.4));
+    Standard_SStream aStream;
+    aCoords.DumpJson (aStream);
+    MESSAGE_INFO_STREAM(aStream, "gp_Ax2", "", &aPerfMeter, NULL);
+  }
+  // gp_Ax3
+  {
+    gp_Ax3 aPln (gp_Pnt (10., 20., 15.), gp_Dir (0., 0., 1.), gp_Dir (1., 0., 0.));
+    Standard_SStream aStream;
+    aPln.DumpJson (aStream);
+    MESSAGE_INFO_STREAM(aStream, "gp_Ax3", "", &aPerfMeter, NULL);
+  }
+  // gp_Trsf
+  {
+    gp_Trsf aTrsf;
+    aTrsf.SetRotation (gp::OZ(), 0.3);
+    aTrsf.SetTranslationPart (gp_Vec (15., 15., 15.));
+    aTrsf.SetScaleFactor (3.);
+
+    Standard_SStream aStream;
+    aTrsf.DumpJson (aStream);
+    MESSAGE_INFO_STREAM(aStream, "gp_Trsf", "", &aPerfMeter, NULL);
+  }
   // Bnd_Box
   {
     Bnd_Box aBox (gp_Pnt (20., 15., 10.), gp_Pnt (25., 20., 15.));
@@ -362,6 +404,29 @@ void MessageModel_Actions::OnTestPropertyPanel()
     anOBB.DumpJson (aStream);
     MESSAGE_INFO_STREAM(aStream, "Bnd_OBB", "", &aPerfMeter, NULL);
   }
+  // Quantity_ColorRGBA
+  {
+    Quantity_ColorRGBA aColor (0.2f, 0.8f, 0.8f, 0.2f);
+    Standard_SStream aStream;
+    aColor.DumpJson (aStream);
+    MESSAGE_INFO_STREAM(aStream, "Quantity_ColorRGBA", "", &aPerfMeter, NULL);
+  }
+  // Quantity_Color
+  {
+    Quantity_Color aColor (0.8, 0.8, 0.8, Quantity_TOC_RGB);
+    Standard_SStream aStream;
+    aColor.DumpJson (aStream);
+    MESSAGE_INFO_STREAM(aStream, "Quantity_Color", "", &aPerfMeter, NULL);
+  }
+
+  // SHAPE messages
+  {
+    BRepBuilderAPI_MakeEdge aBuilder (gp_Pnt (0., 0., 0.), gp_Pnt (20., 10., 20.));
+    TopoDS_Shape aShape = aBuilder.Shape();
+
+    MESSAGE_INFO_SHAPE (aShape, "Shape message edge", "", &aPerfMeter, NULL);
+  }
+
   myTreeModel->UpdateTreeModel();
 #endif
 }
index c4882a928bcfd9ca9f7a589d90a5c27c2bf521d3..f5b2219541155255e365427ae3f23faaf6b18226 100644 (file)
@@ -207,26 +207,55 @@ int MessageModel_ItemAlert::initRowCount() const
 // =======================================================================
 void MessageModel_ItemAlert::GetStream (Standard_OStream& OS) const
 {
-  //return;
   Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (getAlert());
-  if (!anExtendedAlert.IsNull() && !anExtendedAlert->Attribute().IsNull())
-  {
-    Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
-    if (!anAttribute.IsNull())
-    {
-      if (!Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
-      {
-        //if (GetProperties().IsNull())
-        //{
-        //  TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
-        //  SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem));
-        //}
-        Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
-        //Handle(MessageModel_ItemPropertiesAttributeStream) aProperties = Handle(MessageModel_ItemPropertiesAttributeStream)::DownCast (GetProperties());
-        OS << anAttributeStream->GetStream().str();
-      }
-    }
-  }
+  if (anExtendedAlert.IsNull() || anExtendedAlert->Attribute().IsNull())
+    return;
+
+  Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
+  if (anAttribute.IsNull())
+    return;
+
+  if (Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
+    return;
+
+  Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
+  OS << anAttributeStream->GetStream().str();
+}
+
+// =======================================================================
+// function : SetStream
+// purpose :
+// =======================================================================
+bool MessageModel_ItemAlert::SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
+                                        Standard_Integer& theLastPos) const
+{
+  Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (getAlert());
+  if (anExtendedAlert.IsNull() || anExtendedAlert->Attribute().IsNull())
+    return false;
+
+  Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
+  if (anAttribute.IsNull())
+    return false;
+
+  if (Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
+    return false;
+
+  Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
+  TCollection_AsciiString aStreamValue = Standard_Dump::Text (anAttributeStream->GetStream());
+
+  TCollection_AsciiString aNewValue = Standard_Dump::Text (theSStream);
+
+  Standard_SStream aStream;
+  aStream << aStreamValue.SubString (1, theStartPos - 1);
+  aStream << aNewValue;
+  if (theLastPos + 1 <= aStreamValue.Length())
+    aStream << aStreamValue.SubString (theLastPos + 1, aStreamValue.Length());
+
+  //TCollection_AsciiString aStreamValue_debug = Standard_Dump::Text (aStream);
+
+  anAttributeStream->SetStream (aStream);
+
+  return true;
 }
 
 // =======================================================================
@@ -268,33 +297,33 @@ void MessageModel_ItemAlert::Init()
     }
   }
 
-  /*Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(myAlert);
+  Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(myAlert);
   if (!anExtendedAlert.IsNull() && !anExtendedAlert->Attribute().IsNull())
   {
     Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
     if (!anAttribute.IsNull())
     {
-      if (!Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
-      {
-        if (GetProperties().IsNull())
-        {
-          TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
-          SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem));
-        }
-        Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
-        Handle(MessageModel_ItemPropertiesAttributeStream) aProperties = Handle(MessageModel_ItemPropertiesAttributeStream)::DownCast (GetProperties());
-        aProperties->Init (anAttributeStream->GetStream());
-      }
-      //if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
-      //  myPresentations.Append (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
-      //if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
-      //  myPresentations.Append (new Convert_TransientShape (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape()));
+      //if (!Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
+      //{
+      //  if (GetProperties().IsNull())
+      //  {
+      //    TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
+      //    SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem));
+      //  }
+      //  Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
+      //  Handle(MessageModel_ItemPropertiesAttributeStream) aProperties = Handle(MessageModel_ItemPropertiesAttributeStream)::DownCast (GetProperties());
+      //  aProperties->Init (anAttributeStream->GetStream());
+      //}
+      ////if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
+      ////  myPresentations.Append (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
+      if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+        myPresentations.Append (new Convert_TransientShape (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape()));
     }
     //TCollection_AsciiString aDescription = anExtendedAlert->Attribute()->GetDescription();
     //Bnd_Box aBox;
     //if (aBox.Init (Standard_SStream (aDescription.ToCString())))
     //  myPresentations.Append (new Convert_TransientShape (Convert_Tools::CreateShape (aBox)));
-  }*/
+  }
   MessageModel_ItemBase::Init();
 }
 
index 41950e8c30a11f71944344ecff84fec92c462e47..6938a2f00e3519a6e961b535acab737bf0fa0b4b 100644 (file)
@@ -78,6 +78,11 @@ public:
   //! \return stream value or dummy
   Standard_EXPORT virtual void GetStream (Standard_OStream& OS) const Standard_OVERRIDE;
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual bool SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
+                                          Standard_Integer& theLastPos) const Standard_OVERRIDE;
+
   //! Sets some shape to present the item
   //! \param theShape shape instance
   void SetCustomShape (const TopoDS_Shape& theShape) { myCustomShape = theShape; }
index 97300335578d4aa6d8da574457e286be005d0c5d..06b3accb1594d40b5aa41e9e9295a5f268029db2 100644 (file)
@@ -198,3 +198,31 @@ Handle(Message_Report) MessageModel_ItemReport::FindReport (const MessageModel_I
   }
   return NULL;
 }
+
+// =======================================================================
+// function : GetStream
+// purpose :
+// =======================================================================
+void MessageModel_ItemReport::GetStream (Standard_OStream& theOStream) const
+{
+  Handle(Message_Report) aReport = GetReport();
+  if (aReport.IsNull())
+    return;
+
+  aReport->DumpJson (theOStream);
+}
+
+// =======================================================================
+// function : SetStream
+// purpose :
+// =======================================================================
+bool MessageModel_ItemReport::SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
+                                         Standard_Integer& theLastPos) const
+{
+  Handle(Message_Report) aReport = GetReport();
+  if (aReport.IsNull())
+    return false;
+
+  Standard_Integer aStartPos = 1;
+  return aReport->InitJson (theSStream, aStartPos);
+}
index 258a58abce6d7588bea6e47dfa27b8b04879dab8..e0bfa260e8dc5389cbe1d5ff3735c4dba430b139 100644 (file)
@@ -78,6 +78,15 @@ public:
   //! Returns report of the item
   static Handle(Message_Report) FindReport (const MessageModel_ItemBasePtr& thetItem);
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
+
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual bool SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
+                                          Standard_Integer& theLastPos) const Standard_OVERRIDE;
+
 protected:
 
   //! Initialize the current item. It is empty because Reset() is also empty.
index 5b7e5d415ff461c1d9bcdc1e409762f84e0e0016..f2a1dbac9515c1f105faab66fd2cad792d0caa16 100644 (file)
@@ -101,7 +101,7 @@ TopoDS_Shape MessageView_VisibilityState::getShape (const QModelIndex& theIndex)
   if (!anAlertItem)
     return TopoDS_Shape();
 
-  if (!anAlertItem->GetCustomShape().IsNull())
+  /*if (!anAlertItem->GetCustomShape().IsNull())
     return anAlertItem->GetCustomShape();
 
   Handle(Message_Alert) anAlert = anAlertItem->GetAlert();
@@ -115,7 +115,7 @@ TopoDS_Shape MessageView_VisibilityState::getShape (const QModelIndex& theIndex)
   Handle(TopoDS_AlertAttribute) aShapeAttribute = Handle(TopoDS_AlertAttribute)::DownCast (anAlertExtended->Attribute());
   if (!aShapeAttribute.IsNull())
     return aShapeAttribute->GetShape();
-
+  */
   return TopoDS_Shape();
 }
 
index 69fda2984032e4746c6ab0709359a237bbdc3046..59b7b5d801bc5a1a073d8ab4e0f1460400d7b946 100644 (file)
 #include <inspector/MessageModel_TreeModel.hxx>
 
 #include <inspector/TreeModel_ContextMenu.hxx>
-#include <inspector/TreeModel_ItemStream.hxx>
 #include <inspector/TreeModel_Tools.hxx>
 
 #include <inspector/ViewControl_PropertyView.hxx>
 #include <inspector/ViewControl_TableModelValues.hxx>
 #include <inspector/ViewControl_TreeView.hxx>
-#include <inspector/Convert_TransientShape.hxx>
+#include <inspector/Convert_Tools.hxx>
 
+#include <inspector/View_DisplayPreview.hxx >
 #include <inspector/View_Tools.hxx>
 #include <inspector/View_Viewer.hxx>
 #include <inspector/View_Widget.hxx>
@@ -142,6 +142,8 @@ Handle(Prs3d_Drawer) GetPreviewAttributes (const Handle(AIS_InteractiveContext)&
 MessageView_Window::MessageView_Window (QWidget* theParent)
 : QObject (theParent)
 {
+  myDisplayPreview = new View_DisplayPreview();
+
   myMainWindow = new QMainWindow (theParent);
 
   myTreeView = new ViewControl_TreeView (myMainWindow);
@@ -188,11 +190,14 @@ MessageView_Window::MessageView_Window (QWidget* theParent)
   myPropertyPanelWidget->setWidget (myPropertyView->GetControl());
   myMainWindow->addDockWidget (Qt::RightDockWidgetArea, myPropertyPanelWidget);
   connect (myPropertyPanelWidget->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT (onPropertyPanelShown (bool)));
-  connect (myPropertyView, SIGNAL (propertyViewSelectionChanged()), this, SLOT (onPropertyViewSelectionChanged ()));
+  connect (myPropertyView, SIGNAL (propertyViewSelectionChanged()), this, SLOT (onPropertyViewSelectionChanged()));
+  connect (myPropertyView, SIGNAL (propertyViewDataChanged()), this, SLOT (onPropertyViewDataChanged()));
+
 
   // view
   myViewWindow = new View_Window (myMainWindow, false);
   connect (myViewWindow, SIGNAL(eraseAllPerformed()), this, SLOT(onEraseAllPerformed()));
+  connect (myViewWindow->GetViewToolBar(), SIGNAL (contextChanged()), this, SLOT (onContextSelected()));
   aVisibilityState->SetDisplayer (myViewWindow->GetDisplayer());
   aVisibilityState->SetPresentationType (View_PresentationType_Main);
   myViewWindow->GetView()->SetPredefinedSize (MESSAGEVIEW_DEFAULT_VIEW_WIDTH, MESSAGEVIEW_DEFAULT_VIEW_HEIGHT);
@@ -363,6 +368,7 @@ void MessageView_Window::Init (NCollection_List<Handle(Standard_Transient)>& the
   if (!aContext.IsNull())
   {
     myViewWindow->SetContext (View_ContextType_External, aContext);
+    myViewWindow->GetViewToolBar()->SetCurrentContextType (View_ContextType_External);
   }
 
   if (!aViewCamera.IsNull())
@@ -409,7 +415,7 @@ void MessageView_Window::addReport (const Handle(Message_Report)& theReport,
 }
 
 // =======================================================================
-// function : onTreeViewSelectionChanged
+// function : onTreeViewVisibilityClicked
 // purpose :
 // =======================================================================
 void MessageView_Window::onTreeViewVisibilityClicked(const QModelIndex& theIndex)
@@ -430,37 +436,7 @@ void MessageView_Window::onTreeViewSelectionChanged (const QItemSelection&, cons
     return;
 
   updatePropertyPanelBySelection();
-
-  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++)
-  {
-    QModelIndex anIndex = *aSelIt;
-    if (anIndex.column() != 0)
-      continue;
-
-    TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
-    if (!anItemBase)
-      continue;
-
-    //Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->GetProperties();
-    //if (anItemProperties)
-    //  anItemProperties->GetPresentations (-1, -1, aPresentations);
-    TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast<TreeModel_ItemStream> (anItemBase);
-    if (!aStreamParent)
-      return;
-
-    Handle(TreeModel_ItemProperties) anItemProperties = aStreamParent->Properties ();
-    if (anItemProperties)
-      anItemProperties->GetPresentations (-1, -1, aPresentations);
-
-    MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
-    if (!anAlertItem)
-      continue;
-    anAlertItem->GetPresentations (aPresentations);
-  }
-  updatePreviewPresentation (aPresentations);
+  updatePreviewPresentation();
 }
 
 // =======================================================================
@@ -553,15 +529,12 @@ void MessageView_Window::onPropertyViewSelectionChanged()
   if (!anAlertItem)
     return;
 
-  QList<ViewControl_Table*> aPropertyTables;
-  myPropertyView->GetActiveTables (aPropertyTables);
-  if (aPropertyTables.isEmpty())
+  ViewControl_Table* aPropertyTable = myPropertyView->GetTable();
+  if (!aPropertyTable->IsActive())
     return;
 
-  ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
-
   QMap<int, QList<int>> aSelectedIndices;
-  aFirstTable->GetSelectedIndices (aSelectedIndices);
+  aPropertyTable->GetSelectedIndices (aSelectedIndices);
 
   // clear presentation if selection is empty
   MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
@@ -573,7 +546,7 @@ void MessageView_Window::onPropertyViewSelectionChanged()
     return;
   }
 
-  /*TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aFirstTable);
+  /*TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aPropertyTable);
   if (aShapeOfSelection.IsNull())
     return;
 
@@ -596,6 +569,24 @@ void MessageView_Window::onPropertyViewSelectionChanged()
   }*/
 }
 
+// =======================================================================
+// function : onPropertyViewDataChanged
+// purpose :
+// =======================================================================
+void MessageView_Window::onPropertyViewDataChanged()
+{
+  QItemSelectionModel* aModel = myTreeView->selectionModel();
+  if (!aModel)
+    return;
+  QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
+  TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+  if (!anItemBase)
+    return;
+
+  updatePropertyPanelBySelection();
+  updatePreviewPresentation();
+}
+
 // =======================================================================
 // function : onEraseAllPerformed
 // purpose :
@@ -703,6 +694,19 @@ void MessageView_Window::onReloadReport()
   aTreeModel->SetReport (aReportItem->Row(), aReport, aDescription);
 }
 
+// =======================================================================
+// function : onContextSelected
+// purpose :
+// =======================================================================
+void MessageView_Window::onContextSelected()
+{
+  Handle(AIS_InteractiveContext) aContext = myViewWindow->GetViewToolBar()->GetCurrentContext();
+  if (aContext.IsNull())
+    return;
+
+  myDisplayPreview->SetContext (aContext);
+}
+
 // =======================================================================
 // function : updatePropertyPanelBySelection
 // purpose :
@@ -722,97 +726,62 @@ void MessageView_Window::updatePropertyPanelBySelection()
   MessageModel_Tools::GetPropertyTableValues (anItemBase, aTableValues);
 
   myPropertyView->Init (aTableValues);*/
-  QList<ViewControl_TableModelValues*> aTableValuesList;
+  ViewControl_TableModelValues* aTableValues = 0;
 
   QItemSelectionModel* aModel = myTreeView->selectionModel();
   if (!aModel)
     return;
 
   QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
-  TreeModel_ItemStreamPtr aStreamItem = itemDynamicCast<TreeModel_ItemStream> (TreeModel_ModelBase::GetItemByIndex (anIndex));
-  if (aStreamItem)
+  TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+  if (anItemBase)
   {
-    Handle(TreeModel_ItemProperties) anItemProperties = aStreamItem->Properties ();
+    Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->Properties ();
     if (!anItemProperties.IsNull())
     {
-      ViewControl_TableModelValues* aTableValues = new ViewControl_TableModelValues();
+      aTableValues = new ViewControl_TableModelValues();
       aTableValues->SetProperties (anItemProperties);
-      aTableValuesList.append (aTableValues);
     }
   }
-  myPropertyView->Init (aTableValuesList);
+  myPropertyView->Init (aTableValues);
 }
 
 // =======================================================================
 // function : updatePreviewPresentation
 // purpose :
 // =======================================================================
-void MessageView_Window::updatePreviewPresentation (const NCollection_List<Handle(Standard_Transient)>& thePresentations)
+void MessageView_Window::updatePreviewPresentation()
 {
   Handle(AIS_InteractiveContext) aContext = myViewWindow->GetViewToolBar()->GetCurrentContext();
   if (aContext.IsNull())
     return;
 
-  if (!myPreviewPresentations.IsEmpty())
+  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++)
   {
-    for (NCollection_List<Handle(Standard_Transient)>::Iterator aDisplayedIt (myPreviewPresentations); aDisplayedIt.More(); aDisplayedIt.Next())
-    {
-      Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (aDisplayedIt.Value());
-      if (!aPrs.IsNull() && aPrs->GetContext() == aContext)
-        aContext->Remove (aPrs, Standard_True);
-    }
-  }
-  myPreviewPresentations.Clear();
+    QModelIndex anIndex = *aSelIt;
+    if (anIndex.column() != 0)
+      continue;
 
-  myPreviewPresentations = thePresentations;
-  if (myPreviewPresentations.IsEmpty())
-    return;
+    TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+    if (!anItemBase)
+      continue;
 
-  BRep_Builder aBuilder;
-  TopoDS_Compound aCompound;
-  aBuilder.MakeCompound (aCompound);
-  for (NCollection_List<Handle(Standard_Transient)>::Iterator aDisplayedIt (myPreviewPresentations); aDisplayedIt.More(); aDisplayedIt.Next())
-  {
-    Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (aDisplayedIt.Value());
-    if (!aPrs.IsNull())
-    {
-      if (!aPrs->GetContext().IsNull())
-        continue; // not possible to display one object in several contexts
-      aContext->Display (aPrs, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
-    }
-    else if (!Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value()).IsNull())
+    Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->Properties();
+    if (anItemProperties)
     {
-      Handle(Convert_TransientShape) aShapeObject = Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value());
-      aBuilder.Add (aCompound, aShapeObject->GetShape());
+      anItemProperties->GetPresentations (-1, -1, aPresentations);
     }
-  }
-
-  if (aCompound.IsNull())
-  {
-    if (!aContext.IsNull() && myPreviewPresentation->GetContext() == aContext)
-      aContext->Remove (myPreviewPresentation, Standard_True);
-    myPreviewPresentation = NULL;
-    return;
-
-  }
-  else
-  {
-    if (myPreviewPresentation.IsNull())
-    {
-      myPreviewPresentation = new AIS_Shape (aCompound);
-      myPreviewPresentation->SetAttributes (GetPreviewAttributes(aContext));
-      //myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
 
-      //myPreviewPresentation->SetTransformPersistence(thePersistent);
-      if (!aContext.IsNull())
-        aContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
-    }
-    else
+    MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
+    if (anAlertItem)
     {
-      Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
-      //myPreviewPresentation->SetTransformPersistence(thePersistent);
-      if (!aContext.IsNull() && myPreviewPresentation->GetContext() == aContext)
-        aContext->Redisplay (myPreviewPresentation, Standard_True);
+      anAlertItem->GetPresentations (aPresentations);
     }
   }
+
+  myDisplayPreview->SetContext (aContext);
+  myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, aPresentations);
 }
index 6ff19ed309de32f1d00247932556c9c79306dde2..a602fe7e471d84dd6fa14def44c294df7c3fab16 100644 (file)
@@ -40,6 +40,7 @@
 
 class View_Window;
 
+class View_DisplayPreview;
 class ViewControl_PropertyView;
 class MessageModel_ReportCallBack;
 
@@ -139,6 +140,9 @@ protected slots:
   //! \param theDeselected container of selected table cells
   void onPropertyViewSelectionChanged();
 
+  //! Update tree view item, preview presentation by item value change
+  void onPropertyViewDataChanged();
+
   //! Updates visibility states by erase all in context
   void onEraseAllPerformed();
 
@@ -157,13 +161,15 @@ protected slots:
   //! Reads if possible report of a selected item and updates this report in tree view
   void onReloadReport();
 
+  //! Updates context in preview display
+  void onContextSelected();
+
 protected:
   //! Updates property panel content by item selected in tree view.
   void updatePropertyPanelBySelection();
 
   //!< Updates presentation of preview for parameter shapes. Creates a compound of the shapes
-  //!< \param theShape container of shapes
-  void updatePreviewPresentation (const NCollection_List<Handle(Standard_Transient)>& thePresentations);
+  void updatePreviewPresentation();
 
 private:
   QMainWindow* myMainWindow; //!< main control, parent for all MessageView controls
@@ -172,6 +178,8 @@ private:
   QDockWidget* myPropertyPanelWidget; //!< property pane dockable widget
   ViewControl_PropertyView* myPropertyView; //!< property control to display model item values if exist
 
+  View_DisplayPreview* myDisplayPreview; //!< class for preview display
+
   View_Window* myViewWindow; //!< OCC 3d view to visualize presentations
   QTreeView* myTreeView; //!< tree view visualized shapes
   MessageModel_Actions* myTreeViewActions; //!< processing history view actions
@@ -180,7 +188,6 @@ private:
   Handle(Message_ReportCallBack) myCallBack; //! < message call back to update content of the view
 
   Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
-  NCollection_List<Handle(Standard_Transient)> myPreviewPresentations;
 };
 
 #endif
index b3f1a5ad37ccbdd74a9d000ed5a8c32a053ee552..1c42a38530772e9c4ba7d3af93f7ca9286716d2b 100644 (file)
@@ -126,10 +126,10 @@ int main (int argc, char** argv)
     aPlugins.insert("TKShapeView");
     aPlugins.insert("TKVInspector");
 
-    //Handle(Message_Report) aReport = Message_Report::CurrentReport (Standard_True);
-    //aReport->SetLimit (100);//30);
-    //aReport->SetActive (Standard_True);//Standard_False);
-    //aPlugins.insert("TKMessageView");
+    Handle(Message_Report) aReport = Message_Report::CurrentReport (Standard_True);
+    aReport->SetLimit (100);//30);
+    aReport->SetActive (Standard_True);//Standard_False);
+    aPlugins.insert("TKMessageView");
 
     anActivatedPluginName = "TKVInspector";
     //anActivatedPluginName = "TKMessageView";
index fd85421be9b192826a7531a5ed3cadf3c4a83bb9..0e517c2551cee31cdb3c6f748f13f6741659bc36 100644 (file)
@@ -5,3 +5,4 @@ TKMath
 TKBRep
 TKTopAlgo
 TKPrim
+TKV3d
index 09c1735db0121e4e61f2501e20ff0b0f91acf0c1..f7ce1dccd4a573ca1d648015a2866848267be077 100644 (file)
@@ -14,6 +14,7 @@
 // commercial license or contractual agreement. 
 
 #include <inspector/TreeModel_ItemBase.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
 #include <inspector/TreeModel_ItemRole.hxx>
 #include <inspector/TreeModel_ItemStream.hxx>
 
@@ -47,6 +48,11 @@ void TreeModel_ItemBase::Reset()
       anItem->Reset();
   }
   m_bInitialized = false;
+  if (!myProperties.IsNull())
+  {
+    myProperties->Reset();
+    //myProperties = 0;
+  }
   myCachedValues.clear();
 }
 
@@ -122,18 +128,46 @@ void TreeModel_ItemBase::Init()
 {
   m_bInitialized = true;
 
-  NCollection_List<Standard_Integer> aHierarchicalValues;
+  //NCollection_List<Standard_Integer> aHierarchicalValues;
+  int aStreamChildrenCount = 0;
   if (Column() == 0)
   {
-    NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
+    //NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
     Standard_SStream aStream;
     GetStream (aStream);
-    Standard_Dump::SplitJson (Standard_Dump::Text (aStream), aValues);
-    aHierarchicalValues = Standard_Dump::HierarchicalValueIndices (aValues);
+    if (!Standard_Dump::Text (aStream).IsEmpty())
+    {
+      if (!myProperties)
+      {
+        myProperties = new TreeModel_ItemProperties();
+        myProperties->SetItem (currentItem());
+      }
+      myProperties->Init();
+      aStreamChildrenCount = myProperties->Children().Extent();
+    }
+    //Standard_Dump::SplitJson (Standard_Dump::Text (aStream), aValues);
+    //aHierarchicalValues = Standard_Dump::HierarchicalValueIndices (aValues);
+
+    //if (!aValues.IsEmpty())
+    //{
+    //  if (!myProperties)
+    //  {
+    //    myProperties = new TreeModel_ItemProperties();
+    //    myProperties->SetItem (currentItem());
+    //  }
+    //  TCollection_AsciiString aKeyValue, aPropertiesValue;
+    //  aKeyValue = aValues.FindFromIndex (/*Row() +*/ 1);
+    //  if (!Standard_Dump::SplitJson (aKeyValue, aValues))
+    //    aPropertiesValue = Standard_Dump::Text (aStream);
+    //  else
+    //    aPropertiesValue = aKeyValue;
+
+    //  myProperties->Init (aPropertiesValue);
+    //}
 
     //if (aHierarchicalValues.Size() == 1)
   }
-  m_iStreamChildren = aHierarchicalValues.Extent();
+  m_iStreamChildren = aStreamChildrenCount;//aHierarchicalValues.Extent();
 }
 
 // =======================================================================
index a784548c88086bbd59209d8c888ea068075b7f2b..9271e8cb5b44d562d2801b9329781ae29b21aab9 100644 (file)
@@ -36,6 +36,7 @@
 #include <Standard_WarningsRestore.hxx>
 
 class TreeModel_ItemBase;
+class TreeModel_ItemProperties;
 
 typedef QExplicitlySharedDataPointer<TreeModel_ItemBase> TreeModel_ItemBasePtr;
 
@@ -103,8 +104,11 @@ public:
   //! \return stream value or dummy
   virtual void GetStream (Standard_OStream& theOStream) const { (void)theOStream; }
 
-  //! Sets stream value into the object
-  virtual void SetStream (Standard_SStream& theStream) const { (void)theStream; }
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  virtual bool SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
+                          Standard_Integer& theLastPos) const
+  { (void)theSStream; (void)theStartPos; (void)theLastPos; return false; }
 
   //! Gets the parent of the item, or TreeModel_ItemBasePtr() if it has no parent.
   //! \return pointer to the item
@@ -145,6 +149,9 @@ public:
   //! Dumps the content of me into the stream
   virtual Standard_Boolean Dump (Standard_OStream& theOStream) const { (void)theOStream; return Standard_False; }
 
+  //! Returns the item properties
+  Handle(TreeModel_ItemProperties) Properties() const { return myProperties; }
+
 protected:
 
   //! \param theParent the parent item
@@ -179,6 +186,10 @@ protected:
   //! \return the value
   Standard_EXPORT virtual QVariant initValue (const int theItemRole) const;
 
+protected:
+  Handle(TreeModel_ItemProperties) myProperties; //!< the properties
+  int m_iStreamChildren; //!< the count of stream items
+
 private:
 
   typedef QHash< QPair<int, int>, TreeModel_ItemBasePtr > PositionToItemHash;
@@ -188,7 +199,6 @@ private:
   TreeModel_ItemBasePtr m_pParent; //!< the parent item
   int m_iRow;          //!< the item row position in the parent item
   int m_iColumn;       //!< the item column position in the parent item
-  int m_iStreamChildren; //!< the count of stream items
   bool m_bInitialized; //!< the state whether the item content is already initialized
 };
 
index 8ccd2d6f11e29764780955b8df22aafb689b3d31..4813754b34ec740eb733dbeeb5547faa26b690fa 100644 (file)
@@ -14,6 +14,8 @@
 // commercial license or contractual agreement. 
 
 #include <inspector/TreeModel_ItemProperties.hxx>
+#include <inspector/TreeModel_ItemStream.hxx>
+#include <inspector/Convert_Tools.hxx>
 #include <inspector/Convert_TransientShape.hxx>
 
 #include <BRepBuilderAPI_MakeVertex.hxx>
@@ -27,18 +29,74 @@ IMPLEMENT_STANDARD_RTTIEXT(TreeModel_ItemProperties, Standard_Transient)
 // purpose :
 // =======================================================================
 
-void TreeModel_ItemProperties::Init (const TCollection_AsciiString& theStreamValue)
+void TreeModel_ItemProperties::Init ()
 {
-  NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
-  if (!Standard_Dump::SplitJson (theStreamValue, aValues))
-    return;
+  Standard_SStream aStream;
+  Item()->GetStream (aStream);
+
+  NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue> aValues;
+  TCollection_AsciiString aStreamText = Standard_Dump::Text (aStream);
+  Standard_Dump::SplitJson (aStreamText, aValues);
+
+  TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast<TreeModel_ItemStream>(Item());
+  TCollection_AsciiString aKey;
+  Standard_DumpValue aKeyValue;
+  if (!aStreamParent)
+  {
+    Standard_SStream aStream;
+    Item()->GetStream (aStream);
+
+    //aKey = aValues.FindKey (1);
+    //aKeyValue = aValues.FindFromIndex (1);
+
+    //// one row value, like gp_XYZ, without additional { for type
+    //aValues.Clear();
+    //if (!Standard_Dump::SplitJson (aKeyValue.myValue, aValues))
+    //{
+    //  aKeyValue = Standard_DumpValue (aStreamText, 1);
+    //}
+
+    Handle(Standard_Transient) anItemObject = Item()->GetObject();
+    aKey = anItemObject.IsNull() ? "Dump" : anItemObject->DynamicType()->Name();
+    aKeyValue = Standard_DumpValue (aStreamText, 1);
+
+    myKey = aKey;
+    myStreamValue = aKeyValue;
+  }
+  else
+  {
+    TCollection_AsciiString aValue;
+    Handle(TreeModel_ItemProperties) aParentProperties = Item()->Parent() ? Item()->Parent()->Properties() : 0;
+    if (aParentProperties)
+      aParentProperties->GetChildStream (Item()->Row(), aKey, aKeyValue);
+
+    myKey = aKey;
+    myStreamValue = aKeyValue;
+
+    aValues.Clear();
+    Standard_Dump::SplitJson (myStreamValue.myValue, aValues);
+  }
 
   for (Standard_Integer anIndex = 1; anIndex <= aValues.Size(); anIndex++)
   {
-    TCollection_AsciiString aValue = aValues.FindFromIndex (anIndex);
-    if (!Standard_Dump::HasChildKey (aValue))
+    Standard_DumpValue aValue = aValues.FindFromIndex (anIndex);
+    if (Standard_Dump::HasChildKey (aValue.myValue))
+      myChildren.Add (aValues.FindKey (anIndex), aValue);
+    else
       myValues.Add (aValues.FindKey (anIndex), aValue);
   }
+
+  //aValues.Clear();
+  //if (!Standard_Dump::SplitJson (myStreamValue.myValue, aValues))
+  //{
+  //  return;
+  //}
+  //for (Standard_Integer anIndex = 1; anIndex <= aValues.Size(); anIndex++)
+  //{
+  //  Standard_DumpValue aValue = aValues.FindFromIndex (anIndex);
+  //  if (!Standard_Dump::HasChildKey (aValue.myValue))
+  //    myValues.Add (aValues.FindKey (anIndex), aValue);
+  //}
 }
 
 // =======================================================================
@@ -47,6 +105,10 @@ void TreeModel_ItemProperties::Init (const TCollection_AsciiString& theStreamVal
 // =======================================================================
 void TreeModel_ItemProperties::Reset()
 {
+  myKey = "";
+  myStreamValue = Standard_DumpValue();
+
+  myChildren.Clear();
   myValues.Clear();
 }
 
@@ -57,7 +119,7 @@ void TreeModel_ItemProperties::Reset()
 
 int TreeModel_ItemProperties::RowCount() const
 {
-  return myValues.Size();
+  return Values().Size();
 }
 
 // =======================================================================
@@ -67,15 +129,84 @@ int TreeModel_ItemProperties::RowCount() const
 
 QVariant TreeModel_ItemProperties::Data (const int theRow, const int theColumn, int theRole) const
 {
+  if (theColumn == 1 && theRole == Qt::BackgroundRole)
+  {
+    Quantity_Color aColor;
+    Standard_SStream aStream;
+    Item()->GetStream (aStream);
+    if (Convert_Tools::ConvertStreamToColor (aStream, aColor))
+    {
+      Standard_Real aRed, aGreen, aBlue;
+      aColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB);
+
+      int aDelta = 255;
+      return QColor((int)(aRed * aDelta), (int)(aGreen * aDelta), (int)(aBlue * aDelta));
+    }
+  }
+
   if (theRole != Qt::DisplayRole && theRole != Qt::ToolTipRole)
     return QVariant();
 
-  if (theColumn == 0) return myValues.FindKey (theRow + 1).ToCString();
-  else if (theColumn == 1) return myValues.FindFromIndex (theRow + 1).ToCString();
+  if (theColumn == 0) return Values().FindKey (theRow + 1).ToCString();
+  else if (theColumn == 1) return Values().FindFromIndex (theRow + 1).myValue.ToCString();
 
   return QVariant();
 }
 
+// =======================================================================
+// function : GetEditType
+// purpose :
+// =======================================================================
+
+ViewControl_EditType TreeModel_ItemProperties::GetEditType (const int, const int theColumn) const
+{
+  if (theColumn == 0)
+    return ViewControl_EditType_None;
+
+  return ViewControl_EditType_Line;
+}
+
+// =======================================================================
+// function : SetData
+// purpose :
+// =======================================================================
+
+bool TreeModel_ItemProperties::SetData (const int theRow, const int theColumn, const QVariant& theValue, int)
+{
+  if (theColumn == 0)
+    return false;
+
+  TreeModel_ItemBasePtr aParent = Item()->Parent();
+  while (aParent && itemDynamicCast<TreeModel_ItemStream>(aParent))
+  {
+    aParent = aParent->Parent();
+  }
+  if (!aParent)
+    return false;
+
+  Standard_SStream aStream;
+  Item()->GetStream (aStream);
+
+  //TCollection_AsciiString aStreamValue = Standard_Dump::Text (aStream);
+
+  Standard_DumpValue aValue = Values().FindFromIndex (theRow + 1);
+  Standard_Integer aStartPos = aValue.myStartPosition;
+  Standard_Integer aLastPos = aStartPos + aValue.myValue.Length() - 1;
+
+  aStream.str ("");
+  //aStream << aStreamValue.SubString (1, aStartPos - 1);
+  aStream << theValue.toString().toStdString().c_str();
+  //if (aLastPos + 1 <= aStreamValue.Length())
+  //  aStream << aStreamValue.SubString (aLastPos + 1, aStreamValue.Length());
+
+  //TCollection_AsciiString aStreamValue_debug = Standard_Dump::Text (aStream);
+
+  Item()->SetStream (aStream, aStartPos, aLastPos);
+  Item()->Reset();
+
+  return true;
+}
+
 // =======================================================================
 // function : GetPresentations
 // purpose :
@@ -88,6 +219,10 @@ void TreeModel_ItemProperties::GetPresentations (const int theRow, const int the
 
   if (theRow < 0) // full presentation
   {
+    Standard_SStream aStream;
+    Item()->GetStream (aStream);
+
+    Convert_Tools::ConvertStreamToPresentations (aStream, 1, -1, thePresentations);
     return;
   }
 
@@ -98,8 +233,8 @@ void TreeModel_ItemProperties::GetPresentations (const int theRow, const int the
   NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
   aValues.Add (Data (theRow, 0).toString().toStdString().c_str(), Data (theRow, theColumn).toString().toStdString().c_str());
 
-  Standard_SStream aStreamOnSelected;
-  Standard_Dump::JoinJson (aStreamOnSelected, aValues);
+  //Standard_SStream aStreamOnSelected;
+  //Standard_Dump::JoinJson (aStreamOnSelected, aValues);
 
   //if (theRow < 0) // full presentation
   //{
@@ -108,12 +243,12 @@ void TreeModel_ItemProperties::GetPresentations (const int theRow, const int the
     //  thePresentations.Append (new Convert_TransientShape (Convert_Tools::CreateShape (aBox)));
   //}
 
-  gp_XYZ aPoint;
-  Standard_Integer aPosition = 1;
-  if (aPoint.InitJson (aStreamOnSelected, aPosition))
-  {
-    thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPoint)));
-  }
+  //gp_XYZ aPoint;
+  //Standard_Integer aPosition = 1;
+  //if (aPoint.InitJson (aStreamOnSelected, aPosition))
+  //{
+  //  thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPoint)));
+  //}
 
 
   //QVariant aValue = GetTableData (theRow, theColumn, Qt::DisplayRole);
@@ -141,3 +276,30 @@ Qt::ItemFlags TreeModel_ItemProperties::GetTableFlags (const int, const int theC
   return aFlags;
 }
 
+// =======================================================================
+// function : GetChildStream
+// purpose :
+// =======================================================================
+void TreeModel_ItemProperties::GetChildStream (const int theRowId,
+                                               TCollection_AsciiString& theKey,
+                                               Standard_DumpValue& theValue) const
+{
+  if (myChildren.Size() <= theRowId)
+    return;
+
+  theKey = myChildren.FindKey (theRowId + 1);
+  theValue = myChildren.FindFromIndex (theRowId + 1);
+}
+
+// =======================================================================
+// function : GetChildStream
+// purpose :
+// =======================================================================
+void TreeModel_ItemProperties::initItem() const
+{
+  if (!Item())
+    return;
+  if (Item()->IsInitialized())
+    return;
+  Item()->Init();
+}
index 06eadb44ee94b53807a50048dd166c0e62fa8578..64dbe80a3e7591d0caf0eea89406702c1300b49a 100644 (file)
@@ -17,6 +17,7 @@
 #define TreeModel_ItemProperties_H
 
 #include <Standard.hxx>
+#include <Standard_Dump.hxx>
 #include <Standard_Handle.hxx>
 #include <Standard_Macro.hxx>
 #include <Standard_Type.hxx>
@@ -65,7 +66,7 @@ public:
   TreeModel_ItemBasePtr Item() const { return myItem; }
 
   //! Fill internal containers by stream values
-  void Init (const TCollection_AsciiString& theStreamValue);
+  Standard_EXPORT void Init (/*const Standard_SStream& theStream*/);
 
   //! If the item has internal values, there should be reseted here.
   Standard_EXPORT virtual void Reset();
@@ -86,6 +87,20 @@ public:
   //! \return value interpreted depending on the given role
   QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
 
+  //! Returns type of edit control for the model index. By default, it is an empty control
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \return edit type
+  ViewControl_EditType GetEditType (const int theRow, const int theColumn) const;
+
+  //! Sets content of the model index for the given role, it is applyed to internal container of values
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \param theRole a view role
+  //! \return true if the value is changed
+  Standard_EXPORT virtual bool SetData (const int theRow, const int theColumn, const QVariant& theValue,
+                                        int theRole = Qt::DisplayRole);
+
   //! Returns presentation of the attribute to be visualized in the view
   //! \param theRow a model index row
   //! \param theColumn a model index column
@@ -99,12 +114,40 @@ public:
   //! \return flags
   Standard_EXPORT virtual Qt::ItemFlags GetTableFlags (const int theRow, const int theColumn) const;
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT void GetChildStream (const int theRowId,
+                                       TCollection_AsciiString& theKey,
+                                       Standard_DumpValue& theValue) const;
+
+  //! Returns data object of the item.
+  //! \return object key
+  const TCollection_AsciiString& GetKey() const { return myKey; }
+
+  //! Returns stream value of the item.
+  //! \return value
+  const TCollection_AsciiString& StreamValue() const { return myStreamValue.myValue; }
+
+  //! Returns children stream values
+  const NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& Values() const { initItem(); return myValues; }
+
+  //! Returns children stream values
+  const NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& Children() const { initItem(); return myChildren; }
+
   DEFINE_STANDARD_RTTIEXT (TreeModel_ItemProperties, Standard_Transient)
 
+protected:
+  //! Initialize the current item. It creates a backup of the specific item information
+  void initItem() const;
+
 private:
   TreeModel_ItemBasePtr myItem; //!< current item
 
-  NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> myValues; //!< the values
+  TCollection_AsciiString myKey; //!< the item key
+  Standard_DumpValue myStreamValue; //!< the stream value
+  NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue> myChildren; //!< the children
+
+  NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue> myValues; //!< the values
 };
 
 #endif
\ No newline at end of file
index 17cda16e6035e05fbfe226fc5b2647e0eac36b42..76296d8a110119425c6d16c20fb3f89fa19c31e6 100644 (file)
@@ -26,7 +26,7 @@
 TreeModel_ItemStream::TreeModel_ItemStream (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
  : TreeModel_ItemBase (theParent, theRow, theColumn)
 {
-  myProperties = new TreeModel_ItemProperties();
+  //myProperties = new TreeModel_ItemProperties();
 }
 
 // =======================================================================
@@ -35,53 +35,67 @@ TreeModel_ItemStream::TreeModel_ItemStream (TreeModel_ItemBasePtr theParent, con
 // =======================================================================
 void TreeModel_ItemStream::Init()
 {
-  if (!myProperties->Item())
-    myProperties->SetItem (currentItem());
+  //if (!GetProperties()->Item())
+  //  myProperties->SetItem (currentItem());
+
+  //TCollection_AsciiString aKey, aKeyValue, aPropertiesValue;
+  //TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast<TreeModel_ItemStream>(Parent());
+  //if (!aStreamParent)
+  //{
+  //  Standard_SStream aStream;
+  //  Parent()->GetStream (aStream);
+
+  //  NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
+  //  Standard_Dump::SplitJson (Standard_Dump::Text (aStream), aValues);
+
+  //  aKey = aValues.FindKey (Row() + 1);
+  //  aKeyValue = aValues.FindFromIndex (Row() + 1);
+
+  //  // one row value, like gp_XYZ, without additional { for type
+  //  aValues.Clear();
+  //  if (!Standard_Dump::SplitJson (aKeyValue, aValues))
+  //    aPropertiesValue = Standard_Dump::Text (aStream);
+  //  else
+  //    aPropertiesValue = aKeyValue;
+  //}
+  //else
+  //{
+  //  TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast<TreeModel_ItemStream>(Parent());
+
+  //  TCollection_AsciiString aValue;
+  //  aStreamParent->GetChildStream (Row(), aKey, aKeyValue);
+  //  aPropertiesValue = aKeyValue;
+  //}
+
+  //myKey = aKey;
+  ////myProperties->Init (aPropertiesValue);
+  //myStreamValue = aKeyValue;
+
+  //NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
+  //Standard_Dump::SplitJson (aKeyValue, aValues);
+
+  //for (Standard_Integer anIndex = 1; anIndex <= aValues.Size(); anIndex++)
+  //{
+  //  TCollection_AsciiString aValue = aValues.FindFromIndex (anIndex);
+  //  if (Standard_Dump::HasChildKey (aValue))
+  //    myChildren.Add (aValues.FindKey (anIndex), aValue);
+  //}
 
-  TCollection_AsciiString aKey, aKeyValue, aPropertiesValue;
-  TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast<TreeModel_ItemStream>(Parent());
-  if (!aStreamParent)
-  {
-    Standard_SStream aStream;
-    Parent()->GetStream (aStream);
-
-    NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
-    Standard_Dump::SplitJson (Standard_Dump::Text (aStream), aValues);
-
-    aKey = aValues.FindKey (Row() + 1);
-    aKeyValue = aValues.FindFromIndex (Row() + 1);
-
-    // one row value, like gp_XYZ, without additional { for type
-    aValues.Clear();
-    if (!Standard_Dump::SplitJson (aKeyValue, aValues))
-      aPropertiesValue = Standard_Dump::Text (aStream);
-    else
-      aPropertiesValue = aKeyValue;
-  }
-  else
-  {
-    TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast<TreeModel_ItemStream>(Parent());
-
-    TCollection_AsciiString aValue;
-    aStreamParent->GetChildStream (Row(), aKey, aKeyValue);
-    aPropertiesValue = aKeyValue;
-  }
-
-  myKey = aKey;
-  myProperties->Init (aPropertiesValue);
-  myStreamValue = aKeyValue;
-
-  NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
-  Standard_Dump::SplitJson (aKeyValue, aValues);
+  TreeModel_ItemBase::Init();
 
-  for (Standard_Integer anIndex = 1; anIndex <= aValues.Size(); anIndex++)
+  //NCollection_List<Standard_Integer> aHierarchicalValues;
+  int aStreamChildrenCount = 0;
+  if (Column() == 0)
   {
-    TCollection_AsciiString aValue = aValues.FindFromIndex (anIndex);
-    if (Standard_Dump::HasChildKey (aValue))
-      myChildren.Add (aValues.FindKey (anIndex), aValue);
+    if (!myProperties)
+    {
+      myProperties = new TreeModel_ItemProperties();
+      myProperties->SetItem (currentItem());
+    }
+    myProperties->Init();
+    aStreamChildrenCount = myProperties->Children().Extent();
   }
-
-  TreeModel_ItemBase::Init();
+  m_iStreamChildren = aStreamChildrenCount;//aHierarchicalValues.Extent();
 }
 
 // =======================================================================
@@ -90,11 +104,10 @@ void TreeModel_ItemStream::Init()
 // =======================================================================
 void TreeModel_ItemStream::Reset()
 {
-  myKey = "";
-  myStreamValue = "";
+  //myKey = "";
+  //myStreamValue = "";
 
-  myProperties->Reset();
-  myChildren.Clear();
+  //myChildren.Clear();
 
   TreeModel_ItemBase::Reset();
 }
@@ -112,31 +125,34 @@ QVariant TreeModel_ItemStream::initValue (const int theItemRole) const
   if (Column() != 0)
     return QVariant();
 
+  if (theItemRole == Qt::ForegroundRole)
+    return QColor (Qt::darkBlue);
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
   switch (Column())
   {
-    case 0: return GetKey().ToCString();
+    case 0: return Properties() ? Properties()->GetKey().ToCString() : "";
   }
   return QVariant();
 }
 
-// =======================================================================
-// function : GetChildStream
-// purpose :
-// =======================================================================
-void TreeModel_ItemStream::GetChildStream (const int theRowId,
-                                           TCollection_AsciiString& theKey,
-                                           TCollection_AsciiString& theValue) const
-{
-  TreeModel_ItemBasePtr aParentItem = Parent();
-  if (!aParentItem)
-    return;
-
-  theKey = myChildren.FindKey (theRowId + 1);
-  theValue = myChildren.FindFromIndex (theRowId + 1);
-}
+//// =======================================================================
+//// function : GetChildStream
+//// purpose :
+//// =======================================================================
+//void TreeModel_ItemStream::GetChildStream (const int theRowId,
+//                                           TCollection_AsciiString& theKey,
+//                                           TCollection_AsciiString& theValue) const
+//{
+//  TreeModel_ItemBasePtr aParentItem = Parent();
+//  if (!aParentItem)
+//    return;
+//
+//  theKey = myChildren.FindKey (theRowId + 1);
+//  theValue = myChildren.FindFromIndex (theRowId + 1);
+//}
 
 // =======================================================================
 // function : GetStream
@@ -144,12 +160,13 @@ void TreeModel_ItemStream::GetChildStream (const int theRowId,
 // =======================================================================
 void TreeModel_ItemStream::GetStream (Standard_OStream& theOStream) const
 {
+  if (!Properties())
+    return;
   //Handle(AIS_InteractiveObject) anIO = GetInteractiveObject();
   //if (anIO.IsNull())
   //  return;
 
-  theOStream << myStreamValue;
-
+  theOStream << Properties()->StreamValue();
   //anIO->DumpJson (theOStream);
 }
 
index 9581d4e7479f94d669b8f12578d31b043be33ed4..288963011b6ce895a108d1bb3be58b21c849c7e2 100644 (file)
@@ -60,21 +60,18 @@ public:
   //! \return the value
   Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
 
-  //! Returns stream value of the item to fulfill property panel.
-  //! \return stream value or dummy
-  Standard_EXPORT void GetChildStream (const int theRowId,
-                                       TCollection_AsciiString& theKey,
-                                       TCollection_AsciiString& theValue) const;
-
-  //! Returns data object of the item.
-  //! \return object
-  const TCollection_AsciiString& GetKey() const { initItem(); return myKey; }
+  ////! Returns stream value of the item to fulfill property panel.
+  ////! \return stream value or dummy
+  //Standard_EXPORT void GetChildStream (const int theRowId,
+  //                                     TCollection_AsciiString& theKey,
+  //                                     TCollection_AsciiString& theValue) const;
 
-  const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& GetChildren() const
-    { initItem(); return myChildren; }
+  ////! Returns data object of the item.
+  ////! \return object
+  //const TCollection_AsciiString& GetKey() const { initItem(); return myKey; }
 
-  //! Returns the item properties
-  Handle(TreeModel_ItemProperties) Properties() const { return myProperties; }
+  //const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& GetChildren() const
+  //  { initItem(); return myChildren; }
 
   //! Returns stream value of the item to fulfill property panel.
   //! \return stream value or dummy
@@ -103,10 +100,9 @@ private:
   Standard_EXPORT TreeModel_ItemStream(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn);
 
 protected:
-  Handle(TreeModel_ItemProperties) myProperties; //!< the properties
-  TCollection_AsciiString myKey; //!< the item key
-  TCollection_AsciiString myStreamValue; //!< the stream value
-  NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> myChildren; //!< the children
+  //TCollection_AsciiString myKey; //!< the item key
+  //TCollection_AsciiString myStreamValue; //!< the stream value
+  //NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> myChildren; //!< the children
 };
 
 #endif
index 31478bf9f8d61b2bb83d15d647f63cfcb3baf854..7ce6f67aadbd34de0a41e9e46a4e6383af71c059 100644 (file)
@@ -42,14 +42,16 @@ VInspector_ItemBVHTree::VInspector_ItemBVHTree (TreeModel_ItemBasePtr theParent,
 // =======================================================================
 int VInspector_ItemBVHTree::initRowCount() const
 {
-  if (Column() != 0)
-    return  0;
+  return 0;//
 
-  opencascade::handle<BVH_Tree<Standard_Real, 3> > aTree =  GetTree();
-  if (aTree.IsNull())
-    return 0;
+  //if (Column() != 0)
+  //  return  0;
 
-  return aTree->Length();
+  //opencascade::handle<BVH_Tree<Standard_Real, 3> > aTree =  GetTree();
+  //if (aTree.IsNull())
+  //  return 0;
+
+  //return aTree->Length();
 }
 
 // =======================================================================
@@ -134,17 +136,16 @@ void VInspector_ItemBVHTree::initItem() const
 }
 
 // =======================================================================
-// function : Dump
+// function : GetStream
 // purpose :
 // =======================================================================
-Standard_Boolean VInspector_ItemBVHTree::Dump (Standard_OStream& theOStream) const
+void VInspector_ItemBVHTree::GetStream (Standard_OStream& theOStream) const
 {
   opencascade::handle<BVH_Tree<Standard_Real, 3> > aBVHTree = GetTree();
   if (aBVHTree.IsNull())
-    return Standard_False;
+    return;
 
   aBVHTree->DumpJson (theOStream);
-  return Standard_True;
 }
 
 // =======================================================================
index 611af1483d8a0aaf0167c2dccaeb1ba1ec119dd4..ea91796cc6ca202fc7b0bfe6fa4ec77b41f362e0 100644 (file)
@@ -54,8 +54,9 @@ public:
   opencascade::handle<BVH_Tree<Standard_Real, 3> > GetTree() const
   { return opencascade::handle<BVH_Tree<Standard_Real, 3> >::DownCast (GetObject()); }
 
-  //! Dumps the content of me into the stream
-  virtual Standard_Boolean Dump (Standard_OStream& theOStream) const;
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
 
 protected:
   //! Initialize the current item. It is empty because Reset() is also empty.
index decdc4b162d0f8cbfc1ec6118c1971419e0c3854..3558b849278eef52caf3e18368a11ad33603d098 100644 (file)
@@ -40,7 +40,7 @@ int VInspector_ItemContext::initRowCount() const
   int aNbProperties = 1; // item to visualize Filters/Drawer information of context
 
   int aNbPresentations = 0;
-  Handle(AIS_InteractiveContext) aContext = GetContext();
+  Handle(AIS_InteractiveContext) aContext = Handle(AIS_InteractiveContext)::DownCast (GetObject());
   if (aContext.IsNull())
     return 0;
 
@@ -94,25 +94,59 @@ QVariant VInspector_ItemContext::initValue (const int theItemRole) const
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
-  if (GetContext().IsNull())
+  Handle(AIS_InteractiveContext) aContext = Handle(AIS_InteractiveContext)::DownCast (GetObject());
+  if (aContext.IsNull())
     return Column() == 0 ? "Empty context" : "";
 
   switch (Column())
   {
-    case 0: return GetContext()->DynamicType()->Name();
+    case 0: return aContext->DynamicType()->Name();
     case 4:
     {
       Handle(AIS_InteractiveObject) anEmptyIO;
-      int aSelectedCount = VInspector_Tools::SelectedOwners (GetContext(), anEmptyIO, false);
+      int aSelectedCount = VInspector_Tools::SelectedOwners (aContext, anEmptyIO, false);
       return aSelectedCount > 0 ? QString::number (aSelectedCount) : "";
     }
-    case 6: return GetContext()->DeviationCoefficient();
+    case 6: return aContext->DeviationCoefficient();
     default:
       break;
   }
   return QVariant();
 }
 
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void VInspector_ItemContext::Init()
+{
+  Handle(AIS_InteractiveContext) aContext = GetContext();
+  if (aContext.IsNull())
+    return;
+
+  TreeModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void VInspector_ItemContext::Reset()
+{
+  VInspector_ItemBase::Reset();
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemContext::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemContext*>(this)->Init();
+}
+
 // =======================================================================
 // function : createChild
 // purpose :
@@ -124,3 +158,17 @@ TreeModel_ItemBasePtr VInspector_ItemContext::createChild (int theRow, int theCo
   else
     return VInspector_ItemPresentableObject::CreateItem (currentItem(), theRow, theColumn);
 }
+
+// =======================================================================
+// function : GetStream
+// purpose :
+// =======================================================================
+void VInspector_ItemContext::GetStream (Standard_OStream& theOStream) const
+{
+  Handle(AIS_InteractiveContext) aContext = GetContext();
+  if (aContext.IsNull())
+    return;
+
+  aContext->DumpJson (theOStream);
+}
+
index aa693d39c44fafd69156a12fccbe5011ccbbca36..1d3fe7a264010ae84dcaa85c72a09928b3034cf2 100644 (file)
@@ -51,11 +51,21 @@ public:
   //! \return the value
   Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
+
+  //! Inits the item, fills internal containers
+  Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+  //! Resets cached values
+  Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
 protected:
 
   //! Initialize the current item. It creates a backup of the specific item information
   //! Do nothing as context has been already set into item
-  virtual void initItem() const Standard_OVERRIDE {}
+  virtual void initItem() const Standard_OVERRIDE;
 
 protected:
 
index cd6bc3b392e79d67cdd565b3e73e47f534311205..fcf7dc382a9a7696a2e573c9af9a292071e4e8d6 100644 (file)
@@ -63,6 +63,19 @@ void VInspector_ItemGraphic3dCamera::Reset()
   myCamera = NULL;
 }
 
+// =======================================================================
+// function : GetStream
+// purpose :
+// =======================================================================
+void VInspector_ItemGraphic3dCamera::GetStream (Standard_OStream& theOStream) const
+{
+  Handle(Graphic3d_Camera) aCamera = GetCamera();
+  if (aCamera.IsNull())
+    return;
+
+  aCamera->DumpJson (theOStream);
+}
+
 // =======================================================================
 // function : initItem
 // purpose :
@@ -80,6 +93,8 @@ void VInspector_ItemGraphic3dCamera::initItem() const
 // =======================================================================
 int VInspector_ItemGraphic3dCamera::initRowCount() const
 {
+  Handle(Graphic3d_Camera) aCamera = GetCamera(); // we need Init() call for having GetStream() filled
+
   return 0;
 }
 
index 5ca33c5dc0ca6a1a82f5fafb43079bb59575a970..e01b8d6af7da91e2429cfb131342dd655d44bbcd 100644 (file)
@@ -54,6 +54,10 @@ public:
   //! Resets cached values
   Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
+
 protected:
   //! Build presentation shape
   //! \return generated shape of the item parameters
index df0d2bc319367de32da9ced0cbcbfb57f02ea1a4..7f3292bafdf74af45397e7dbcbc3e51396f22e03 100644 (file)
@@ -116,7 +116,6 @@ void VInspector_ItemGraphic3dGroup::GetStream (Standard_OStream& theOStream) con
   aGroup->DumpJson (theOStream);
 }
 
-
 // =======================================================================
 // function : createChild
 // purpose :
index 89c0bdbc967d8a231b2f01100939c6fc67dc5dbb..f5b361348c9aa3bb51bdd4040b1b5e792a44ca31 100644 (file)
@@ -185,19 +185,27 @@ void VInspector_ItemPresentableObject::Init()
     AIS_ListOfInteractive aListOfIO;
     GetContext()->DisplayedObjects (aListOfIO); // the presentation is in displayed objects of Context
     GetContext()->ErasedObjects (aListOfIO); // the presentation is in erased objects of Context
+
+    std::vector<Handle(AIS_InteractiveObject)> aListOfIOSorted;
+    for (AIS_ListIteratorOfListOfInteractive anIOIt (aListOfIO); anIOIt.More(); anIOIt.Next())
+    {
+      aListOfIOSorted.push_back (anIOIt.Value());
+    }
+    std::sort (aListOfIOSorted.begin(), aListOfIOSorted.end());
+
     int aDeltaIndex = 1; // properties item
     int aCurrentIndex = 0;
-    for (AIS_ListIteratorOfListOfInteractive anIOIt (aListOfIO); anIOIt.More(); anIOIt.Next(), aCurrentIndex++)
+    for (std::vector<Handle(AIS_InteractiveObject)>::const_iterator anIOIt = aListOfIOSorted.begin(); anIOIt != aListOfIOSorted.end(); anIOIt++, aCurrentIndex++)
     {
       if (aCurrentIndex != aRowId - aDeltaIndex)
         continue;
-      anIO = anIOIt.Value();
+      anIO = *anIOIt;
       break;
     }
   }
 
   setInteractiveObject (anIO);
-  myTransformPersistence = anIO->TransformPersistence();
+  myTransformPersistence = !anIO.IsNull() ? anIO->TransformPersistence() : NULL;
   UpdatePresentationShape();
   TreeModel_ItemBase::Init(); // to use getIO() without circling initialization
 }
index f4dd35ec1a903f3b919823996842a2fa74b1fcfe..cc049f1c13fc42c94823c8d5ca3f065158ff3b4c 100644 (file)
@@ -157,6 +157,20 @@ void VInspector_ItemPrs3dDrawer::initItem() const
   const_cast<VInspector_ItemPrs3dDrawer*>(this)->Init();
 }
 
+
+// =======================================================================
+// function : GetStream
+// purpose :
+// =======================================================================
+void VInspector_ItemPrs3dDrawer::GetStream (Standard_OStream& theOStream) const
+{
+  Handle(Prs3d_Drawer) aDrawer = GetDrawer();
+  if (aDrawer.IsNull())
+    return;
+
+  aDrawer->DumpJson (theOStream);
+}
+
 // =======================================================================
 // function : GetPrs3dAspect
 // purpose :
index 943d06794c1d19365b9406afae0f6042cd840efc..0ffa87aee5e8923654338eb808a5678b2e72eef5 100644 (file)
@@ -63,6 +63,10 @@ public:
                                                             TCollection_AsciiString& theName,
                                                             Standard_Boolean& theOwnAspect) const;
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
+
 protected:
 
   //! Initialize the current item. It is empty because Reset() is also empty.
index afc4d7abb484d02bc8bb8f3711c58c371bd45613..f5aa2ecd70fe761cb54e3b1f4e263b3a9d8c4d37 100644 (file)
@@ -139,7 +139,7 @@ void VInspector_ItemPrs3dPresentation::setPresentation (const Handle(Prs3d_Prese
 TopoDS_Shape VInspector_ItemPrs3dPresentation::buildPresentationShape()
 {
   if (!myPresentation.IsNull())
-    myPresentationShape = Convert_Tools::CreateShape (myPresentation->MinMaxValues());
+    Convert_Tools::CreateShape (myPresentation->MinMaxValues(), myPresentationShape);
 
   return TopoDS_Shape();
 }
index 49378693c8b018c9f5616c8cec199cd68d722580..e25321dba38c63631ebff57e1367e2ab146a7be3 100644 (file)
@@ -162,5 +162,8 @@ TopoDS_Shape VInspector_ItemSelect3DSensitiveSetItem::buildPresentationShape()
     return TopoDS_Shape();
 
   Select3D_BndBox3d aBndBox = aSensitiveSet->Box (Row());
-  return VInspector_Tools::CreateShape (aBndBox);
+  TopoDS_Shape aShape;
+  VInspector_Tools::CreateShape (aBndBox, aShape);
+
+  return aShape;
 }
index 4d1bb397a7c9e12042b22fcc7e57cf9c9f8e95a9..766fff8d3d5820edd7ea723538cc32ccadcb7b7b 100644 (file)
@@ -235,18 +235,25 @@ TopoDS_Shape VInspector_ItemSelectBasicsSensitiveEntity::buildPresentationShape
   TopoDS_Compound aCompound;
   aBuilder.MakeCompound (aCompound);
 
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (aBaseEntity->CenterOfGeometry()));
+  BRepBuilderAPI_MakeVertex aVBuilder (aBaseEntity->CenterOfGeometry());
+  if (aVBuilder.IsDone())
+    aBuilder.Add (aCompound, aVBuilder.Shape());
   
   Select3D_BndBox3d aBoundingBox = aBaseEntity->BoundingBox();
   if (aBoundingBox.IsValid())
-    aBuilder.Add (aCompound, VInspector_Tools::CreateShape (aBoundingBox));
+  {
+    TopoDS_Shape aShape;
+    if (VInspector_Tools::CreateShape (aBoundingBox, aShape))
+      aBuilder.Add (aCompound, aShape);
+  }
 
   Standard_CString aTypeName = aBaseEntity->DynamicType()->Name();
   if (aTypeName == STANDARD_TYPE (Select3D_SensitiveBox)->Name())
   {
     Handle(Select3D_SensitiveBox) anEntity = Handle(Select3D_SensitiveBox)::DownCast (aBaseEntity);
-    TopoDS_Shape aShape = Convert_Tools::CreateShape(anEntity->Box());
-    aBuilder.Add (aCompound, aShape);
+    TopoDS_Shape aShape;
+    if (Convert_Tools::CreateShape(anEntity->Box(), aShape))
+      aBuilder.Add (aCompound, aShape);
   }
   else if (aTypeName == STANDARD_TYPE (Select3D_SensitiveFace)->Name())
   {
index 699044b8446dc7e932d023651d00ac53126a041d..c6a6fc851fc24ab820a440ff0f18f83f1797f08a 100644 (file)
@@ -104,18 +104,17 @@ void VInspector_ItemSelectMgrBaseFrustum::initItem() const
 }
 
 // =======================================================================
-// function : Dump
+// function : GetStream
 // purpose :
 // =======================================================================
-Standard_Boolean VInspector_ItemSelectMgrBaseFrustum::Dump (Standard_OStream& theOStream) const
+void VInspector_ItemSelectMgrBaseFrustum::GetStream (Standard_OStream& theOStream) const
 {
   Handle(SelectMgr_BaseFrustum) aFrustum = GetFrustum();
 
   if (aFrustum.IsNull())
-    return Standard_False;
+    return;
 
   aFrustum->DumpJson (theOStream);
-  return Standard_True;
 }
 
 // =======================================================================
index 087818e265751a809864f93a5f7bee46f70b1d21..984490af7e33193f7a3ccf790c820612d4267b7d 100644 (file)
@@ -53,8 +53,9 @@ public:
   Standard_EXPORT Handle(SelectMgr_BaseFrustum) GetFrustum() const
   { return Handle(SelectMgr_BaseFrustum)::DownCast (GetObject()); }
 
-  //! Dumps the content of me into the stream
-  virtual Standard_Boolean Dump (Standard_OStream& theOStream) const;
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
 
 protected:
   //! Initialize the current item. It is empty because Reset() is also empty.
index 3c0aaae57da74b4efe0513f974e93d7165964c7b..4092108135e919cd927c9f92da2b75ee66a9960a 100644 (file)
@@ -140,6 +140,19 @@ opencascade::handle<BVH_Tree<Standard_Real, 3> > VInspector_ItemSelectMgrSelecta
   return aSet.BVH (aBVHSubset);
 }
 
+// =======================================================================
+// function : GetStream
+// purpose :
+// =======================================================================
+void VInspector_ItemSelectMgrSelectableObjectSet::GetStream (Standard_OStream& theOStream) const
+{
+  SelectMgr_SelectableObjectSet aSet;
+  if (!GetSelectableObjectSet (aSet))
+    return;
+
+  aSet.DumpJson (theOStream);
+}
+
 // =======================================================================
 // function : createChild
 // purpose :
index 2fe94f6dd15a85ccd06d97ea7c8dbd240d809564..b312b99f94aca5da31247dc09b01d3109e0e7c85 100644 (file)
@@ -58,6 +58,10 @@ public:
   //! Returns child BVH tree of the row
   opencascade::handle<BVH_Tree<Standard_Real, 3> > GetBVHTree (const int theRow, TCollection_AsciiString& theName) const;
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
+
 protected:
   //! Initialize the current item. It is empty because Reset() is also empty.
   virtual void initItem() const Standard_OVERRIDE;
index 26031aca73594f3f8fd47ad0b965b176aa6ea2e0..80725372da721029db602d164862a378ae66f996 100644 (file)
@@ -119,6 +119,19 @@ Standard_Boolean VInspector_ItemSelectMgrSelectingVolumeManager::GetViewerSelect
   return Standard_True;
 }
 
+// =======================================================================
+// function : GetStream
+// purpose :
+// =======================================================================
+void VInspector_ItemSelectMgrSelectingVolumeManager::GetStream (Standard_OStream& theOStream) const
+{
+  SelectMgr_SelectingVolumeManager aVolumeManager;
+  if (!GetViewerSelector (aVolumeManager))
+    return;
+
+  aVolumeManager.DumpJson (theOStream);
+}
+
 // =======================================================================
 // function : createChild
 // purpose :
index d526bf829e2b0a490d5bd4590e2debf03057e4e6..3c1eff62826d0a511240e21a4ef1a53dc2b9faef 100644 (file)
@@ -57,6 +57,10 @@ public:
   //! Returns frustum Frustum for row = 0, FrustumSet for row = 1   
   Handle(SelectMgr_BaseFrustum) GetFrustum (const int theRow) const;
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
+
 protected:
   //! Initialize the current item. It is empty because Reset() is also empty.
   virtual void initItem() const Standard_OVERRIDE;
index 0836fe741771d257d2f3e47c52f5924c338fbd56..e01c355aa07cf9d3c144baf6636bc95dc1fa744b 100644 (file)
@@ -38,6 +38,9 @@
 int VInspector_ItemSelectMgrSelection::initRowCount() const
 {
   Handle(SelectMgr_Selection) aSelection = GetSelection();
+
+  if (aSelection.IsNull())
+    return 0;
 #if OCC_VERSION_HEX < 0x070201
   int aRows = 0;
   for (aSelection->Init(); aSelection->More(); aSelection->Next())
@@ -58,6 +61,9 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const
   if (aParentValue.isValid())
     return aParentValue;
 
+  if (GetSelection().IsNull())
+    return QVariant();
+
   switch (theItemRole)
   {
     case Qt::DisplayRole:
index 3dc5a08424670c0df8ed1c18614776687477120c..8ee5bbc9c0e31beda13a48bc0b647d38de3a8ef4 100644 (file)
@@ -123,20 +123,23 @@ void VInspector_ItemSelectMgrSensitiveEntity::Init()
 
   int aRowId = Row();
   int aCurrentId = 0;
-#if OCC_VERSION_HEX < 0x070201
-  for (aSelection->Init(); aSelection->More(); aSelection->Next(), aCurrentId++)
-#else
-  for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next(), aCurrentId++)
-#endif
+  if (!aSelection.IsNull())
   {
-    if (aCurrentId != aRowId)
-      continue;
-#if OCC_VERSION_HEX < 0x070201
-    myEntity = aSelection->Sensitive();
-#else
-    myEntity = aSelEntIter.Value();
-#endif
-    break;
+  #if OCC_VERSION_HEX < 0x070201
+    for (aSelection->Init(); aSelection->More(); aSelection->Next(), aCurrentId++)
+  #else
+    for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next(), aCurrentId++)
+  #endif
+    {
+      if (aCurrentId != aRowId)
+        continue;
+  #if OCC_VERSION_HEX < 0x070201
+      myEntity = aSelection->Sensitive();
+  #else
+      myEntity = aSelEntIter.Value();
+  #endif
+      break;
+    }
   }
   TreeModel_ItemBase::Init();
 }
@@ -152,6 +155,19 @@ void VInspector_ItemSelectMgrSensitiveEntity::Reset()
   myEntity = NULL;
 }
 
+// =======================================================================
+// function : GetStream
+// purpose :
+// =======================================================================
+void VInspector_ItemSelectMgrSensitiveEntity::GetStream (Standard_OStream& theOStream) const
+{
+  Handle(SelectMgr_SensitiveEntity) anEntity = GetSensitiveEntity();
+  if (anEntity.IsNull())
+    return;
+
+  anEntity->DumpJson (theOStream);
+}
+
 // =======================================================================
 // function : initItem
 // purpose :
index a8e55c0b3e159e576a0661912d0f2188cd3f769b..6ae54355a386c92b6bd4a2e5b3122b2addb35dc7 100644 (file)
@@ -55,6 +55,10 @@ public:
   //! Resets cached values
   Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
+
 protected:
 
   //! Initialize the current item. It is empty because Reset() is also empty.
index 964745e2203e2f54a373c80d0708e1c4f1730ad6..c1104b05a713082be84f6c1580c491cc535b7200 100644 (file)
@@ -216,17 +216,16 @@ void VInspector_ItemSelectMgrViewerSelector::initItem() const
 }
 
 // =======================================================================
-// function : Dump
+// function : GetStream
 // purpose :
 // =======================================================================
-Standard_Boolean VInspector_ItemSelectMgrViewerSelector::Dump (Standard_OStream& theOStream) const
+void VInspector_ItemSelectMgrViewerSelector::GetStream (Standard_OStream& theOStream) const
 {
   Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector();
   if (aViewerSelector.IsNull())
-    return Standard_False;
+    return;
 
   aViewerSelector->DumpJson (theOStream);
-  return Standard_True;
 }
 
 // =======================================================================
index b460d8272b1f45bc99a0c2cfe69f677fb21b2c33..f1509a7dacbb9c03e73cecc124586f4ff2f60536 100644 (file)
@@ -95,8 +95,9 @@ protected:
   //! \return the value
   Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
 
-  //! Dumps the content of me into the stream
-  virtual Standard_Boolean Dump (Standard_OStream& theOStream) const;
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
 
 protected:
 
index 005808bac8cd71aa237852a0f4741ec15ca4fece..aee1f4a86f53638e65c775496c780426ccac8ef7 100644 (file)
@@ -126,6 +126,19 @@ void VInspector_ItemV3dViewer::Reset()
   setViewer (NULL);
 }
 
+// =======================================================================
+// function : GetStream
+// purpose :
+// =======================================================================
+void VInspector_ItemV3dViewer::GetStream (Standard_OStream& theOStream) const
+{
+  Handle(V3d_Viewer) aViewer = GetViewer();
+  if (aViewer.IsNull())
+    return;
+
+  aViewer->DumpJson (theOStream);
+}
+
 // =======================================================================
 // function : initItem
 // purpose :
index 42e2f337e25b097185ffec32ea924e9bb8a5b659..575a4f5470461a31cf99680afe16ac1be64108c2 100644 (file)
@@ -59,6 +59,10 @@ public:
   Standard_EXPORT Handle(V3d_Viewer) GetViewer() const
   { return Handle(V3d_Viewer)::DownCast (GetObject()); }
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
+
 protected:
   //! Initialize the current item. It is empty because Reset() is also empty.
   virtual void initItem() const Standard_OVERRIDE;
index c56f6065fd252ccf39ff3f9694d0a64e196bd6c2..93c4e084920366ccda5a03cbdf7b9c4bf5dc622d 100644 (file)
@@ -565,15 +565,15 @@ QVariant VInspector_Tools::ToVariant (const Select3D_BndBox3d& theBoundingBox)
 //function : CreateShape
 //purpose  :
 //=======================================================================
-TopoDS_Shape VInspector_Tools::CreateShape (const Select3D_BndBox3d& theBoundingBox)
+Standard_Boolean VInspector_Tools::CreateShape (const Select3D_BndBox3d& theBoundingBox, TopoDS_Shape& theShape)
 {
   if (!theBoundingBox.IsValid())
-    return TopoDS_Shape();
+    return Standard_False;
 
   gp_Pnt aPntMin = gp_Pnt (theBoundingBox.CornerMin().x(), theBoundingBox.CornerMin().y(), theBoundingBox.CornerMin().z());
   gp_Pnt aPntMax = gp_Pnt (theBoundingBox.CornerMax().x(), theBoundingBox.CornerMax().y(), theBoundingBox.CornerMax().z());
 
-  return Convert_Tools::CreateBoxShape (aPntMin, aPntMax);
+  return Convert_Tools::CreateBoxShape (aPntMin, aPntMax, theShape);
 }
 
 //=======================================================================
index a765ee2d3a8ce3ae91a3e76d377138d1199be3e2..ea6ccaeca939b368f2d6101711828a76e1b1b1ce 100644 (file)
@@ -180,7 +180,7 @@ public:
   //! Creates box shape
   //! \param theBoundingBox box shape parameters
   //! \return created shape
-  Standard_EXPORT static TopoDS_Shape CreateShape (const Select3D_BndBox3d& theBoundingBox);
+  Standard_EXPORT static Standard_Boolean CreateShape (const Select3D_BndBox3d& theBoundingBox, TopoDS_Shape& theShape);
 
   //! Build string presentation of Graphic3D index buffer
   //! \param theIndexBuffer index buffer
index c2bd8ed934a233f525d324c351b29f94f7f9ca81..e57f62777435f4aab2b96eb6bcf68f6a4bfce9ea 100644 (file)
@@ -32,7 +32,6 @@
 #include <inspector/TreeModel_ColumnType.hxx>
 #include <inspector/TreeModel_ContextMenu.hxx>
 #include <inspector/TreeModel_ItemProperties.hxx>
-#include <inspector/TreeModel_ItemStream.hxx>
 #include <inspector/TreeModel_Tools.hxx>
 
 #include <inspector/ViewControl_MessageDialog.hxx>
@@ -255,6 +254,11 @@ void VInspector_Window::GetPreferences (TInspectorAPI_PreferencesDataMap& theIte
   {
     theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str());
   }
+
+  anItems.clear();
+  ViewControl_PropertyView::SaveState (myPropertyView, anItems, "property_view_parameters_");
+  for (QMap<QString, QString>::const_iterator anItemsIt = anItems.begin(); anItemsIt != anItems.end(); anItemsIt++)
+    theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str());
 }
 
 // =======================================================================
@@ -272,15 +276,20 @@ void VInspector_Window::SetPreferences (const TInspectorAPI_PreferencesDataMap&
 
   for (TInspectorAPI_IteratorOfPreferencesDataMap anItemIt (theItem); anItemIt.More(); anItemIt.Next())
   {
-    if (anItemIt.Key().IsEqual ("geometry"))
-      myMainWindow->restoreState (TreeModel_Tools::ToByteArray (anItemIt.Value().ToCString()));
-    else if (TreeModel_Tools::RestoreState (myTreeView, anItemIt.Key().ToCString(), anItemIt.Value().ToCString()))
+    TCollection_AsciiString anItemKey = anItemIt.Key();
+    TCollection_AsciiString anItemValue = anItemIt.Value();
+    if (anItemKey.IsEqual ("geometry"))
+      myMainWindow->restoreState (TreeModel_Tools::ToByteArray (anItemValue.ToCString()));
+    else if (TreeModel_Tools::RestoreState (myTreeView, anItemKey.ToCString(), anItemValue.ToCString()))
       continue;
-    else if (TreeModel_Tools::RestoreState (myHistoryView, anItemIt.Key().ToCString(), anItemIt.Value().ToCString(),
+    else if (TreeModel_Tools::RestoreState (myHistoryView, anItemKey.ToCString(), anItemValue.ToCString(),
                                             "history_view_"))
       continue;
-    else if (View_PreviewParameters::RestoreState (myDisplayPreview->GetPreviewParameters(), anItemIt.Key().ToCString(),
-      anItemIt.Value().ToCString(), "preview_parameters_"))
+    else if (View_PreviewParameters::RestoreState (myDisplayPreview->GetPreviewParameters(), anItemKey.ToCString(),
+      anItemValue.ToCString(), "preview_parameters_"))
+      continue;
+    else if (ViewControl_PropertyView::RestoreState (myPropertyView, anItemKey.ToCString(),
+      anItemValue.ToCString(), "property_view_parameters_"))
       continue;
   }
 }
@@ -425,12 +434,9 @@ NCollection_List<TopoDS_Shape> VInspector_Window::GetSelectedShapes (const QMode
 
   // obtain selection from the property panel
   {
-    //QList<ViewControl_Table*> aPropertyTables;
-    //myPropertyView->GetActiveTables (aPropertyTables);
-    //if (!aPropertyTables.isEmpty())
+    //ViewControl_Table* aPropertyTable = myPropertyView->GetTable();
+    //if (aPropertyTable->IsActive())
     //{
-    //  ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
-
     //  Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
 
     QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0);
@@ -451,17 +457,12 @@ NCollection_List<TopoDS_Shape> VInspector_Window::GetSelectedShapes (const QMode
 void VInspector_Window::GetSelectedPropertyPanelShapes (const TreeModel_ItemBasePtr& theTreeItem,
                                                         NCollection_List<TopoDS_Shape>& theShapes)
 {
-  QList<ViewControl_Table*> aPropertyTables;
-  myPropertyView->GetActiveTables (aPropertyTables);
-  if (aPropertyTables.isEmpty())
-    return;
-
-  ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
-  if (!aFirstTable)
+  ViewControl_Table* aPropertyTable = myPropertyView->GetTable();
+  if (!aPropertyTable->IsActive())
     return;
 
   NCollection_List<Handle(Standard_Transient)> theSelPresentations;
-  aFirstTable->GetSelectedPresentations (theTreeItem, theSelPresentations);
+  aPropertyTable->GetSelectedPresentations (theTreeItem, theSelPresentations);
 
   for (NCollection_List<Handle(Standard_Transient)>::Iterator anIterator (theSelPresentations); anIterator.More(); anIterator.Next())
   {
@@ -470,7 +471,7 @@ void VInspector_Window::GetSelectedPropertyPanelShapes (const TreeModel_ItemBase
       theShapes.Append (aShapePrs->GetShape());
   }
 
-  //QModelIndexList& thePropertyPanelIndices = aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
+  //QModelIndexList& thePropertyPanelIndices = aPropertyTable->GetTableView()->selectionModel()->selectedIndexes(),
 
   //QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theTreeViewIndices);
   //NCollection_List<Handle(Standard_Transient)> aPropertyPresentations;
@@ -768,26 +769,24 @@ void VInspector_Window::onPropertyViewSelectionChanged()
   if (!aTreeItemSelected)
     return;
 
-  QList<ViewControl_Table*> aPropertyTables;
-  myPropertyView->GetActiveTables (aPropertyTables);
-  if (aPropertyTables.isEmpty())
+  ViewControl_Table* aPropertyTable = myPropertyView->GetTable();
+  if (!aPropertyTable->IsActive())
     return;
 
-  ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
   NCollection_List<Handle(Standard_Transient)> aSelPresentations;
-  aFirstTable->GetSelectedPresentations (aTreeItemSelected, aSelPresentations);
+  aPropertyTable->GetSelectedPresentations (aTreeItemSelected, aSelPresentations);
 
   //Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->GetProperties();
 
 
   //QMap<int, QList<int>> aSelectedIndices;
-  //aFirstTable->GetSelectedIndices (aSelectedIndices);
+  //aPropertyTable->GetSelectedIndices (aSelectedIndices);
 
-  //ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*>(aFirstTable->GetTableView()->model());
+  //ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*>(aPropertyTable->GetTableView()->model());
   //ViewControl_TableModelValues* aTableValues = aTableModel->GetModelValues();
 
   QStringList aPointers;
-  aFirstTable->GetSelectedPointers (aPointers);
+  aPropertyTable->GetSelectedPointers (aPointers);
 
   //NCollection_List<Handle(Standard_Transient)> aSelPresentations;
   /*for (QMap<int, QList<int>>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
@@ -815,7 +814,7 @@ void VInspector_Window::onPropertyViewSelectionChanged()
   //NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aTreeViewSelected);
 
   //GetSelectedPropertyPanelShapes(aTreeViewSelected,
-  //                               aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
+  //                               aPropertyTable->GetTableView()->selectionModel()->selectedIndexes(),
   //                               aSelectedShapes);
   //updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
 
@@ -845,11 +844,8 @@ void VInspector_Window::onTreeViewSelectionChanged (const QItemSelection&,
     return;
 
   NCollection_List<Handle(Standard_Transient)> aSelPresentations;
-  TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast<TreeModel_ItemStream> (aTreeItemSelected);
-  if (!aStreamParent)
-    return;
 
-  Handle(TreeModel_ItemProperties) anItemProperties = aStreamParent->Properties ();
+  Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->Properties ();
   if (anItemProperties)
     anItemProperties->GetPresentations (-1, -1, aSelPresentations);
   //else
@@ -1075,17 +1071,12 @@ void VInspector_Window::updatePropertyPanelBySelection()
   if (!anItemBase)
     return;
 
-  TreeModel_ItemStreamPtr aStreamItem = itemDynamicCast<TreeModel_ItemStream> (anItemBase);
-  if (!aStreamItem)
-    return;
-
-  Handle(TreeModel_ItemProperties) anItemProperties = aStreamItem->Properties ();
-  QList<ViewControl_TableModelValues*> aTableValuesList;
+  Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->Properties ();
+  ViewControl_TableModelValues* aTableValues = 0;
   if (!anItemProperties.IsNull())
   {
-    ViewControl_TableModelValues* aTableValues = new ViewControl_TableModelValues();
+    aTableValues = new ViewControl_TableModelValues();
     aTableValues->SetProperties (anItemProperties);
-    aTableValuesList.append (aTableValues);
   }
 
   /*QItemSelectionModel* aModel = myTreeView->selectionModel();
@@ -1100,7 +1091,7 @@ void VInspector_Window::updatePropertyPanelBySelection()
     TreeModel_ItemBasePtr aSelectedItem = TreeModel_ModelBase::GetItemByIndex(aSelected.first());
     VInspector_Tools::GetPropertyTableValues (aSelectedItem, myPaneCreators, aTableValues);
   }*/
-  myPropertyView->Init (aTableValuesList);
+  myPropertyView->Init (aTableValues);
 }
 
 // =======================================================================
@@ -1231,14 +1222,43 @@ void VInspector_Window::selectTreeViewItems (const QStringList& thePointers)
 // function : createView
 // purpose :
 // =======================================================================
+#include <Prs3d_DatumAspect.hxx>
 Handle(AIS_InteractiveContext) VInspector_Window::createView()
 {
   // create two view windows
   Handle(AIS_InteractiveContext) aContext = View_Viewer::CreateStandardViewer();
 
   Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY()));
-  aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
-  aContext->Display (aTrihedron, Standard_True);
+  aTrihedron->SetSize (0.5);
+  //aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
+  //aContext->Display (aTrihedron, Standard_True);
+      aContext->Display(aTrihedron,
+                        0 /*wireframe*/,
+                        -1 /* selection mode */,
+                        Standard_True /* update viewer*/,
+                        Standard_True /* allow decomposition */,
+                        AIS_DS_Displayed /* xdisplay status */);
+  aContext->Load (aTrihedron);
+  aContext->Activate (aTrihedron, AIS_TrihedronSelectionMode_Axes);
+  {
+    Handle(AIS_Trihedron) myTrihedron = aTrihedron;
+    myTrihedron->SetInfiniteState( Standard_True);
+
+    Quantity_Color Col(193 / 255., 205 / 255., 193 / 255., Quantity_TOC_RGB);
+    myTrihedron->SetArrowColor(Col.Name());
+    //myTrihedron->SetSize(myTrihedronSize);
+    Handle(Prs3d_Drawer) drawer = myTrihedron->Attributes();
+    if (drawer->HasOwnDatumAspect()) {
+      Handle(Prs3d_DatumAspect) daspect = drawer->DatumAspect();
+      daspect->FirstAxisAspect()->SetColor(Quantity_Color(1.0, 0.0, 0.0, Quantity_TOC_RGB));
+      daspect->SecondAxisAspect()->SetColor(Quantity_Color(0.0, 1.0, 0.0, Quantity_TOC_RGB));
+      daspect->ThirdAxisAspect()->SetColor(Quantity_Color(0.0, 0.0, 1.0, Quantity_TOC_RGB));
+
+      daspect->FirstAxisAspect()->SetWidth(3.0);
+      daspect->SecondAxisAspect()->SetWidth(3.0);
+      daspect->ThirdAxisAspect()->SetWidth(3.0);
+    }
+  }
 
   myViewWindow = new View_Window (0, aContext, false /*for opening several BREP files*/, true);
   myViewWindow->GetView()->SetPredefinedSize (VINSPECTOR_DEFAULT_VIEW_WIDTH, VINSPECTOR_DEFAULT_VIEW_HEIGHT);
index 7e4395a7ab859d8cf3dcc3d26b97057551389803..24fc9079a5926216f149ff06dfccb4b5d04425ea 100644 (file)
 #include <BRepBuilderAPI_MakeVertex.hxx>
 #include <BRepBuilderAPI_MakeEdge.hxx>
 #include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
 
 #include <Geom_Axis2Placement.hxx>
+#include <Prs3d_PointAspect.hxx>
 #include <TopoDS_Compound.hxx>
 
+void enableGlobalClipping (const Handle(AIS_InteractiveObject)& theObject, const bool theIsEnable)
+{
+  if (theIsEnable)
+  {
+    theObject->SetClipPlanes (Handle(Graphic3d_SequenceOfHClipPlane)());
+  }
+  else
+  {
+    Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = new Graphic3d_SequenceOfHClipPlane;
+    aPlanes->SetOverrideGlobal (Standard_True);
+    theObject->SetClipPlanes (aPlanes);
+  }
+}
+
 // =======================================================================
 // function : Constructor
 // purpose :
@@ -55,7 +71,8 @@ void View_DisplayPreview::SetContext (const Handle(AIS_InteractiveContext)& theC
   // remove all preview presentations from the previous context, display it in the new 
 
   myContext = theContext;
-  myPreviewParameters->GetDrawer()->Link (theContext->DefaultDrawer());
+  if (!theContext.IsNull())
+    myPreviewParameters->GetDrawer()->Link (theContext->DefaultDrawer());
 }
 
 // =======================================================================
@@ -68,38 +85,62 @@ void View_DisplayPreview::UpdatePreview (const View_DisplayActionType,
   if (myContext.IsNull())
     return;
 
+  // clear previous previews
+  for (NCollection_List<Handle(AIS_InteractiveObject)>::Iterator anIterator (myPreviewReadyPresentations); anIterator.More(); anIterator.Next())
+  {
+    if (!anIterator.Value()->GetContext().IsNull())
+      anIterator.Value()->GetContext()->Remove (anIterator.Value(), Standard_True);
+  }
+  myPreviewReadyPresentations.Clear();
+
   if (thePresentations.IsEmpty())
   {
-    myContext->Remove (myPreviewPresentation, Standard_True);
+    if (!myPreviewPresentation.IsNull() && !myPreviewPresentation->GetContext().IsNull())
+      myPreviewPresentation->GetContext()->Remove (myPreviewPresentation, Standard_True);
     myPreviewPresentation = NULL;
+
     return;
   }
 
+  // display parameter previews
   BRep_Builder aBuilder;
   TopoDS_Compound aCompound;
   aBuilder.MakeCompound (aCompound);
   for (NCollection_List<Handle(Standard_Transient)>::Iterator anIterator (thePresentations); anIterator.More(); anIterator.Next())
   {
     Handle(Convert_TransientShape) aShapePtr = Handle(Convert_TransientShape)::DownCast (anIterator.Value());
-    if (aShapePtr.IsNull())
-      continue;
-
-    aBuilder.Add (aCompound, aShapePtr->GetShape());
+    if (!aShapePtr.IsNull())
+    {
+      aBuilder.Add (aCompound, aShapePtr->GetShape());
+    }
+    Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (anIterator.Value());
+    if (!aPrs.IsNull() && aPrs->GetContext().IsNull()/*is not displayed in another context*/)
+    {
+      myContext->Display (aPrs, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
+      enableGlobalClipping(aPrs, false);
+      myPreviewReadyPresentations.Append (aPrs);
+    }
   }
 
   if (myPreviewPresentation.IsNull())
   {
     myPreviewPresentation = new AIS_Shape (aCompound);
+    Quantity_Color aColor(Quantity_NOC_TOMATO);
+    myPreviewPresentation->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
     myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
 
     //myPreviewPresentation->SetTransformPersistence(thePersistent);
     myContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
+    enableGlobalClipping(myPreviewPresentation, false);
   }
   else
   {
     Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
     //myPreviewPresentation->SetTransformPersistence(thePersistent);
-    myContext->Redisplay (myPreviewPresentation, Standard_True);
+    if (!myPreviewPresentation.IsNull() && !myPreviewPresentation->GetContext().IsNull())
+    {
+      myPreviewPresentation->GetContext()->Redisplay (myPreviewPresentation, Standard_True);
+    }
   }
 }
 
@@ -117,9 +158,17 @@ void View_DisplayPreview::DisplayDefaultPreview()
   TopoDS_Compound aCompound;
   aBuilder.MakeCompound (aCompound);
   aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (gp_Pnt(25., 10., 0.)));
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt(20., 20., 0.), gp_Pnt(30., 20., 10.)));
+  BRepBuilderAPI_MakeEdge anEdgeBuilder (gp_Pnt(20., 20., 0.), gp_Pnt(30., 20., 10.));
+  aBuilder.Add (aCompound, anEdgeBuilder);
+
+  BRepBuilderAPI_MakeEdge anEdgeBuilder1 (gp_Pnt(10., 10., 0.), gp_Pnt(20., 10., 0.));
+  BRepBuilderAPI_MakeEdge anEdgeBuilder2 (gp_Pnt(20., 10., 0.), gp_Pnt(20., 0., 0.));
+
+  aBuilder.Add (aCompound, BRepBuilderAPI_MakeWire (anEdgeBuilder1, anEdgeBuilder2));
   //aBuilder.Add (aCompound, BRepBuilderAPI_MakeFace (gp_Pln (gp_Pnt (20., 30., 0.), gp_Dir (1., 0., 0.))).Face());
-  aBuilder.Add (aCompound, Convert_Tools::CreateBoxShape (gp_Pnt(20., 40., 0.), gp_Pnt(30., 60., 10.)));
+  TopoDS_Shape aShape;
+  if (Convert_Tools::CreateBoxShape (gp_Pnt(20., 40., 0.), gp_Pnt(30., 60., 10.), aShape))
+    aBuilder.Add (aCompound, aShape);
 
   Handle(AIS_Shape) aDefaultPreview = new AIS_Shape (aCompound);
   aDefaultPreview->SetAttributes (myPreviewParameters->GetDrawer());
index 2d2d6bbf49b4348c46985914a84f2559fa874051..2c6619d79cbe8a98633400989474a06d53e7d0fd 100644 (file)
@@ -80,6 +80,7 @@ private:
 
   View_PreviewParameters* myPreviewParameters; //!< drawer of preview presentation
   Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
+  NCollection_List<Handle(AIS_InteractiveObject)> myPreviewReadyPresentations; //!< presentation of preview for a selected object
 };
 
 #endif
index 30d0b4766ad82acec78c2188fe6eff5772b80a34..ccacc5fc64955eaedf3aa905d233424eb8a07b96 100644 (file)
@@ -43,9 +43,9 @@ View_PreviewParameters::View_PreviewParameters()
   myDrawer->ShadingAspect()->SetColor (aColor);
   myDrawer->ShadingAspect()->SetMaterial (aShadingMaterial);
 
-  myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
-  myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
-  myDrawer->SetTransparency (aTransparency);
+  //myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
+  //myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
+  //myDrawer->SetTransparency (aTransparency);
 
   // common parameters
   myDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
@@ -94,10 +94,10 @@ bool  View_PreviewParameters::RestoreState (View_PreviewParameters* theParameter
                                                   const QString& theKey, const QString& theValue,
                                                   const QString& thePrefix)
 {
-  //if (theKey == thePrefix + "has_point_aspect") // point parameters
-  //{
+  if (theKey == thePrefix + "has_point_aspect") // point parameters
+  {
   //  myDrawer->SetOwnPointAspect (theValue.toBool());
-  //}
+  }
   //else if (theKey == thePrefix + "point_aspect") // point parameters
   //{
   //  Standard_SStream aStream;
@@ -114,7 +114,7 @@ bool  View_PreviewParameters::RestoreState (View_PreviewParameters* theParameter
   //  aStream << theValue.ToString().ToStdString();
   //  myDrawer->ShadingAspect()->Init (aStream);
   //}
-  //else
-  //  return false;
+  else
+    return false;
   return true;
 }
index c5931bf6667823d803eceee4e11cba031d64a29d..78f9771f584451fe89a8c00be05605d31986ce38 100644 (file)
@@ -41,7 +41,7 @@ public:
   //! Returns main control
   const Handle(Prs3d_Drawer)& GetDrawer() const { return myDrawer; }
 
-    //! Save state of three view in a container in form: key, value. It saves:
+  //! Save state of three view in a container in form: key, value. It saves:
   //! - visibiblity of columns,
   //! - columns width
   //! \param theTreeView a view instance
index 1ebff8d129924bae98efb60622fa7d811f22ad59..5eebbfb6e8ca3c843e878985fa2e11fcff9ed074 100644 (file)
@@ -145,6 +145,16 @@ View_ContextType View_ToolBar::GetCurrentContextType() const
   return (View_ContextType)myViewSelector->currentIndex();
 }
 
+// =======================================================================
+// function : SetCurrentContext
+// purpose :
+// =======================================================================
+void View_ToolBar::SetCurrentContextType (View_ContextType theType)
+{
+  myViewSelector->setCurrentIndex ((int)theType);
+  emit contextChanged();
+}
+
 // =======================================================================
 // function : GetCurrentContext
 // purpose :
@@ -165,6 +175,74 @@ bool View_ToolBar::IsActionChecked (const int theActionId) const
   return myActionsMap.contains (anActionId) ? myActionsMap[anActionId]->isChecked() : false;
 }
 
+// =======================================================================
+// function : SaveState
+// purpose :
+// =======================================================================
+void View_ToolBar::SaveState (View_ToolBar* theParameters,
+                              QMap<QString, QString>& theItems,
+                              const QString& thePrefix)
+{
+  //Handle(Prs3d_Drawer) aDrawer = theParameters->GetDrawer();
+
+  //Quantity_Color aColor = aDrawer->Color();
+  //Standard_ShortReal aTransparency = aDrawer->Transparency();
+
+  //// point parameters
+  //{
+  //  Standard_Boolean anOwnPointAspect = aDrawer->HasOwnPointAspect();
+  //  Standard_SStream OS;
+  //  if (anOwnPointAspect)
+  //    myDrawer->PointAspect()->Dump (OS);
+  //  TCollection_AsciiString aStream (OS.str().c_str());
+  //  theItems[thePrefix + "has_point_aspect"] = anOwnPointAspect;
+  //  theItems[thePrefix + "point_aspect"] = aStream.ToCString();
+  //}
+  //// shading parameters
+  //{
+  //  Standard_Boolean anOwnShadingAspect = aDrawer->HasOwnShadingAspect();
+  //  Standard_SStream OS;
+  //  if (anOwnShadingAspect)
+  //    myDrawer->ShadingAspect()->Dump (OS);
+  //  TCollection_AsciiString aStream (OS.str().c_str());
+  //  theItems[thePrefix + "has_shading_aspect"] = anOwnShadingAspect;
+  //  theItems[thePrefix + "shading_aspect"] = aStream.ToCString();
+  //}
+}
+
+// =======================================================================
+// function : RestoreState
+// purpose :
+// =======================================================================
+bool  View_ToolBar::RestoreState (View_ToolBar* theParameters,
+                                  const QString& theKey, const QString& theValue,
+                                  const QString& thePrefix)
+{
+  //if (theKey == thePrefix + "has_point_aspect") // point parameters
+  //{
+  //  myDrawer->SetOwnPointAspect (theValue.toBool());
+  //}
+  //else if (theKey == thePrefix + "point_aspect") // point parameters
+  //{
+  //  Standard_SStream aStream;
+  //  aStream << theValue.ToString().ToStdString();
+  //  myDrawer->PointAspect()->Init (aStream);
+  //}
+  //else if (theKey == thePrefix + "has_shading_aspect") // shading parameters
+  //{
+  //  myDrawer->SetOwnShadingAspect (theValue.toBool());
+  //}
+  //else if (theKey == thePrefix + "shading_aspect") // shading parameters
+  //{
+  //  Standard_SStream aStream;
+  //  aStream << theValue.ToString().ToStdString();
+  //  myDrawer->ShadingAspect()->Init (aStream);
+  //}
+  //else
+  //  return false;
+  return true;
+}
+
 // =======================================================================
 // function : onActionClicked
 // purpose :
index dca417ba0559cae58b9d07e8398230d66e8d70ea..31f3eba3ea5f9b85d05212969d5a258a51331464 100644 (file)
@@ -60,12 +60,35 @@ public:
   //! \returns type of active item of context selector
   Standard_EXPORT View_ContextType GetCurrentContextType() const;
 
+  //! Sets current context type
+  //! \param theType a context type
+  Standard_EXPORT void SetCurrentContextType (View_ContextType theType);
+
   //! \returns an active context of context selector
   Standard_EXPORT Handle(AIS_InteractiveContext) GetCurrentContext() const;
 
   //! \returns whether the action is checked(toggled). Acceptable only if the action is checkable.
   Standard_EXPORT bool IsActionChecked (const int theActionId) const;
 
+  //! Save state of three view in a container in form: key, value. It saves:
+  //! - visibiblity of columns,
+  //! - columns width
+  //! \param theTreeView a view instance
+  //! \param theItems [out] properties
+  //! \param thePrefix peference item prefix
+  Standard_EXPORT static void SaveState (View_ToolBar* theParameters,
+                                         QMap<QString, QString>& theItems,
+                                         const QString& thePrefix = QString());
+  //! Restore state of three view by a container
+  //! \param theTreeView a view instance
+  //! \param theKey property key
+  //! \param theValue property value
+  //! \param thePrefix peference item prefix
+  //! \return boolean value whether the property is applyed to the tree view
+  Standard_EXPORT static bool RestoreState (View_ToolBar* theParameters,
+                                            const QString& theKey, const QString& theValue,
+                                            const QString& thePrefix = QString());
+
 signals:
 
   //! Signal about click on action of View_ToolActionType enumeration
index 49a55224606118bf175e3a67f3ef109820104b78..69b5f710fca4e8098b7825de7cee5404c17a63bf 100644 (file)
@@ -18,6 +18,7 @@
 #include <inspector/View_Displayer.hxx>
 #include <inspector/View_DisplayPreview.hxx>
 #include <inspector/View_PreviewParameters.hxx>
+#include <inspector/View_ToolBar.hxx>
 #include <inspector/View_Viewer.hxx>
 #include <inspector/View_Widget.hxx>
 #include <inspector/View_Window.hxx>
@@ -79,6 +80,7 @@ void View_Tools::SaveState (View_Window* theView, QMap<QString, QString>& theIte
   theItems[thePrefix + "view_camera_direction"] = aCameraDirection.join (",");
 
   View_PreviewParameters::SaveState (theView->GetDisplayer()->GetDisplayPreview()->GetPreviewParameters(), theItems, "preview_parameters_");
+  View_ToolBar::SaveState (theView->GetViewToolBar(), theItems, "view_toolbar_");
 }
 
 // =======================================================================
@@ -106,5 +108,9 @@ bool View_Tools::RestoreState (View_Window* theView, const QString& theKey, cons
   {
     return true;
   }
+  else if (View_ToolBar::RestoreState (theView->GetViewToolBar(), theKey, theValue, "view_toolbar_"))
+  {
+    return true;
+  }
   return false;
 }
index 04907e14794d0170bd6e080442cdbea4dd357f17..03e8abe6912185e77635e6256e23519e9f0ff6e4 100644 (file)
@@ -19,7 +19,7 @@
 #include <Standard_ExtString.hxx>
 #include <Standard_Version.hxx>
 
-//#define USE_CLIPPLANE
+#define USE_CLIPPLANE
 
 #ifdef USE_CLIPPLANE
 #include <Graphic3d_ClipPlane.hxx>
index 26a4f65577d76374eec9c9b658af5adbcdaf215e..6659080eaf0bd0e31b23c03b224e78fe627cd871 100644 (file)
@@ -523,8 +523,8 @@ void View_Widget::processLeftButtonUp (const int theFlags, const QPoint thePoint
   myDragMultiButtonDownX = 0;
   myDragMultiButtonDownY = 0;
 
-  myCurrentMode = View_CurrentAction3d_Nothing;
-  activateCursor (myCurrentMode);
+  //myCurrentMode = View_CurrentAction3d_Nothing;
+  //activateCursor (myCurrentMode);
   emit selectionChanged();
   emit leftButtonUp(thePoint.x(), thePoint.y());
 }
index f2f20c92132b678ea6afdd8f0d59db754b22d321..cea23c87141ec0c37705c727f70026c753bc6083 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <Standard_WarningsDisable.hxx>
 #include <QAbstractTableModel>
+#include <QHeaderView>
 #include <QStackedWidget>
 #include <QScrollArea>
 #include <QTableView>
@@ -79,39 +80,38 @@ ViewControl_PropertyView::ViewControl_PropertyView (QWidget* theParent, const QS
   myAttributesStack->addWidget (myTableWidget);
 
   myAttributesStack->setCurrentWidget (myEmptyWidget);
+
+  // create table
+  ViewControl_Table* aTable = new ViewControl_Table (myMainWidget);
+  ViewControl_TableModel* aModel = new ViewControl_TableModel(aTable->GetTableView());
+  aTable->SetModel (aModel);
+
+  connect (aTable->GetTableView()->selectionModel(),
+          SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
+          this, SLOT(onTableSelectionChanged (const QItemSelection&, const QItemSelection&)));
+
+  connect (aModel, SIGNAL (dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)),
+           this, SIGNAL (propertyViewDataChanged()));
+
+  myTableWidgetLayout->addWidget (aTable->GetControl());
+  myTable = aTable;
 }
 
 // =======================================================================
 // function : Init
 // purpose :
 // =======================================================================
-void ViewControl_PropertyView::Init (const QList<ViewControl_TableModelValues*>& theTableValues)
+void ViewControl_PropertyView::Init (ViewControl_TableModelValues* theTableValues)
 {
-  for (int aTableId = 0; aTableId < theTableValues.size(); aTableId++)
+  ViewControl_Table* aTable = GetTable();
+  if (theTableValues)
   {
-    ViewControl_TableModelValues* aValues = theTableValues[aTableId];
-
-    ViewControl_Table* aTable = findTable (aTableId);
-
-    aTable->Init (aValues);
+    aTable->Init (theTableValues);
     ViewControl_Tools::SetDefaultHeaderSections (aTable->GetTableView(), Qt::Horizontal);
-
-    aTable->SetActive (true);
-  }
-  // hide not used tables
-  for (int aTableId = theTableValues.size(); aTableId < myTables.size(); aTableId++)
-  {
-    ViewControl_Table* aTable = findTable (aTableId, false);
-    if (!aTable)
-      continue;
-
-    ViewControl_TableModel* aModel = dynamic_cast<ViewControl_TableModel*> (aTable->GetTableView()->model());
-    aModel->SetModelValues (0);
-
-    aTable->SetActive (false);
   }
+  aTable->SetActive (theTableValues);
 
-  if (theTableValues.size() > 0)
+  if (theTableValues)
     myAttributesStack->setCurrentWidget (myTableWidget);
   else
     myAttributesStack->setCurrentWidget (myEmptyWidget);
@@ -126,17 +126,12 @@ void ViewControl_PropertyView::Init (QWidget*)
 }
 
 // =======================================================================
-// function : GetActiveTables
+// function : GetTable
 // purpose :
 // =======================================================================
-void ViewControl_PropertyView::GetActiveTables (QList<ViewControl_Table*>& theTables)
+ViewControl_Table* ViewControl_PropertyView::GetTable()
 {
-  for (int aTableId = 0; aTableId < myTables.size(); aTableId++)
-  {
-    ViewControl_Table* aTable = findTable (aTableId, false);
-    if (aTable && aTable->IsActive())
-      theTables.append (aTable);
-  }
+  return myTable;
 }
 
 // =======================================================================
@@ -149,12 +144,10 @@ void ViewControl_PropertyView::ClearActiveTablesSelection()
   myOwnSelectionChangeBlocked = true;
 
   QList<ViewControl_Table*> aTables;
-  for (int aTableId = 0; aTableId < myTables.size(); aTableId++)
-  {
-    ViewControl_Table* aTable = findTable (aTableId, false);
-    if (aTable && aTable->IsActive())
-      aTable->GetTableView()->selectionModel()->clearSelection();
-  }
+  ViewControl_Table* aTable = GetTable();
+  if (aTable->IsActive())
+    aTable->GetTableView()->selectionModel()->clearSelection();
+
   myOwnSelectionChangeBlocked = aWasBlocked;
 }
 
@@ -164,12 +157,9 @@ void ViewControl_PropertyView::ClearActiveTablesSelection()
 // =======================================================================
 void ViewControl_PropertyView::Clear()
 {
-  for (int aTableId = 0; aTableId < myTables.size(); aTableId++)
+  ViewControl_Table* aTable = GetTable();
+  if (aTable->IsActive())
   {
-    ViewControl_Table* aTable = findTable (aTableId, false);
-    if (!aTable)
-      continue;
-
     ViewControl_TableModel* aModel = dynamic_cast<ViewControl_TableModel*> (aTable->GetTableView()->model());
     aModel->SetModelValues (0);
 
@@ -179,31 +169,37 @@ void ViewControl_PropertyView::Clear()
 }
 
 // =======================================================================
-// function : findTable
+// function : SaveState
 // purpose :
 // =======================================================================
-ViewControl_Table* ViewControl_PropertyView::findTable (const int theTableId, const bool isToCreate)
+void ViewControl_PropertyView::SaveState (ViewControl_PropertyView* thePropertyView,
+                                          QMap<QString, QString>& theItems,
+                                          const QString& thePrefix)
 {
-  if (!isToCreate && theTableId >= myTables.size())
-    return 0;
-
-  if (theTableId < myTables.size())
-    return myTables[theTableId];
-
-  ViewControl_Table* aTable = new ViewControl_Table (myMainWidget);
-  ViewControl_TableModel* aModel = new ViewControl_TableModel(aTable->GetTableView());
-  aTable->SetModel (aModel);
-
-
-  connect (aTable->GetTableView()->selectionModel(),
-          SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
-          this, SLOT(onTableSelectionChanged (const QItemSelection&, const QItemSelection&)));
-
-  myTableWidgetLayout->addWidget (aTable->GetControl());
-
-  myTables.insert (theTableId, aTable);
+  ViewControl_Table* aTable = thePropertyView->GetTable();
+  int aColumnWidth = aTable->GetTableView()->columnWidth (0);
+  theItems[thePrefix + "column_width_0"] = QString::number (aColumnWidth);
+}
 
-  return myTables[theTableId];
+// =======================================================================
+// function : RestoreState
+// purpose :
+// =======================================================================
+bool ViewControl_PropertyView::RestoreState (ViewControl_PropertyView* thePropertyView,
+                                             const QString& theKey,
+                                             const QString& theValue,
+                                             const QString& thePrefix)
+{
+  if (theKey == thePrefix + "column_width_0")
+  {
+    bool isOk;
+    int aWidth = theValue.toInt (&isOk);
+    if (isOk)
+      thePropertyView->GetTable()->GetTableView()->horizontalHeader()->setDefaultSectionSize (aWidth);
+  }
+  else
+    return false;
+  return true;
 }
 
 // =======================================================================
index 2cb6f753772420d0a846d48a73009793281a934d..f3677b77789891ee627821de6f65dead4223cfad 100644 (file)
@@ -49,7 +49,7 @@ public:
   //! Fills the view content with values. Number of visible tables is size of container,
   //! Each element of container is values of the corresponded table
   //! \param theTableValues values
-  Standard_EXPORT void Init (const QList<ViewControl_TableModelValues*>& theTableValues);
+  Standard_EXPORT void Init (ViewControl_TableModelValues* theTableValues);
 
   //! Fills the view content with the parameter custom widget.
   //! \param theWidget control
@@ -61,28 +61,44 @@ public:
   //! \return the text edit control
   QWidget* GetControl() const { return myMainWidget; }
 
-  //! Returns container of active tables
-  //! \param theTables [out] modified container
-  Standard_EXPORT void GetActiveTables (QList<ViewControl_Table*>& theTables);
+  //! Returns container an active table or NULL
+  Standard_EXPORT ViewControl_Table* GetTable();
 
   //! Clears selection in active tables
   Standard_EXPORT void ClearActiveTablesSelection();
 
+  //! Save state of three view in a container in form: key, value. It saves:
+  //! - visibiblity of columns,
+  //! - columns width
+  //! \param theTreeView a view instance
+  //! \param theItems [out] properties
+  //! \param thePrefix peference item prefix
+  Standard_EXPORT static void SaveState (ViewControl_PropertyView* theParameters,
+                                         QMap<QString, QString>& theItems,
+                                         const QString& thePrefix = QString());
+  //! Restore state of three view by a container
+  //! \param theTreeView a view instance
+  //! \param theKey property key
+  //! \param theValue property value
+  //! \param thePrefix peference item prefix
+  //! \return boolean value whether the property is applyed to the tree view
+  Standard_EXPORT static bool RestoreState (ViewControl_PropertyView* theParameters,
+                                            const QString& theKey, const QString& theValue,
+                                            const QString& thePrefix = QString());
+
 signals:
+  //! Signal about selection change in property view table
   void propertyViewSelectionChanged();
 
+  //! Signal about data change in property view table
+  void propertyViewDataChanged();
+
 protected slots:
   //! Emits signal about selection is changed
   //! \param theSelected container of selected table cells
   //! \param theDeselected container of selected table cells
   void onTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected);
 
-protected:
-  //! Returns table instance or create if it was not created ealier
-  //! \param theTableId an index in internal container of tables
-  //! \param isToCreate if true, the table is created if not exists
-  ViewControl_Table* findTable (const int theTableId, const bool isToCreate = true);
-
 private:
   bool myOwnSelectionChangeBlocked; //! blocking emit of selection changed signal
 
@@ -93,7 +109,7 @@ private:
 
   QWidget* myTableWidget; //!< widget of tables in vertical layout
   QVBoxLayout* myTableWidgetLayout; //! main view layout where tables or custom widgets are presented
-  QList<ViewControl_Table*> myTables; //!< table view, shown only first tables filled in Init method
+  ViewControl_Table* myTable; //!< table view, shown only first tables filled in Init method
   QWidget* myCustomWidget; //!< custom view widget
 };
 #endif
index 1ee8f1c7e913bd27daaa183713066b140fb8c172..b3dc851561c58a179dd0ef6d2d8fece7de949a9f 100644 (file)
@@ -55,6 +55,9 @@ ViewControl_Table::ViewControl_Table (QWidget* theParent)
   int aDefCellSize = aVHeader->minimumSectionSize();
   aVHeader->setDefaultSectionSize (aDefCellSize);
 
+  connect (myTableView->horizontalHeader(), SIGNAL (sectionResized (int, int, int)),
+           this, SLOT(onHeaderResized (int, int, int)));
+
   aLayout->addWidget (myTableView);
 }
 
@@ -87,12 +90,10 @@ void ViewControl_Table::Init (ViewControl_TableModelValues* theModelValues)
   ViewControl_TableItemDelegate* aDelegate = dynamic_cast<ViewControl_TableItemDelegate*>(myTableView->itemDelegate());
   aDelegate->SetModelValues (theModelValues);
 
-  int aSectionSize;
   myTableView->horizontalHeader()->setVisible (theModelValues->IsHeaderVisible (Qt::Horizontal));
-  if (theModelValues->GetDefaultSectionSize (Qt::Horizontal, aSectionSize) )
-    myTableView->horizontalHeader()->setDefaultSectionSize (aSectionSize);
 
   myTableView->verticalHeader()->setVisible (theModelValues->IsHeaderVisible (Qt::Vertical));
+  int aSectionSize;
   if (theModelValues->GetDefaultSectionSize (Qt::Vertical, aSectionSize) )
   {
     myTableView->verticalHeader()->setDefaultSectionSize (aSectionSize);
@@ -197,4 +198,17 @@ void ViewControl_Table::GetSelectedPointers (QStringList& thePointers) const
         thePointers.append (aData);
     }
   }
-}
\ No newline at end of file
+}
+
+// =======================================================================
+// function : onHeaderResized
+// purpose :
+// =======================================================================
+
+void ViewControl_Table::onHeaderResized (int theSectionId, int, int)
+{
+  if (theSectionId != 0)
+    return;
+
+  myTableView->horizontalHeader()->setDefaultSectionSize (myTableView->columnWidth (theSectionId));
+}
index 3c7611ea513aee6f0eb1eeaa9f39755bcd5c0c69..ce54db27ce6eea4e95a3a9e8c3a317633fabf5a8 100644 (file)
@@ -86,6 +86,9 @@ public:
   //! \return string value
   Standard_EXPORT static QString SeparatorData();
 
+protected slots:
+  void onHeaderResized (int theSectionId, int, int);
+
 private:
   bool myIsActive; //!< true if the table is used in property view and visible
 
index c3b43209b8fa84c72aebd93cc180242e59f39709..c92865da240a9141f9edc096f967100c34028c1f 100644 (file)
@@ -74,5 +74,9 @@ bool ViewControl_TableModel::setData (const QModelIndex& theIndex, const QVarian
     return false;
 
   int aRow = theIndex.row(), aColumn = theIndex.column();
-  return myModelValues->SetData (aRow, aColumn, theValue, theRole);
+  bool aResult = myModelValues->SetData (aRow, aColumn, theValue, theRole);
+
+  emit dataChanged (theIndex, theIndex);
+
+  return aResult;
 }
index 3d12d42db52fc1107af3a7a2d80756163b582b2b..7f107fabf12ebd8c2b1511ba2ac9a3205c3f2c5a 100644 (file)
@@ -85,8 +85,8 @@ QVariant ViewControl_TableModelValues::Data (const int theRow, const int theColu
 
 bool ViewControl_TableModelValues::SetData (const int theRow, const int theColumn, const QVariant& theValue, int)
 {
-  //if (!GetProperties().IsNull())
-  //  return GetProperties()->SetTableData (theRow, theColumn, theValue);
+  if (!GetProperties().IsNull())
+    return GetProperties()->SetData (theRow, theColumn, theValue);
 
   return false;
 }
@@ -113,10 +113,10 @@ QVariant ViewControl_TableModelValues::HeaderData (int theSection, Qt::Orientati
 // =======================================================================
 ViewControl_EditType ViewControl_TableModelValues::GetEditType (const int theRow, const int theColumn) const
 {
-  //if (!GetProperties().IsNull())
-  //{
-  //  return GetProperties()->GetTableEditType (theRow, theColumn);
-  //}
+  if (!GetProperties().IsNull())
+  {
+    return GetProperties()->GetEditType (theRow, theColumn);
+  }
   return ViewControl_EditType_None;
 }