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:
@@ -1238,3 +1238,33 @@ void Geom2d_BSplineCurve::PeriodicNormalization(Standard_Real& Parameter) const
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_BSplineCurve::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_BoundedCurve)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, rational)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, periodic)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, knotSet)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, smooth)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, deg)
|
||||
if (!poles.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, poles->Size())
|
||||
|
||||
if (!weights.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, weights->Size())
|
||||
if (!flatknots.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, flatknots->Size())
|
||||
if (!knots.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, knots->Size())
|
||||
if (!mults.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mults->Size())
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, maxderivinv)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, maxderivinvok)
|
||||
}
|
||||
|
@@ -817,6 +817,9 @@ public:
|
||||
//! Creates a new object which is a copy of this BSpline curve.
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -822,3 +822,23 @@ void Geom2d_BezierCurve::Init
|
||||
weights.Nullify();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_BezierCurve::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_BoundedCurve)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, rational)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, closed)
|
||||
if (!poles.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, poles->Size())
|
||||
if (!weights.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, weights->Size())
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, maxderivinv)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, maxderivinvok)
|
||||
}
|
||||
|
@@ -320,6 +320,9 @@ public:
|
||||
//! Creates a new object which is a copy of this Bezier curve.
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -19,4 +19,15 @@
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Geom2d_BoundedCurve,Geom2d_Curve)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Geom2d_BoundedCurve,Geom2d_Curve)
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_BoundedCurve::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Curve)
|
||||
}
|
||||
|
@@ -61,6 +61,9 @@ public:
|
||||
//! "FirstParameter" of the curve.
|
||||
Standard_EXPORT virtual gp_Pnt2d StartPoint() const = 0;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -72,3 +72,11 @@ void Geom2d_CartesianPoint::Transform (const Trsf2d& T) {
|
||||
|
||||
gpPnt2d.Transform (T);
|
||||
}
|
||||
|
||||
void Geom2d_CartesianPoint::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Point)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &gpPnt2d)
|
||||
}
|
||||
|
@@ -76,6 +76,9 @@ public:
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -263,3 +263,15 @@ void Geom2d_Circle::Transform (const Trsf2d& T)
|
||||
radius = radius * Abs(T.ScaleFactor());
|
||||
pos.Transform (T);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_Circle::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Conic)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, radius)
|
||||
}
|
||||
|
@@ -155,6 +155,9 @@ public:
|
||||
//! Creates a new object which is a copy of this circle.
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -69,3 +69,16 @@ Standard_Boolean Geom2d_Conic::IsCN (const Standard_Integer ) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_Conic::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Curve)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &pos)
|
||||
}
|
||||
|
@@ -109,6 +109,9 @@ public:
|
||||
//! Returns True, the order of continuity of a conic is infinite.
|
||||
Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Geom2d_Conic,Geom2d_Curve)
|
||||
|
||||
protected:
|
||||
|
@@ -88,3 +88,14 @@ gp_Pnt2d Geom2d_Curve::Value(const Standard_Real U)const
|
||||
D0(U,P);
|
||||
return P;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_Curve::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Geometry)
|
||||
}
|
||||
|
@@ -224,6 +224,9 @@ public:
|
||||
//! are parallel.
|
||||
Standard_EXPORT gp_Pnt2d Value (const Standard_Real U) const;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -383,3 +383,17 @@ void Geom2d_Ellipse::Transform (const Trsf2d& T)
|
||||
minorRadius = minorRadius * Abs(T.ScaleFactor());
|
||||
pos.Transform(T);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_Ellipse::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Conic)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, majorRadius)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, minorRadius)
|
||||
}
|
||||
|
@@ -241,6 +241,9 @@ public:
|
||||
//! Creates a new object which is a copy of this ellipse.
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -133,3 +133,8 @@ Handle(Geom2d_Geometry) Geom2d_Geometry::Translated (const gp_Pnt2d& P1, const g
|
||||
G->Translate (P1, P2);
|
||||
return G;
|
||||
}
|
||||
|
||||
void Geom2d_Geometry::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
}
|
||||
|
@@ -110,6 +110,9 @@ public:
|
||||
|
||||
Standard_EXPORT virtual Handle(Geom2d_Geometry) Copy() const = 0;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -436,3 +436,17 @@ void Geom2d_Hyperbola::Transform (const Trsf2d& T)
|
||||
minorRadius = minorRadius * Abs (T.ScaleFactor());
|
||||
pos.Transform(T);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_Hyperbola::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Conic)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, majorRadius)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, minorRadius)
|
||||
}
|
||||
|
@@ -294,6 +294,9 @@ public:
|
||||
//! Creates a new object which is a copy of this hyperbola.
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -293,3 +293,14 @@ Standard_Real Geom2d_Line::Distance (const gp_Pnt2d& P) const {
|
||||
return L.Distance (P);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_Line::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Curve)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &pos)
|
||||
}
|
||||
|
@@ -181,6 +181,9 @@ public:
|
||||
//! Creates a new object, which is a copy of this line.
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -388,3 +388,19 @@ GeomAbs_Shape Geom2d_OffsetCurve::GetBasisCurveContinuity() const
|
||||
{
|
||||
return myBasisCurveContinuity;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_OffsetCurve::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Curve)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, basisCurve.get())
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, offsetValue)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myBasisCurveContinuity)
|
||||
}
|
||||
|
@@ -285,6 +285,9 @@ public:
|
||||
//! Returns continuity of the basis curve.
|
||||
Standard_EXPORT GeomAbs_Shape GetBasisCurveContinuity() const;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -335,4 +335,15 @@ Standard_Real Geom2d_Parabola::ParametricTransformation(const gp_Trsf2d& T) cons
|
||||
return Abs(T.ScaleFactor());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_Parabola::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Conic)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, focalLength)
|
||||
}
|
||||
|
||||
|
@@ -205,6 +205,9 @@ public:
|
||||
//! Creates a new object, which is a copy of this parabola.
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -37,3 +37,14 @@ Standard_Real Geom2d_Point::SquareDistance (const Handle(Geom2d_Point)& Other) c
|
||||
gp_Pnt2d P2 = Other->Pnt2d ();
|
||||
return P1.SquareDistance (P2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_Point::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_Geometry)
|
||||
}
|
||||
|
@@ -56,6 +56,9 @@ public:
|
||||
//! computes the square distance between <me> and <Other>.
|
||||
Standard_EXPORT Standard_Real SquareDistance (const Handle(Geom2d_Point)& Other) const;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -345,3 +345,17 @@ Standard_Real Geom2d_TrimmedCurve::ParametricTransformation(const gp_Trsf2d& T)
|
||||
return basisCurve->ParametricTransformation(T);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_TrimmedCurve::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2d_BoundedCurve)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, basisCurve.get())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, uTrim1)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, uTrim2)
|
||||
}
|
||||
|
@@ -256,6 +256,9 @@ public:
|
||||
//! Creates a new object, which is a copy of this trimmed curve.
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user