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

0031354: Visualization - Dump improvement for V3d, Graphic3d, Aspect

- do not dump light in view as it's dumped in the viewer
This commit is contained in:
sshutina
2020-02-06 18:17:35 +03:00
committed by bugmaster
parent f0da497005
commit a516227511
72 changed files with 1396 additions and 11 deletions

View File

@@ -39,6 +39,7 @@ Graphic3d_BvhCStructureSetTrsfPers.cxx
Graphic3d_BvhCStructureSetTrsfPers.hxx
Graphic3d_Camera.cxx
Graphic3d_Camera.hxx
Graphic3d_CameraTile.cxx
Graphic3d_CameraTile.hxx
Graphic3d_CappingFlags.hxx
Graphic3d_CLight.cxx
@@ -116,6 +117,7 @@ Graphic3d_PolygonOffset.cxx
Graphic3d_PolygonOffset.hxx
Graphic3d_PriorityDefinitionError.hxx
Graphic3d_RenderingMode.hxx
Graphic3d_RenderingParams.cxx
Graphic3d_RenderingParams.hxx
Graphic3d_RenderTransparentMethod.hxx
Graphic3d_SequenceOfGroup.hxx

View File

@@ -55,3 +55,13 @@ Graphic3d_AspectText3d::Graphic3d_AspectText3d (const Quantity_Color& theColor,
myTextFont = new TCollection_HAsciiString (theFont);
}
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void Graphic3d_AspectText3d::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS(theOStream, theDepth, Graphic3d_Aspects)
}

View File

@@ -110,6 +110,9 @@ public:
//! Returns text FontAspect
Font_FontAspect GetTextFontAspect() const { return myTextFontAspect; }
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
};

View File

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

View File

@@ -245,4 +245,50 @@ void Graphic3d_CLight::SetRange (Standard_ShortReal theValue)
Standard_OutOfRange_Raise_if (theValue < 0.0, "Graphic3d_CLight::SetRange(), Bad value for falloff range");
updateRevisionIf (Abs (Range() - theValue) > ShortRealEpsilon());
myDirection.w() = theValue;
};
};
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Graphic3d_CLight::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, this)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myId)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myName)
if (myType == Graphic3d_TOLS_SPOT || myType == Graphic3d_TOLS_POSITIONAL)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPosition)
}
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColor)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIntensity)
if (myType == Graphic3d_TOLS_SPOT || myType == Graphic3d_TOLS_DIRECTIONAL)
{
gp_Dir aDirection = Direction();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aDirection)
}
if (myType == Graphic3d_TOLS_POSITIONAL || myType == Graphic3d_TOLS_SPOT)
{
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ConstAttenuation())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, LinearAttenuation())
}
if (myType == Graphic3d_TOLS_SPOT)
{
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Angle())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Concentration())
}
if (myType == Graphic3d_TOLS_POSITIONAL || myType == Graphic3d_TOLS_SPOT)
{
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Range())
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySmoothness)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myType)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRevision)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsHeadlight)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsEnabled)
}

View File

@@ -204,6 +204,9 @@ public:
//! @return modification counter
Standard_Size Revision() const { return myRevision; }
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
private:

View File

@@ -1407,3 +1407,46 @@ void Graphic3d_CView::DiagnosticInformation (TColStd_IndexedDataMapOfStringStrin
theDict.ChangeFromIndex (theDict.Add ("VRserial", aSerial)) = aSerial;
}
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Graphic3d_CView::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Graphic3d_DataStructureManager);
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myId)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myRenderParams)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBgColor)
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStructureManager)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myCamera.get())
for (Graphic3d_SequenceOfStructure::Iterator anIter (myStructsToCompute); anIter.More(); anIter.Next())
{
const Handle(Graphic3d_Structure)& aStructToCompute = anIter.Value();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aStructToCompute.get())
}
for (Graphic3d_SequenceOfStructure::Iterator anIter (myStructsComputed); anIter.More(); anIter.Next())
{
const Handle(Graphic3d_Structure)& aStructComputed = anIter.Value();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aStructComputed.get())
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsInComputedMode)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsActive)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsRemoved)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShadingModel)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVisualization)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myBackXRCamera.get())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myBaseXRCamera.get())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPosedXRCamera.get())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPosedXRCameraCopy.get())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUnitFactor)
}

View File

@@ -534,6 +534,9 @@ public: //! @name obsolete Graduated Trihedron functionality
(void )theMin;
(void )theMax;
}
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
private:

View File

@@ -1742,4 +1742,23 @@ void Graphic3d_Camera::DumpJson (Standard_OStream& theOStream, Standard_Integer
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEye)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDistance)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myAxialScale)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myProjType)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFOVy)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZNear)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZFar)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAspect)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myScale)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZFocus)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZFocusType)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIOD)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIODType)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myTile)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myMatricesD)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myMatricesF)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myWorldViewProjState)
}

View File

@@ -78,6 +78,23 @@ private:
//! Return true if Projection was not invalidated.
Standard_Boolean IsProjectionValid() const { return myIsProjectionValid; }
//! Dumps the content of me into the stream
void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const
{
if (IsOrientationValid())
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Orientation)
}
if (IsProjectionValid())
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &MProjection)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &LProjection)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &RProjection)
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsOrientationValid)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsProjectionValid)
}
public:

View File

@@ -0,0 +1,30 @@
// Created on: 2020-02-06
// Created by: Svetlana SHUTINA
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_CameraTile.hxx>
#include <Standard_Dump.hxx>
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Graphic3d_CameraTile::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &TotalSize)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &TileSize)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Offset)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsTopDown)
}

View File

@@ -16,6 +16,7 @@
#include <Graphic3d_Vec2.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_TypeDef.hxx>
//! Class defines the area (Tile) inside a view.
@@ -82,6 +83,9 @@ public:
&& anOffset1.x() == anOffset2.x()
&& anOffset1.y() == anOffset2.y();
}
//! 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 @@
// for the class
#include <Graphic3d_DataStructureManager.hxx>
#include <Standard_Dump.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_DataStructureManager,Standard_Transient)
@@ -32,3 +33,12 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_DataStructureManager,Standard_Transient)
//-Constructors
Graphic3d_DataStructureManager::Graphic3d_DataStructureManager () {
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Graphic3d_DataStructureManager::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
}

View File

@@ -32,6 +32,7 @@ DEFINE_STANDARD_HANDLE(Graphic3d_DataStructureManager, Standard_Transient)
//! It defines the global attributes.
class Graphic3d_DataStructureManager : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_DataStructureManager,Standard_Transient)
protected:
@@ -41,6 +42,9 @@ protected:
//! Returns camera object of the view.
virtual const Handle(Graphic3d_Camera)& Camera() const = 0;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
};
#endif // _Graphic3d_DataStructureManager_HeaderFile

View File

@@ -281,3 +281,20 @@ void Graphic3d_GraphicDriver::SetZLayerSettings (const Graphic3d_ZLayerId theLay
"Graphic3d_GraphicDriver::SetZLayerSettings, Layer with theLayerId does not exist");
aLayerDef->SetLayerSettings (theSettings);
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void Graphic3d_GraphicDriver::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myStructGenId)
for (NCollection_List<Handle(Graphic3d_Layer)>::Iterator anIter (myLayers); anIter.More(); anIter.Next())
{
const Handle(Graphic3d_Layer)& aLayer = anIter.Value();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aLayer.get())
}
}

View File

@@ -155,6 +155,9 @@ public:
//! Frees the identifier of a structure.
Standard_EXPORT void RemoveIdentification(const Standard_Integer theId);
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -452,11 +452,15 @@ void Graphic3d_Group::AddText (const Handle(Graphic3d_Text)& theTextParams,
// function : DumpJson
// purpose :
// =======================================================================
void Graphic3d_Group::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
void Graphic3d_Group::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, this)
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStructure)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBounds)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsClosed)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myContainsFacet)
}

View File

@@ -0,0 +1,92 @@
// Created on: 2020-02-06
// Created by: Svetlana SHUTINA
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_RenderingParams.hxx>
#include <Standard_Dump.hxx>
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Graphic3d_RenderingParams::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Method)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, TransparencyMethod)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, LineFeather)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, PbrEnvPow2Size)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, PbrEnvSpecMapNbLevels)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, PbrEnvBakingDiffNbSamples)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, PbrEnvBakingSpecNbSamples)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, PbrEnvBakingProbability)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, OitDepthFactor)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, NbMsaaSamples)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, RenderResolutionScale)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ToEnableDepthPrepass)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ToEnableAlphaToCoverage)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsGlobalIlluminationEnabled)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, SamplesPerPixel)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, RaytracingDepth)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsShadowEnabled)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsReflectionEnabled)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsAntialiasingEnabled)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsTransparentShadowEnabled)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, UseEnvironmentMapBackground)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ToIgnoreNormalMapInRayTracing)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, CoherentPathTracingMode)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, AdaptiveScreenSampling)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, AdaptiveScreenSamplingAtomic)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ShowSamplingTiles)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, TwoSidedBsdfModels)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, RadianceClampingValue)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, RebuildRayTracingShaders)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, RayTracingTileSize)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, NbRayTracingTiles)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, CameraApertureRadius)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, CameraFocalPlaneDist)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, FrustumCullingState)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ToneMappingMethod)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Exposure)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, WhitePoint)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, StereoMode)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, AnaglyphFilter)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &AnaglyphLeft)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &AnaglyphRight)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ToReverseStereo)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, StatsPosition.get())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, ChartPosition.get())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &ChartSize)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, StatsTextAspect.get())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, StatsUpdateInterval)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, StatsTextHeight)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, StatsNbFrames)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, StatsMaxChartTime)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, CollectedStats)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ToShowStats)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Resolution)
}

View File

@@ -176,6 +176,9 @@ public:
{
return Resolution / static_cast<Standard_ShortReal> (THE_DEFAULT_RESOLUTION);
}
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
public:

View File

@@ -1041,8 +1041,22 @@ void Graphic3d_Structure::DumpJson (Standard_OStream& theOStream, Standard_Integ
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStructureManager)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myCStructure.get())
for (NCollection_IndexedMap<Graphic3d_Structure*>::Iterator anIter (myAncestors); anIter.More(); anIter.Next())
{
Graphic3d_Structure* anAncestor = anIter.Value();
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, anAncestor)
}
for (NCollection_IndexedMap<Graphic3d_Structure*>::Iterator anIter (myDescendants); anIter.More(); anIter.Next())
{
Graphic3d_Structure* aDescendant = anIter.Value();
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aDescendant)
}
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myOwner)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVisual)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myComputeVisual)
}

View File

@@ -446,3 +446,37 @@ void Graphic3d_StructureManager::ChangeZLayer (const Handle(Graphic3d_Structure)
aViewIt.Value()->ChangeZLayer (theStructure, theLayerId);
}
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void Graphic3d_StructureManager::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
for (Graphic3d_MapOfStructure::Iterator anIter (myDisplayedStructure); anIter.More(); anIter.Next())
{
const Handle(Graphic3d_Structure)& aDisplayedStructure = anIter.Value();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aDisplayedStructure.get())
}
for (Graphic3d_MapOfStructure::Iterator anIter (myHighlightedStructure); anIter.More(); anIter.Next())
{
const Handle(Graphic3d_Structure)& aHighlightedStructure = anIter.Value();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aHighlightedStructure.get())
}
for (Graphic3d_MapOfObject::Iterator anIter (myRegisteredObjects); anIter.More(); anIter.Next())
{
const Handle(Graphic3d_ViewAffinity)& aRegisteredObject = anIter.Value();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aRegisteredObject.get())
}
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myGraphicDriver.get())
for (Graphic3d_IndexedMapOfView::Iterator anIter (myDefinedViews); anIter.More(); anIter.Next())
{
Graphic3d_CView* aDefinedView = anIter.Value();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aDefinedView)
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDeviceLostFlag)
}

View File

@@ -162,6 +162,9 @@ public:
//! Sets Device Lost flag.
void SetDeviceLost() { myDeviceLostFlag = Standard_True; }
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -15,9 +15,22 @@
#include <Graphic3d_Vertex.hxx>
#include <gp_XYZ.hxx>
#include <Standard_Dump.hxx>
Standard_ShortReal Graphic3d_Vertex::Distance(const Graphic3d_Vertex& AOther) const
{
return sqrt( (X() - AOther.X()) * (X() - AOther.X())
+ (Y() - AOther.Y()) * (Y() - AOther.Y())
+ (Z() - AOther.Z()) * (Z() - AOther.Z()) );
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void Graphic3d_Vertex::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
gp_XYZ aCoord (xyz[0], xyz[1], xyz[2]);
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aCoord)
}

View File

@@ -102,6 +102,9 @@ public:
//! Returns the distance between two points.
Standard_EXPORT Standard_ShortReal Distance (const Graphic3d_Vertex& theOther) const;
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
float xyz[3];

View File

@@ -141,6 +141,15 @@ public:
&& myWorldViewState == theOther.myWorldViewState;
}
//! Dumps the content of me into the stream
void DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsValid)
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myCamera)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myProjectionState)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myWorldViewState)
}
private:
Standard_Boolean myIsValid;