From f79490a6af7f9d83100e9c94f19c167bb991cb7e Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 17 Sep 2019 01:32:38 +0300 Subject: [PATCH] 0030949: Foundation Classes - Dump improvement for OCCT classes --- src/AIS/AIS_InteractiveObject.cxx | 8 + src/AIS/AIS_InteractiveObject.hxx | 2 + src/BRepTest/BRepTest_BasicCommands.cxx | 27 +- src/BVH/BVH_Box.hxx | 10 + src/BVH/BVH_Tree.hxx | 33 ++ src/BVH/BVH_Types.hxx | 28 ++ src/Bnd/Bnd_Box.cxx | 32 ++ src/Bnd/Bnd_Box.hxx | 10 + src/Bnd/Bnd_OBB.cxx | 19 ++ src/Bnd/Bnd_OBB.hxx | 4 + src/Bnd/Bnd_Range.cxx | 14 +- src/Bnd/Bnd_Range.hxx | 3 + src/Graphic3d/FILES | 1 + src/Graphic3d/Graphic3d_Aspects.cxx | 50 ++++ src/Graphic3d/Graphic3d_Aspects.hxx | 3 + src/Graphic3d/Graphic3d_Group.cxx | 15 + src/Graphic3d/Graphic3d_Group.hxx | 3 + src/Graphic3d/Graphic3d_PolygonOffset.cxx | 29 ++ src/Graphic3d/Graphic3d_PolygonOffset.hxx | 5 + src/OpenGl/OpenGl_Aspects.cxx | 16 + src/OpenGl/OpenGl_Aspects.hxx | 3 + src/OpenGl/OpenGl_Group.cxx | 18 ++ src/OpenGl/OpenGl_Group.hxx | 3 + src/Prs3d/Prs3d_ArrowAspect.cxx | 15 + src/Prs3d/Prs3d_ArrowAspect.hxx | 3 + src/Prs3d/Prs3d_BasicAspect.hxx | 5 + src/Prs3d/Prs3d_DatumAspect.cxx | 24 ++ src/Prs3d/Prs3d_DatumAspect.hxx | 3 + src/Prs3d/Prs3d_DimensionAspect.cxx | 25 ++ src/Prs3d/Prs3d_DimensionAspect.hxx | 3 + src/Prs3d/Prs3d_Drawer.cxx | 12 + src/Prs3d/Prs3d_Drawer.hxx | 3 + src/Prs3d/Prs3d_LineAspect.cxx | 13 + src/Prs3d/Prs3d_LineAspect.hxx | 3 + src/Prs3d/Prs3d_PlaneAspect.cxx | 26 ++ src/Prs3d/Prs3d_PlaneAspect.hxx | 3 + src/Prs3d/Prs3d_PointAspect.cxx | 13 + src/Prs3d/Prs3d_PointAspect.hxx | 3 + src/Prs3d/Prs3d_ShadingAspect.cxx | 13 + src/Prs3d/Prs3d_ShadingAspect.hxx | 3 + src/Prs3d/Prs3d_TextAspect.cxx | 19 ++ src/Prs3d/Prs3d_TextAspect.hxx | 3 + src/PrsMgr/PrsMgr_PresentableObject.cxx | 36 +++ src/PrsMgr/PrsMgr_PresentableObject.hxx | 3 + src/Quantity/Quantity_Color.cxx | 14 + src/Quantity/Quantity_Color.hxx | 3 + src/Quantity/Quantity_ColorRGBA.cxx | 13 + src/Quantity/Quantity_ColorRGBA.hxx | 3 + src/SelectMgr/SelectMgr_BaseFrustum.cxx | 18 ++ src/SelectMgr/SelectMgr_BaseFrustum.hxx | 5 + src/SelectMgr/SelectMgr_EntityOwner.cxx | 14 + src/SelectMgr/SelectMgr_EntityOwner.hxx | 3 + src/SelectMgr/SelectMgr_SelectableObject.cxx | 21 ++ src/SelectMgr/SelectMgr_SelectableObject.hxx | 3 + src/SelectMgr/SelectMgr_ViewClipRange.cxx | 15 + src/SelectMgr/SelectMgr_ViewClipRange.hxx | 5 + src/SelectMgr/SelectMgr_ViewerSelector.cxx | 24 ++ src/SelectMgr/SelectMgr_ViewerSelector.hxx | 3 + src/Standard/FILES | 2 + src/Standard/Standard_Dump.cxx | 298 +++++++++++++++++++ src/Standard/Standard_Dump.hxx | 210 +++++++++++++ src/TopLoc/TopLoc_Datum3D.cxx | 12 + src/TopLoc/TopLoc_Datum3D.hxx | 3 + src/TopLoc/TopLoc_ItemLocation.cxx | 14 + src/TopLoc/TopLoc_ItemLocation.hxx | 4 + src/TopLoc/TopLoc_Location.cxx | 23 ++ src/TopLoc/TopLoc_Location.hxx | 3 + src/TopoDS/TopoDS_Shape.cxx | 14 + src/TopoDS/TopoDS_Shape.hxx | 3 + src/TopoDS/TopoDS_TShape.cxx | 14 + src/TopoDS/TopoDS_TShape.hxx | 3 + src/ViewerTest/ViewerTest.cxx | 25 +- src/XCAFPrs/XCAFPrs_Style.cxx | 18 ++ src/XCAFPrs/XCAFPrs_Style.hxx | 3 + src/gp/gp_Mat.cxx | 17 ++ src/gp/gp_Mat.hxx | 3 + src/gp/gp_Trsf.cxx | 16 + src/gp/gp_Trsf.hxx | 4 + src/gp/gp_XYZ.cxx | 17 ++ src/gp/gp_XYZ.hxx | 5 + tests/bugs/modalg_7/bug29311_15 | 2 +- tests/bugs/vis/bug30949 | 20 ++ 82 files changed, 1436 insertions(+), 8 deletions(-) create mode 100644 src/Graphic3d/Graphic3d_PolygonOffset.cxx create mode 100644 src/Standard/Standard_Dump.cxx create mode 100644 src/Standard/Standard_Dump.hxx create mode 100644 tests/bugs/vis/bug30949 diff --git a/src/AIS/AIS_InteractiveObject.cxx b/src/AIS/AIS_InteractiveObject.cxx index 078bdc3c9a..fc76106d79 100644 --- a/src/AIS/AIS_InteractiveObject.cxx +++ b/src/AIS/AIS_InteractiveObject.cxx @@ -144,3 +144,11 @@ void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& theAspect aGroup->SetGroupPrimitivesAspect (aTextAspect->Aspect()); } } + +void AIS_InteractiveObject::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (AIS_InteractiveObject)); + DUMP_FIELD_VALUES_PARENT (theOStream, SelectMgr_SelectableObject); + DUMP_FIELD_VALUES_POINTER (theOStream, myCTXPtr); + DUMP_FIELD_VALUES_POINTER (theOStream, myOwner); +} diff --git a/src/AIS/AIS_InteractiveObject.hxx b/src/AIS/AIS_InteractiveObject.hxx index 4ca80616ed..fb1766e350 100644 --- a/src/AIS/AIS_InteractiveObject.hxx +++ b/src/AIS/AIS_InteractiveObject.hxx @@ -118,6 +118,8 @@ public: Standard_DEPRECATED("Deprecated method, results might be undefined") Standard_EXPORT void SetAspect (const Handle(Prs3d_BasicAspect)& anAspect); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; protected: //! The TypeOfPresention3d means that the interactive object diff --git a/src/BRepTest/BRepTest_BasicCommands.cxx b/src/BRepTest/BRepTest_BasicCommands.cxx index eb913e11ee..7d2e6a191a 100644 --- a/src/BRepTest/BRepTest_BasicCommands.cxx +++ b/src/BRepTest/BRepTest_BasicCommands.cxx @@ -55,6 +55,9 @@ #include #include #include + +#include + #include Standard_IMPORT Draw_Viewer dout; @@ -498,6 +501,7 @@ static Standard_Integer BoundBox(Draw_Interpretor& theDI, Bnd_Box anAABB; Standard_Boolean doPrint = Standard_False; + Standard_Boolean doDump = Standard_False; Standard_Boolean useOldSyntax = Standard_False; Standard_Boolean isOBB = Standard_False; Standard_Boolean isTriangulationReq = Standard_True; @@ -527,11 +531,14 @@ static Standard_Integer BoundBox(Draw_Interpretor& theDI, aResShapeName = theArgVal[++anArgIter]; hasToDraw = Standard_False; } - else if (anArgCase == "-dump" - || anArgCase == "-print") + else if (anArgCase == "-print") { doPrint = Standard_True; } + else if (anArgCase == "-dump") + { + doDump = Standard_True; + } else if (anArgCase == "-save" && anArgIter + 6 < theNArg && anOutVars[0].IsEmpty()) @@ -601,7 +608,7 @@ static Standard_Integer BoundBox(Draw_Interpretor& theDI, } // enable printing (old syntax) if neither saving to shape nor to DRAW variables is requested - if (! doPrint && anOutVars[0].IsEmpty() && aResShapeName.IsEmpty()) + if (! doPrint && ! doDump && anOutVars[0].IsEmpty() && aResShapeName.IsEmpty()) { doPrint = Standard_True; useOldSyntax = Standard_True; @@ -636,6 +643,15 @@ static Standard_Integer BoundBox(Draw_Interpretor& theDI, << "Half Z: " << anOBB.ZHSize() << "\n"; } + if (doDump) + { + Standard_SStream aStream; + anOBB.Dump (aStream); + + theDI << "Oriented bounding box\n"; + theDI << Standard_Dump::ConvertDumpToText (aStream); + } + if (hasToDraw && !anOBB.IsVoid()) { @@ -1475,7 +1491,7 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands) theCommands.Add ("bounding", "bounding {shape | xmin ymin zmin xmax ymax zmax}" "\n\t\t: [-obb] [-noTriangulation] [-optimal] [-extToler]" - "\n\t\t: [-dump] [-shape name] [-nodraw] [-finitePart]" + "\n\t\t: [-dump] [-print] [-shape name] [-nodraw] [-finitePart]" "\n\t\t: [-save xmin ymin zmin xmax ymax zmax]" "\n\t\t:" "\n\t\t: Computes a bounding box. Two types of the source data are supported:" @@ -1492,9 +1508,10 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands) "\n\t\t: -extToler Include tolerance of the shape in the resulting box." "\n\t\t:" "\n\t\t: Output options:" - "\n\t\t: -dump Prints the information about computed Bounding Box." + "\n\t\t: -print Prints the information about computed Bounding Box." "\n\t\t: It is enabled by default (with plain old syntax for AABB)" "\n\t\t: if neither -shape nor -save is specified." + "\n\t\t: -dump Prints Dump information about Bounding Box." "\n\t\t: -shape Stores computed box as solid in DRAW variable with specified name." "\n\t\t: -save Stores min and max coordinates of AABB in specified variables." "\n\t\t: -noDraw Avoid drawing resulting Bounding Box in DRAW viewer." diff --git a/src/BVH/BVH_Box.hxx b/src/BVH/BVH_Box.hxx index 920c278a41..850fe7860c 100644 --- a/src/BVH/BVH_Box.hxx +++ b/src/BVH/BVH_Box.hxx @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -108,6 +109,15 @@ public: //! Returns center of bounding box along the given axis. T Center (const Standard_Integer theAxis) const; + //! Dumps the content of me into the stream + void Dump (Standard_OStream& theOStream) const + { + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (BVH_Box)); + DUMP_FIELD_VALUES (theOStream, IsValid()); + Bnd_Box aBndBox = BVH::ToBndBox (CornerMin(), CornerMax()); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &aBndBox); + } + public: //! Checks if the Box is out of the other box. diff --git a/src/BVH/BVH_Tree.hxx b/src/BVH/BVH_Tree.hxx index a223d14b30..f9f89dbd21 100644 --- a/src/BVH/BVH_Tree.hxx +++ b/src/BVH/BVH_Tree.hxx @@ -27,6 +27,11 @@ class BVH_TreeBaseTransient : public Standard_Transient DEFINE_STANDARD_RTTIEXT(BVH_TreeBaseTransient, Standard_Transient) protected: BVH_TreeBaseTransient() {} + //! Dumps the content of me into the stream + virtual void Dump (Standard_OStream& theOStream) const { (void)theOStream; } + //! Dumps the content of me into the stream + virtual void DumpNode (const int theNodeIndex, Standard_OStream& theOStream) const + { (void)theNodeIndex; (void)theOStream; } }; //! Stores parameters of bounding volume hierarchy (BVH). @@ -178,6 +183,34 @@ public: //! @name methods for accessing serialized tree data return myMaxPointBuffer; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE + { + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (BVH_TreeBase)); + DUMP_FIELD_VALUES (theOStream, myDepth); + DUMP_FIELD_VALUES (theOStream, Length()); + + for (Standard_Integer aNodeIdx = 0; aNodeIdx < Length(); ++aNodeIdx) + { + DumpNode (aNodeIdx, theOStream); + } + } + + //! Dumps the content of node into the stream + Standard_EXPORT virtual void DumpNode (const int theNodeIndex, Standard_OStream& theOStream) const Standard_OVERRIDE + { + Standard_Dump::Sentry aSentry (theOStream, "BVH_TreeNode"); + DUMP_FIELD_VALUES (theOStream, theNodeIndex); + + Bnd_Box aBndBox = BVH::ToBndBox (MinPoint (theNodeIndex), MaxPoint (theNodeIndex)); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &aBndBox); + + DUMP_FIELD_VALUES (theOStream, BegPrimitive (theNodeIndex)); + DUMP_FIELD_VALUES (theOStream, EndPrimitive (theNodeIndex)); + DUMP_FIELD_VALUES (theOStream, Level (theNodeIndex)); + DUMP_FIELD_VALUES (theOStream, IsOuter (theNodeIndex)); + } + public: //! @name protected fields //! Array of node data records. diff --git a/src/BVH/BVH_Types.hxx b/src/BVH/BVH_Types.hxx index 6cbf7ae916..fcbc66bca1 100644 --- a/src/BVH/BVH_Types.hxx +++ b/src/BVH/BVH_Types.hxx @@ -21,10 +21,12 @@ #include +#include #include #include #include #include +#include #include // GCC supports shrink function only in C++11 mode @@ -57,6 +59,32 @@ namespace BVH typedef NCollection_Vec3 Type; }; + template Bnd_Box ToBndBox (const T& theType1, const T& theType2) + { + return Bnd_Box (theType1, 0., 0., theType2, 0., 0.); + } + + template Bnd_Box ToBndBox (const NCollection_Vec2& theType1, + const NCollection_Vec2& theType2) + { + return Bnd_Box (theType1.x(), theType1.y(), 0., + theType2.x(), theType2.y(), 0.); + } + + template Bnd_Box ToBndBox (const NCollection_Vec3& theType1, + const NCollection_Vec3& theType2) + { + return Bnd_Box (theType1.x(), theType1.y(), theType1.z(), + theType2.x(), theType2.y(), theType2.z()); + } + + template Bnd_Box ToBndBox (const NCollection_Vec4& theType1, + const NCollection_Vec4& theType2) + { + return Bnd_Box (theType1.x(), theType1.y(), theType1.z(), + theType2.x(), theType2.y(), theType2.z()); + } + template struct VectorType { typedef NCollection_Vec4 Type; diff --git a/src/Bnd/Bnd_Box.cxx b/src/Bnd/Bnd_Box.cxx index 1b4ab44b53..e82f372171 100644 --- a/src/Bnd/Bnd_Box.cxx +++ b/src/Bnd/Bnd_Box.cxx @@ -21,6 +21,7 @@ #include #include #include +#include // set the flag to one #define ClearVoidFlag() ( Flags &= ~VoidMask ) @@ -43,6 +44,19 @@ Bnd_Box::Bnd_Box() SetVoid(); } +//======================================================================= +//function : Bnd_Box +//purpose : +//======================================================================= +Bnd_Box::Bnd_Box (const Standard_Real theXmin, const Standard_Real theYmin, const Standard_Real theZmin, + const Standard_Real theXmax, const Standard_Real theYmax, const Standard_Real theZmax) +: Gap (0.0) +{ + SetVoid(); + Update (theXmin, theYmin, theZmin, theXmax, theYmax, theZmax); +} + + //======================================================================= //function : Set //purpose : @@ -957,3 +971,21 @@ void Bnd_Box::Dump () const std::cout << "\n Gap : " << Gap; std::cout << "\n"; } + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void Bnd_Box::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Bnd_Box)); + + DUMP_FIELD_VALUES (theOStream, Xmin); + DUMP_FIELD_VALUES (theOStream, Ymin); + DUMP_FIELD_VALUES (theOStream, Zmin); + DUMP_FIELD_VALUES (theOStream, Xmax); + DUMP_FIELD_VALUES (theOStream, Ymax); + DUMP_FIELD_VALUES (theOStream, Zmax); + DUMP_FIELD_VALUES (theOStream, Gap); + DUMP_FIELD_VALUES (theOStream, Flags); +} diff --git a/src/Bnd/Bnd_Box.hxx b/src/Bnd/Bnd_Box.hxx index 834338f5bf..3e0ec9724b 100644 --- a/src/Bnd/Bnd_Box.hxx +++ b/src/Bnd/Bnd_Box.hxx @@ -69,6 +69,13 @@ public: //! The constructed box is qualified Void. Its gap is null. Standard_EXPORT Bnd_Box(); + //! Creates a bounding box, it contains: + //! - interval [ aXmin,aXmax ] in the "X Direction", + //! - interval [ aYmin,aYmax ] in the "Y Direction", + //! - interval [ aZmin,aZmax ] in the "Z Direction"; + //! The constructed box is qualified Void. Its gap is null. + Standard_EXPORT Bnd_Box (const Standard_Real aXmin, const Standard_Real aYmin, const Standard_Real aZmin, + const Standard_Real aXmax, const Standard_Real aYmax, const Standard_Real aZmax); //! Sets this bounding box so that it covers the whole of 3D space. //! It is infinitely long in all directions. void SetWhole() { Flags = WholeMask; } @@ -296,6 +303,9 @@ public: && Xmax >= Xmin; } + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + protected: //! Bit flags. diff --git a/src/Bnd/Bnd_OBB.cxx b/src/Bnd/Bnd_OBB.cxx index 0120cfe1de..fd9805706c 100644 --- a/src/Bnd/Bnd_OBB.cxx +++ b/src/Bnd/Bnd_OBB.cxx @@ -24,6 +24,7 @@ #include #include +#include #include //! Auxiliary class to select from the points stored in @@ -992,3 +993,21 @@ void Bnd_OBB::Add(const Bnd_OBB& theOther) ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15)); } +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void Bnd_OBB::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Bnd_OBB)); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myCenter); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &XDirection()); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &YDirection()); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &ZDirection()); + + DUMP_FIELD_VALUES (theOStream, XHSize()); + DUMP_FIELD_VALUES (theOStream, YHSize()); + DUMP_FIELD_VALUES (theOStream, ZHSize()); + DUMP_FIELD_VALUES (theOStream, myIsAABox); +} diff --git a/src/Bnd/Bnd_OBB.hxx b/src/Bnd/Bnd_OBB.hxx index ffed615cca..de3c0e533c 100644 --- a/src/Bnd/Bnd_OBB.hxx +++ b/src/Bnd/Bnd_OBB.hxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -281,6 +282,9 @@ public: //! (which it was created from) and theP. Standard_EXPORT void Add(const gp_Pnt& theP); + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + protected: void ProcessOnePoint(const gp_Pnt& theP) diff --git a/src/Bnd/Bnd_Range.cxx b/src/Bnd/Bnd_Range.cxx index 63d0961343..f5bdc81da9 100644 --- a/src/Bnd/Bnd_Range.cxx +++ b/src/Bnd/Bnd_Range.cxx @@ -15,6 +15,7 @@ #include +#include //======================================================================= //function : Common @@ -174,4 +175,15 @@ void Bnd_Range::Split(const Standard_Real theVal, { theList.Append(Bnd_Range(aValPrev, myLast)); } -} \ No newline at end of file +} +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Bnd_Range::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Bnd_Range)); + + DUMP_FIELD_VALUES (theOStream, myFirst); + DUMP_FIELD_VALUES (theOStream, myLast); +} diff --git a/src/Bnd/Bnd_Range.hxx b/src/Bnd/Bnd_Range.hxx index 0c006d27d9..cf07eef1fd 100644 --- a/src/Bnd/Bnd_Range.hxx +++ b/src/Bnd/Bnd_Range.hxx @@ -256,6 +256,9 @@ public: return ((myFirst == theOther.myFirst) && (myLast == theOther.myLast)); } + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + private: Standard_Real myFirst; //!< Start of range diff --git a/src/Graphic3d/FILES b/src/Graphic3d/FILES index 1a2c358d67..31fb75226d 100755 --- a/src/Graphic3d/FILES +++ b/src/Graphic3d/FILES @@ -112,6 +112,7 @@ Graphic3d_NameOfTexture2D.hxx Graphic3d_NameOfTextureEnv.hxx Graphic3d_NameOfTexturePlane.hxx Graphic3d_NMapOfTransient.hxx +Graphic3d_PolygonOffset.cxx Graphic3d_PolygonOffset.hxx Graphic3d_PriorityDefinitionError.hxx Graphic3d_RenderingMode.hxx diff --git a/src/Graphic3d/Graphic3d_Aspects.cxx b/src/Graphic3d/Graphic3d_Aspects.cxx index b8d12a4937..a3dc1e5f0d 100644 --- a/src/Graphic3d/Graphic3d_Aspects.cxx +++ b/src/Graphic3d/Graphic3d_Aspects.cxx @@ -12,6 +12,7 @@ // commercial license or contractual agreement. #include +#include IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Aspects, Standard_Transient) @@ -60,3 +61,52 @@ void Graphic3d_Aspects::SetTextureMap (const Handle(Graphic3d_TextureMap)& theTe myTextureSet = new Graphic3d_TextureSet (theTexture); } + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void Graphic3d_Aspects::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (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; + */ + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myInteriorColor); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myBackInteriorColor); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myEdgeColor); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myPolygonOffset); + + + /*Aspect_InteriorStyle myInteriorStyle; + Graphic3d_TypeOfShadingModel myShadingModel; + Graphic3d_AlphaMode myAlphaMode; + Standard_ShortReal myAlphaCutoff; + + Aspect_TypeOfLine myLineType; + Standard_ShortReal myLineWidth; + + Aspect_TypeOfMarker myMarkerType; + Standard_ShortReal myMarkerScale; + + Aspect_TypeOfStyleText myTextStyle; + Aspect_TypeOfDisplayText myTextDisplayType; + Font_FontAspect myTextFontAspect; + Standard_ShortReal myTextAngle; + */ + + DUMP_FIELD_VALUES (theOStream, myToSkipFirstEdge); + DUMP_FIELD_VALUES (theOStream, myToDistinguishMaterials); + DUMP_FIELD_VALUES (theOStream, myToDrawEdges); + DUMP_FIELD_VALUES (theOStream, myToDrawSilhouette); + DUMP_FIELD_VALUES (theOStream, myToSuppressBackFaces); + DUMP_FIELD_VALUES (theOStream, myToMapTexture); + DUMP_FIELD_VALUES (theOStream, myIsTextZoomable); +} diff --git a/src/Graphic3d/Graphic3d_Aspects.hxx b/src/Graphic3d/Graphic3d_Aspects.hxx index 70aa6a2779..6bdb6e17a2 100644 --- a/src/Graphic3d/Graphic3d_Aspects.hxx +++ b/src/Graphic3d/Graphic3d_Aspects.hxx @@ -477,6 +477,9 @@ public: && myIsTextZoomable == theOther.myIsTextZoomable; } + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + protected: Handle(Graphic3d_ShaderProgram) myProgram; diff --git a/src/Graphic3d/Graphic3d_Group.cxx b/src/Graphic3d/Graphic3d_Group.cxx index 4e7966d60b..7f09e556b3 100644 --- a/src/Graphic3d/Graphic3d_Group.cxx +++ b/src/Graphic3d/Graphic3d_Group.cxx @@ -447,3 +447,18 @@ void Graphic3d_Group::AddText (const Handle(Graphic3d_Text)& theTextParams, Update(); } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Graphic3d_Group::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Graphic3d_Group)); + + //Graphic3d_Structure* myStructure; //!< pointer to the parent structure + //Graphic3d_BndBox4f myBounds; //!< bounding box + + DUMP_FIELD_VALUES (theOStream, myIsClosed); + DUMP_FIELD_VALUES (theOStream, myContainsFacet); +} diff --git a/src/Graphic3d/Graphic3d_Group.hxx b/src/Graphic3d/Graphic3d_Group.hxx index 289e0139e8..edf18ad6ed 100644 --- a/src/Graphic3d/Graphic3d_Group.hxx +++ b/src/Graphic3d/Graphic3d_Group.hxx @@ -280,6 +280,9 @@ public: const Standard_Boolean theHasOwnAnchor = Standard_True); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const; + protected: //! Creates a group in the structure . diff --git a/src/Graphic3d/Graphic3d_PolygonOffset.cxx b/src/Graphic3d/Graphic3d_PolygonOffset.cxx new file mode 100644 index 0000000000..555134ccc4 --- /dev/null +++ b/src/Graphic3d/Graphic3d_PolygonOffset.cxx @@ -0,0 +1,29 @@ +// Copyright (c) 2016 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void Graphic3d_PolygonOffset::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Graphic3d_PolygonOffset)); + + DUMP_FIELD_VALUES (theOStream, Mode); + DUMP_FIELD_VALUES (theOStream, Factor); + DUMP_FIELD_VALUES (theOStream, Units); +} diff --git a/src/Graphic3d/Graphic3d_PolygonOffset.hxx b/src/Graphic3d/Graphic3d_PolygonOffset.hxx index 6bc5d09297..1e4bda9d2c 100644 --- a/src/Graphic3d/Graphic3d_PolygonOffset.hxx +++ b/src/Graphic3d/Graphic3d_PolygonOffset.hxx @@ -15,6 +15,7 @@ #define _Graphic3d_PolygonOffset_HeaderFile #include +#include //! Polygon offset parameters. struct Graphic3d_PolygonOffset @@ -33,6 +34,10 @@ struct Graphic3d_PolygonOffset && Factor == theOther.Factor && Units == theOther.Units; } + + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + }; #endif // _Graphic3d_PolygonOffset_HeaderFile diff --git a/src/OpenGl/OpenGl_Aspects.cxx b/src/OpenGl/OpenGl_Aspects.cxx index 13cf990279..a678aa9ae6 100644 --- a/src/OpenGl/OpenGl_Aspects.cxx +++ b/src/OpenGl/OpenGl_Aspects.cxx @@ -114,3 +114,19 @@ void OpenGl_Aspects::Release (OpenGl_Context* theContext) myResSprite.Release (theContext); myResProgram.Release (theContext); } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void OpenGl_Aspects::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (OpenGl_Aspects)); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myAspect); + DUMP_FIELD_VALUES (theOStream, myShadingModel); + + //mutable OpenGl_AspectsProgram myResProgram; + //mutable OpenGl_AspectsTextureSet myResTextureSet; + //mutable OpenGl_AspectsSprite myResSprite; +} diff --git a/src/OpenGl/OpenGl_Aspects.hxx b/src/OpenGl/OpenGl_Aspects.hxx index 9e881dfebc..a5c9813118 100644 --- a/src/OpenGl/OpenGl_Aspects.hxx +++ b/src/OpenGl/OpenGl_Aspects.hxx @@ -89,6 +89,9 @@ public: //! Update presentation aspects parameters after their modification. virtual void SynchronizeAspects() Standard_OVERRIDE { SetAspect (myAspect); } + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + protected: //! OpenGl resources diff --git a/src/OpenGl/OpenGl_Group.cxx b/src/OpenGl/OpenGl_Group.cxx index 1a9a3e9011..038b98abd0 100644 --- a/src/OpenGl/OpenGl_Group.cxx +++ b/src/OpenGl/OpenGl_Group.cxx @@ -353,3 +353,21 @@ void OpenGl_Group::Release (const Handle(OpenGl_Context)& theGlCtx) OpenGl_Element::Destroy (theGlCtx.get(), myAspects); } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void OpenGl_Group::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (OpenGl_Group)); + + DUMP_FIELD_VALUES_PARENT (theOStream, Graphic3d_Group); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myAspects); + //OpenGl_CappingPlaneResource* myAspectFillCapping; + //OpenGl_ElementNode* myFirst; + //OpenGl_ElementNode* myLast; + + DUMP_FIELD_VALUES (theOStream, myIsRaytracable); +} diff --git a/src/OpenGl/OpenGl_Group.hxx b/src/OpenGl/OpenGl_Group.hxx index 4f03f02b4b..b50db2d82d 100644 --- a/src/OpenGl/OpenGl_Group.hxx +++ b/src/OpenGl/OpenGl_Group.hxx @@ -111,6 +111,9 @@ public: //! Returns OpenGL capping filling aspect. const OpenGl_CappingPlaneResource* AspectFillCapping() const { return myAspectFillCapping; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + protected: Standard_EXPORT virtual ~OpenGl_Group(); diff --git a/src/Prs3d/Prs3d_ArrowAspect.cxx b/src/Prs3d/Prs3d_ArrowAspect.cxx index dcd3b0204c..a7471716d0 100644 --- a/src/Prs3d/Prs3d_ArrowAspect.cxx +++ b/src/Prs3d/Prs3d_ArrowAspect.cxx @@ -15,6 +15,7 @@ #include #include +#include IMPLEMENT_STANDARD_RTTIEXT(Prs3d_ArrowAspect, Prs3d_BasicAspect) @@ -65,3 +66,17 @@ void Prs3d_ArrowAspect::SetAngle (const Standard_Real theAngle) || theAngle >= M_PI / 2.0, "Prs3d_ArrowAspect::SetAngle() - angle out of range"); myAngle = theAngle; } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_ArrowAspect::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Prs3d_ArrowAspect)); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myArrowAspect); + + DUMP_FIELD_VALUES (theOStream, myAngle); + DUMP_FIELD_VALUES (theOStream, myLength); +} diff --git a/src/Prs3d/Prs3d_ArrowAspect.hxx b/src/Prs3d/Prs3d_ArrowAspect.hxx index 6489b5a0db..d060ff18da 100644 --- a/src/Prs3d/Prs3d_ArrowAspect.hxx +++ b/src/Prs3d/Prs3d_ArrowAspect.hxx @@ -57,6 +57,9 @@ public: void SetAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) { myArrowAspect = theAspect; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + protected: Handle(Graphic3d_AspectLine3d) myArrowAspect; diff --git a/src/Prs3d/Prs3d_BasicAspect.hxx b/src/Prs3d/Prs3d_BasicAspect.hxx index 7578c71a20..19c5541a2c 100644 --- a/src/Prs3d/Prs3d_BasicAspect.hxx +++ b/src/Prs3d/Prs3d_BasicAspect.hxx @@ -17,6 +17,7 @@ #define _Prs3d_BasicAspect_HeaderFile #include +#include #include #include @@ -25,6 +26,10 @@ class Prs3d_BasicAspect : public Standard_Transient { DEFINE_STANDARD_RTTIEXT(Prs3d_BasicAspect, Standard_Transient) + + //! Dumps the content of me into the stream + virtual void Dump (Standard_OStream& theOStream) const = 0; + }; DEFINE_STANDARD_HANDLE(Prs3d_BasicAspect, Standard_Transient) diff --git a/src/Prs3d/Prs3d_DatumAspect.cxx b/src/Prs3d/Prs3d_DatumAspect.cxx index 5afab0e8d7..398e96e467 100644 --- a/src/Prs3d/Prs3d_DatumAspect.cxx +++ b/src/Prs3d/Prs3d_DatumAspect.cxx @@ -14,6 +14,8 @@ #include +#include + IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect) // ======================================================================= @@ -167,3 +169,25 @@ Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis (Prs3d_DatumParts thePart) } return Prs3d_DP_None; } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_DatumAspect::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Prs3d_DatumAspect)); + + DUMP_FIELD_VALUES (theOStream, myAxes); + DUMP_FIELD_VALUES (theOStream, myToDrawLabels); + DUMP_FIELD_VALUES (theOStream, myToDrawArrows); + + //NCollection_DataMap myAttributes; + //NCollection_DataMap myShadedAspects; + //NCollection_DataMap myLineAspects; + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myTextAspect); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myPointAspect); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myArrowAspect); +} + diff --git a/src/Prs3d/Prs3d_DatumAspect.hxx b/src/Prs3d/Prs3d_DatumAspect.hxx index 69bb3c2ced..53a5a4ba1a 100644 --- a/src/Prs3d/Prs3d_DatumAspect.hxx +++ b/src/Prs3d/Prs3d_DatumAspect.hxx @@ -153,6 +153,9 @@ public: //! Returns type of arrow for a type of axis Standard_EXPORT Prs3d_DatumParts ArrowPartForAxis (Prs3d_DatumParts thePart) const; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + private: Prs3d_DatumAxes myAxes; Standard_Boolean myToDrawLabels; diff --git a/src/Prs3d/Prs3d_DimensionAspect.cxx b/src/Prs3d/Prs3d_DimensionAspect.cxx index 6e1141f9cd..7b1b54a9e4 100755 --- a/src/Prs3d/Prs3d_DimensionAspect.cxx +++ b/src/Prs3d/Prs3d_DimensionAspect.cxx @@ -16,6 +16,7 @@ #include #include +#include IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect) @@ -59,3 +60,27 @@ void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor) myTextAspect->SetColor (theColor); myArrowAspect->SetColor (theColor); } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_DimensionAspect::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Prs3d_DimensionAspect)); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myLineAspect); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myTextAspect); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myArrowAspect); + + DUMP_FIELD_VALUES (theOStream, myValueStringFormat); + DUMP_FIELD_VALUES (theOStream, myExtensionSize); + DUMP_FIELD_VALUES (theOStream, myArrowTailSize); + DUMP_FIELD_VALUES (theOStream, myArrowOrientation); + DUMP_FIELD_VALUES (theOStream, myTextHPosition); + DUMP_FIELD_VALUES (theOStream, myTextVPosition); + DUMP_FIELD_VALUES (theOStream, myToDisplayUnits); + DUMP_FIELD_VALUES (theOStream, myIsText3d); + DUMP_FIELD_VALUES (theOStream, myIsTextShaded); + DUMP_FIELD_VALUES (theOStream, myIsArrows3d); +} + diff --git a/src/Prs3d/Prs3d_DimensionAspect.hxx b/src/Prs3d/Prs3d_DimensionAspect.hxx index c6b80ac099..ceb8177edd 100644 --- a/src/Prs3d/Prs3d_DimensionAspect.hxx +++ b/src/Prs3d/Prs3d_DimensionAspect.hxx @@ -115,6 +115,9 @@ public: //! Returns format. const TCollection_AsciiString& ValueStringFormat() const { return myValueStringFormat; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + protected: Handle(Prs3d_LineAspect) myLineAspect; diff --git a/src/Prs3d/Prs3d_Drawer.cxx b/src/Prs3d/Prs3d_Drawer.cxx index dc1d3f810d..08d2375aca 100644 --- a/src/Prs3d/Prs3d_Drawer.cxx +++ b/src/Prs3d/Prs3d_Drawer.cxx @@ -27,6 +27,7 @@ #include #include #include +#include IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Drawer, Graphic3d_PresentationAttributes) @@ -1433,3 +1434,14 @@ bool Prs3d_Drawer::SetShadingModel (Graphic3d_TypeOfShadingModel theModel, return isUpdateNeeded; } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_Drawer::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Prs3d_Drawer)); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myShadingAspect); +} diff --git a/src/Prs3d/Prs3d_Drawer.hxx b/src/Prs3d/Prs3d_Drawer.hxx index 274dd4de53..87498f6fe4 100644 --- a/src/Prs3d/Prs3d_Drawer.hxx +++ b/src/Prs3d/Prs3d_Drawer.hxx @@ -902,6 +902,9 @@ public: Standard_EXPORT bool SetShadingModel (Graphic3d_TypeOfShadingModel theModel, bool theToOverrideDefaults = false); + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + protected: Handle(Prs3d_Drawer) myLink; diff --git a/src/Prs3d/Prs3d_LineAspect.cxx b/src/Prs3d/Prs3d_LineAspect.cxx index b648b1026a..6bc1c94175 100644 --- a/src/Prs3d/Prs3d_LineAspect.cxx +++ b/src/Prs3d/Prs3d_LineAspect.cxx @@ -14,6 +14,8 @@ #include +#include + IMPLEMENT_STANDARD_RTTIEXT(Prs3d_LineAspect, Prs3d_BasicAspect) // ======================================================================= @@ -27,3 +29,14 @@ Prs3d_LineAspect::Prs3d_LineAspect (const Quantity_Color& theColor, { // } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_LineAspect::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Prs3d_LineAspect)); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myAspect); +} + diff --git a/src/Prs3d/Prs3d_LineAspect.hxx b/src/Prs3d/Prs3d_LineAspect.hxx index cb20cfb647..665821ac1d 100644 --- a/src/Prs3d/Prs3d_LineAspect.hxx +++ b/src/Prs3d/Prs3d_LineAspect.hxx @@ -63,6 +63,9 @@ public: void SetAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) { myAspect = theAspect; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + protected: Handle(Graphic3d_AspectLine3d) myAspect; diff --git a/src/Prs3d/Prs3d_PlaneAspect.cxx b/src/Prs3d/Prs3d_PlaneAspect.cxx index 8d71bb33bc..69cc3bf35a 100644 --- a/src/Prs3d/Prs3d_PlaneAspect.cxx +++ b/src/Prs3d/Prs3d_PlaneAspect.cxx @@ -14,6 +14,8 @@ #include +#include + IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PlaneAspect, Prs3d_BasicAspect) // ======================================================================= @@ -37,3 +39,27 @@ Prs3d_PlaneAspect::Prs3d_PlaneAspect() { // } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_PlaneAspect::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Prs3d_PlaneAspect)); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myEdgesAspect); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myIsoAspect); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myArrowAspect); + + DUMP_FIELD_VALUES (theOStream, myArrowsLength); + DUMP_FIELD_VALUES (theOStream, myArrowsSize); + DUMP_FIELD_VALUES (theOStream, myArrowsAngle); + DUMP_FIELD_VALUES (theOStream, myPlaneXLength); + DUMP_FIELD_VALUES (theOStream, myPlaneYLength); + DUMP_FIELD_VALUES (theOStream, myIsoDistance); + DUMP_FIELD_VALUES (theOStream, myDrawCenterArrow); + DUMP_FIELD_VALUES (theOStream, myDrawEdgesArrows); + DUMP_FIELD_VALUES (theOStream, myDrawEdges); + DUMP_FIELD_VALUES (theOStream, myDrawIso); +} + diff --git a/src/Prs3d/Prs3d_PlaneAspect.hxx b/src/Prs3d/Prs3d_PlaneAspect.hxx index 4833059bc7..481613135d 100644 --- a/src/Prs3d/Prs3d_PlaneAspect.hxx +++ b/src/Prs3d/Prs3d_PlaneAspect.hxx @@ -96,6 +96,9 @@ public: //! Returns the distance between isoparameters used in the display of planes. Standard_Real IsoDistance() const { return myIsoDistance; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + protected: Handle(Prs3d_LineAspect) myEdgesAspect; diff --git a/src/Prs3d/Prs3d_PointAspect.cxx b/src/Prs3d/Prs3d_PointAspect.cxx index b69b01689f..9a630ef956 100644 --- a/src/Prs3d/Prs3d_PointAspect.cxx +++ b/src/Prs3d/Prs3d_PointAspect.cxx @@ -14,6 +14,8 @@ #include +#include + IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PointAspect, Prs3d_BasicAspect) // ======================================================================= @@ -40,3 +42,14 @@ Prs3d_PointAspect::Prs3d_PointAspect (const Quantity_Color& theColor, { // } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_PointAspect::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Prs3d_PointAspect)); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myAspect); +} + diff --git a/src/Prs3d/Prs3d_PointAspect.hxx b/src/Prs3d/Prs3d_PointAspect.hxx index 7c2fcd3c70..16e35038ec 100644 --- a/src/Prs3d/Prs3d_PointAspect.hxx +++ b/src/Prs3d/Prs3d_PointAspect.hxx @@ -61,6 +61,9 @@ public: //! Returns marker's texture. const Handle(Graphic3d_MarkerImage)& GetTexture() const { return myAspect->GetMarkerImage(); } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + protected: Handle(Graphic3d_AspectMarker3d) myAspect; diff --git a/src/Prs3d/Prs3d_ShadingAspect.cxx b/src/Prs3d/Prs3d_ShadingAspect.cxx index 102deb416a..a35cf375ea 100644 --- a/src/Prs3d/Prs3d_ShadingAspect.cxx +++ b/src/Prs3d/Prs3d_ShadingAspect.cxx @@ -18,6 +18,7 @@ #include #include #include +#include IMPLEMENT_STANDARD_RTTIEXT(Prs3d_ShadingAspect, Prs3d_BasicAspect) @@ -164,3 +165,15 @@ Standard_Real Prs3d_ShadingAspect::Transparency (const Aspect_TypeOfFacingModel } return 0.0; } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_ShadingAspect::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Prs3d_ShadingAspect), this); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myAspect); +} + diff --git a/src/Prs3d/Prs3d_ShadingAspect.hxx b/src/Prs3d/Prs3d_ShadingAspect.hxx index 8510621a31..4192321d13 100644 --- a/src/Prs3d/Prs3d_ShadingAspect.hxx +++ b/src/Prs3d/Prs3d_ShadingAspect.hxx @@ -62,6 +62,9 @@ public: void SetAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) { myAspect = theAspect; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + protected: Handle(Graphic3d_AspectFillArea3d) myAspect; diff --git a/src/Prs3d/Prs3d_TextAspect.cxx b/src/Prs3d/Prs3d_TextAspect.cxx index d194818103..f50afab7c9 100644 --- a/src/Prs3d/Prs3d_TextAspect.cxx +++ b/src/Prs3d/Prs3d_TextAspect.cxx @@ -17,6 +17,7 @@ #include #include +#include IMPLEMENT_STANDARD_RTTIEXT(Prs3d_TextAspect, Prs3d_BasicAspect) @@ -47,3 +48,21 @@ Prs3d_TextAspect::Prs3d_TextAspect (const Handle(Graphic3d_AspectText3d)& theAsp { // } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_TextAspect::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Prs3d_TextAspect)); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myTextAspect); + + DUMP_FIELD_VALUES (theOStream, "Height"); + + DUMP_FIELD_VALUES (theOStream, "HorizontalJustification"); + DUMP_FIELD_VALUES (theOStream, "VerticalJustification"); + DUMP_FIELD_VALUES (theOStream, "Orientation"); +} + diff --git a/src/Prs3d/Prs3d_TextAspect.hxx b/src/Prs3d/Prs3d_TextAspect.hxx index cf59e1aefa..31ffef706a 100644 --- a/src/Prs3d/Prs3d_TextAspect.hxx +++ b/src/Prs3d/Prs3d_TextAspect.hxx @@ -97,6 +97,9 @@ public: void SetAspect (const Handle(Graphic3d_AspectText3d)& theAspect) { myTextAspect = theAspect; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + protected: Handle(Graphic3d_AspectText3d) myTextAspect; diff --git a/src/PrsMgr/PrsMgr_PresentableObject.cxx b/src/PrsMgr/PrsMgr_PresentableObject.cxx index b3730f08d8..aba0dffea9 100644 --- a/src/PrsMgr/PrsMgr_PresentableObject.cxx +++ b/src/PrsMgr/PrsMgr_PresentableObject.cxx @@ -837,3 +837,39 @@ void PrsMgr_PresentableObject::PolygonOffsets (Standard_Integer& theMode, myDrawer->ShadingAspect()->Aspect()->PolygonOffsets (theMode, theFactor, theUnits); } } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void PrsMgr_PresentableObject::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (PrsMgr_PresentableObject)); + + DUMP_FIELD_VALUES (theOStream, myParent); + + DUMP_FIELD_VALUES (theOStream, myOwnWidth); + DUMP_FIELD_VALUES (theOStream, hasOwnColor); + DUMP_FIELD_VALUES (theOStream, hasOwnMaterial); + + DUMP_FIELD_VALUES (theOStream, myInfiniteState); + DUMP_FIELD_VALUES (theOStream, myIsMutable); + DUMP_FIELD_VALUES (theOStream, myHasOwnPresentations); + +/* + PrsMgr_Presentations myPresentations; //!< list of presentations + Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes; //!< sequence of object-specific clipping planes + Handle(Prs3d_Drawer) myDrawer; //!< main presentation attributes + Handle(Prs3d_Drawer) myHilightDrawer; //!< (optional) custom presentation attributes for highlighting selected object + Handle(Prs3d_Drawer) myDynHilightDrawer; //!< (optional) custom presentation attributes for highlighting detected object + Handle(Graphic3d_TransformPers) myTransformPersistence; //!< transformation persistence + Handle(Geom_Transformation) myLocalTransformation; //!< local transformation relative to parent object + Handle(Geom_Transformation) myTransformation; //!< absolute transformation of this object (combined parents + local transformations) + Handle(Geom_Transformation) myCombinedParentTransform; //!< transformation of parent object (combined for all parents) + PrsMgr_ListOfPresentableObjects myChildren; //!< list of children + gp_GTrsf myInvTransformation; //!< inversion of absolute transformation (combined parents + local transformations) + PrsMgr_TypeOfPresentation3d myTypeOfPresentation3d; //!< presentation type + + Aspect_TypeOfFacingModel myCurrentFacingModel; //!< current facing model +*/ +} diff --git a/src/PrsMgr/PrsMgr_PresentableObject.hxx b/src/PrsMgr/PrsMgr_PresentableObject.hxx index 39676b151e..e777583807 100644 --- a/src/PrsMgr/PrsMgr_PresentableObject.hxx +++ b/src/PrsMgr/PrsMgr_PresentableObject.hxx @@ -479,6 +479,9 @@ public: //! @name simplified presentation properties API //! Clears settings provided by the drawing tool aDrawer. Standard_EXPORT virtual void UnsetAttributes(); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const; + public: //! @name deprecated methods //! gives the list of modes which are flagged "to be updated". diff --git a/src/Quantity/Quantity_Color.cxx b/src/Quantity/Quantity_Color.cxx index ae29401215..b22e857bb0 100644 --- a/src/Quantity/Quantity_Color.cxx +++ b/src/Quantity/Quantity_Color.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -3924,3 +3925,16 @@ void call_rgbhls (float r, float g, float b, float& h, float& l, float& s) if (h < 0.0) h += 360.0; } } + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void Quantity_Color::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Quantity_Color)); + + DUMP_FIELD_VALUES (theOStream, MyRed); + DUMP_FIELD_VALUES (theOStream, MyGreen); + DUMP_FIELD_VALUES (theOStream, MyBlue); +} diff --git a/src/Quantity/Quantity_Color.hxx b/src/Quantity/Quantity_Color.hxx index 07ce584ec6..404ddedccc 100644 --- a/src/Quantity/Quantity_Color.hxx +++ b/src/Quantity/Quantity_Color.hxx @@ -264,6 +264,9 @@ Standard_Boolean operator == (const Quantity_Color& Other) const //! Internal test Standard_EXPORT static void Test(); + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + private: //! Converts HLS components into RGB ones. diff --git a/src/Quantity/Quantity_ColorRGBA.cxx b/src/Quantity/Quantity_ColorRGBA.cxx index b7ade567a5..5737bfbf02 100644 --- a/src/Quantity/Quantity_ColorRGBA.cxx +++ b/src/Quantity/Quantity_ColorRGBA.cxx @@ -16,6 +16,7 @@ #include #include +#include #include @@ -198,3 +199,15 @@ bool Quantity_ColorRGBA::ColorFromHex (const char* const theHexColorString, const ColorInteger aColorComponentBase = isShort ? THE_HEX_COLOR_COMPONENT_SHORT_BASE : THE_HEX_COLOR_COMPONENT_BASE; return convertIntegerToColorRGBA (aHexColorInteger, aColorComponentBase, hasAlphaComponent, theColor); } + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void Quantity_ColorRGBA::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (Quantity_ColorRGBA)); + + DUMP_FIELD_VALUES (theOStream, myAlpha); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myRgb); +} diff --git a/src/Quantity/Quantity_ColorRGBA.hxx b/src/Quantity/Quantity_ColorRGBA.hxx index c67cd52489..a236100953 100644 --- a/src/Quantity/Quantity_ColorRGBA.hxx +++ b/src/Quantity/Quantity_ColorRGBA.hxx @@ -121,6 +121,9 @@ public: Quantity_ColorRGBA& theColor, const bool theAlphaComponentIsOff = false); + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + private: static void myTestSize3() { Standard_STATIC_ASSERT (sizeof(float) * 3 == sizeof(Quantity_Color)); } diff --git a/src/SelectMgr/SelectMgr_BaseFrustum.cxx b/src/SelectMgr/SelectMgr_BaseFrustum.cxx index f01a825c0e..8a98b3ae84 100644 --- a/src/SelectMgr/SelectMgr_BaseFrustum.cxx +++ b/src/SelectMgr/SelectMgr_BaseFrustum.cxx @@ -15,6 +15,10 @@ #include +#include + +#include + IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_BaseFrustum,Standard_Transient) //======================================================================= @@ -245,3 +249,17 @@ gp_Pnt SelectMgr_BaseFrustum::DetectedPoint (const Standard_Real /*theDepth*/) c { return gp_Pnt (RealLast(), RealLast(), RealLast()); } + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void SelectMgr_BaseFrustum::Dump(Standard_OStream& theOStream)const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (SelectMgr_BaseFrustum)); + + DUMP_FIELD_VALUES (theOStream, myPixelTolerance); + DUMP_FIELD_VALUES (theOStream, myIsOrthographic); + DUMP_FIELD_VALUES_POINTER (theOStream, myBuilder); + DUMP_FIELD_VALUES_POINTER (theOStream, myCamera); +} diff --git a/src/SelectMgr/SelectMgr_BaseFrustum.hxx b/src/SelectMgr/SelectMgr_BaseFrustum.hxx index 95062200c2..56556e0b6f 100644 --- a/src/SelectMgr/SelectMgr_BaseFrustum.hxx +++ b/src/SelectMgr/SelectMgr_BaseFrustum.hxx @@ -28,6 +28,8 @@ #include #include +#include + //! This class is an interface for different types of selecting frustums, //! defining different selection types, like point, box or polyline //! selection. It contains signatures of functions for detection of @@ -171,6 +173,9 @@ public: return; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const; + DEFINE_STANDARD_RTTIEXT(SelectMgr_BaseFrustum,Standard_Transient) protected: diff --git a/src/SelectMgr/SelectMgr_EntityOwner.cxx b/src/SelectMgr/SelectMgr_EntityOwner.cxx index d537c01dd6..9b6dc83e7f 100644 --- a/src/SelectMgr/SelectMgr_EntityOwner.cxx +++ b/src/SelectMgr/SelectMgr_EntityOwner.cxx @@ -82,3 +82,17 @@ void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationMa mySelectable->HilightOwnerWithColor (thePM, theStyle, this); } } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void SelectMgr_EntityOwner::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (SelectMgr_EntityOwner)); + + DUMP_FIELD_VALUES_POINTER (theOStream, mySelectable); + DUMP_FIELD_VALUES (theOStream, mypriority); + DUMP_FIELD_VALUES (theOStream, myIsSelected); + DUMP_FIELD_VALUES (theOStream, myFromDecomposition); +} diff --git a/src/SelectMgr/SelectMgr_EntityOwner.hxx b/src/SelectMgr/SelectMgr_EntityOwner.hxx index 3e96e0f51a..8eaa8b26d8 100644 --- a/src/SelectMgr/SelectMgr_EntityOwner.hxx +++ b/src/SelectMgr/SelectMgr_EntityOwner.hxx @@ -187,6 +187,9 @@ public: //! Sets flag indicating this owner points to a part of object (TRUE) or to entire object (FALSE). void SetComesFromDecomposition (const Standard_Boolean theIsFromDecomposition) { myFromDecomposition = theIsFromDecomposition; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const; + public: //! Sets the selectable object. diff --git a/src/SelectMgr/SelectMgr_SelectableObject.cxx b/src/SelectMgr/SelectMgr_SelectableObject.cxx index 4980ecf7b6..e388801aa3 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.cxx +++ b/src/SelectMgr/SelectMgr_SelectableObject.cxx @@ -548,3 +548,24 @@ const Handle(SelectMgr_EntityOwner)& SelectMgr_SelectableObject::GetAssemblyOwne { return THE_NULL_ENTITYOWNER; } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void SelectMgr_SelectableObject::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (SelectMgr_SelectableObject)); + + DUMP_FIELD_VALUES_PARENT (theOStream, PrsMgr_PresentableObject); + + DUMP_FIELD_VALUES (theOStream, myGlobalSelMode); + //DUMP_FIELD_VALUES (theOStream, "mycurrent", mycurrent); + DUMP_FIELD_VALUES (theOStream, myAutoHilight); + +/* + SelectMgr_SequenceOfSelection myselections; //!< list of selections + Handle(Prs3d_Presentation) mySelectionPrs; //!< optional presentation for highlighting selected object + Handle(Prs3d_Presentation) myHilightPrs; //!< optional presentation for highlighting detected object +*/ +} diff --git a/src/SelectMgr/SelectMgr_SelectableObject.hxx b/src/SelectMgr/SelectMgr_SelectableObject.hxx index 2da46a4120..7eb75fe41e 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.hxx +++ b/src/SelectMgr/SelectMgr_SelectableObject.hxx @@ -169,6 +169,9 @@ public: //! Returns common entity owner if the object is an assembly Standard_EXPORT virtual const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + public: //! Begins the iteration scanning for sensitive primitives. diff --git a/src/SelectMgr/SelectMgr_ViewClipRange.cxx b/src/SelectMgr/SelectMgr_ViewClipRange.cxx index d820ecd080..b60de47881 100644 --- a/src/SelectMgr/SelectMgr_ViewClipRange.cxx +++ b/src/SelectMgr/SelectMgr_ViewClipRange.cxx @@ -102,3 +102,18 @@ void SelectMgr_ViewClipRange::AddClippingPlanes (const Graphic3d_SequenceOfHClip } } } + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void SelectMgr_ViewClipRange::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (SelectMgr_ViewClipRange)); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myUnclipRange); + for (size_t aRangeIter = 0; aRangeIter < myClipRanges.size(); ++aRangeIter) + { + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myClipRanges[aRangeIter]); + } +} diff --git a/src/SelectMgr/SelectMgr_ViewClipRange.hxx b/src/SelectMgr/SelectMgr_ViewClipRange.hxx index b2f012474b..509d0f775f 100644 --- a/src/SelectMgr/SelectMgr_ViewClipRange.hxx +++ b/src/SelectMgr/SelectMgr_ViewClipRange.hxx @@ -18,6 +18,8 @@ #include #include +#include +#include #include @@ -117,6 +119,9 @@ public: //! Adds a clipping sub-range (for clipping chains). void AddClipSubRange (const Bnd_Range& theRange) { myClipRanges.push_back (theRange); } + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + private: std::vector myClipRanges; diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.cxx b/src/SelectMgr/SelectMgr_ViewerSelector.cxx index 9e467d2df6..1e933ea09c 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.cxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.cxx @@ -1046,3 +1046,27 @@ void SelectMgr_ViewerSelector::AllowOverlapDetection (const Standard_Boolean the { mySelectingVolumeMgr.AllowOverlapDetection (theIsToAllow); } + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void SelectMgr_ViewerSelector::Dump(Standard_OStream& theOStream)const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (SelectMgr_ViewerSelector)); + + DUMP_FIELD_VALUES (theOStream, preferclosest); + DUMP_FIELD_VALUES (theOStream, myToUpdateTolerance); + DUMP_FIELD_VALUES (theOStream, mystored.Extent()); + //DUMP_FIELD_VALUES (theOStream, mySelectingVolumeMgr); + + Standard_Integer aNbOfSelected = 0; + for (SelectMgr_SelectableObjectSet::Iterator aSelectableIt (mySelectableObjects); aSelectableIt.More(); aSelectableIt.Next()) + { + aNbOfSelected++; + } + DUMP_FIELD_VALUES (theOStream, aNbOfSelected); + DUMP_FIELD_VALUES (theOStream, myTolerances.Tolerance()); + DUMP_FIELD_VALUES (theOStream, myTolerances.CustomTolerance()); + DUMP_FIELD_VALUES (theOStream, myZLayerOrderMap.Size()); +} diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.hxx b/src/SelectMgr/SelectMgr_ViewerSelector.hxx index 70b032cd1c..2887823e2d 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.hxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.hxx @@ -209,6 +209,9 @@ public: //! mark both included and overlapped entities as matched Standard_EXPORT void AllowOverlapDetection (const Standard_Boolean theIsToAllow); + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + public: //! Begins an iteration scanning for the owners detected at a position in the view. diff --git a/src/Standard/FILES b/src/Standard/FILES index 01ca8000ee..84ad0eccd4 100755 --- a/src/Standard/FILES +++ b/src/Standard/FILES @@ -24,6 +24,8 @@ Standard_DimensionError.hxx Standard_DimensionMismatch.hxx Standard_DivideByZero.hxx Standard_DomainError.hxx +Standard_Dump.cxx +Standard_Dump.hxx Standard_ErrorHandler.cxx Standard_ErrorHandler.hxx Standard_ExtCharacter.hxx diff --git a/src/Standard/Standard_Dump.cxx b/src/Standard/Standard_Dump.cxx new file mode 100644 index 0000000000..291538dbb1 --- /dev/null +++ b/src/Standard/Standard_Dump.cxx @@ -0,0 +1,298 @@ +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +// ======================================================================= +// function : Sentry constructor +// purpose : +// ======================================================================= +Standard_Dump::Sentry::Sentry (Standard_OStream& theOStream, + const TCollection_AsciiString& theClassName, + const void* thePointer) +: myOStream (&theOStream), myClassName (theClassName) +{ + (*myOStream) << startKey (myClassName); + if (thePointer) + { + TCollection_AsciiString Pointer = Standard_Dump::GetPointerInfo (thePointer); + DUMP_FIELD_VALUES(theOStream, Pointer) + } +} + +// ======================================================================= +// function : GetPointerInfo +// purpose : +// ======================================================================= +TCollection_AsciiString Standard_Dump::GetPointerInfo (const Handle(Standard_Transient)& thePointer, + const bool isShortInfo) +{ + if (thePointer.IsNull()) + return TCollection_AsciiString(); + + return GetPointerInfo (thePointer.get(), isShortInfo); +} + +// ======================================================================= +// function : GetPointerInfo +// purpose : +// ======================================================================= +TCollection_AsciiString Standard_Dump::GetPointerInfo (const void* thePointer, const bool isShortInfo) +{ + std::ostringstream aPtrStr; + aPtrStr << thePointer; + if (!isShortInfo) + return aPtrStr.str().c_str(); + + TCollection_AsciiString anInfoPtr (aPtrStr.str().c_str()); + for (int aSymbolId = 1; aSymbolId < anInfoPtr.Length(); aSymbolId++) + { + if (anInfoPtr.Value(aSymbolId) != '0') + { + anInfoPtr = anInfoPtr.SubString (aSymbolId, anInfoPtr.Length()); + anInfoPtr.Prepend (GetPointerPrefix()); + return anInfoPtr; + } + } + return aPtrStr.str().c_str(); +} + +// ---------------------------------------------------------------------------- +// Split +// ---------------------------------------------------------------------------- +void Standard_Dump::Split (const Standard_SStream& theStream, + NCollection_IndexedDataMap& theValues, + TCollection_AsciiString& theStreamKey) +{ + TCollection_AsciiString aStreamStr (theStream.str().c_str()); + + split (aStreamStr, theValues, theStreamKey); +} + +// ---------------------------------------------------------------------------- +// split +// ---------------------------------------------------------------------------- +void Standard_Dump::split (const TCollection_AsciiString& theStreamStr, + NCollection_IndexedDataMap& theValues, + TCollection_AsciiString& theStreamKey) +{ + TCollection_AsciiString aStreamStr = theStreamStr; + + TCollection_AsciiString aSplitValue, aTailValue, aKey; + if (splitDumped (aStreamStr, aSplitValue, aTailValue, aKey)) + { + if (aTailValue.IsEmpty()) + { + theStreamKey = aKey; + splitKey (aSplitValue, aStreamStr, aKey); + } + } + + NCollection_List aValues; + splitValue (aStreamStr, DumpSeparator(), aValues); + + for (NCollection_List::Iterator anIterator (aValues); anIterator.More(); anIterator.Next()) + { + TCollection_AsciiString aKey = anIterator.Value(); + anIterator.Next(); + if (!anIterator.More()) + break; + theValues.Add (aKey, anIterator.Value()); + } +} + +// ---------------------------------------------------------------------------- +// splitValue +// ---------------------------------------------------------------------------- +void Standard_Dump::splitValue (const TCollection_AsciiString& theValue, + const TCollection_AsciiString& theSeparator, + NCollection_List& theValues) +{ + TCollection_AsciiString aCurrentString = theValue; + + TCollection_AsciiString aSplitValue, aTailValue, aKey; + while (!aCurrentString.IsEmpty()) + { + TCollection_AsciiString aValueString = aCurrentString; + if (splitDumped (aValueString, aSplitValue, aTailValue, aKey)) + { + aValueString = aSplitValue; + aCurrentString = aTailValue; + } + else + { + Standard_Integer aPosition = aValueString.Search (theSeparator); + if (aPosition < 0 ) + break; + aCurrentString = aValueString.Split (aPosition - 1); + } + theValues.Append (aValueString); + if (aCurrentString.IsEmpty()) + break; + + aCurrentString = aCurrentString.Split (theSeparator.Length()); + } +} + +// ---------------------------------------------------------------------------- +// DumpFieldToName +// ---------------------------------------------------------------------------- +void Standard_Dump::DumpFieldToName (const char* theField, const char*& theName) +{ + theName = theField; + + if (theName[0] == '&') + { + theName = theName + 1; + } + if (::LowerCase (theName[0]) == 'm' && theName[1] == 'y') + { + theName = theName + 2; + } +} + +// ---------------------------------------------------------------------------- +// ToString +// ---------------------------------------------------------------------------- +TCollection_AsciiString Standard_Dump::ToDumpString (const Standard_SStream& theStream) +{ + return TCollection_AsciiString (theStream.str().c_str()); +} + +// ---------------------------------------------------------------------------- +// ConvertDumpToText +// ---------------------------------------------------------------------------- +TCollection_AsciiString Standard_Dump::ConvertDumpToText (const Standard_SStream& theStream) +{ + TCollection_AsciiString aText; + + Standard_Integer aLevel = 0; + convertDumpToText (ToDumpString (theStream), aLevel, aText); + + return aText; +} + +TCollection_AsciiString getLevelIndent (const int theLevel) +{ + TCollection_AsciiString aLevelIndent; + for (int i = 0; i < theLevel; i++) + aLevelIndent += " "; + return aLevelIndent; +} + +// ---------------------------------------------------------------------------- +// convertDumpToText +// ---------------------------------------------------------------------------- +void Standard_Dump::convertDumpToText (const TCollection_AsciiString& theStreamStr, + const Standard_Integer theLevel, + TCollection_AsciiString& theText) +{ + + NCollection_IndexedDataMap aSplitValues; + TCollection_AsciiString aStreamKey; + split (theStreamStr, aSplitValues, aStreamKey); + Standard_Integer aLevel = theLevel; + //if (!aStreamKey.IsEmpty()) + //{ + // theText += getLevelIndent (aLevel) + aStreamKey + "\n"; + // aLevel++; + //} + + for (Standard_Integer anIndex = 1; anIndex <= aSplitValues.Size(); anIndex++) + { + TCollection_AsciiString aValue = aSplitValues.FindFromIndex (anIndex); + TCollection_AsciiString aKey = aSplitValues.FindKey (anIndex); + + if (Standard_Dump::HasBracketKey (aValue)) + { + theText += getLevelIndent (aLevel + 1) + aKey + "\n"; + convertDumpToText (aValue, aLevel + 2, theText); + } + else + { + theText += getLevelIndent (aLevel + 1) + aKey + " = " + aValue + "\n"; + } + } +} + +// ---------------------------------------------------------------------------- +// splitDumped +// ---------------------------------------------------------------------------- +Standard_Boolean Standard_Dump::splitDumped (const TCollection_AsciiString& theSourceValue, + TCollection_AsciiString& theSplitValue, + TCollection_AsciiString& theTailValue, + TCollection_AsciiString& theKey) +{ + Standard_Integer aBracketPosition = theSourceValue.Search (XMLBracketOpen()); + // the first symbol is bracket + if (aBracketPosition != 1 || aBracketPosition >= theSourceValue.Length()) + return Standard_False; + + TCollection_AsciiString aValue = theSourceValue.SubString (aBracketPosition + 1, theSourceValue.Length()); + + aBracketPosition = aValue.Search (XMLBracketClose()); + if (aBracketPosition <= 1 || aBracketPosition >= theSourceValue.Length()) + return Standard_False; + + theKey = aValue; + + TCollection_AsciiString aTailValue = theKey.Split (aBracketPosition - 1); + aTailValue = aTailValue.SubString (2, aTailValue.Length()); // remove close bracket + TCollection_AsciiString aStopKey = stopKey (theKey); + + aBracketPosition = theSourceValue.Search (aStopKey); + + Standard_Integer aStopKeyLastPosition = aBracketPosition + aStopKey.Length() - 1; + + if (aBracketPosition <= 1 || aStopKeyLastPosition > theSourceValue.Length()) + return Standard_False; + + theSplitValue = theSourceValue; + theTailValue = theSplitValue.Split (aStopKeyLastPosition); + + return Standard_True; +} + +// ---------------------------------------------------------------------------- +// splitKey +// ---------------------------------------------------------------------------- +Standard_Boolean Standard_Dump::splitKey (const TCollection_AsciiString& theSourceValue, + TCollection_AsciiString& theSplitValue, + TCollection_AsciiString& theKey) +{ + Standard_Integer aBracketPosition = theSourceValue.Search (XMLBracketOpen()); + // the first symbol is bracket + if (aBracketPosition != 1 || aBracketPosition >= theSourceValue.Length()) + return Standard_False; + + TCollection_AsciiString aValue = theSourceValue.SubString (aBracketPosition + 1, theSourceValue.Length()); + + aBracketPosition = aValue.Search (XMLBracketClose()); + if (aBracketPosition <= 1 || aBracketPosition >= theSourceValue.Length()) + return Standard_False; + + theKey = aValue; + + TCollection_AsciiString aTailValue = theKey.Split (aBracketPosition - 1); + aTailValue = aTailValue.SubString (2, aTailValue.Length()); // remove close bracket + TCollection_AsciiString aStopKey = stopKey (theKey); + + aBracketPosition = aTailValue.Search (aStopKey); + if (aBracketPosition <= 1 || aBracketPosition >= aTailValue.Length()) + return Standard_False; + + theSplitValue = aTailValue; + aTailValue = theSplitValue.Split (aBracketPosition - 1); + + return Standard_True; +} diff --git a/src/Standard/Standard_Dump.hxx b/src/Standard/Standard_Dump.hxx new file mode 100644 index 0000000000..e36cf0c4ac --- /dev/null +++ b/src/Standard/Standard_Dump.hxx @@ -0,0 +1,210 @@ +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Standard_Dump_HeaderFile +#define _Standard_Dump_HeaderFile + +#include +#include +#include +#include + +#include +#include + + +//! The interface to prepare and parse an object Dump. +class Standard_Dump +{ +public: + /** + * @brief Simple sentry class providing convenient interface to dump. + * + * Appends start and last rows in dump with class name key + * + * Create instance of that class in the first row of Dump. + */ + class Sentry + { + public: + //! Constructor - add parameters of start class name definition in the stream + Standard_EXPORT Sentry (Standard_OStream& theOStream, const TCollection_AsciiString& theClassName, const void* thePointer = NULL); + + //! Destructor - add parameters of stop class name definition in the stream + ~Sentry() { (*myOStream) << stopKey (myClassName); } + + private: + Standard_OStream* myOStream; + TCollection_AsciiString myClassName; + }; + + //! Returns separator symbol of Dump information + static Standard_Character DumpSeparator() { return '\\'; } + + //! Returns separator symbol of class name prefix + static Standard_CString ClassNameSeparator() { return " ,"; } + + //! Returns default prefix added for each pointer info string + Standard_EXPORT static TCollection_AsciiString GetPointerPrefix() { return "0x"; } + + //! Convert handle pointer to string value + //! @param thePointer a pointer + //! @param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped + //! @return the string value + Standard_EXPORT static TCollection_AsciiString GetPointerInfo (const Handle(Standard_Transient)& thePointer, + const bool isShortInfo = true); + + //! Convert pointer to string value + //! @param thePointer a pointer + //! @param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped + //! @return the string value + Standard_EXPORT static TCollection_AsciiString GetPointerInfo (const void* thePointer, + const bool isShortInfo = true); + + //! Converts stream into map of values. Values are not empty if the stream contains at least two values. + //! + //! The one level stream example: key_1\value_1\key_2\value_2 + //! In output: theStreamKey equals class_name, theValues contains key_1, value_1, key_2, and value_2. + //! + //! Two level stream example: key_1\value_1\key_2\value_2\key_3subclass_key_1\subclass_value1 + //! In output: theStreamKey equals class_name, theValues contains key_1, value_1, key_2, and value_2, key_3 and + //! subclass_key_1\subclass_value1. + //! The last value might be processed later using the same method. + //! + //! @param theStream stream value + //! @param theValues [out] container of split values + Standard_EXPORT static void Split (const Standard_SStream& theStream, + NCollection_IndexedDataMap& theValues, + TCollection_AsciiString& theStreamKey); + + //! Unites list of string into one string using the separator + Standard_EXPORT static TCollection_AsciiString Join (const NCollection_List& theValues, + const TCollection_AsciiString& theSeparator); + + //! Convert field name into dump text value, removes "&" and "my" prefixes + //! @param theField a source value + //! @param theName [out] an updated name + Standard_EXPORT static void DumpFieldToName (const char* theField, const char*& theName); + + //! Converts stream value to string value + Standard_EXPORT static TCollection_AsciiString ToDumpString (const Standard_SStream& theStream); + + //! Converts stream value to string value + Standard_EXPORT static TCollection_AsciiString ConvertDumpToText (const Standard_SStream& theStream); + + //! Returns true if the value has bracket key + static Standard_Boolean HasBracketKey (const TCollection_AsciiString& theSourceValue) + { return theSourceValue.Search (XMLBracketOpen()) >= 0; } + +private: + //! Converts stream value to string value + static TCollection_AsciiString startKey (const TCollection_AsciiString& theValue) + { return XMLBracketOpen() + theValue + XMLBracketClose(); } + + //! Converts stream value to string value + static TCollection_AsciiString stopKey (const TCollection_AsciiString& theValue) + { return XMLBracketOpen() + XMLFinishKey() + theValue + XMLBracketClose(); } + + //! Converts stream text into map of values. + //! @param theStream stream value + //! @param theValues [out] container of split values + Standard_EXPORT static void split (const TCollection_AsciiString& theStreamStr, + NCollection_IndexedDataMap& theValues, + TCollection_AsciiString& theStreamKey); + + //! Splits value into container of value using separator. + //! It is not recursive, do not split sub class values. + //! + //! Two level stream example: key_1\value_1\key_2\value_2\key_3subclass_key_1\subclass_value1 + //! In out, theValues contains: key_1, value_1, key_2, and value_2, key_3 and subclass_key_1\subclass_value1. + //! + //! @param theValue source stream value + //! @param theSeparator split separator + //! @param theValues [out] container of split values + Standard_EXPORT static void splitValue (const TCollection_AsciiString& theValue, + const TCollection_AsciiString& theSeparator, + NCollection_List& theValues); + + //! Splits value into two sub-strings using Dump keys. + //! Example: + //! aString contains "abcdefg" + //! splitDumped(aString) gives theSplitValue = "abc", theTailValue = "defg", theKey = "key" + //! @param theSourceValue source stream value to split + //! @param theSplitValue [out] split value + //! @param theTailValue [out] value out of the key on the left + //! @param theKey [out] key of split value + Standard_EXPORT static Standard_Boolean splitDumped (const TCollection_AsciiString& theSourceValue, + TCollection_AsciiString& theSplitValue, + TCollection_AsciiString& theTailValue, + TCollection_AsciiString& theKey); + + //! Splits value that contains a key in form: value. In this case the values are: + //! theSplitValue = value, theKey = key. + //! @param theSourceValue source stream value to split + //! @param theSplitValue [out] split value + //! @param theKey [out] key of split value + Standard_EXPORT static Standard_Boolean splitKey (const TCollection_AsciiString& theSourceValue, + TCollection_AsciiString& theSplitValue, + TCollection_AsciiString& theKey); + + //! Converts stream value to string value + static void convertDumpToText (const TCollection_AsciiString& theStreamStr, + const Standard_Integer theLevel, + TCollection_AsciiString& theText); + + //! Stream value open key separator + static TCollection_AsciiString XMLBracketOpen() { return TCollection_AsciiString ("<"); } + + //! Stream value close key separator + static TCollection_AsciiString XMLBracketClose() { return TCollection_AsciiString (">"); } + + //! Stream value finish key separator + static TCollection_AsciiString XMLFinishKey() { return TCollection_AsciiString ("\\"); } + +}; + +#define CLASS_NAME(theClass) #theClass + +#define DUMP_FIELD_VALUES(theOStream, theField) \ +{ \ + const char* aName = NULL; \ + Standard_Dump::DumpFieldToName (#theField, aName); \ + theOStream << aName << Standard_Dump::DumpSeparator() << theField << Standard_Dump::DumpSeparator(); \ +} + +#define DUMP_FIELD_VALUES_POINTER(theOStream, theField) \ +{ \ + const char* aName = NULL; \ + Standard_Dump::DumpFieldToName (#theField, aName); \ + theOStream << aName << Standard_Dump::DumpSeparator() << Standard_Dump::GetPointerInfo (theField) << Standard_Dump::DumpSeparator(); \ +} + +#define DUMP_FIELD_VALUES_SUBCLASS(theOStream, theField) \ +{ \ + Standard_SStream aFieldStream; \ + if (theField) (theField)->Dump (aFieldStream); \ + const char* aName = NULL; \ + Standard_Dump::DumpFieldToName (#theField, aName); \ + theOStream << aName << Standard_Dump::DumpSeparator() << Standard_Dump::ToDumpString (aFieldStream) << Standard_Dump::DumpSeparator(); \ +} + +#define DUMP_FIELD_VALUES_PARENT(theOStream, theField) \ +{ \ + Standard_SStream aTmpStream; \ + theField::Dump (aTmpStream); \ + const char* aName = NULL; \ + Standard_Dump::DumpFieldToName (#theField, aName); \ + theOStream << aName << Standard_Dump::DumpSeparator() << Standard_Dump::ToDumpString (aTmpStream) << Standard_Dump::DumpSeparator(); \ +} + +#endif // _Standard_Dump_HeaderFile diff --git a/src/TopLoc/TopLoc_Datum3D.cxx b/src/TopLoc/TopLoc_Datum3D.cxx index 03984f7161..835d7d0579 100644 --- a/src/TopLoc/TopLoc_Datum3D.cxx +++ b/src/TopLoc/TopLoc_Datum3D.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include IMPLEMENT_STANDARD_RTTIEXT(TopLoc_Datum3D,Standard_Transient) @@ -41,6 +42,17 @@ TopLoc_Datum3D::TopLoc_Datum3D (const gp_Trsf& T) : { } +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void TopLoc_Datum3D::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (TopLoc_Datum3D)); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myTrsf); +} + //======================================================================= //function : ShallowDump //purpose : diff --git a/src/TopLoc/TopLoc_Datum3D.hxx b/src/TopLoc/TopLoc_Datum3D.hxx index b1f589d201..b7f7d0670f 100644 --- a/src/TopLoc/TopLoc_Datum3D.hxx +++ b/src/TopLoc/TopLoc_Datum3D.hxx @@ -53,6 +53,9 @@ public: const gp_Trsf& Transformation() const; + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + //! Writes the contents of this Datum3D to the stream S. Standard_EXPORT void ShallowDump (Standard_OStream& S) const; diff --git a/src/TopLoc/TopLoc_ItemLocation.cxx b/src/TopLoc/TopLoc_ItemLocation.cxx index c994bbd36a..0460206f43 100644 --- a/src/TopLoc/TopLoc_ItemLocation.cxx +++ b/src/TopLoc/TopLoc_ItemLocation.cxx @@ -16,6 +16,7 @@ #include +#include #include #include #include @@ -32,3 +33,16 @@ TopLoc_ItemLocation::TopLoc_ItemLocation myTrsf (D->Transformation().Powered (P)) { } + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void TopLoc_ItemLocation::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (TopLoc_ItemLocation)); + + DUMP_FIELD_VALUES (theOStream, myPower); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myTrsf); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myDatum); +} diff --git a/src/TopLoc/TopLoc_ItemLocation.hxx b/src/TopLoc/TopLoc_ItemLocation.hxx index f2e117b390..0735480544 100644 --- a/src/TopLoc/TopLoc_ItemLocation.hxx +++ b/src/TopLoc/TopLoc_ItemLocation.hxx @@ -22,6 +22,7 @@ #include #include +#include #include class TopLoc_Datum3D; class TopLoc_Location; @@ -49,6 +50,9 @@ public: //! Sets the exponent to

Standard_EXPORT TopLoc_ItemLocation(const Handle(TopLoc_Datum3D)& D, const Standard_Integer P); + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + friend class TopLoc_Location; friend class TopLoc_SListOfItemLocation; diff --git a/src/TopLoc/TopLoc_Location.cxx b/src/TopLoc/TopLoc_Location.cxx index 21c9f81e70..2814f3cc80 100644 --- a/src/TopLoc/TopLoc_Location.cxx +++ b/src/TopLoc/TopLoc_Location.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -230,6 +231,28 @@ Standard_Boolean TopLoc_Location::IsDifferent return !IsEqual(Other); } +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void TopLoc_Location::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (TopLoc_Location)); + + DUMP_FIELD_VALUES (theOStream, IsIdentity()); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &Transformation()); + + /*TopLoc_SListOfItemLocation items = myItems; + if (!items.IsEmpty()) + { + while (items.More()) + { + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &items.Value()); + items.Next(); + } + }*/ +} + //======================================================================= //function : ShallowDump //purpose : diff --git a/src/TopLoc/TopLoc_Location.hxx b/src/TopLoc/TopLoc_Location.hxx index 0eec93b46b..736091a806 100644 --- a/src/TopLoc/TopLoc_Location.hxx +++ b/src/TopLoc/TopLoc_Location.hxx @@ -142,6 +142,9 @@ Standard_Boolean operator != (const TopLoc_Location& Other) const return IsDifferent(Other); } + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + //! Prints the contents of on the stream . Standard_EXPORT void ShallowDump (Standard_OStream& S) const; diff --git a/src/TopoDS/TopoDS_Shape.cxx b/src/TopoDS/TopoDS_Shape.cxx index 513703947c..df18151102 100644 --- a/src/TopoDS/TopoDS_Shape.cxx +++ b/src/TopoDS/TopoDS_Shape.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -33,3 +34,16 @@ Standard_Integer TopoDS_Shape::HashCode (const Standard_Integer theUpperBound) c const Standard_Integer aHL = myLocation.HashCode (theUpperBound); return ::HashCode (aHS ^ aHL, theUpperBound); } + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void TopoDS_Shape::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (TopoDS_Shape)); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, myTShape); + DUMP_FIELD_VALUES (theOStream, myOrient); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myLocation); +} diff --git a/src/TopoDS/TopoDS_Shape.hxx b/src/TopoDS/TopoDS_Shape.hxx index ea05cb600f..dd947013f1 100644 --- a/src/TopoDS/TopoDS_Shape.hxx +++ b/src/TopoDS/TopoDS_Shape.hxx @@ -280,6 +280,9 @@ public: void TShape (const Handle(TopoDS_TShape)& theTShape) { myTShape = theTShape; } + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + private: Handle(TopoDS_TShape) myTShape; diff --git a/src/TopoDS/TopoDS_TShape.cxx b/src/TopoDS/TopoDS_TShape.cxx index 01ecb142e3..fa44bd29fe 100644 --- a/src/TopoDS/TopoDS_TShape.cxx +++ b/src/TopoDS/TopoDS_TShape.cxx @@ -17,4 +17,18 @@ #include #include +#include + IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TShape,Standard_Transient) + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void TopoDS_TShape::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (TopoDS_TShape), this); + + DUMP_FIELD_VALUES (theOStream, myFlags); + //TopoDS_ListOfShape myShapes; +} diff --git a/src/TopoDS/TopoDS_TShape.hxx b/src/TopoDS/TopoDS_TShape.hxx index 27932d635b..1421347db0 100644 --- a/src/TopoDS/TopoDS_TShape.hxx +++ b/src/TopoDS/TopoDS_TShape.hxx @@ -126,6 +126,9 @@ public: //! @sa TopoDS_Iterator for accessing sub-shapes Standard_Integer NbChildren() const { return myShapes.Size(); } + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + friend class TopoDS_Iterator; friend class TopoDS_Builder; diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index 100d63efda..2f37196499 100644 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -2288,7 +2288,7 @@ struct ViewerTest_AspectsChangeSet //function : VAspects //purpose : //============================================================================== -static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, +static Standard_Integer VAspects (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec) { @@ -2339,6 +2339,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, // parse syntax of legacy commands bool toParseAliasArgs = false; + Standard_Boolean toDump = false; if (aCmdName == "vsetwidth") { if (aNames.IsEmpty() @@ -3282,6 +3283,10 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, aChangeSet->ToSetTypeOfEdge = -1; aChangeSet->TypeOfEdge = Aspect_TOL_SOLID; } + else if (anArg == "-dump") + { + toDump = Standard_True; + } else { std::cout << "Error: wrong syntax at " << anArg << "\n"; @@ -3342,6 +3347,13 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, aCtx->Redisplay (aPrs, Standard_False); } } + if (toDump) + { + Standard_SStream aStream; + aDrawer->Dump (aStream); + + theDI << Standard_Dump::ConvertDumpToText (aStream); + } return 0; } @@ -3495,6 +3507,16 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, { aPrs->SynchronizeAspects(); } + + if (toDump) + { + Standard_SStream aStream; + aDrawer->Dump (aStream); + + theDI << aName << ": \n"; + theDI << Standard_Dump::ConvertDumpToText (aStream); + theDI << "\n"; + } } } return 0; @@ -6617,6 +6639,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands) "\n\t\t: [-setDrawEdges {0|1}] [-setEdgeType LineType] [-setEdgeColor R G B] [-setQuadEdges {0|1}]" "\n\t\t: [-setDrawSilhouette {0|1}]" "\n\t\t: [-setAlphaMode {opaque|mask|blend|blendauto} [alphaCutOff=0.5]]" + "\n\t\t: [-dump]" "\n\t\t: Manage presentation properties of all, selected or named objects." "\n\t\t: When -subshapes is specified than following properties will be" "\n\t\t: assigned to specified sub-shapes." diff --git a/src/XCAFPrs/XCAFPrs_Style.cxx b/src/XCAFPrs/XCAFPrs_Style.cxx index 0a0c52f933..cd4961d680 100644 --- a/src/XCAFPrs/XCAFPrs_Style.cxx +++ b/src/XCAFPrs/XCAFPrs_Style.cxx @@ -15,6 +15,8 @@ #include +#include + //======================================================================= //function : XCAFPrs_Style //purpose : @@ -67,3 +69,19 @@ void XCAFPrs_Style::UnSetColorCurv() myHasColorCurv = Standard_False; myColorCurv.SetValues (Quantity_NOC_YELLOW); } + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void XCAFPrs_Style::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (XCAFPrs_Style)); + + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myColorSurf); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &myColorCurv); + + DUMP_FIELD_VALUES (theOStream, myHasColorSurf); + DUMP_FIELD_VALUES (theOStream, myHasColorCurv); + DUMP_FIELD_VALUES (theOStream, myIsVisible); +} diff --git a/src/XCAFPrs/XCAFPrs_Style.hxx b/src/XCAFPrs/XCAFPrs_Style.hxx index 214a0bdcfa..9885ef06d1 100644 --- a/src/XCAFPrs/XCAFPrs_Style.hxx +++ b/src/XCAFPrs/XCAFPrs_Style.hxx @@ -121,6 +121,9 @@ public: return theS1.IsEqual (theS2); } + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + protected: Quantity_ColorRGBA myColorSurf; diff --git a/src/gp/gp_Mat.cxx b/src/gp/gp_Mat.cxx index cb106686fc..88f3572676 100644 --- a/src/gp/gp_Mat.cxx +++ b/src/gp/gp_Mat.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #define M00 ((Standard_Real*)M)[0] #define M01 ((Standard_Real*)M)[1] @@ -268,3 +269,19 @@ void gp_Mat::Power (const Standard_Integer N) } } +void gp_Mat::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (gp_Mat)); + + DUMP_FIELD_VALUES (theOStream, Mat00); + DUMP_FIELD_VALUES (theOStream, Mat01); + DUMP_FIELD_VALUES (theOStream, Mat02); + + DUMP_FIELD_VALUES (theOStream, Mat10); + DUMP_FIELD_VALUES (theOStream, Mat11); + DUMP_FIELD_VALUES (theOStream, Mat12); + + DUMP_FIELD_VALUES (theOStream, Mat20); + DUMP_FIELD_VALUES (theOStream, Mat21); + DUMP_FIELD_VALUES (theOStream, Mat22); +} diff --git a/src/gp/gp_Mat.hxx b/src/gp/gp_Mat.hxx index 16fc2f2144..81c1054ca1 100644 --- a/src/gp/gp_Mat.hxx +++ b/src/gp/gp_Mat.hxx @@ -255,6 +255,9 @@ public: //! Transposes the matrix. A(j, i) -> A (i, j) Standard_NODISCARD gp_Mat Transposed() const; + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + friend class gp_XYZ; friend class gp_Trsf; diff --git a/src/gp/gp_Trsf.cxx b/src/gp/gp_Trsf.cxx index 6401493575..5ac9df82b9 100644 --- a/src/gp/gp_Trsf.cxx +++ b/src/gp/gp_Trsf.cxx @@ -34,6 +34,7 @@ #include #include #include +#include //======================================================================= //function : gp_Trsf @@ -849,3 +850,18 @@ void gp_Trsf::Orthogonalize() matrix = aTM; } + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void gp_Trsf::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (gp_Trsf)); + + DUMP_FIELD_VALUES (theOStream, Form()); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &TranslationPart()); + DUMP_FIELD_VALUES (theOStream, ScaleFactor()); + DUMP_FIELD_VALUES (theOStream, ScaleFactor()); + DUMP_FIELD_VALUES_SUBCLASS (theOStream, &HVectorialPart()); +} diff --git a/src/gp/gp_Trsf.hxx b/src/gp/gp_Trsf.hxx index ebb05bfbd3..6a56fc9690 100644 --- a/src/gp/gp_Trsf.hxx +++ b/src/gp/gp_Trsf.hxx @@ -24,6 +24,7 @@ #include #include #include +#include #include class Standard_ConstructionError; @@ -349,6 +350,9 @@ void operator *= (const gp_Trsf& T) theMat.SetValue (3, 3, static_cast (1)); } + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; + friend class gp_GTrsf; protected: diff --git a/src/gp/gp_XYZ.cxx b/src/gp/gp_XYZ.cxx index 7bf550dcec..30d64312db 100644 --- a/src/gp/gp_XYZ.cxx +++ b/src/gp/gp_XYZ.cxx @@ -15,8 +15,13 @@ #include #include +#include #include #include +#include +#include + +#include Standard_Boolean gp_XYZ::IsEqual (const gp_XYZ& Other, const Standard_Real Tolerance) const { @@ -33,3 +38,15 @@ Standard_Boolean gp_XYZ::IsEqual (const gp_XYZ& Other, return Standard_True; } +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void gp_XYZ::Dump (Standard_OStream& theOStream) const +{ + Standard_Dump::Sentry aSentry (theOStream, CLASS_NAME (gp_XYZ)); + + DUMP_FIELD_VALUES (theOStream, x); + DUMP_FIELD_VALUES (theOStream, y); + DUMP_FIELD_VALUES (theOStream, z); +} diff --git a/src/gp/gp_XYZ.hxx b/src/gp/gp_XYZ.hxx index 1ecb7d2605..90581a2775 100644 --- a/src/gp/gp_XYZ.hxx +++ b/src/gp/gp_XYZ.hxx @@ -22,6 +22,9 @@ #include #include #include + +#include + class Standard_ConstructionError; class Standard_OutOfRange; class gp_Mat; @@ -324,6 +327,8 @@ public: void SetLinearForm (const gp_XYZ& XYZ1, const gp_XYZ& XYZ2); + //! Dumps the content of me into the stream + Standard_EXPORT void Dump (Standard_OStream& theOStream) const; protected: diff --git a/tests/bugs/modalg_7/bug29311_15 b/tests/bugs/modalg_7/bug29311_15 index 565a634561..6d5d0ea7f5 100644 --- a/tests/bugs/modalg_7/bug29311_15 +++ b/tests/bugs/modalg_7/bug29311_15 @@ -13,7 +13,7 @@ set pz 3 vertex vv $px $py $pz set log [bounding vv -obb -dump] -if {![regexp {Center: +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $log full xc yc zc]} { +if {![regexp {Center\n x = +([-0-9.+eE]+)\n y = +([-0-9.+eE]+)\n z = +([-0-9.+eE]+)} $log full xc yc zc]} { puts "Error in Dump." } diff --git a/tests/bugs/vis/bug30949 b/tests/bugs/vis/bug30949 new file mode 100644 index 0000000000..e9ecf6965c --- /dev/null +++ b/tests/bugs/vis/bug30949 @@ -0,0 +1,20 @@ +puts "=============" +puts "0030949: Foundation Classes - Dump improvement for OCCT classes" +puts "=============" + +pload VISUALIZATION +vinit View + +set pred 0.329 +set pgreen 0.224 +set pblue 0.027 + +set log [vaspects -defaults -dump] + +if {![regexp {Red = +([-0-9.+eE]+)\n Green = +([-0-9.+eE]+)\n Blue = +([-0-9.+eE]+)} $log full cred cgreen cblue]} { + puts "Error in Dump." +} + +checkreal "Cred" $cred $pred 1.0e-7 0.0 +checkreal "Cgreen" $cgreen $pgreen 1.0e-7 0.0 +checkreal "Cblue" $cblue $pblue 1.0e-7 0.0 -- 2.39.5