1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0031313: Foundation Classes - Dump improvement for classes

- Provide DumpJson for geometrical, ocaf and visualization classes;
- Change depth parameter of DumpJson (constant is not obligate here)
- Introduce a new macro for transient objects to be called as the first row in DumpJson: OCCT_DUMP_TRANSIENT_CLASS_BEGIN. We need not put the class name in the macro, using get_type_name of Standard_Transient for it.
- change implementation of OCCT_DUMP_CLASS_BEGIN and OCCT_DUMP_TRANSIENT_CLASS_BEGIN. It is not an sentry more and it does not create a new hierarchy level. It appends a new row into the output stream: "className": <className>
- OCCT_DUMP_* does not require semicolon
- class header is included first in source files of TDataStd, TDocStd, TCAFDoc
This commit is contained in:
nds
2020-01-28 12:03:38 +03:00
committed by bugmaster
parent 00ea7f2676
commit bc73b00672
532 changed files with 5237 additions and 419 deletions

View File

@@ -27,6 +27,7 @@
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_Dump.hxx>
Standard_Boolean gp_Ax1::IsCoaxial
(const gp_Ax1& Other,
@@ -84,3 +85,8 @@ gp_Ax1 gp_Ax1::Mirrored (const gp_Ax2& A2) const
return A1;
}
void gp_Ax1::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
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())
}

View File

@@ -205,6 +205,9 @@ public:
Standard_NODISCARD gp_Ax1 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -28,6 +28,7 @@
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_Dump.hxx>
gp_Ax2::gp_Ax2 (const gp_Pnt& P, const gp_Dir& V) :
axis(P,V)
@@ -113,3 +114,11 @@ gp_Ax2 gp_Ax2::Mirrored(const gp_Ax2& A2) const
return Temp;
}
void gp_Ax2::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_VECTOR_CLASS (theOStream, "Location", 3, axis.Location().X(), axis.Location().Y(), axis.Location().Z())
OCCT_DUMP_VECTOR_CLASS (theOStream, "Direction", 3, axis.Direction().X(), axis.Direction().Y(), axis.Direction().Z())
OCCT_DUMP_VECTOR_CLASS (theOStream, "XDirection", 3, vxdir.X(), vxdir.Y(), vxdir.Z())
OCCT_DUMP_VECTOR_CLASS (theOStream, "YDirection", 3, vydir.X(), vydir.Y(), vydir.Z())
}

View File

@@ -323,6 +323,9 @@ public:
Standard_NODISCARD gp_Ax2 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -24,6 +24,7 @@
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_Dump.hxx>
void gp_Ax22d::Mirror (const gp_Pnt2d& P)
{
@@ -57,3 +58,10 @@ gp_Ax22d gp_Ax22d::Mirrored(const gp_Ax2d& A1) const
return Temp;
}
void gp_Ax22d::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_VECTOR_CLASS (theOStream, "Location", 2, point.X(), point.Y())
OCCT_DUMP_VECTOR_CLASS (theOStream, "XAxis", 2, vxdir.X(), vxdir.Y())
OCCT_DUMP_VECTOR_CLASS (theOStream, "YAxis", 2, vydir.X(), vydir.Y())
}

View File

@@ -210,6 +210,9 @@ public:
//! point <P2>.
Standard_NODISCARD gp_Ax22d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -25,6 +25,7 @@
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <gp_XY.hxx>
#include <Standard_Dump.hxx>
Standard_Boolean gp_Ax2d::IsCoaxial (const gp_Ax2d& Other,
const Standard_Real AngularTolerance,
@@ -75,3 +76,10 @@ gp_Ax2d gp_Ax2d::Mirrored (const gp_Ax2d& A) const
return AA;
}
void gp_Ax2d::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, gp_Ax2d)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vdir)
}

View File

@@ -168,6 +168,9 @@ public:
//! point <P2>.
Standard_NODISCARD gp_Ax2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -23,6 +23,7 @@
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_Dump.hxx>
//=======================================================================
//function : gp_Ax3
@@ -105,3 +106,12 @@ gp_Ax3 gp_Ax3::Mirrored(const gp_Ax2& A2)const
return Temp;
}
void gp_Ax3::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
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())
}

View File

@@ -290,6 +290,9 @@ public:
Standard_NODISCARD gp_Ax3 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -22,6 +22,7 @@
#include <gp_XYZ.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_Dump.hxx>
#include <Standard_OutOfRange.hxx>
Standard_Real gp_Dir::Angle (const gp_Dir& Other) const
@@ -139,3 +140,7 @@ gp_Dir gp_Dir::Mirrored (const gp_Ax2& A2) const
return V;
}
void gp_Dir::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_VECTOR_CLASS (theOStream, "gp_Dir", 3, coord.X(), coord.Y(), coord.Z())
}

View File

@@ -263,6 +263,9 @@ public:
Standard_NODISCARD gp_Dir Transformed (const gp_Trsf& T) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -21,6 +21,7 @@
#include <gp_XY.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_Dump.hxx>
#include <Standard_OutOfRange.hxx>
Standard_Real gp_Dir2d::Angle (const gp_Dir2d& Other) const
@@ -101,3 +102,7 @@ gp_Dir2d gp_Dir2d::Mirrored (const gp_Ax2d& A) const
return V;
}
void gp_Dir2d::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_VECTOR_CLASS (theOStream, "gp_Dir2d", 2, coord.X(), coord.Y())
}

View File

@@ -249,6 +249,9 @@ public:
//! direction <me> is reversed.
Standard_NODISCARD gp_Dir2d Transformed (const gp_Trsf2d& T) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -22,6 +22,7 @@
#include <gp_Trsf.hxx>
#include <gp_XYZ.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_Dump.hxx>
#include <Standard_OutOfRange.hxx>
void gp_GTrsf::SetTranslationPart (const gp_XYZ& Coord)
@@ -157,3 +158,18 @@ void gp_GTrsf::SetForm()
return;
}
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void gp_GTrsf::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, gp_GTrsf)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &matrix)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, shape)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, scale)
}

View File

@@ -244,6 +244,9 @@ public:
gp_Trsf Trsf() const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -273,7 +273,7 @@ void gp_Mat::Power (const Standard_Integer N)
//function : DumpJson
//purpose :
//=======================================================================
void gp_Mat::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
void gp_Mat::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_VECTOR_CLASS (theOStream, gp_Mat, 9, Mat00, Mat01, Mat02, Mat10, Mat11, Mat12, Mat20, Mat21, Mat22);
OCCT_DUMP_VECTOR_CLASS (theOStream, "gp_Mat", 9, Mat00, Mat01, Mat02, Mat10, Mat11, Mat12, Mat20, Mat21, Mat22)
}

View File

@@ -256,7 +256,7 @@ public:
Standard_NODISCARD gp_Mat Transposed() const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
friend class gp_XYZ;

View File

@@ -30,6 +30,7 @@
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_Dump.hxx>
gp_Pln::gp_Pln (const gp_Pnt& P,
const gp_Dir& V)
@@ -130,3 +131,7 @@ gp_Pln gp_Pln::Mirrored (const gp_Ax2& A2) const
return Pl;
}
void gp_Pln::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &pos)
}

View File

@@ -241,6 +241,9 @@ public:
Standard_NODISCARD gp_Pln Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -25,6 +25,7 @@
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <gp_XYZ.hxx>
#include <Standard_Dump.hxx>
#include <Standard_OutOfRange.hxx>
void gp_Pnt::Transform (const gp_Trsf& T)
@@ -85,3 +86,7 @@ gp_Pnt gp_Pnt::Mirrored (const gp_Ax2& A2) const
return P;
}
void gp_Pnt::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_VECTOR_CLASS (theOStream, "gp_Pnt", 3, coord.X(), coord.Y(), coord.Z())
}

View File

@@ -174,6 +174,9 @@ public:
Standard_NODISCARD gp_Pnt Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -22,6 +22,7 @@
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <gp_XY.hxx>
#include <Standard_Dump.hxx>
#include <Standard_OutOfRange.hxx>
void gp_Pnt2d::Transform (const gp_Trsf2d& T)
@@ -69,3 +70,7 @@ gp_Pnt2d gp_Pnt2d::Mirrored (const gp_Ax2d& A) const
return P;
}
void gp_Pnt2d::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_VECTOR_CLASS (theOStream, "gp_Pnt2d", 2, coord.X(), coord.Y())
}

View File

@@ -151,6 +151,9 @@ public:
Standard_NODISCARD gp_Pnt2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -855,13 +855,12 @@ void gp_Trsf::Orthogonalize()
//function : DumpJson
//purpose :
//=======================================================================
void gp_Trsf::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
void gp_Trsf::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, gp_Trsf);
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc);
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &matrix);
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, shape);
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, scale);
OCCT_DUMP_VECTOR_CLASS (theOStream, "Location", 3, loc.X(), loc.Y(), loc.Z())
OCCT_DUMP_VECTOR_CLASS (theOStream, "Matrix", 9, matrix.Value(1, 1), matrix.Value(1, 2), matrix.Value(1, 3),
matrix.Value(2, 1), matrix.Value(2, 2), matrix.Value(2, 3),
matrix.Value(3, 1), matrix.Value(3, 2), matrix.Value(3, 3))
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, shape)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, scale)
}

View File

@@ -351,7 +351,7 @@ void operator *= (const gp_Trsf& T)
}
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
friend class gp_GTrsf;

View File

@@ -38,7 +38,7 @@ Standard_Boolean gp_XYZ::IsEqual (const gp_XYZ& Other,
//function : DumpJson
//purpose :
//=======================================================================
void gp_XYZ::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
void gp_XYZ::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_VECTOR_CLASS (theOStream, gp_XYZ, 3, x, y, z)
OCCT_DUMP_VECTOR_CLASS (theOStream, "gp_XYZ", 3, x, y, z)
}

View File

@@ -328,8 +328,7 @@ public:
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected: