1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +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:
nds
2019-09-19 15:13:42 +03:00
committed by bugmaster
parent c42ef16585
commit 0904aa6395
83 changed files with 1420 additions and 4 deletions

View File

@@ -15,6 +15,10 @@
#include <SelectMgr_BaseFrustum.hxx>
#include <Message.hxx>
#include <Standard_Dump.hxx>
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 : DumpJson
//purpose :
//=======================================================================
void SelectMgr_BaseFrustum::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
{
DUMP_CLASS_BEGIN (theOStream, SelectMgr_BaseFrustum);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPixelTolerance);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsOrthographic);
DUMP_FIELD_VALUE_POINTER (theOStream, myBuilder);
DUMP_FIELD_VALUE_POINTER (theOStream, myCamera);
}

View File

@@ -28,6 +28,8 @@
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <Standard_OStream.hxx>
//! 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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
DEFINE_STANDARD_RTTIEXT(SelectMgr_BaseFrustum,Standard_Transient)
protected:

View File

@@ -82,3 +82,17 @@ void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationMa
mySelectable->HilightOwnerWithColor (thePM, theStyle, this);
}
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void SelectMgr_EntityOwner::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
{
DUMP_CLASS_BEGIN (theOStream, SelectMgr_EntityOwner);
DUMP_FIELD_VALUE_POINTER (theOStream, mySelectable);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, mypriority);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsSelected);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFromDecomposition);
}

View File

@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
public:
//! Sets the selectable object.

View File

@@ -548,3 +548,16 @@ const Handle(SelectMgr_EntityOwner)& SelectMgr_SelectableObject::GetAssemblyOwne
{
return THE_NULL_ENTITYOWNER;
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void SelectMgr_SelectableObject::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
{
DUMP_CLASS_BEGIN (theOStream, SelectMgr_SelectableObject);
DUMP_FIELD_VALUES_BY_KIND (theOStream, theDepth, PrsMgr_PresentableObject);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myGlobalSelMode);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAutoHilight);
}

View File

@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
public:
//! Begins the iteration scanning for sensitive primitives.

View File

@@ -102,3 +102,18 @@ void SelectMgr_ViewClipRange::AddClippingPlanes (const Graphic3d_SequenceOfHClip
}
}
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void SelectMgr_ViewClipRange::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
{
DUMP_CLASS_BEGIN (theOStream, SelectMgr_ViewClipRange);
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUnclipRange);
for (size_t aRangeIter = 0; aRangeIter < myClipRanges.size(); ++aRangeIter)
{
DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myClipRanges[aRangeIter]);
}
}

View File

@@ -18,6 +18,8 @@
#include <Bnd_Range.hxx>
#include <Standard_TypeDef.hxx>
#include <Standard_OStream.hxx>
#include <Standard_Dump.hxx>
#include <vector>
@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
private:
std::vector<Bnd_Range> myClipRanges;

View File

@@ -1046,3 +1046,26 @@ void SelectMgr_ViewerSelector::AllowOverlapDetection (const Standard_Boolean the
{
mySelectingVolumeMgr.AllowOverlapDetection (theIsToAllow);
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void SelectMgr_ViewerSelector::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
{
DUMP_CLASS_BEGIN (theOStream, SelectMgr_ViewerSelector);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, preferclosest);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToUpdateTolerance);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, mystored.Extent());
Standard_Integer aNbOfSelected = 0;
for (SelectMgr_SelectableObjectSet::Iterator aSelectableIt (mySelectableObjects); aSelectableIt.More(); aSelectableIt.Next())
{
aNbOfSelected++;
}
DUMP_FIELD_VALUE_NUMERICAL (theOStream, aNbOfSelected);
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerances.Tolerance());
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerances.CustomTolerance());
DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayerOrderMap.Size());
}

View File

@@ -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 DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
public:
//! Begins an iteration scanning for the owners detected at a position in the view.