mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +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:
@@ -254,12 +254,12 @@ gp_Pnt SelectMgr_BaseFrustum::DetectedPoint (const Standard_Real /*theDepth*/) c
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SelectMgr_BaseFrustum::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
void SelectMgr_BaseFrustum::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_BaseFrustum);
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPixelTolerance);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsOrthographic);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myBuilder);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myCamera);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPixelTolerance)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsOrthographic)
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myBuilder)
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myCamera)
|
||||
}
|
||||
|
@@ -174,7 +174,7 @@ public:
|
||||
}
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(SelectMgr_BaseFrustum,Standard_Transient)
|
||||
|
||||
|
@@ -87,12 +87,14 @@ void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationMa
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void SelectMgr_EntityOwner::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
void SelectMgr_EntityOwner::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_EntityOwner);
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mySelectable);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mypriority);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsSelected);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFromDecomposition);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, this)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mySelectable)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mypriority)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsSelected)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFromDecomposition)
|
||||
}
|
||||
|
@@ -188,7 +188,7 @@ public:
|
||||
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;
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -552,11 +552,21 @@ const Handle(SelectMgr_EntityOwner)& SelectMgr_SelectableObject::GetAssemblyOwne
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void SelectMgr_SelectableObject::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
void SelectMgr_SelectableObject::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_SelectableObject);
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, PrsMgr_PresentableObject);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myGlobalSelMode);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAutoHilight);
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, PrsMgr_PresentableObject)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySelectionPrs.get())
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myHilightPrs.get())
|
||||
|
||||
for (SelectMgr_SequenceOfSelection::Iterator anIterator (myselections); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
const Handle(SelectMgr_Selection)& aSelection = anIterator.Value();
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aSelection.get())
|
||||
}
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myGlobalSelMode)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAutoHilight)
|
||||
}
|
||||
|
@@ -170,7 +170,7 @@ public:
|
||||
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;
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -389,3 +389,29 @@ void SelectMgr_SelectableObjectSet::MarkDirty()
|
||||
myIsDirty[BVHSubset_3dPersistent] = Standard_True;
|
||||
myIsDirty[BVHSubset_2dPersistent] = Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SelectMgr_SelectableObjectSet::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
|
||||
{
|
||||
for (Standard_Integer aSubsetIdx = 0; aSubsetIdx < BVHSubsetNb; ++aSubsetIdx)
|
||||
{
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aSubsetIdx)
|
||||
|
||||
Standard_Boolean IsDirty = myIsDirty[aSubsetIdx];
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsDirty)
|
||||
|
||||
for (NCollection_IndexedMap<Handle(SelectMgr_SelectableObject)>::Iterator anObjectIt (myObjects[aSubsetIdx]);
|
||||
anObjectIt.More(); anObjectIt.Next())
|
||||
{
|
||||
const Handle(SelectMgr_SelectableObject)& SelectableObject = anObjectIt.Value();
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, SelectableObject.get())
|
||||
}
|
||||
|
||||
TCollection_AsciiString separator;
|
||||
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, separator)
|
||||
}
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLastWidth)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLastHeight)
|
||||
}
|
||||
|
@@ -180,6 +180,9 @@ public:
|
||||
return myBVH[theSubset];
|
||||
}
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||
|
||||
private:
|
||||
|
||||
//! Returns an appropriate subset of theObject given depending on its persistence type.
|
||||
|
@@ -14,6 +14,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <SelectMgr_SelectingVolumeManager.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// function : SelectMgr_SelectingVolumeManager
|
||||
@@ -482,3 +483,24 @@ void SelectMgr_SelectingVolumeManager::SetViewClipping (const SelectMgr_Selectin
|
||||
myObjectClipPlanes = theOther.myObjectClipPlanes;
|
||||
myViewClipRange = theOther.myViewClipRange;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SelectMgr_SelectingVolumeManager::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_SelectingVolumeManager)
|
||||
|
||||
for (Standard_Integer anIdx = 0; anIdx < VolumeTypesNb; ++anIdx)
|
||||
{
|
||||
const Handle(SelectMgr_BaseFrustum)& aSelectingVolume = mySelectingVolumes[anIdx];
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aSelectingVolume.get())
|
||||
}
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myViewClipPlanes.get())
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myObjectClipPlanes.get())
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myViewClipRange)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToAllowOverlap)
|
||||
}
|
||||
|
@@ -236,6 +236,9 @@ public:
|
||||
return mySelectingVolumes[myActiveSelectionType / 2]->GetPlanes (thePlaneEquations);
|
||||
}
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
enum { Frustum, FrustumSet, VolumeTypesNb }; //!< Defines the amount of available selecting volumes
|
||||
|
||||
|
@@ -115,3 +115,25 @@ void SelectMgr_Selection::SetSensitivity (const Standard_Integer theNewSens)
|
||||
anEntity->BaseSensitive()->SetSensitivityFactor (theNewSens);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void SelectMgr_Selection::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anIterator (myEntities); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
const Handle(SelectMgr_SensitiveEntity)& anEntity = anIterator.Value();
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anEntity.get())
|
||||
}
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMode)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySelectionState)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySensFactor)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUpdateStatus)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myBVHUpdateStatus)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsCustomSens)
|
||||
}
|
||||
|
@@ -120,6 +120,9 @@ public:
|
||||
//! proper updates use SelectMgr_SelectionManager::SetSelectionSensitivity method.
|
||||
Standard_EXPORT void SetSensitivity (const Standard_Integer theNewSens);
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||
|
||||
private:
|
||||
|
||||
NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> myEntities;
|
||||
|
@@ -39,3 +39,15 @@ void SelectMgr_SensitiveEntity::Clear()
|
||||
mySensitive->Clear();
|
||||
mySensitive.Nullify();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void SelectMgr_SensitiveEntity::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySensitive.get())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsActiveForSelection)
|
||||
}
|
||||
|
@@ -47,6 +47,9 @@ public:
|
||||
//! Marks entity as active for selection
|
||||
void SetActiveForSelection() const { myIsActiveForSelection = Standard_True; }
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(SelectMgr_SensitiveEntity,Standard_Transient) // Type definition
|
||||
|
||||
private:
|
||||
|
@@ -107,13 +107,14 @@ void SelectMgr_ViewClipRange::AddClippingPlanes (const Graphic3d_SequenceOfHClip
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void SelectMgr_ViewClipRange::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
void SelectMgr_ViewClipRange::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_ViewClipRange);
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_ViewClipRange)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUnclipRange);
|
||||
for (size_t aRangeIter = 0; aRangeIter < myClipRanges.size(); ++aRangeIter)
|
||||
{
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myClipRanges[aRangeIter]);
|
||||
Bnd_Range aClipRange = myClipRanges[aRangeIter];
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aClipRange)
|
||||
}
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUnclipRange)
|
||||
}
|
||||
|
@@ -120,7 +120,7 @@ public:
|
||||
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;
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -1051,21 +1051,38 @@ void SelectMgr_ViewerSelector::AllowOverlapDetection (const Standard_Boolean the
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SelectMgr_ViewerSelector::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
void SelectMgr_ViewerSelector::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_ViewerSelector);
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, preferclosest);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToUpdateTolerance);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mystored.Extent());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, preferclosest)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToUpdateTolerance)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mystored.Extent())
|
||||
|
||||
Standard_Integer aNbOfSelected = 0;
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, &mySelectingVolumeMgr)
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, &mySelectableObjects)
|
||||
|
||||
Standard_Integer aNbOfSelectableObjects = 0;
|
||||
for (SelectMgr_SelectableObjectSet::Iterator aSelectableIt (mySelectableObjects); aSelectableIt.More(); aSelectableIt.Next())
|
||||
{
|
||||
aNbOfSelected++;
|
||||
aNbOfSelectableObjects++;
|
||||
}
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aNbOfSelected);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerances.Tolerance());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerances.CustomTolerance());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayerOrderMap.Size());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aNbOfSelectableObjects)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerances.Tolerance())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerances.CustomTolerance())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayerOrderMap.Extent())
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myEntitySetBuilder.get())
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCameraEye)
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCameraDir)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCameraScale)
|
||||
|
||||
if (!myIndexes.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIndexes->Size())
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurRank)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsLeftChildQueuedFirst)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myEntityIdx)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMapOfObjectSensitives.Extent())
|
||||
}
|
||||
|
@@ -210,7 +210,7 @@ public:
|
||||
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;
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||
|
||||
public:
|
||||
|
||||
|
Reference in New Issue
Block a user