mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0030268: Inspectors - improvements in VInspector plugin
# Dump for OCCT objects
This commit is contained in:
@@ -985,3 +985,12 @@ void Bnd_Box::DumpJson (Standard_OStream& theOStream, const Standard_Integer) co
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Gap);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Flags);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Bnd_Box::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -305,6 +305,9 @@ public:
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
//! Inits the content of me into the stream
|
||||
Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
|
||||
|
||||
protected:
|
||||
|
||||
//! Bit flags.
|
||||
|
@@ -1041,3 +1041,12 @@ void Bnd_OBB::DumpJson (Standard_OStream& theOStream, const Standard_Integer the
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHDims[2]);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsAABox);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Bnd_OBB::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -285,6 +285,9 @@ public:
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
//! Inits the content of me into the stream
|
||||
Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
|
||||
|
||||
protected:
|
||||
|
||||
void ProcessOnePoint(const gp_Pnt& theP)
|
||||
|
@@ -60,6 +60,24 @@ void Graphic3d_CStructure::DumpJson (Standard_OStream& theOStream, const Standar
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aGroup.get());
|
||||
}
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Id);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayer);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Priority);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, PreviousPriority);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ContainsFacet);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &ViewAffinity);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsInfinite);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, stick);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, highlight);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, visible);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, HLRValidation);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsForHighlight);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsMutable);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Is2dText);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBndBox);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTrsf.get());
|
||||
|
@@ -1546,3 +1546,41 @@ void Graphic3d_Camera::FrustumPoints (NCollection_Array1<Graphic3d_Vec3d>& thePo
|
||||
aTmpPnt = anInvWorldView * aLeftBottomFar;
|
||||
thePoints.SetValue (FrustumVert_LeftBottomFar, aTmpPnt.xyz() / aTmpPnt.w());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Graphic3d_Camera::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Camera);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUp);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myDirection);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEye);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDistance);
|
||||
|
||||
/*gp_XYZ myAxialScale; //!< World axial scale.
|
||||
|
||||
Projection myProjType; //!< Projection type used for rendering.
|
||||
Standard_Real myFOVy; //!< Field Of View in y axis.
|
||||
Standard_Real myFOVyTan; //!< Field Of View as Tan(DTR_HALF * myFOVy)
|
||||
Standard_Real myZNear; //!< Distance to near clipping plane.
|
||||
Standard_Real myZFar; //!< Distance to far clipping plane.
|
||||
Standard_Real myAspect; //!< Width to height display ratio.
|
||||
|
||||
Standard_Real myScale; //!< Specifies parallel scale for orthographic projection.
|
||||
Standard_Real myZFocus; //!< Stereographic focus value.
|
||||
FocusType myZFocusType; //!< Stereographic focus definition type.
|
||||
|
||||
Standard_Real myIOD; //!< Intraocular distance value.
|
||||
IODType myIODType; //!< Intraocular distance definition type.
|
||||
|
||||
Graphic3d_CameraTile myTile;//!< Tile defining sub-area for drawing
|
||||
|
||||
mutable TransformMatrices<Standard_Real> myMatricesD;
|
||||
mutable TransformMatrices<Standard_ShortReal> myMatricesF;
|
||||
|
||||
mutable Graphic3d_WorldViewProjState myWorldViewProjState;*/
|
||||
}
|
||||
|
@@ -552,6 +552,9 @@ public:
|
||||
//! The matrix will be updated on request.
|
||||
Standard_EXPORT void InvalidateOrientation();
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
//! @name Managing projection and orientation cache
|
||||
private:
|
||||
|
||||
|
@@ -626,3 +626,41 @@ void Graphic3d_Layer::SetLayerSettings (const Graphic3d_ZLayerSettings& theSetti
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_Layer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Layer);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLayerId);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructures);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructuresNotCulled);
|
||||
|
||||
const Standard_Integer aNbPriorities = myArray.Length();
|
||||
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
|
||||
{
|
||||
const Graphic3d_IndexedMapOfStructure& aStructures = myArray (aPriorityIter);
|
||||
for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next())
|
||||
{
|
||||
const Graphic3d_CStructure* aStructure = aStructIter.Value();
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aStructure);
|
||||
}
|
||||
}
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myLayerSettings);
|
||||
|
||||
//mutable Graphic3d_BvhCStructureSet myBVHPrimitives;
|
||||
//mutable Graphic3d_BvhCStructureSetTrsfPers myBVHPrimitivesTrsfPers;
|
||||
//mutable NCollection_IndexedMap<const Graphic3d_CStructure*> myAlwaysRenderedMap;
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myBVHIsLeftChildQueuedFirst);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsBVHPrimitivesNeedsReset);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsBoundingBoxNeedsReset[0]);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsBoundingBoxNeedsReset[1]);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBoundingBox[0]);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBoundingBox[1]);
|
||||
}
|
||||
|
@@ -144,6 +144,9 @@ public:
|
||||
//! Returns indexed map of always rendered structures.
|
||||
const NCollection_IndexedMap<const Graphic3d_CStructure*>& NonCullableStructures() const { return myAlwaysRenderedMap; }
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
protected:
|
||||
|
||||
//! Updates BVH trees if their state has been invalidated.
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <Graphic3d_LightSet.hxx>
|
||||
#include <Graphic3d_PolygonOffset.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
enum Graphic3d_ZLayerSetting
|
||||
@@ -208,6 +209,31 @@ struct Graphic3d_ZLayerSettings
|
||||
myPolygonOffset.Units =-1.0f;
|
||||
}
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_ZLayerSettings);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myName);
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myLights.get());
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myOriginTrsf.get());
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myOrigin);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCullingDistance);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCullingSize);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPolygonOffset);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsImmediate);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToRaytrace);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUseEnvironmentTexture);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToEnableDepthTest);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToEnableDepthWrite);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToClearDepth);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToRenderInDepthPrepass);
|
||||
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
TCollection_AsciiString myName; //!< user-provided name
|
||||
|
@@ -1442,103 +1442,110 @@ bool Prs3d_Drawer::SetShadingModel (Graphic3d_TypeOfShadingModel theModel,
|
||||
void Prs3d_Drawer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Prs3d_Drawer);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLink.get());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnNbPoints);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaximalParameterValue);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnMaximalParameterValue);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myChordialDeviation);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnChordialDeviation);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeOfDeflection);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTypeOfDeflection);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeOfHLR);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDeviationCoefficient);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousDeviationCoefficient);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDeviationCoefficient);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHLRDeviationCoefficient);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnHLRDeviationCoefficient);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousHLRDeviationCoefficient);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDeviationAngle);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDeviationAngle);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousDeviationAngle);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHLRAngle);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnHLRDeviationAngle);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousHLRDeviationAngle);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsoOnPlane);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnIsoOnPlane);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsoOnTriangulation);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnIsoOnTriangulation);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsAutoTriangulated);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnIsAutoTriangulated);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myUIsoAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnUIsoAspect);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myVIsoAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnVIsoAspect);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myWireAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnWireAspect);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myWireDraw);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnWireDraw);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPointAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnPointAspect);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myLineAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnLineAspect);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTextAspect);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myShadingAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnShadingAspect);
|
||||
|
||||
//Handle(Prs3d_Drawer) myLink;
|
||||
/*
|
||||
Standard_Boolean myHasOwnNbPoints;
|
||||
Standard_Real myMaximalParameterValue;
|
||||
Standard_Boolean myHasOwnMaximalParameterValue;
|
||||
Standard_Real myChordialDeviation;
|
||||
Standard_Boolean myHasOwnChordialDeviation;
|
||||
Aspect_TypeOfDeflection myTypeOfDeflection;
|
||||
Standard_Boolean myHasOwnTypeOfDeflection;
|
||||
Prs3d_TypeOfHLR myTypeOfHLR;
|
||||
Standard_Real myDeviationCoefficient;
|
||||
Standard_Real myPreviousDeviationCoefficient;
|
||||
Standard_Boolean myHasOwnDeviationCoefficient;
|
||||
Standard_Real myHLRDeviationCoefficient;
|
||||
Standard_Boolean myHasOwnHLRDeviationCoefficient;
|
||||
Standard_Real myPreviousHLRDeviationCoefficient;
|
||||
Standard_Real myDeviationAngle;
|
||||
Standard_Boolean myHasOwnDeviationAngle;
|
||||
Standard_Real myPreviousDeviationAngle;
|
||||
Standard_Real myHLRAngle;
|
||||
Standard_Boolean myHasOwnHLRDeviationAngle;
|
||||
Standard_Real myPreviousHLRDeviationAngle;
|
||||
Standard_Boolean myIsoOnPlane;
|
||||
Standard_Boolean myHasOwnIsoOnPlane;
|
||||
Standard_Boolean myIsoOnTriangulation;
|
||||
Standard_Boolean myHasOwnIsoOnTriangulation;
|
||||
Standard_Boolean myIsAutoTriangulated;
|
||||
Standard_Boolean myHasOwnIsAutoTriangulated;*/
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPlaneAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnPlaneAspect);
|
||||
|
||||
/*Handle(Prs3d_IsoAspect) myUIsoAspect;
|
||||
Standard_Boolean myHasOwnUIsoAspect;
|
||||
Handle(Prs3d_IsoAspect) myVIsoAspect;
|
||||
Standard_Boolean myHasOwnVIsoAspect;
|
||||
Handle(Prs3d_LineAspect) myWireAspect;
|
||||
Standard_Boolean myHasOwnWireAspect;
|
||||
Standard_Boolean myWireDraw;
|
||||
Standard_Boolean myHasOwnWireDraw;
|
||||
Handle(Prs3d_PointAspect) myPointAspect;
|
||||
Standard_Boolean myHasOwnPointAspect;
|
||||
Handle(Prs3d_LineAspect) myLineAspect;
|
||||
Standard_Boolean myHasOwnLineAspect;
|
||||
*/
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySeenLineAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSeenLineAspect);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTextAspect);
|
||||
if (!myTextAspect.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get());
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myArrowAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnArrowAspect);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLineArrowDraw);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnLineArrowDraw);
|
||||
|
||||
//Handle(Prs3d_ShadingAspect) myShadingAspect;
|
||||
//Standard_Boolean myHasOwnShadingAspect;
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myHiddenLineAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnHiddenLineAspect);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDrawHiddenLine);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDrawHiddenLine);
|
||||
|
||||
/*Handle(Prs3d_PlaneAspect) myPlaneAspect;
|
||||
Standard_Boolean myHasOwnPlaneAspect;
|
||||
Handle(Prs3d_LineAspect) mySeenLineAspect;
|
||||
Standard_Boolean myHasOwnSeenLineAspect;
|
||||
Handle(Prs3d_ArrowAspect) myArrowAspect;
|
||||
Standard_Boolean myHasOwnArrowAspect;
|
||||
Standard_Boolean myLineArrowDraw;
|
||||
Standard_Boolean myHasOwnLineArrowDraw;
|
||||
Handle(Prs3d_LineAspect) myHiddenLineAspect;
|
||||
Standard_Boolean myHasOwnHiddenLineAspect;
|
||||
Standard_Boolean myDrawHiddenLine;
|
||||
Standard_Boolean myHasOwnDrawHiddenLine;
|
||||
Handle(Prs3d_LineAspect) myVectorAspect;
|
||||
Standard_Boolean myHasOwnVectorAspect;
|
||||
Prs3d_VertexDrawMode myVertexDrawMode;
|
||||
Handle(Prs3d_DatumAspect) myDatumAspect;
|
||||
Standard_Boolean myHasOwnDatumAspect;
|
||||
Handle(Prs3d_LineAspect) mySectionAspect;
|
||||
Standard_Boolean myHasOwnSectionAspect;
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myVectorAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnVectorAspect);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVertexDrawMode);
|
||||
|
||||
Handle(Prs3d_LineAspect) myFreeBoundaryAspect;
|
||||
Standard_Boolean myHasOwnFreeBoundaryAspect;
|
||||
Standard_Boolean myFreeBoundaryDraw;
|
||||
Standard_Boolean myHasOwnFreeBoundaryDraw;
|
||||
Handle(Prs3d_LineAspect) myUnFreeBoundaryAspect;
|
||||
Standard_Boolean myHasOwnUnFreeBoundaryAspect;
|
||||
Standard_Boolean myUnFreeBoundaryDraw;
|
||||
Standard_Boolean myHasOwnUnFreeBoundaryDraw;
|
||||
Handle(Prs3d_LineAspect) myFaceBoundaryAspect;
|
||||
Standard_Integer myFaceBoundaryUpperContinuity; //!< the most edge continuity class (GeomAbs_Shape) to be included to face boundaries presentation, or -1 if undefined
|
||||
Standard_Boolean myHasOwnFaceBoundaryAspect;
|
||||
Standard_Boolean myFaceBoundaryDraw;
|
||||
Standard_Boolean myHasOwnFaceBoundaryDraw;
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDatumAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDatumAspect);
|
||||
|
||||
Handle(Prs3d_DimensionAspect) myDimensionAspect;
|
||||
Standard_Boolean myHasOwnDimensionAspect;
|
||||
Prs3d_DimensionUnits myDimensionModelUnits;
|
||||
Standard_Boolean myHasOwnDimLengthModelUnits;
|
||||
Standard_Boolean myHasOwnDimAngleModelUnits;
|
||||
Prs3d_DimensionUnits myDimensionDisplayUnits;
|
||||
Standard_Boolean myHasOwnDimLengthDisplayUnits;
|
||||
Standard_Boolean myHasOwnDimAngleDisplayUnits;
|
||||
*/
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySectionAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSectionAspect);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFreeBoundaryAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFreeBoundaryAspect);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFreeBoundaryDraw);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFreeBoundaryDraw);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myUnFreeBoundaryAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnUnFreeBoundaryAspect);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUnFreeBoundaryDraw);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnUnFreeBoundaryDraw);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFaceBoundaryAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceBoundaryUpperContinuity);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFaceBoundaryAspect);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceBoundaryDraw);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFaceBoundaryDraw);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDimensionAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimensionAspect);
|
||||
//OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDimensionModelUnits);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimLengthModelUnits);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimAngleModelUnits);
|
||||
//OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDimensionDisplayUnits);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimLengthDisplayUnits);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimAngleDisplayUnits);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFillCappingAspect);
|
||||
if (!myFillCappingAspect.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFillCappingAspect.get());
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFillCappingAspect.get());
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ void Standard_Dump::AddValuesSeparator (Standard_OStream& theOStream)
|
||||
Standard_SStream aStream;
|
||||
aStream << theOStream.rdbuf();
|
||||
TCollection_AsciiString aStreamStr = Standard_Dump::Text (aStream);
|
||||
if (!aStreamStr.EndsWith ("{"))
|
||||
if (!aStreamStr.IsEmpty() && !aStreamStr.EndsWith ("{"))
|
||||
theOStream << ", ";
|
||||
}
|
||||
|
||||
@@ -104,9 +104,17 @@ Standard_Boolean Standard_Dump::ProcessStreamName (const Standard_SStream& theSt
|
||||
TCollection_AsciiString aText = Text (theStream);
|
||||
if (aText.IsEmpty())
|
||||
return Standard_False;
|
||||
TCollection_AsciiString aSubText = aText.SubString (theStreamPos, aText.Length());
|
||||
|
||||
TCollection_AsciiString aKeyName = theName + JsonKeyToString (Standard_JsonKey_SeparatorKeyToValue);
|
||||
TCollection_AsciiString aSubText = aText.SubString (theStreamPos, aText.Length());
|
||||
if (aSubText.StartsWith (JsonKeyToString (Standard_JsonKey_SeparatorValueToValue)))
|
||||
{
|
||||
theStreamPos += JsonKeyLength (Standard_JsonKey_SeparatorValueToValue);
|
||||
aSubText = aText.SubString (theStreamPos, aText.Length());
|
||||
}
|
||||
TCollection_AsciiString aKeyName = TCollection_AsciiString (JsonKeyToString (Standard_JsonKey_Quote))
|
||||
+ theName
|
||||
+ TCollection_AsciiString (JsonKeyToString (Standard_JsonKey_Quote))
|
||||
+ JsonKeyToString (Standard_JsonKey_SeparatorKeyToValue);
|
||||
Standard_Boolean aResult = aSubText.StartsWith (aKeyName);
|
||||
if (aResult)
|
||||
theStreamPos += aKeyName.Length();
|
||||
@@ -122,14 +130,15 @@ Standard_Boolean Standard_Dump::InitRealValues (const Standard_SStream& theStrea
|
||||
Standard_Integer& theStreamPos,
|
||||
int theCount, ...)
|
||||
{
|
||||
Standard_Integer aStreamPos = theStreamPos + JsonKeyLength (Standard_JsonKey_OpenContainer) + 1;
|
||||
Standard_Integer aStreamPos = theStreamPos + JsonKeyLength (Standard_JsonKey_OpenContainer);
|
||||
|
||||
TCollection_AsciiString aText = Text (theStream);
|
||||
TCollection_AsciiString aSubText = aText.SubString (aStreamPos, aText.Length());
|
||||
Standard_Integer aClosePos = aSubText.Location (JsonKeyToString (Standard_JsonKey_CloseContainer), aStreamPos, aSubText.Length());
|
||||
|
||||
va_list vl;
|
||||
va_start(vl, theCount);
|
||||
aStreamPos = 1;
|
||||
Standard_Integer aClosePos = aSubText.Location (JsonKeyToString (Standard_JsonKey_CloseContainer), aStreamPos, aSubText.Length());
|
||||
for(int i = 0; i < theCount; ++i)
|
||||
{
|
||||
//if (i < theCount -1)
|
||||
@@ -142,13 +151,15 @@ Standard_Boolean Standard_Dump::InitRealValues (const Standard_SStream& theStrea
|
||||
if (!aValueText.IsRealValue())
|
||||
return Standard_False;
|
||||
|
||||
va_arg(vl, Standard_Real) = aValueText.RealValue();
|
||||
Standard_Real aVal = aValueText.RealValue();
|
||||
*(va_arg(vl, Standard_Real*)) = aValueText.RealValue();
|
||||
|
||||
aStreamPos = aNextPos + 1;
|
||||
aStreamPos = aNextPos + JsonKeyLength (Standard_JsonKey_SeparatorValueToValue);
|
||||
//theOStream << va_arg(vl, Standard_Real);
|
||||
}
|
||||
va_end(vl);
|
||||
|
||||
aClosePos = aText.Location (JsonKeyToString (Standard_JsonKey_CloseContainer), theStreamPos, aText.Length());
|
||||
theStreamPos = aClosePos + JsonKeyLength (Standard_JsonKey_CloseContainer);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -461,7 +472,7 @@ Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString&
|
||||
Standard_Integer aCloseIndex2 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_SeparatorValueToValue) - 1;
|
||||
aCloseIndex = aCloseIndex1 < aCloseIndex2 ? aCloseIndex1 : aCloseIndex2;
|
||||
|
||||
aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex);
|
||||
aSplitValue = aStartIndex <= aCloseIndex ? theStreamStr.SubString (aStartIndex, aCloseIndex) : "";
|
||||
theNextIndex = aCloseIndex + 1;
|
||||
}
|
||||
break;
|
||||
|
@@ -33,7 +33,7 @@ class Standard_DumpSentry;
|
||||
//! It creates "key": { result of dump of the field }
|
||||
//! - OCCT_DUMP_FIELD_VALUES_NUMERICAL. Use it for unlimited list of fields of C++ double type.
|
||||
//! It creates massive of values [value_1, value_2, ...]
|
||||
//! - OCCT_DUMP_FIELD_VALUES_STRING. Use it for unlimited list of fields of TCollection_AsciiString types.
|
||||
//! - OCCT_DUMP_FIELD_VALUES_STRING. Use it for unlimited list of fields of TCollection_AsciiString types.F
|
||||
//! It creates massive of values ["value_1", "value_2", ...]
|
||||
//! - OCCT_DUMP_BASE_CLASS. Use if Dump implementation of the class is virtual, to perform ClassName::Dump() of the parent class,
|
||||
//! expected parameter is the parent class name.
|
||||
@@ -90,16 +90,27 @@ class Standard_DumpSentry;
|
||||
//! Depth = -1 is the default value, dump here is unlimited.
|
||||
#define OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, theField) \
|
||||
{ \
|
||||
if (theDepth != 0) \
|
||||
if (theDepth != 0 && (theField) != NULL) \
|
||||
{ \
|
||||
Standard_SStream aFieldStream; \
|
||||
if ((theField) != NULL) \
|
||||
(theField)->DumpJson (aFieldStream, theDepth - 1); \
|
||||
(theField)->DumpJson (aFieldStream, theDepth - 1); \
|
||||
const char* aName = Standard_Dump::DumpFieldToName (#theField); \
|
||||
Standard_Dump::DumpKeyToClass (theOStream, aName, Standard_Dump::Text (aFieldStream)); \
|
||||
} \
|
||||
}
|
||||
|
||||
//! @def OCCT_INIT_FIELD_VALUES_DUMPED
|
||||
//! Append into output value: "Name": { field dumped values }
|
||||
//! It computes Dump of the fields. The expected field is a pointer.
|
||||
//! Use this macro for fields of the dumped class which has own Dump implementation.
|
||||
//! The macros is recursive. Recursion is stopped when the depth value becomes equal to zero.
|
||||
//! Depth = -1 is the default value, dump here is unlimited.
|
||||
#define OCCT_INIT_FIELD_VALUES_DUMPED(theSStream, theStreamPos, theField) \
|
||||
{ \
|
||||
if ((theField) == NULL || !(theField)->InitJson (theSStream, theStreamPos)) \
|
||||
return Standard_False; \
|
||||
}
|
||||
|
||||
//! @def OCCT_DUMP_FIELD_VALUES_NUMERICAL
|
||||
//! Append real values into output values in an order: [value_1, value_2, ...]
|
||||
//! It computes Dump of the parent. The expected field is a parent class name to call ClassName::Dump.
|
||||
@@ -143,21 +154,24 @@ class Standard_DumpSentry;
|
||||
//! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call, but pay attention that it should be only one row in the object dump.
|
||||
#define OCCT_DUMP_VECTOR_CLASS(theOStream, theName, theCount, ...) \
|
||||
{ \
|
||||
Standard_Dump::AddValuesSeparator (theOStream); \
|
||||
theOStream << "\"" << OCCT_CLASS_NAME(theName) << "\": ["; \
|
||||
Standard_Dump::DumpRealValues (theOStream, theCount, __VA_ARGS__);\
|
||||
theOStream << "]"; \
|
||||
}
|
||||
|
||||
//! @def OCCT_DUMP_VECTOR_CLASS
|
||||
//! @def OCCT_INIT_VECTOR_CLASS
|
||||
//! Append vector values into output value: "Name": [value_1, value_2, ...]
|
||||
//! This macro is intended to have only one row for dumped object in Json.
|
||||
//! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call, but pay attention that it should be only one row in the object dump.
|
||||
#define OCCT_INIT_VECTOR_CLASS(theOStream, theName, theStreamPos, theCount, ...) \
|
||||
{ \
|
||||
if (!Standard_Dump::ProcessStreamName (theOStream, OCCT_CLASS_NAME(theName), theStreamPos)) \
|
||||
Standard_Integer aStreamPos = theStreamPos; \
|
||||
if (!Standard_Dump::ProcessStreamName (theOStream, OCCT_CLASS_NAME(theName), aStreamPos)) \
|
||||
return Standard_False; \
|
||||
if (!Standard_Dump::InitRealValues (theOStream, theStreamPos, theCount, __VA_ARGS__)) \
|
||||
if (!Standard_Dump::InitRealValues (theOStream, aStreamPos, theCount, __VA_ARGS__)) \
|
||||
return Standard_False; \
|
||||
theStreamPos = aStreamPos; \
|
||||
}
|
||||
|
||||
//! @brief Simple sentry class providing convenient interface to dump.
|
||||
|
@@ -76,5 +76,7 @@ void StdSelect_Shape::DumpJson (Standard_OStream& theOStream, const Standard_Int
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, StdSelect_Shape);
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, PrsMgr_PresentableObject);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &mysh);
|
||||
}
|
||||
|
@@ -573,3 +573,14 @@ void V3d_Viewer::DisplayPrivilegedPlane (const Standard_Boolean theOnOff, const
|
||||
|
||||
myPlaneStructure->Display();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void V3d_Viewer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, V3d_Viewer);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPrivilegedPlane);
|
||||
}
|
||||
|
@@ -480,6 +480,9 @@ public: //! @name deprecated methods
|
||||
aColor.Values (theV1, theV2, theV3, theType) ;
|
||||
}
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
private:
|
||||
|
||||
//! Returns the default background colour.
|
||||
|
@@ -86,8 +86,19 @@ gp_Ax1 gp_Ax1::Mirrored (const gp_Ax2& A2) const
|
||||
return A1;
|
||||
}
|
||||
|
||||
void gp_Ax1::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
void gp_Ax1::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vdir);
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, Location, 3, loc.X(), loc.Y(), loc.Z())
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, Direction, 3, vdir.X(), vdir.Y(), vdir.Z())
|
||||
}
|
||||
|
||||
Standard_Boolean gp_Ax1::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
gp_XYZ& anXYZLoc = loc.ChangeCoord();
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Location, theStreamPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
|
||||
gp_XYZ aDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Direction, theStreamPos, 3, &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
|
||||
SetDirection (aDir);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -208,6 +208,8 @@ public:
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
//! Inits the content of me into the stream
|
||||
Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -107,9 +107,33 @@ gp_Ax3 gp_Ax3::Mirrored(const gp_Ax2& A2)const
|
||||
}
|
||||
|
||||
|
||||
void gp_Ax3::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
void gp_Ax3::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &axis);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vydir);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vxdir);
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, Location, 3, Location().X(), Location().Y(), Location().Z())
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, Direction, 3, Direction().X(), Direction().Y(), Direction().Z())
|
||||
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, XDirection, 3, XDirection().X(), XDirection().Y(), XDirection().Z())
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, YDirection, 3, YDirection().X(), YDirection().Y(), YDirection().Z())
|
||||
}
|
||||
|
||||
Standard_Boolean gp_Ax3::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
gp_XYZ anXYZLoc;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Location, theStreamPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
|
||||
SetLocation (anXYZLoc);
|
||||
|
||||
gp_XYZ aDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Direction, theStreamPos, 3, &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
|
||||
gp_XYZ aXDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, XDirection, theStreamPos, 3, &aXDir.ChangeCoord (1), &aXDir.ChangeCoord (2), &aXDir.ChangeCoord (3))
|
||||
gp_XYZ anYDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, YDirection, theStreamPos, 3, &anYDir.ChangeCoord (1), &anYDir.ChangeCoord (2), &anYDir.ChangeCoord (3))
|
||||
|
||||
SetXDirection (aXDir);
|
||||
SetYDirection (anYDir);
|
||||
|
||||
if (!Direction().IsEqual (aDir, Precision::Confusion()))
|
||||
return Standard_False;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -293,6 +293,8 @@ public:
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
//! Inits the content of me into the stream
|
||||
Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -142,5 +142,11 @@ gp_Dir gp_Dir::Mirrored (const gp_Ax2& A2) const
|
||||
|
||||
void gp_Dir::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &coord);
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, gp_Dir, 3, coord.X(), coord.Y(), coord.Z())
|
||||
}
|
||||
|
||||
Standard_Boolean gp_Dir::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, gp_Dir, theStreamPos, 3, &coord.ChangeCoord (1), &coord.ChangeCoord (2), &coord.ChangeCoord (3))
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -266,6 +266,9 @@ public:
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
//! Inits the content of me into the stream
|
||||
Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -88,5 +88,10 @@ gp_Pnt gp_Pnt::Mirrored (const gp_Ax2& A2) const
|
||||
|
||||
void gp_Pnt::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &coord);
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, gp_Pnt, 3, coord.X(), coord.Y(), coord.Z())
|
||||
}
|
||||
|
||||
Standard_Boolean gp_Pnt::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, gp_Pnt, theStreamPos, 3, &coord.ChangeCoord (1), &coord.ChangeCoord (2), &coord.ChangeCoord (3))
|
||||
}
|
||||
|
@@ -177,6 +177,8 @@ public:
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
//! Inits the content of me into the stream
|
||||
Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -47,30 +47,8 @@ void gp_XYZ::DumpJson (Standard_OStream& theOStream, const Standard_Integer) con
|
||||
//function : InitJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean gp_XYZ::InitJson (Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
Standard_Boolean gp_XYZ::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, gp_XYZ, theStreamPos, 3, &x, &y, &z)
|
||||
|
||||
//NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
|
||||
//if (!Standard_Dump::SplitJson (Standard_Dump::Text (theSStream), aValues) || aValues.Size() > 1)
|
||||
// return Standard_False;
|
||||
|
||||
//if (aValues.FindKey (1).IsEqual (OCCT_CLASS_NAME(gp_XYZ)))
|
||||
// return Standard_False;
|
||||
|
||||
//NCollection_IndexedMap<TCollection_AsciiString> aValuesList;
|
||||
|
||||
//TCollection_AsciiString aValue = aValues.FindFromIndex (1);
|
||||
//aValue.Split (Standard_Dump::JsonKeyToString (Standard_JsonKey_SeparatorValueToValue), aValuesList);
|
||||
|
||||
//if (aValuesList.Size() != 3 ||
|
||||
// !aValuesList.FindKey(1).IsRealValue() || !aValuesList.FindKey(2).IsRealValue() || !aValuesList.FindKey(3).IsRealValue())
|
||||
// return Standard_False;
|
||||
|
||||
//x = aValuesList.FindKey(1).RealValue();
|
||||
//y = aValuesList.FindKey(2).RealValue();
|
||||
//z = aValuesList.FindKey(3).RealValue();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
@@ -332,7 +332,7 @@ public:
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
//! Inits the content of me into the stream
|
||||
Standard_EXPORT Standard_Boolean InitJson (Standard_SStream& theSStream, Standard_Integer& theStreamPos);
|
||||
Standard_EXPORT Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -14,7 +14,11 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/Convert_Tools.hxx>
|
||||
#include <inspector/Convert_TransientShape.hxx>
|
||||
|
||||
#include <AIS_Plane.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Prs3d_PlaneAspect.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
@@ -23,6 +27,62 @@
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : CreateShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Convert_Tools::ConvertStreamToPresentations (const Standard_SStream& theSStream,
|
||||
const Standard_Integer theStartPos,
|
||||
const Standard_Integer /*theLastPos*/,
|
||||
NCollection_List<Handle(Standard_Transient)>& thePresentations)
|
||||
{
|
||||
int aStartPos = theStartPos;
|
||||
gp_XYZ aPoint;
|
||||
if (aPoint.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPoint)));
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Pnt aPnt;
|
||||
if (aPnt.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPnt)));
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Dir aDir;
|
||||
if (aDir.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeEdge (gp::Origin(), aDir.XYZ())));
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Ax3 aPln;
|
||||
if (aPln.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
Handle(Geom_Plane) aGeomPlane = new Geom_Plane (aPln);
|
||||
Handle(AIS_Plane) aPlanePrs = new AIS_Plane (aGeomPlane);
|
||||
|
||||
// TODO - default fields to be defined in another place
|
||||
aPlanePrs->Attributes()->SetPlaneAspect (new Prs3d_PlaneAspect());
|
||||
Handle (Prs3d_PlaneAspect) aPlaneAspect = aPlanePrs->Attributes()->PlaneAspect();
|
||||
aPlaneAspect->SetPlaneLength (100, 100);
|
||||
aPlaneAspect->SetDisplayCenterArrow (Standard_True);
|
||||
aPlaneAspect->SetDisplayEdgesArrows (Standard_True);
|
||||
aPlaneAspect->SetArrowsSize (100);
|
||||
aPlaneAspect->SetArrowsLength (100);
|
||||
aPlaneAspect->SetDisplayCenterArrow (Standard_True);
|
||||
aPlaneAspect->SetDisplayEdges (Standard_True);
|
||||
|
||||
aPlanePrs->SetColor (Quantity_NOC_WHITE);
|
||||
aPlanePrs->SetTransparency (0);
|
||||
|
||||
thePresentations.Append (aPlanePrs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CreateShape
|
||||
//purpose :
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Bnd_OBB.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
@@ -29,6 +30,7 @@
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QString>
|
||||
@@ -42,6 +44,14 @@ class Geom_Transformation;
|
||||
class Convert_Tools
|
||||
{
|
||||
public:
|
||||
//! Creates shape presentations on the stream if possible. Tries to init some OCCT base for a new presentation
|
||||
//! \param theStream source of presentation
|
||||
//! \param thePresentations container to add new presentation/s
|
||||
Standard_EXPORT static void ConvertStreamToPresentations (const Standard_SStream& theSStream,
|
||||
const Standard_Integer theStartPos,
|
||||
const Standard_Integer theLastPos,
|
||||
NCollection_List<Handle(Standard_Transient)>& thePresentations);
|
||||
|
||||
//! Creates box shape
|
||||
//! \param theBoundingBox box shape parameters
|
||||
//! \return created shape
|
||||
|
@@ -347,6 +347,20 @@ void MessageModel_Actions::OnTestPropertyPanel()
|
||||
aCoords.DumpJson (aStream);
|
||||
MESSAGE_INFO_STREAM(aStream, "gp_XYZ", "", &aPerfMeter, NULL);
|
||||
}
|
||||
// gp_Dir
|
||||
{
|
||||
gp_Dir aDir (0.3, 0.3, 0.4);
|
||||
Standard_SStream aStream;
|
||||
aDir.DumpJson (aStream);
|
||||
MESSAGE_INFO_STREAM(aStream, "gp_Dir", "", &aPerfMeter, NULL);
|
||||
}
|
||||
// gp_Ax3
|
||||
{
|
||||
gp_Ax3 aPln (gp_Pnt (10., 20., 15.), gp_Dir (0., 0., 1.), gp_Dir (1., 0., 0.));
|
||||
Standard_SStream aStream;
|
||||
aPln.DumpJson (aStream);
|
||||
MESSAGE_INFO_STREAM(aStream, "gp_Ax3", "", &aPerfMeter, NULL);
|
||||
}
|
||||
// Bnd_Box
|
||||
{
|
||||
Bnd_Box aBox (gp_Pnt (20., 15., 10.), gp_Pnt (25., 20., 15.));
|
||||
|
@@ -25,14 +25,14 @@
|
||||
#include <inspector/MessageModel_TreeModel.hxx>
|
||||
|
||||
#include <inspector/TreeModel_ContextMenu.hxx>
|
||||
#include <inspector/TreeModel_ItemStream.hxx>
|
||||
#include <inspector/TreeModel_Tools.hxx>
|
||||
|
||||
#include <inspector/ViewControl_PropertyView.hxx>
|
||||
#include <inspector/ViewControl_TableModelValues.hxx>
|
||||
#include <inspector/ViewControl_TreeView.hxx>
|
||||
#include <inspector/Convert_TransientShape.hxx>
|
||||
#include <inspector/Convert_Tools.hxx>
|
||||
|
||||
#include <inspector/View_DisplayPreview.hxx >
|
||||
#include <inspector/View_Tools.hxx>
|
||||
#include <inspector/View_Viewer.hxx>
|
||||
#include <inspector/View_Widget.hxx>
|
||||
@@ -142,6 +142,8 @@ Handle(Prs3d_Drawer) GetPreviewAttributes (const Handle(AIS_InteractiveContext)&
|
||||
MessageView_Window::MessageView_Window (QWidget* theParent)
|
||||
: QObject (theParent)
|
||||
{
|
||||
myDisplayPreview = new View_DisplayPreview();
|
||||
|
||||
myMainWindow = new QMainWindow (theParent);
|
||||
|
||||
myTreeView = new ViewControl_TreeView (myMainWindow);
|
||||
@@ -363,6 +365,7 @@ void MessageView_Window::Init (NCollection_List<Handle(Standard_Transient)>& the
|
||||
if (!aContext.IsNull())
|
||||
{
|
||||
myViewWindow->SetContext (View_ContextType_External, aContext);
|
||||
myViewWindow->GetViewToolBar()->SetCurrentContextType (View_ContextType_External);
|
||||
}
|
||||
|
||||
if (!aViewCamera.IsNull())
|
||||
@@ -409,7 +412,7 @@ void MessageView_Window::addReport (const Handle(Message_Report)& theReport,
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onTreeViewSelectionChanged
|
||||
// function : onTreeViewVisibilityClicked
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageView_Window::onTreeViewVisibilityClicked(const QModelIndex& theIndex)
|
||||
@@ -444,21 +447,17 @@ void MessageView_Window::onTreeViewSelectionChanged (const QItemSelection&, cons
|
||||
if (!anItemBase)
|
||||
continue;
|
||||
|
||||
//Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->GetProperties();
|
||||
//if (anItemProperties)
|
||||
// anItemProperties->GetPresentations (-1, -1, aPresentations);
|
||||
TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast<TreeModel_ItemStream> (anItemBase);
|
||||
if (!aStreamParent)
|
||||
return;
|
||||
|
||||
Handle(TreeModel_ItemProperties) anItemProperties = aStreamParent->Properties ();
|
||||
Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->Properties ();
|
||||
if (anItemProperties)
|
||||
{
|
||||
anItemProperties->GetPresentations (-1, -1, aPresentations);
|
||||
}
|
||||
|
||||
MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
|
||||
if (!anAlertItem)
|
||||
continue;
|
||||
anAlertItem->GetPresentations (aPresentations);
|
||||
if (anAlertItem)
|
||||
{
|
||||
anAlertItem->GetPresentations (aPresentations);
|
||||
}
|
||||
}
|
||||
updatePreviewPresentation (aPresentations);
|
||||
}
|
||||
@@ -729,10 +728,10 @@ void MessageView_Window::updatePropertyPanelBySelection()
|
||||
return;
|
||||
|
||||
QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
|
||||
TreeModel_ItemStreamPtr aStreamItem = itemDynamicCast<TreeModel_ItemStream> (TreeModel_ModelBase::GetItemByIndex (anIndex));
|
||||
if (aStreamItem)
|
||||
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||
if (anItemBase)
|
||||
{
|
||||
Handle(TreeModel_ItemProperties) anItemProperties = aStreamItem->Properties ();
|
||||
Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->Properties ();
|
||||
if (!anItemProperties.IsNull())
|
||||
{
|
||||
ViewControl_TableModelValues* aTableValues = new ViewControl_TableModelValues();
|
||||
@@ -753,66 +752,6 @@ void MessageView_Window::updatePreviewPresentation (const NCollection_List<Handl
|
||||
if (aContext.IsNull())
|
||||
return;
|
||||
|
||||
if (!myPreviewPresentations.IsEmpty())
|
||||
{
|
||||
for (NCollection_List<Handle(Standard_Transient)>::Iterator aDisplayedIt (myPreviewPresentations); aDisplayedIt.More(); aDisplayedIt.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (aDisplayedIt.Value());
|
||||
if (!aPrs.IsNull() && aPrs->GetContext() == aContext)
|
||||
aContext->Remove (aPrs, Standard_True);
|
||||
}
|
||||
}
|
||||
myPreviewPresentations.Clear();
|
||||
|
||||
myPreviewPresentations = thePresentations;
|
||||
if (myPreviewPresentations.IsEmpty())
|
||||
return;
|
||||
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Compound aCompound;
|
||||
aBuilder.MakeCompound (aCompound);
|
||||
for (NCollection_List<Handle(Standard_Transient)>::Iterator aDisplayedIt (myPreviewPresentations); aDisplayedIt.More(); aDisplayedIt.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (aDisplayedIt.Value());
|
||||
if (!aPrs.IsNull())
|
||||
{
|
||||
if (!aPrs->GetContext().IsNull())
|
||||
continue; // not possible to display one object in several contexts
|
||||
aContext->Display (aPrs, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
|
||||
}
|
||||
else if (!Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value()).IsNull())
|
||||
{
|
||||
Handle(Convert_TransientShape) aShapeObject = Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value());
|
||||
aBuilder.Add (aCompound, aShapeObject->GetShape());
|
||||
}
|
||||
}
|
||||
|
||||
if (aCompound.IsNull())
|
||||
{
|
||||
if (!aContext.IsNull() && myPreviewPresentation->GetContext() == aContext)
|
||||
aContext->Remove (myPreviewPresentation, Standard_True);
|
||||
myPreviewPresentation = NULL;
|
||||
return;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (myPreviewPresentation.IsNull())
|
||||
{
|
||||
myPreviewPresentation = new AIS_Shape (aCompound);
|
||||
myPreviewPresentation->SetAttributes (GetPreviewAttributes(aContext));
|
||||
//myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
|
||||
|
||||
//myPreviewPresentation->SetTransformPersistence(thePersistent);
|
||||
if (!aContext.IsNull())
|
||||
aContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
|
||||
//myPreviewPresentation->SetTransformPersistence(thePersistent);
|
||||
if (!aContext.IsNull() && myPreviewPresentation->GetContext() == aContext)
|
||||
aContext->Redisplay (myPreviewPresentation, Standard_True);
|
||||
}
|
||||
}
|
||||
myDisplayPreview->SetContext (aContext);
|
||||
myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, thePresentations);
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@
|
||||
|
||||
class View_Window;
|
||||
|
||||
class View_DisplayPreview;
|
||||
class ViewControl_PropertyView;
|
||||
class MessageModel_ReportCallBack;
|
||||
|
||||
@@ -172,6 +173,8 @@ private:
|
||||
QDockWidget* myPropertyPanelWidget; //!< property pane dockable widget
|
||||
ViewControl_PropertyView* myPropertyView; //!< property control to display model item values if exist
|
||||
|
||||
View_DisplayPreview* myDisplayPreview; //!< class for preview display
|
||||
|
||||
View_Window* myViewWindow; //!< OCC 3d view to visualize presentations
|
||||
QTreeView* myTreeView; //!< tree view visualized shapes
|
||||
MessageModel_Actions* myTreeViewActions; //!< processing history view actions
|
||||
@@ -180,7 +183,6 @@ private:
|
||||
Handle(Message_ReportCallBack) myCallBack; //! < message call back to update content of the view
|
||||
|
||||
Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
|
||||
NCollection_List<Handle(Standard_Transient)> myPreviewPresentations;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -126,10 +126,10 @@ int main (int argc, char** argv)
|
||||
aPlugins.insert("TKShapeView");
|
||||
aPlugins.insert("TKVInspector");
|
||||
|
||||
//Handle(Message_Report) aReport = Message_Report::CurrentReport (Standard_True);
|
||||
//aReport->SetLimit (100);//30);
|
||||
//aReport->SetActive (Standard_True);//Standard_False);
|
||||
//aPlugins.insert("TKMessageView");
|
||||
Handle(Message_Report) aReport = Message_Report::CurrentReport (Standard_True);
|
||||
aReport->SetLimit (100);//30);
|
||||
aReport->SetActive (Standard_True);//Standard_False);
|
||||
aPlugins.insert("TKMessageView");
|
||||
|
||||
anActivatedPluginName = "TKVInspector";
|
||||
//anActivatedPluginName = "TKMessageView";
|
||||
|
@@ -5,3 +5,4 @@ TKMath
|
||||
TKBRep
|
||||
TKTopAlgo
|
||||
TKPrim
|
||||
TKV3d
|
||||
|
@@ -14,6 +14,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/TreeModel_ItemBase.hxx>
|
||||
#include <inspector/TreeModel_ItemProperties.hxx>
|
||||
#include <inspector/TreeModel_ItemRole.hxx>
|
||||
#include <inspector/TreeModel_ItemStream.hxx>
|
||||
|
||||
@@ -47,6 +48,11 @@ void TreeModel_ItemBase::Reset()
|
||||
anItem->Reset();
|
||||
}
|
||||
m_bInitialized = false;
|
||||
if (!myProperties.IsNull())
|
||||
{
|
||||
myProperties->Reset();
|
||||
myProperties = 0;
|
||||
}
|
||||
myCachedValues.clear();
|
||||
}
|
||||
|
||||
@@ -131,6 +137,23 @@ void TreeModel_ItemBase::Init()
|
||||
Standard_Dump::SplitJson (Standard_Dump::Text (aStream), aValues);
|
||||
aHierarchicalValues = Standard_Dump::HierarchicalValueIndices (aValues);
|
||||
|
||||
if (!aValues.IsEmpty())
|
||||
{
|
||||
if (!myProperties)
|
||||
{
|
||||
myProperties = new TreeModel_ItemProperties();
|
||||
myProperties->SetItem (currentItem());
|
||||
}
|
||||
TCollection_AsciiString aKeyValue, aPropertiesValue;
|
||||
aKeyValue = aValues.FindFromIndex (/*Row() +*/ 1);
|
||||
if (!Standard_Dump::SplitJson (aKeyValue, aValues))
|
||||
aPropertiesValue = Standard_Dump::Text (aStream);
|
||||
else
|
||||
aPropertiesValue = aKeyValue;
|
||||
|
||||
myProperties->Init (aPropertiesValue);
|
||||
}
|
||||
|
||||
//if (aHierarchicalValues.Size() == 1)
|
||||
}
|
||||
m_iStreamChildren = aHierarchicalValues.Extent();
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
class TreeModel_ItemBase;
|
||||
class TreeModel_ItemProperties;
|
||||
|
||||
typedef QExplicitlySharedDataPointer<TreeModel_ItemBase> TreeModel_ItemBasePtr;
|
||||
|
||||
@@ -145,6 +146,9 @@ public:
|
||||
//! Dumps the content of me into the stream
|
||||
virtual Standard_Boolean Dump (Standard_OStream& theOStream) const { (void)theOStream; return Standard_False; }
|
||||
|
||||
//! Returns the item properties
|
||||
Handle(TreeModel_ItemProperties) Properties() const { return myProperties; }
|
||||
|
||||
protected:
|
||||
|
||||
//! \param theParent the parent item
|
||||
@@ -179,6 +183,9 @@ protected:
|
||||
//! \return the value
|
||||
Standard_EXPORT virtual QVariant initValue (const int theItemRole) const;
|
||||
|
||||
protected:
|
||||
Handle(TreeModel_ItemProperties) myProperties; //!< the properties
|
||||
|
||||
private:
|
||||
|
||||
typedef QHash< QPair<int, int>, TreeModel_ItemBasePtr > PositionToItemHash;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/TreeModel_ItemProperties.hxx>
|
||||
#include <inspector/Convert_Tools.hxx>
|
||||
#include <inspector/Convert_TransientShape.hxx>
|
||||
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
@@ -88,6 +89,10 @@ void TreeModel_ItemProperties::GetPresentations (const int theRow, const int the
|
||||
|
||||
if (theRow < 0) // full presentation
|
||||
{
|
||||
Standard_SStream aStream;
|
||||
Item()->GetStream (aStream);
|
||||
|
||||
Convert_Tools::ConvertStreamToPresentations (aStream, 1, -1, thePresentations);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -93,7 +93,6 @@ void TreeModel_ItemStream::Reset()
|
||||
myKey = "";
|
||||
myStreamValue = "";
|
||||
|
||||
myProperties->Reset();
|
||||
myChildren.Clear();
|
||||
|
||||
TreeModel_ItemBase::Reset();
|
||||
|
@@ -73,9 +73,6 @@ public:
|
||||
const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& GetChildren() const
|
||||
{ initItem(); return myChildren; }
|
||||
|
||||
//! Returns the item properties
|
||||
Handle(TreeModel_ItemProperties) Properties() const { return myProperties; }
|
||||
|
||||
//! Returns stream value of the item to fulfill property panel.
|
||||
//! \return stream value or dummy
|
||||
virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
|
||||
@@ -103,7 +100,6 @@ private:
|
||||
Standard_EXPORT TreeModel_ItemStream(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn);
|
||||
|
||||
protected:
|
||||
Handle(TreeModel_ItemProperties) myProperties; //!< the properties
|
||||
TCollection_AsciiString myKey; //!< the item key
|
||||
TCollection_AsciiString myStreamValue; //!< the stream value
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> myChildren; //!< the children
|
||||
|
@@ -63,6 +63,19 @@ void VInspector_ItemGraphic3dCamera::Reset()
|
||||
myCamera = NULL;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetStream
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemGraphic3dCamera::GetStream (Standard_OStream& theOStream) const
|
||||
{
|
||||
Handle(Graphic3d_Camera) aCamera = GetCamera();
|
||||
if (aCamera.IsNull())
|
||||
return;
|
||||
|
||||
aCamera->DumpJson (theOStream);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initItem
|
||||
// purpose :
|
||||
@@ -80,6 +93,8 @@ void VInspector_ItemGraphic3dCamera::initItem() const
|
||||
// =======================================================================
|
||||
int VInspector_ItemGraphic3dCamera::initRowCount() const
|
||||
{
|
||||
Handle(Graphic3d_Camera) aCamera = GetCamera(); // we need Init() call for having GetStream() filled
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -54,6 +54,10 @@ public:
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Returns stream value of the item to fulfill property panel.
|
||||
//! \return stream value or dummy
|
||||
Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
//! Build presentation shape
|
||||
//! \return generated shape of the item parameters
|
||||
|
@@ -157,6 +157,20 @@ void VInspector_ItemPrs3dDrawer::initItem() const
|
||||
const_cast<VInspector_ItemPrs3dDrawer*>(this)->Init();
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// function : GetStream
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemPrs3dDrawer::GetStream (Standard_OStream& theOStream) const
|
||||
{
|
||||
Handle(Prs3d_Drawer) aDrawer = GetDrawer();
|
||||
if (aDrawer.IsNull())
|
||||
return;
|
||||
|
||||
aDrawer->DumpJson (theOStream);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetPrs3dAspect
|
||||
// purpose :
|
||||
|
@@ -63,6 +63,10 @@ public:
|
||||
TCollection_AsciiString& theName,
|
||||
Standard_Boolean& theOwnAspect) const;
|
||||
|
||||
//! Returns stream value of the item to fulfill property panel.
|
||||
//! \return stream value or dummy
|
||||
Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
|
@@ -126,6 +126,19 @@ void VInspector_ItemV3dViewer::Reset()
|
||||
setViewer (NULL);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetStream
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemV3dViewer::GetStream (Standard_OStream& theOStream) const
|
||||
{
|
||||
Handle(V3d_Viewer) aViewer = GetViewer();
|
||||
if (aViewer.IsNull())
|
||||
return;
|
||||
|
||||
aViewer->DumpJson (theOStream);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initItem
|
||||
// purpose :
|
||||
|
@@ -59,6 +59,10 @@ public:
|
||||
Standard_EXPORT Handle(V3d_Viewer) GetViewer() const
|
||||
{ return Handle(V3d_Viewer)::DownCast (GetObject()); }
|
||||
|
||||
//! Returns stream value of the item to fulfill property panel.
|
||||
//! \return stream value or dummy
|
||||
Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
virtual void initItem() const Standard_OVERRIDE;
|
||||
|
@@ -1237,7 +1237,8 @@ Handle(AIS_InteractiveContext) VInspector_Window::createView()
|
||||
Handle(AIS_InteractiveContext) aContext = View_Viewer::CreateStandardViewer();
|
||||
|
||||
Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY()));
|
||||
aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
|
||||
aTrihedron->SetSize (0.5);
|
||||
//aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
|
||||
aContext->Display (aTrihedron, Standard_True);
|
||||
|
||||
myViewWindow = new View_Window (0, aContext, false /*for opening several BREP files*/, true);
|
||||
|
@@ -32,8 +32,23 @@
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
void enableGlobalClipping (const Handle(AIS_InteractiveObject)& theObject, const bool theIsEnable)
|
||||
{
|
||||
if (theIsEnable)
|
||||
{
|
||||
theObject->SetClipPlanes (Handle(Graphic3d_SequenceOfHClipPlane)());
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = new Graphic3d_SequenceOfHClipPlane;
|
||||
aPlanes->SetOverrideGlobal (Standard_True);
|
||||
theObject->SetClipPlanes (aPlanes);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
@@ -55,7 +70,8 @@ void View_DisplayPreview::SetContext (const Handle(AIS_InteractiveContext)& theC
|
||||
// remove all preview presentations from the previous context, display it in the new
|
||||
|
||||
myContext = theContext;
|
||||
myPreviewParameters->GetDrawer()->Link (theContext->DefaultDrawer());
|
||||
if (!theContext.IsNull())
|
||||
myPreviewParameters->GetDrawer()->Link (theContext->DefaultDrawer());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -68,38 +84,62 @@ void View_DisplayPreview::UpdatePreview (const View_DisplayActionType,
|
||||
if (myContext.IsNull())
|
||||
return;
|
||||
|
||||
// clear previous previews
|
||||
for (NCollection_List<Handle(AIS_InteractiveObject)>::Iterator anIterator (myPreviewReadyPresentations); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
if (!anIterator.Value()->GetContext().IsNull())
|
||||
anIterator.Value()->GetContext()->Remove (anIterator.Value(), Standard_True);
|
||||
}
|
||||
myPreviewReadyPresentations.Clear();
|
||||
|
||||
if (thePresentations.IsEmpty())
|
||||
{
|
||||
myContext->Remove (myPreviewPresentation, Standard_True);
|
||||
if (!myPreviewPresentation.IsNull() && !myPreviewPresentation->GetContext().IsNull())
|
||||
myPreviewPresentation->GetContext()->Remove (myPreviewPresentation, Standard_True);
|
||||
myPreviewPresentation = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// display parameter previews
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Compound aCompound;
|
||||
aBuilder.MakeCompound (aCompound);
|
||||
for (NCollection_List<Handle(Standard_Transient)>::Iterator anIterator (thePresentations); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
Handle(Convert_TransientShape) aShapePtr = Handle(Convert_TransientShape)::DownCast (anIterator.Value());
|
||||
if (aShapePtr.IsNull())
|
||||
continue;
|
||||
|
||||
aBuilder.Add (aCompound, aShapePtr->GetShape());
|
||||
if (!aShapePtr.IsNull())
|
||||
{
|
||||
aBuilder.Add (aCompound, aShapePtr->GetShape());
|
||||
}
|
||||
Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (anIterator.Value());
|
||||
if (!aPrs.IsNull() && aPrs->GetContext().IsNull()/*is not displayed in another context*/)
|
||||
{
|
||||
myContext->Display (aPrs, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
|
||||
enableGlobalClipping(aPrs, false);
|
||||
myPreviewReadyPresentations.Append (aPrs);
|
||||
}
|
||||
}
|
||||
|
||||
if (myPreviewPresentation.IsNull())
|
||||
{
|
||||
myPreviewPresentation = new AIS_Shape (aCompound);
|
||||
Quantity_Color aColor(Quantity_NOC_TOMATO);
|
||||
myPreviewPresentation->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
|
||||
myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
|
||||
|
||||
//myPreviewPresentation->SetTransformPersistence(thePersistent);
|
||||
myContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
|
||||
enableGlobalClipping(myPreviewPresentation, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
|
||||
//myPreviewPresentation->SetTransformPersistence(thePersistent);
|
||||
myContext->Redisplay (myPreviewPresentation, Standard_True);
|
||||
if (!myPreviewPresentation.IsNull() && !myPreviewPresentation->GetContext().IsNull())
|
||||
{
|
||||
myPreviewPresentation->GetContext()->Redisplay (myPreviewPresentation, Standard_True);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -80,6 +80,7 @@ private:
|
||||
|
||||
View_PreviewParameters* myPreviewParameters; //!< drawer of preview presentation
|
||||
Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
|
||||
NCollection_List<Handle(AIS_InteractiveObject)> myPreviewReadyPresentations; //!< presentation of preview for a selected object
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -43,9 +43,9 @@ View_PreviewParameters::View_PreviewParameters()
|
||||
myDrawer->ShadingAspect()->SetColor (aColor);
|
||||
myDrawer->ShadingAspect()->SetMaterial (aShadingMaterial);
|
||||
|
||||
myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
|
||||
myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
|
||||
myDrawer->SetTransparency (aTransparency);
|
||||
//myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
|
||||
//myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
|
||||
//myDrawer->SetTransparency (aTransparency);
|
||||
|
||||
// common parameters
|
||||
myDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
|
||||
|
@@ -145,6 +145,16 @@ View_ContextType View_ToolBar::GetCurrentContextType() const
|
||||
return (View_ContextType)myViewSelector->currentIndex();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCurrentContext
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_ToolBar::SetCurrentContextType (View_ContextType theType)
|
||||
{
|
||||
myViewSelector->setCurrentIndex ((int)theType);
|
||||
emit contextChanged();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetCurrentContext
|
||||
// purpose :
|
||||
|
@@ -60,6 +60,10 @@ public:
|
||||
//! \returns type of active item of context selector
|
||||
Standard_EXPORT View_ContextType GetCurrentContextType() const;
|
||||
|
||||
//! Sets current context type
|
||||
//! \param theType a context type
|
||||
Standard_EXPORT void SetCurrentContextType (View_ContextType theType);
|
||||
|
||||
//! \returns an active context of context selector
|
||||
Standard_EXPORT Handle(AIS_InteractiveContext) GetCurrentContext() const;
|
||||
|
||||
|
Reference in New Issue
Block a user