]> OCCT Git - occt-copy.git/commitdiff
0030268: Inspectors - improvements in VInspector plugin
authornds <nds@opencascade.com>
Sat, 9 Nov 2019 04:12:06 +0000 (07:12 +0300)
committernds <nds@opencascade.com>
Sat, 9 Nov 2019 04:12:06 +0000 (07:12 +0300)
# Dump for OCCT objects

50 files changed:
src/Bnd/Bnd_Box.cxx
src/Bnd/Bnd_Box.hxx
src/Bnd/Bnd_OBB.cxx
src/Bnd/Bnd_OBB.hxx
src/Graphic3d/Graphic3d_CStructure.cxx
src/Graphic3d/Graphic3d_Camera.cxx
src/Graphic3d/Graphic3d_Camera.hxx
src/Graphic3d/Graphic3d_Layer.cxx
src/Graphic3d/Graphic3d_Layer.hxx
src/Graphic3d/Graphic3d_ZLayerSettings.hxx
src/Prs3d/Prs3d_Drawer.cxx
src/Standard/Standard_Dump.cxx
src/Standard/Standard_Dump.hxx
src/StdSelect/StdSelect_Shape.cxx
src/V3d/V3d_Viewer.cxx
src/V3d/V3d_Viewer.hxx
src/gp/gp_Ax1.cxx
src/gp/gp_Ax1.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_XYZ.cxx
src/gp/gp_XYZ.hxx
tools/Convert/Convert_Tools.cxx
tools/Convert/Convert_Tools.hxx
tools/MessageModel/MessageModel_Actions.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_ItemStream.cxx
tools/TreeModel/TreeModel_ItemStream.hxx
tools/VInspector/VInspector_ItemGraphic3dCamera.cxx
tools/VInspector/VInspector_ItemGraphic3dCamera.hxx
tools/VInspector/VInspector_ItemPrs3dDrawer.cxx
tools/VInspector/VInspector_ItemPrs3dDrawer.hxx
tools/VInspector/VInspector_ItemV3dViewer.cxx
tools/VInspector/VInspector_ItemV3dViewer.hxx
tools/VInspector/VInspector_Window.cxx
tools/View/View_DisplayPreview.cxx
tools/View/View_DisplayPreview.hxx
tools/View/View_PreviewParameters.cxx
tools/View/View_ToolBar.cxx
tools/View/View_ToolBar.hxx

index 2942963a731080b53e6d99a484f261756a7b8f33..2236b00693d4a9ae2b65398374bec2785a54c6a8 100644 (file)
@@ -985,3 +985,12 @@ void Bnd_Box::DumpJson (Standard_OStream& theOStream, const Standard_Integer) co
   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)
+{
+  return Standard_False;
+}
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 b3b9ebb67757fcb3d51e7d63d2390dfcdca1b0e3..0f6794c3631cdb1045efc01ea0c27238d47cf2da 100644 (file)
@@ -1041,3 +1041,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 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 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 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 8af632626e63c3bf9017234debb3c01f92ddf045..59da3959f1f76d4f305eab43d3e9a7522ebda977 100644 (file)
@@ -1442,103 +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_VALUES_DUMPED (theOStream, theDepth, myShadingAspect.get());
 
-  //Handle(Prs3d_Drawer)          myLink;
-  /*
-  Standard_Boolean              myHasOwnNbPoints;
-  Standard_Real                 myMaximalParameterValue;
-  Standard_Boolean              myHasOwnMaximalParameterValue;
-  Standard_Real                 myChordialDeviation;
-  Standard_Boolean              myHasOwnChordialDeviation;
-  Aspect_TypeOfDeflection       myTypeOfDeflection;
-  Standard_Boolean              myHasOwnTypeOfDeflection;
-  Prs3d_TypeOfHLR               myTypeOfHLR;
-  Standard_Real                 myDeviationCoefficient;
-  Standard_Real                 myPreviousDeviationCoefficient;
-  Standard_Boolean              myHasOwnDeviationCoefficient;
-  Standard_Real                 myHLRDeviationCoefficient;
-  Standard_Boolean              myHasOwnHLRDeviationCoefficient;
-  Standard_Real                 myPreviousHLRDeviationCoefficient;
-  Standard_Real                 myDeviationAngle;
-  Standard_Boolean              myHasOwnDeviationAngle;
-  Standard_Real                 myPreviousDeviationAngle;
-  Standard_Real                 myHLRAngle;
-  Standard_Boolean              myHasOwnHLRDeviationAngle;
-  Standard_Real                 myPreviousHLRDeviationAngle;
-  Standard_Boolean              myIsoOnPlane;
-  Standard_Boolean              myHasOwnIsoOnPlane;
-  Standard_Boolean              myIsoOnTriangulation;
-  Standard_Boolean              myHasOwnIsoOnTriangulation;
-  Standard_Boolean              myIsAutoTriangulated;
-  Standard_Boolean              myHasOwnIsAutoTriangulated;*/
-
-  /*Handle(Prs3d_IsoAspect)       myUIsoAspect;
-  Standard_Boolean              myHasOwnUIsoAspect;
-  Handle(Prs3d_IsoAspect)       myVIsoAspect;
-  Standard_Boolean              myHasOwnVIsoAspect;
-  Handle(Prs3d_LineAspect)      myWireAspect;
-  Standard_Boolean              myHasOwnWireAspect;
-  Standard_Boolean              myWireDraw;
-  Standard_Boolean              myHasOwnWireDraw;
-  Handle(Prs3d_PointAspect)     myPointAspect;
-  Standard_Boolean              myHasOwnPointAspect;
-  Handle(Prs3d_LineAspect)      myLineAspect;
-  Standard_Boolean              myHasOwnLineAspect;
-  */
-
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTextAspect);
-  if (!myTextAspect.IsNull())
-    OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get());
-
-  //Handle(Prs3d_ShadingAspect)   myShadingAspect;
-  //Standard_Boolean              myHasOwnShadingAspect;
-
-  /*Handle(Prs3d_PlaneAspect)     myPlaneAspect;
-  Standard_Boolean              myHasOwnPlaneAspect;
-  Handle(Prs3d_LineAspect)      mySeenLineAspect;
-  Standard_Boolean              myHasOwnSeenLineAspect;
-  Handle(Prs3d_ArrowAspect)     myArrowAspect;
-  Standard_Boolean              myHasOwnArrowAspect;
-  Standard_Boolean              myLineArrowDraw;
-  Standard_Boolean              myHasOwnLineArrowDraw;
-  Handle(Prs3d_LineAspect)      myHiddenLineAspect;
-  Standard_Boolean              myHasOwnHiddenLineAspect;
-  Standard_Boolean              myDrawHiddenLine;
-  Standard_Boolean              myHasOwnDrawHiddenLine;
-  Handle(Prs3d_LineAspect)      myVectorAspect;
-  Standard_Boolean              myHasOwnVectorAspect;
-  Prs3d_VertexDrawMode          myVertexDrawMode;
-  Handle(Prs3d_DatumAspect)     myDatumAspect;
-  Standard_Boolean              myHasOwnDatumAspect;
-  Handle(Prs3d_LineAspect)      mySectionAspect;
-  Standard_Boolean              myHasOwnSectionAspect;
-
-  Handle(Prs3d_LineAspect)      myFreeBoundaryAspect;
-  Standard_Boolean              myHasOwnFreeBoundaryAspect;
-  Standard_Boolean              myFreeBoundaryDraw;
-  Standard_Boolean              myHasOwnFreeBoundaryDraw;
-  Handle(Prs3d_LineAspect)      myUnFreeBoundaryAspect;
-  Standard_Boolean              myHasOwnUnFreeBoundaryAspect;
-  Standard_Boolean              myUnFreeBoundaryDraw;
-  Standard_Boolean              myHasOwnUnFreeBoundaryDraw;
-  Handle(Prs3d_LineAspect)      myFaceBoundaryAspect;
-  Standard_Integer              myFaceBoundaryUpperContinuity; //!< the most edge continuity class (GeomAbs_Shape) to be included to face boundaries presentation, or -1 if undefined
-  Standard_Boolean              myHasOwnFaceBoundaryAspect;
-  Standard_Boolean              myFaceBoundaryDraw;
-  Standard_Boolean              myHasOwnFaceBoundaryDraw;
-
-  Handle(Prs3d_DimensionAspect) myDimensionAspect;
-  Standard_Boolean              myHasOwnDimensionAspect;
-  Prs3d_DimensionUnits          myDimensionModelUnits;
-  Standard_Boolean              myHasOwnDimLengthModelUnits;
-  Standard_Boolean              myHasOwnDimAngleModelUnits;
-  Prs3d_DimensionUnits          myDimensionDisplayUnits;
-  Standard_Boolean              myHasOwnDimLengthDisplayUnits;
-  Standard_Boolean              myHasOwnDimAngleDisplayUnits;
-  */
+  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);
-  if (!myFillCappingAspect.IsNull())
-    OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFillCappingAspect.get());
+  //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFillCappingAspect.get());
 }
index 4a36e19b8fa386e813f42d68b422e2620b2931d5..f1a0bfdc92aa4a7ebe61929399050d3e5458fabc 100644 (file)
@@ -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 << ", ";
 }
 
@@ -104,9 +104,17 @@ Standard_Boolean Standard_Dump::ProcessStreamName (const Standard_SStream& theSt
   TCollection_AsciiString aText = Text (theStream);
   if (aText.IsEmpty())
     return Standard_False;
-  TCollection_AsciiString aSubText = aText.SubString (theStreamPos, aText.Length());
 
-  TCollection_AsciiString aKeyName = theName + JsonKeyToString (Standard_JsonKey_SeparatorKeyToValue);
+  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();
@@ -122,14 +130,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 +151,15 @@ Standard_Boolean Standard_Dump::InitRealValues (const Standard_SStream& theStrea
     if (!aValueText.IsRealValue())
       return Standard_False;
 
-    va_arg(vl, Standard_Real) = aValueText.RealValue();
+    Standard_Real aVal = 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;
 }
@@ -461,7 +472,7 @@ Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString&
       Standard_Integer aCloseIndex2 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_SeparatorValueToValue) - 1;
       aCloseIndex = aCloseIndex1 < aCloseIndex2 ? aCloseIndex1 : aCloseIndex2;
 
-      aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex);
+      aSplitValue = aStartIndex <= aCloseIndex ? theStreamStr.SubString (aStartIndex, aCloseIndex) : "";
       theNextIndex = aCloseIndex + 1;
     }
     break;
index c4f46ef4f0a32014f2f1d81243753bacb4e81094..52dfbae3f2f1562da09bd0ce9bd50a08e8ff4c65 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.
@@ -90,16 +90,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); \
+    (theField)->DumpJson (aFieldStream, theDepth - 1); \
     const char* 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 +154,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.
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 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..5c0c7a22d49e271ebdc696bc97422f3ee482faf1 100644 (file)
@@ -86,8 +86,19 @@ 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)
+{
+  gp_XYZ& anXYZLoc = loc.ChangeCoord();
+  OCCT_INIT_VECTOR_CLASS (theSStream, Location, theStreamPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
+  gp_XYZ aDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, Direction, theStreamPos, 3, &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
+  SetDirection (aDir);
+
+  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 7ae671a26a490a06ee22bab7015934436ca910f0..874f0704e9acbcc69a7c958711eeeef32de7dad1 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)
+{
+  gp_XYZ anXYZLoc;
+  OCCT_INIT_VECTOR_CLASS (theSStream, Location, theStreamPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
+  SetLocation (anXYZLoc);
+
+  gp_XYZ aDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, Direction, theStreamPos, 3, &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
+  gp_XYZ aXDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, XDirection, theStreamPos, 3, &aXDir.ChangeCoord (1), &aXDir.ChangeCoord (2), &aXDir.ChangeCoord (3))
+  gp_XYZ anYDir;
+  OCCT_INIT_VECTOR_CLASS (theSStream, YDirection, theStreamPos, 3, &anYDir.ChangeCoord (1), &anYDir.ChangeCoord (2), &anYDir.ChangeCoord (3))
+
+  SetXDirection (aXDir);
+  SetYDirection (anYDir);
+
+  if (!Direction().IsEqual (aDir, Precision::Confusion()))
+    return Standard_False;
+
+  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..f6bc02f41c5e6d6aaf0ffc0c1accb6bcb8047e5b 100644 (file)
@@ -142,5 +142,11 @@ 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)
+{
+  OCCT_INIT_VECTOR_CLASS (theSStream, gp_Dir, theStreamPos, 3, &coord.ChangeCoord (1), &coord.ChangeCoord (2), &coord.ChangeCoord (3))
+  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..6d0e017a3ff3869a2e49346757f8d010adbc6f1f 100644 (file)
@@ -88,5 +88,10 @@ 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)
+{
+  OCCT_INIT_VECTOR_CLASS (theSStream, gp_Pnt, theStreamPos, 3, &coord.ChangeCoord (1), &coord.ChangeCoord (2), &coord.ChangeCoord (3))
 }
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 aaf9a3e5363d9a40fc39e1d0ab979e21ecc19f2a..9d612643c06510096a048a82d29be5478a11a0b0 100644 (file)
@@ -47,30 +47,8 @@ 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();
-
-  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..061ed017c183c313176e6669e93fee6988a6a1d1 100644 (file)
 // commercial license or contractual agreement. 
 
 #include <inspector/Convert_Tools.hxx>
+#include <inspector/Convert_TransientShape.hxx>
 
+#include <AIS_Plane.hxx>
+#include <Geom_Plane.hxx>
+#include <Prs3d_PlaneAspect.hxx>
 #include <TColgp_Array1OfPnt.hxx>
 #include <Standard_Dump.hxx>
 #include <BRep_Builder.hxx>
 #include <BRepBuilderAPI_MakeEdge.hxx>
 #include <BRepBuilderAPI_MakeVertex.hxx>
 
+//=======================================================================
+//function : CreateShape
+//purpose  :
+//=======================================================================
+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_Ax3 aPln;
+  if (aPln.InitJson (theSStream, aStartPos))
+  {
+    Handle(Geom_Plane) aGeomPlane = new Geom_Plane (aPln);
+    Handle(AIS_Plane) aPlanePrs = new AIS_Plane (aGeomPlane);
+
+    // 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);
+    return;
+  }
+}
+
 //=======================================================================
 //function : CreateShape
 //purpose  :
index ecce1fdc5f72569e3f6fe5fa32726a2df1d7fba1..763392f1302786b5b5fb960101be71ee364eda76 100644 (file)
@@ -22,6 +22,7 @@
 #include <gp_XYZ.hxx>
 #include <Bnd_Box.hxx>
 #include <Bnd_OBB.hxx>
+#include <NCollection_List.hxx>
 #include <Standard.hxx>
 #include <Standard_Macro.hxx>
 #include <TColgp_HArray1OfPnt.hxx>
@@ -29,6 +30,7 @@
 #include <TCollection_AsciiString.hxx>
 #include <TopLoc_Location.hxx>
 #include <TopoDS_Shape.hxx> 
+#include <Standard_SStream.hxx>
 
 #include <Standard_WarningsDisable.hxx>
 #include <QString>
@@ -42,6 +44,14 @@ 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 add 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);
+
   //! Creates box shape
   //! \param theBoundingBox box shape parameters
   //! \return created shape
index 03115c1a2f0faadc5712eff47a6fab2b7e71681a..d586f84b1a1860c0e4a8620e72bb73eaf759509d 100644 (file)
@@ -347,6 +347,20 @@ 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_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);
+  }
   // Bnd_Box
   {
     Bnd_Box aBox (gp_Pnt (20., 15., 10.), gp_Pnt (25., 20., 15.));
index 69fda2984032e4746c6ab0709359a237bbdc3046..217dc83e938e60b9eb7bdfc221a4704d5f4b7a44 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);
@@ -363,6 +365,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 +412,7 @@ void MessageView_Window::addReport (const Handle(Message_Report)& theReport,
 }
 
 // =======================================================================
-// function : onTreeViewSelectionChanged
+// function : onTreeViewVisibilityClicked
 // purpose :
 // =======================================================================
 void MessageView_Window::onTreeViewVisibilityClicked(const QModelIndex& theIndex)
@@ -444,21 +447,17 @@ void MessageView_Window::onTreeViewSelectionChanged (const QItemSelection&, cons
     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 ();
+    Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->Properties ();
     if (anItemProperties)
+    {
       anItemProperties->GetPresentations (-1, -1, aPresentations);
+    }
 
     MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
-    if (!anAlertItem)
-      continue;
-    anAlertItem->GetPresentations (aPresentations);
+    if (anAlertItem)
+    {
+      anAlertItem->GetPresentations (aPresentations);
+    }
   }
   updatePreviewPresentation (aPresentations);
 }
@@ -729,10 +728,10 @@ void MessageView_Window::updatePropertyPanelBySelection()
     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();
@@ -753,66 +752,6 @@ void MessageView_Window::updatePreviewPresentation (const NCollection_List<Handl
   if (aContext.IsNull())
     return;
 
-  if (!myPreviewPresentations.IsEmpty())
-  {
-    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();
-
-  myPreviewPresentations = thePresentations;
-  if (myPreviewPresentations.IsEmpty())
-    return;
-
-  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(Convert_TransientShape) aShapeObject = Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value());
-      aBuilder.Add (aCompound, aShapeObject->GetShape());
-    }
-  }
-
-  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
-    {
-      Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
-      //myPreviewPresentation->SetTransformPersistence(thePersistent);
-      if (!aContext.IsNull() && myPreviewPresentation->GetContext() == aContext)
-        aContext->Redisplay (myPreviewPresentation, Standard_True);
-    }
-  }
+  myDisplayPreview->SetContext (aContext);
+  myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, thePresentations);
 }
index 6ff19ed309de32f1d00247932556c9c79306dde2..0c51aafb9dba864020ec10c41ebb979a6eca3152 100644 (file)
@@ -40,6 +40,7 @@
 
 class View_Window;
 
+class View_DisplayPreview;
 class ViewControl_PropertyView;
 class MessageModel_ReportCallBack;
 
@@ -172,6 +173,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 +183,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..012fe5bbae15337413550f0e7e50fc8fba9b3acd 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();
 }
 
@@ -131,6 +137,23 @@ void TreeModel_ItemBase::Init()
     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();
index a784548c88086bbd59209d8c888ea068075b7f2b..fa05e205e858dce1b56f23e213b8316157cdbab5 100644 (file)
@@ -36,6 +36,7 @@
 #include <Standard_WarningsRestore.hxx>
 
 class TreeModel_ItemBase;
+class TreeModel_ItemProperties;
 
 typedef QExplicitlySharedDataPointer<TreeModel_ItemBase> TreeModel_ItemBasePtr;
 
@@ -145,6 +146,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 +183,9 @@ protected:
   //! \return the value
   Standard_EXPORT virtual QVariant initValue (const int theItemRole) const;
 
+protected:
+  Handle(TreeModel_ItemProperties) myProperties; //!< the properties
+
 private:
 
   typedef QHash< QPair<int, int>, TreeModel_ItemBasePtr > PositionToItemHash;
index 8ccd2d6f11e29764780955b8df22aafb689b3d31..40d76308962bf2b0c718450b4cc6495100f1cdd1 100644 (file)
@@ -14,6 +14,7 @@
 // commercial license or contractual agreement. 
 
 #include <inspector/TreeModel_ItemProperties.hxx>
+#include <inspector/Convert_Tools.hxx>
 #include <inspector/Convert_TransientShape.hxx>
 
 #include <BRepBuilderAPI_MakeVertex.hxx>
@@ -88,6 +89,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;
   }
 
index 17cda16e6035e05fbfe226fc5b2647e0eac36b42..a84dbde9d6acb6b86a91478f1517f4e3aaaea11e 100644 (file)
@@ -93,7 +93,6 @@ void TreeModel_ItemStream::Reset()
   myKey = "";
   myStreamValue = "";
 
-  myProperties->Reset();
   myChildren.Clear();
 
   TreeModel_ItemBase::Reset();
index 9581d4e7479f94d669b8f12578d31b043be33ed4..14560f8fe7ccf35e3c68815ea1de353ad0bcb791 100644 (file)
@@ -73,9 +73,6 @@ public:
   const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& GetChildren() const
     { initItem(); return myChildren; }
 
-  //! Returns the item properties
-  Handle(TreeModel_ItemProperties) Properties() const { return myProperties; }
-
   //! Returns stream value of the item to fulfill property panel.
   //! \return stream value or dummy
   virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
@@ -103,7 +100,6 @@ 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
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 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 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 c2bd8ed934a233f525d324c351b29f94f7f9ca81..3f2e9fd561019e4dffef65dccf24823008fc48b7 100644 (file)
@@ -1237,7 +1237,8 @@ Handle(AIS_InteractiveContext) VInspector_Window::createView()
   Handle(AIS_InteractiveContext) aContext = View_Viewer::CreateStandardViewer();
 
   Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY()));
-  aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
+  aTrihedron->SetSize (0.5);
+  //aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
   aContext->Display (aTrihedron, Standard_True);
 
   myViewWindow = new View_Window (0, aContext, false /*for opening several BREP files*/, true);
index 7e4395a7ab859d8cf3dcc3d26b97057551389803..1426508137bda82dcb2d88eb8fd32853ff47edf9 100644 (file)
 #include <BRepBuilderAPI_MakeFace.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 +70,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 +84,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);
+    }
   }
 }
 
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..49f1053ceb583740b048cbca64f881a700c7a398 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);
index 1ebff8d129924bae98efb60622fa7d811f22ad59..b9c09b767b577dde2ca97c4509c0ea917e94081f 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 :
index dca417ba0559cae58b9d07e8398230d66e8d70ea..a1dbf302ad2fd9752dab7285f149f444f697f46a 100644 (file)
@@ -60,6 +60,10 @@ 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;