mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0030949: Foundation Classes - Dump improvement for OCCT classes
1. new file Standard_Dump to prepare and parse Dump in JSON format for OCCT objects 2. some presentations cover the proposed dump functionality. 3. 'bounding', 'vaspects' has '-dumpJson' field to see the DumpJson result 4. Bnd_Box constructor with min/max points is implemented to use Dump of this class in Dump BVH_Box 5. Limitation (some classes of Graphic3d, Prs3d has not full filling for DumpJson)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
|
||||
#include <Prs3d_InvalidAngle.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_ArrowAspect, Prs3d_BasicAspect)
|
||||
|
||||
@@ -65,3 +66,16 @@ void Prs3d_ArrowAspect::SetAngle (const Standard_Real theAngle)
|
||||
|| theAngle >= M_PI / 2.0, "Prs3d_ArrowAspect::SetAngle() - angle out of range");
|
||||
myAngle = theAngle;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_ArrowAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
DUMP_CLASS_BEGIN (theOStream, Prs3d_ArrowAspect);
|
||||
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myArrowAspect.get());
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAngle);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLength);
|
||||
}
|
||||
|
@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectLine3d) myArrowAspect;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#define _Prs3d_BasicAspect_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const = 0;
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Prs3d_BasicAspect, Standard_Transient)
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||
|
||||
// =======================================================================
|
||||
@@ -167,3 +169,21 @@ Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis (Prs3d_DatumParts thePart)
|
||||
}
|
||||
return Prs3d_DP_None;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_DatumAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
DUMP_CLASS_BEGIN (theOStream, Prs3d_DatumAspect);
|
||||
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get());
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPointAspect.get());
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myArrowAspect.get());
|
||||
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAxes);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDrawLabels);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDrawArrows);
|
||||
}
|
||||
|
||||
|
@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
Prs3d_DatumAxes myAxes;
|
||||
Standard_Boolean myToDrawLabels;
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect)
|
||||
|
||||
@@ -59,3 +60,28 @@ void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor)
|
||||
myTextAspect->SetColor (theColor);
|
||||
myArrowAspect->SetColor (theColor);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_DimensionAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
DUMP_CLASS_BEGIN (theOStream, Prs3d_DimensionAspect);
|
||||
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myLineAspect.get());
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get());
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myArrowAspect.get());
|
||||
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValueStringFormat);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myExtensionSize);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myArrowTailSize);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myArrowOrientation);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextHPosition);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextVPosition);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDisplayUnits);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsText3d);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsTextShaded);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsArrows3d);
|
||||
}
|
||||
|
||||
|
@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Prs3d_LineAspect) myLineAspect;
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Drawer, Graphic3d_PresentationAttributes)
|
||||
|
||||
@@ -1409,3 +1410,13 @@ bool Prs3d_Drawer::SetShadingModel (Graphic3d_TypeOfShadingModel theModel,
|
||||
|
||||
return isUpdateNeeded;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_Drawer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
DUMP_CLASS_BEGIN (theOStream, Prs3d_Drawer);
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myShadingAspect.get());
|
||||
}
|
||||
|
@@ -891,6 +891,9 @@ public:
|
||||
Standard_EXPORT bool SetShadingModel (Graphic3d_TypeOfShadingModel theModel,
|
||||
bool theToOverrideDefaults = false);
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Prs3d_Drawer) myLink;
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_LineAspect, Prs3d_BasicAspect)
|
||||
|
||||
// =======================================================================
|
||||
@@ -27,3 +29,14 @@ Prs3d_LineAspect::Prs3d_LineAspect (const Quantity_Color& theColor,
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_LineAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
DUMP_CLASS_BEGIN (theOStream, Prs3d_LineAspect);
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get());
|
||||
}
|
||||
|
||||
|
@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectLine3d) myAspect;
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <Prs3d_PlaneAspect.hxx>
|
||||
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PlaneAspect, Prs3d_BasicAspect)
|
||||
|
||||
// =======================================================================
|
||||
@@ -37,3 +39,28 @@ Prs3d_PlaneAspect::Prs3d_PlaneAspect()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_PlaneAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
DUMP_CLASS_BEGIN (theOStream, Prs3d_PlaneAspect);
|
||||
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myEdgesAspect.get());
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myIsoAspect.get());
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myArrowAspect.get());
|
||||
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myArrowsLength);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myArrowsSize);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myArrowsAngle);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPlaneXLength);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPlaneYLength);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsoDistance);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDrawCenterArrow);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDrawEdgesArrows);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDrawEdges);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDrawIso);
|
||||
}
|
||||
|
||||
|
@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Prs3d_LineAspect) myEdgesAspect;
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PointAspect, Prs3d_BasicAspect)
|
||||
|
||||
// =======================================================================
|
||||
@@ -40,3 +42,14 @@ Prs3d_PointAspect::Prs3d_PointAspect (const Quantity_Color& theColor,
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_PointAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
DUMP_CLASS_BEGIN (theOStream, Prs3d_PointAspect);
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get());
|
||||
}
|
||||
|
||||
|
@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectMarker3d) myAspect;
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_ShadingAspect, Prs3d_BasicAspect)
|
||||
|
||||
@@ -168,3 +169,14 @@ Standard_Real Prs3d_ShadingAspect::Transparency (const Aspect_TypeOfFacingModel
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_ShadingAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
DUMP_CLASS_BEGIN (theOStream, Prs3d_ShadingAspect);
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get());
|
||||
}
|
||||
|
||||
|
@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) myAspect;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
|
||||
#include <Font_NameOfFont.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_TextAspect, Prs3d_BasicAspect)
|
||||
|
||||
@@ -47,3 +48,20 @@ Prs3d_TextAspect::Prs3d_TextAspect (const Handle(Graphic3d_AspectText3d)& theAsp
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_TextAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
DUMP_CLASS_BEGIN (theOStream, Prs3d_TextAspect);
|
||||
|
||||
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get());
|
||||
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHeight);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHorizontalJustification);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVerticalJustification);
|
||||
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myOrientation);
|
||||
}
|
||||
|
||||
|
@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectText3d) myTextAspect;
|
||||
|
Reference in New Issue
Block a user