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 (cherry picked from commit 021525334791fa582d2751d86ef63e901509383e)
This commit is contained in:
@@ -1254,6 +1254,9 @@ public: //! @name sub-intensity management (deprecated)
|
||||
//! @param theSelection an instance of the selection
|
||||
void SetSelection (const Handle(AIS_Selection)& theSelection) { mySelection = theSelection; }
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
protected: //! @name internal methods
|
||||
|
||||
Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
|
||||
|
@@ -86,3 +86,42 @@ void AIS_InteractiveContext::PolygonOffsets(
|
||||
anObj->PolygonOffsets( aMode, aFactor, aUnits );
|
||||
}
|
||||
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, AIS_InteractiveContext);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myObjects.Size());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mgrSelector.get());
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainPM.get());
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainVwr.get());
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainSel.get());
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLastActiveView);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLastPicked.get());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToHilightSelected);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mySelection.get());
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myFilters.get());
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myDefaultDrawer.get());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_Selected]);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_Dynamic]);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_LocalSelected]);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_LocalDynamic]);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_SubIntensity]);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedSeq.Size());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurDetected);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurHighlighted);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPickingStrategy);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAutoHilight);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsAutoActivateSelMode);
|
||||
}
|
||||
|
@@ -977,11 +977,30 @@ void Bnd_Box::Dump () const
|
||||
//=======================================================================
|
||||
void Bnd_Box::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Bnd_Box);
|
||||
|
||||
//OCCT_DUMP_CLASS_BEGIN (theOStream, Bnd_Box);
|
||||
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "CornerMin", 3, Xmin, Ymin, Zmin)
|
||||
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "CornerMax", 3, Xmax, Ymax, Zmax)
|
||||
|
||||
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)
|
||||
{
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, CornerMin, aPos, 3, &Xmin, &Ymin, &Zmin)
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, CornerMax, aPos, 3, &Xmax, &Ymax, &Zmax)
|
||||
|
||||
OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, Gap);
|
||||
Standard_Real myFlags;
|
||||
OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, myFlags);
|
||||
Flags = (Standard_Integer)myFlags;
|
||||
|
||||
theStreamPos = aPos;
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -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.
|
||||
|
@@ -1011,3 +1011,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)
|
||||
|
@@ -108,3 +108,27 @@ void Graphic3d_AspectFillCapping::SetHatchRotationPeristent (const Standard_Bool
|
||||
setFlag (theToSet, Flags_HatchRotationPersistent);
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Graphic3d_AspectFillCapping::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_AspectFillCapping);
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Graphic3d_Aspects);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myMaterial);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myMaterial);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myTexture);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myShader);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStippleHatch);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myTextureHatch);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myHatchMaterial);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFlags);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHatchingState);
|
||||
}
|
||||
|
@@ -121,6 +121,9 @@ public:
|
||||
//! Returns modification counter for hatching state.
|
||||
Standard_Size HatchingState() const { return myHatchingState; }
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
private:
|
||||
|
||||
enum Flags
|
||||
|
@@ -70,6 +70,14 @@ void Graphic3d_Aspects::DumpJson (Standard_OStream& theOStream, const Standard_I
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Aspects);
|
||||
|
||||
/*Handle(Graphic3d_ShaderProgram) myProgram;
|
||||
Handle(Graphic3d_TextureSet) myTextureSet;
|
||||
Handle(Graphic3d_MarkerImage) myMarkerImage;
|
||||
Handle(Graphic3d_HatchStyle) myHatchStyle;
|
||||
Handle(TCollection_HAsciiString) myTextFont;
|
||||
Graphic3d_MaterialAspect myFrontMaterial;
|
||||
Graphic3d_MaterialAspect myBackMaterial;*/
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myInteriorColor);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBackInteriorColor);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEdgeColor);
|
||||
@@ -82,4 +90,23 @@ void Graphic3d_Aspects::DumpJson (Standard_OStream& theOStream, const Standard_I
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToSuppressBackFaces);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToMapTexture);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsTextZoomable);
|
||||
|
||||
/*Aspect_InteriorStyle myInteriorStyle;
|
||||
Graphic3d_TypeOfShadingModel myShadingModel;
|
||||
Graphic3d_AlphaMode myAlphaMode;
|
||||
Standard_ShortReal myAlphaCutoff;
|
||||
|
||||
Aspect_TypeOfLine myLineType;
|
||||
Standard_ShortReal myLineWidth;
|
||||
|
||||
Aspect_TypeOfMarker myMarkerType;
|
||||
Standard_ShortReal myMarkerScale;*/
|
||||
|
||||
if (!myTextFont.IsNull())
|
||||
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myTextFont->String());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextStyle);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextDisplayType);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextFontAspect);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextAngle);
|
||||
}
|
||||
|
@@ -58,6 +58,18 @@ Graphic3d_Fresnel Graphic3d_Fresnel::CreateConductor (const Graphic3d_Vec3& theR
|
||||
return Graphic3d_Fresnel (Graphic3d_FM_SCHLICK, aFresnel);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Graphic3d_Fresnel::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Fresnel);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFresnelType);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myFresnelData);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_BSDF
|
||||
// purpose :
|
||||
@@ -189,4 +201,23 @@ Graphic3d_BSDF Graphic3d_BSDF::CreateGlass (const Graphic3d_Vec3& theWeight,
|
||||
theAbsorptionCoeff);
|
||||
|
||||
return aBSDF;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Graphic3d_BSDF::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_BSDF);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Kc);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Kd);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Ks);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Kt);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Le);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &Absorption);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &FresnelCoat);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &FresnelBase);
|
||||
}
|
||||
|
@@ -87,6 +87,9 @@ public:
|
||||
return myFresnelType;
|
||||
}
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
protected:
|
||||
|
||||
//! Creates new Fresnel reflectance factor.
|
||||
@@ -180,6 +183,9 @@ public:
|
||||
//! Performs comparison of two BSDFs.
|
||||
Standard_EXPORT bool operator== (const Graphic3d_BSDF& theOther) const;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_BSDF_HeaderFile
|
||||
|
@@ -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:
|
||||
|
||||
|
@@ -268,6 +268,8 @@ void Graphic3d_ClipPlane::SetChainNextPlane (const Handle(Graphic3d_ClipPlane)&
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_ClipPlane);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySectionStyle.get());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myEntityUID);
|
||||
|
@@ -516,3 +516,15 @@ const Standard_Byte* Graphic3d_HatchStyle::Pattern() const
|
||||
? (const Standard_Byte*)myPredefinedPatterns[myHatchType]
|
||||
: NULL);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Graphic3d_HatchStyle::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_HatchStyle);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPattern.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHatchType);
|
||||
}
|
||||
|
@@ -49,6 +49,9 @@ public:
|
||||
return myHatchType;
|
||||
}
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
private:
|
||||
|
||||
Handle(NCollection_Buffer) myPattern; //!< Image bitmap with custom hatch pattern
|
||||
|
@@ -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.
|
||||
|
@@ -840,3 +840,28 @@ Graphic3d_TypeOfMaterial Graphic3d_MaterialAspect::MaterialType (const Standard_
|
||||
const RawMaterial& aMat = THE_MATERIALS[theRank - 1];
|
||||
return aMat.MaterialType;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Graphic3d_MaterialAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_MaterialAspect);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBSDF);
|
||||
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myStringName);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColors[Graphic3d_TOR_AMBIENT]);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColors[Graphic3d_TOR_DIFFUSE]);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColors[Graphic3d_TOR_SPECULAR]);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColors[Graphic3d_TOR_EMISSION]);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTransparencyCoef);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRefractionIndex);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShininess);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaterialType);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaterialName);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRequestedMaterialName);
|
||||
}
|
||||
|
@@ -244,6 +244,9 @@ public:
|
||||
//! Returns TRUE if this material is identical to specified one.
|
||||
Standard_Boolean operator== (const Graphic3d_MaterialAspect& theOther) const { return IsEqual (theOther); }
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
private:
|
||||
|
||||
//! Initialize the standard material.
|
||||
|
@@ -58,6 +58,8 @@ Handle(Graphic3d_TransformPers) Graphic3d_TransformPers::FromDeprecatedParams (G
|
||||
// =======================================================================
|
||||
void Graphic3d_TransformPers::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_TransformPers);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMode)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "Params3d", 3, myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ)
|
||||
|
@@ -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
|
||||
|
@@ -41,6 +41,8 @@ Message_AttributeStream::Message_AttributeStream (const Standard_SStream& theStr
|
||||
|
||||
void Message_AttributeStream::SetStream (const Standard_SStream& theStream)
|
||||
{
|
||||
myStream.str ("");
|
||||
|
||||
TCollection_AsciiString aStreamStr (theStream.str().c_str());
|
||||
myStream << aStreamStr;
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Message_Report,Standard_Transient)
|
||||
|
||||
@@ -500,3 +501,33 @@ void Message_Report::SetActive (const Standard_Boolean theActive, const Standard
|
||||
"Set active report with gravity not in valid range", );
|
||||
myIsActive[theGravity] = theActive;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Message_Report::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPerfMeterMode);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLimit);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Message_Report::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
|
||||
Standard_Real PerfMeterMode;
|
||||
OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, PerfMeterMode);
|
||||
myPerfMeterMode = (Message_PerfMeterMode)((Standard_Integer)PerfMeterMode);
|
||||
|
||||
Standard_Real Limit;
|
||||
OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, Limit);
|
||||
myLimit = (Standard_Integer)Limit;
|
||||
|
||||
theStreamPos = aPos;
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -149,6 +149,12 @@ public:
|
||||
//! Returns listener of the reports events
|
||||
const Handle(Message_ReportCallBack)& GetCallBack() const { return myCallBack; }
|
||||
|
||||
//! 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);
|
||||
|
||||
// OCCT RTTI
|
||||
DEFINE_STANDARD_RTTIEXT(Message_Report,Standard_Transient)
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#define _NCollection_Buffer_HeaderFile
|
||||
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
//! Low-level buffer object.
|
||||
@@ -122,6 +123,15 @@ public:
|
||||
mySize = 0;
|
||||
}
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
|
||||
{
|
||||
(void)theDepth;
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myData);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySize);
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myAllocator.get());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Byte* myData; //!< data pointer
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#include <NCollection_Vec2.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
//! Auxiliary macros to define couple of similar access components as vector methods
|
||||
#define NCOLLECTION_VEC_COMPONENTS_3D(theX, theY, theZ) \
|
||||
@@ -403,6 +404,13 @@ public:
|
||||
return NCollection_Vec3 (Element_t(0), Element_t(0), Element_t(1));
|
||||
}
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
|
||||
{
|
||||
(void)theDepth;
|
||||
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "Vec3", 3, v[0], v[1], v[2]);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Element_t v[3]; //!< define the vector as array to avoid structure alignment issues
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#define _NCollection_Vec4_H__
|
||||
|
||||
#include <NCollection_Vec3.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
//! Generic 4-components vector.
|
||||
//! To be used as RGBA color vector or XYZW 3D-point with special W-component
|
||||
@@ -375,6 +376,13 @@ public:
|
||||
return aResult /= theRight;
|
||||
}
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
|
||||
{
|
||||
(void)theDepth;
|
||||
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "Vec4", 4, v[0], v[1], v[2], v[3]);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Element_t v[4]; //!< define the vector as array to avoid structure alignment issues
|
||||
|
@@ -341,9 +341,14 @@ namespace
|
||||
// function : RenderCapping
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
#include <Message_Alerts.hxx>
|
||||
#include <Message_PerfMeter.hxx>
|
||||
void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Structure& theStructure)
|
||||
{
|
||||
Message_PerfMeter aPerfMeter;
|
||||
MESSAGE_INFO ("RenderCapping", "", &aPerfMeter, NULL);
|
||||
|
||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||
if (!aContext->Clipping().IsCappingOn())
|
||||
{
|
||||
@@ -380,12 +385,17 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks
|
||||
{
|
||||
// get plane being rendered
|
||||
const Handle(Graphic3d_ClipPlane)& aClipChain = aCappingIt.Value();
|
||||
|
||||
if (!aClipChain->IsCapping()
|
||||
|| aCappingIt.IsDisabled())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Standard_SStream aStream;
|
||||
aClipChain->DumpJson (aStream);
|
||||
MESSAGE_INFO_STREAM(aStream, "ClipChain", "", &aPerfMeter, NULL);
|
||||
|
||||
Standard_Integer aSubPlaneIndex = 1;
|
||||
for (const Graphic3d_ClipPlane* aSubPlaneIter = aClipChain.get(); aSubPlaneIter != NULL; aSubPlaneIter = aSubPlaneIter->ChainNextPlane().get(), ++aSubPlaneIndex)
|
||||
{
|
||||
|
@@ -1442,5 +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);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPlaneAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnPlaneAspect);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySeenLineAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSeenLineAspect);
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myVectorAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnVectorAspect);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVertexDrawMode);
|
||||
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDatumAspect.get());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDatumAspect);
|
||||
|
||||
//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);
|
||||
//OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFillCappingAspect.get());
|
||||
}
|
||||
|
@@ -3932,6 +3932,19 @@ void call_rgbhls (float r, float g, float b, float& h, float& l, float& s)
|
||||
//=======================================================================
|
||||
void Quantity_Color::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Quantity_Color);
|
||||
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "RGB", 3, MyRed, MyGreen, MyBlue)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Quantity_Color::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
Standard_Real aRed, aGreen, aBlue;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, RGB, aPos, 3, &aRed, &aGreen, &aBlue)
|
||||
|
||||
SetValues ((Standard_ShortReal)aRed, (Standard_ShortReal)aGreen, (Standard_ShortReal)aBlue, Quantity_TOC_RGB);
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -267,6 +267,9 @@ Standard_Boolean operator == (const Quantity_Color& Other) const
|
||||
//! 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);
|
||||
|
||||
private:
|
||||
|
||||
//! Converts HLS components into RGB ones.
|
||||
|
@@ -204,10 +204,22 @@ bool Quantity_ColorRGBA::ColorFromHex (const char* const theHexColorString,
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Quantity_ColorRGBA::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
void Quantity_ColorRGBA::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Quantity_ColorRGBA);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myRgb);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlpha);
|
||||
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "RGBA", 4, myRgb.Red(), myRgb.Green(), myRgb.Blue(), myAlpha)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Quantity_ColorRGBA::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
|
||||
Standard_Real aRed, aGreen, aBlue, anAlpha;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, RGBA, aPos, 4, &aRed, &aGreen, &aBlue, &anAlpha)
|
||||
|
||||
SetValues ((Standard_ShortReal)aRed, (Standard_ShortReal)aGreen, (Standard_ShortReal)aBlue, (Standard_ShortReal)anAlpha);
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -124,6 +124,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);
|
||||
|
||||
private:
|
||||
|
||||
static void myTestSize3() { Standard_STATIC_ASSERT (sizeof(float) * 3 == sizeof(Quantity_Color)); }
|
||||
|
@@ -71,7 +71,7 @@ public:
|
||||
Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Select3D_InteriorSensitivePointSet,Select3D_SensitiveSet)
|
||||
|
||||
|
@@ -128,6 +128,7 @@ Select3D_BndBox3d Select3D_SensitiveBox::BoundingBox()
|
||||
void Select3D_SensitiveBox::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveBox);
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBox);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCenter3d);
|
||||
|
@@ -71,7 +71,7 @@ public:
|
||||
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -151,6 +151,7 @@ Standard_Integer Select3D_SensitiveFace::NbSubElements()
|
||||
void Select3D_SensitiveFace::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveFace);
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySensType);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFacePoints.get());
|
||||
|
@@ -74,7 +74,7 @@ public:
|
||||
Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -369,7 +369,6 @@ Standard_Real Select3D_SensitiveGroup::distanceToCOG (SelectBasics_SelectingVolu
|
||||
void Select3D_SensitiveGroup::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveGroup);
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet);
|
||||
|
||||
for (Select3D_IndexedMapOfEntity::Iterator anIterator (myEntities); anIterator.More(); anIterator.Next())
|
||||
|
@@ -144,7 +144,7 @@ public:
|
||||
Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -93,6 +93,7 @@ Standard_Integer Select3D_SensitivePoint::NbSubElements()
|
||||
void Select3D_SensitivePoint::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitivePoint);
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPoint);
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ public:
|
||||
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -318,7 +318,6 @@ gp_Pnt Select3D_SensitivePoly::CenterOfGeometry() const
|
||||
void Select3D_SensitivePoly::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitivePoly);
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet);
|
||||
|
||||
//Select3D_PointData myPolyg; //!< Points of the poly
|
||||
|
@@ -93,7 +93,7 @@ public:
|
||||
const Standard_Integer theIdx2) Standard_OVERRIDE;
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -1226,7 +1226,6 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::elementIsInside (SelectBasics
|
||||
void Select3D_SensitivePrimitiveArray::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitivePrimitiveArray);
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet);
|
||||
|
||||
//Handle(Select3D_PrimArraySubGroupArray) myGroups; //!< sub-groups of sensitive entities
|
||||
|
@@ -198,7 +198,7 @@ public:
|
||||
Standard_Integer LastDetectedEdgeNode2() const { return myDetectedEdgeNode2; }
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -110,6 +110,7 @@ Standard_Integer Select3D_SensitiveSegment::NbSubElements()
|
||||
void Select3D_SensitiveSegment::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveSegment);
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myStart);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEnd);
|
||||
|
@@ -71,7 +71,7 @@ public:
|
||||
void EndPoint (const gp_Pnt& thePnt) { myEnd = thePnt; }
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -237,9 +237,10 @@ void Select3D_SensitiveSet::Clear()
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Select3D_SensitiveSet::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
void Select3D_SensitiveSet::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveSet);
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedIdx);
|
||||
}
|
||||
|
@@ -97,7 +97,7 @@ public:
|
||||
Standard_Integer GetLeafNodeSize() const { return myContent.Builder()->LeafNodeSize(); }
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -101,6 +101,7 @@ Select3D_BndBox3d Select3D_SensitiveTriangle::BoundingBox()
|
||||
void Select3D_SensitiveTriangle::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveTriangle);
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveEntity);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySensType);
|
||||
|
||||
|
@@ -68,7 +68,7 @@ public:
|
||||
virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE { return myCentroid; }
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -451,7 +451,6 @@ gp_GTrsf Select3D_SensitiveTriangulation::InvInitLocation() const
|
||||
void Select3D_SensitiveTriangulation::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveTriangulation);
|
||||
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTriangul.get());
|
||||
|
@@ -94,7 +94,7 @@ public:
|
||||
const TopLoc_Location& GetInitLocation() const { return myInitLocation; }
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -69,7 +69,7 @@ public:
|
||||
const Standard_Integer theIdx2) Standard_OVERRIDE;
|
||||
|
||||
//! 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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveWire,Select3D_SensitiveSet)
|
||||
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <SelectBasics_PickResult.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
|
||||
class Bnd_Box;
|
||||
class gp_Pnt;
|
||||
@@ -116,6 +117,10 @@ public:
|
||||
//! Ax + By + Cz + D = 0) to the given vector
|
||||
virtual void GetPlanes (NCollection_Vector<NCollection_Vec4<Standard_Real> >& thePlaneEquations) const = 0;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
|
||||
{ (void)theDepth; OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myActiveSelectionType) }
|
||||
|
||||
protected:
|
||||
SelectionType myActiveSelectionType; //!< Active selection type: point, box or polyline
|
||||
};
|
||||
|
@@ -91,6 +91,8 @@ void SelectMgr_EntityOwner::DumpJson (Standard_OStream& theOStream, const Standa
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_EntityOwner);
|
||||
|
||||
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);
|
||||
|
@@ -389,3 +389,31 @@ void SelectMgr_SelectableObjectSet::MarkDirty()
|
||||
myIsDirty[BVHSubset_3dPersistent] = Standard_True;
|
||||
myIsDirty[BVHSubset_2dPersistent] = Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SelectMgr_SelectableObjectSet::DumpJson (Standard_OStream& theOStream, const 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())
|
||||
{
|
||||
Handle(SelectMgr_SelectableObject) SelectableObject = anObjectIt.Value();
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, SelectableObject.get());
|
||||
}
|
||||
|
||||
TCollection_AsciiString separator;
|
||||
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, separator);
|
||||
|
||||
}
|
||||
//Graphic3d_WorldViewProjState myLastViewState; //!< Last view-projection state used for construction of BVH
|
||||
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, const 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, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectBasics_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, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
enum { Frustum, FrustumSet, VolumeTypesNb }; //!< Defines the amount of available selecting volumes
|
||||
|
||||
|
@@ -111,9 +111,9 @@ void SelectMgr_ViewClipRange::DumpJson (Standard_OStream& theOStream, const Stan
|
||||
{
|
||||
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]);
|
||||
}
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUnclipRange);
|
||||
}
|
||||
|
@@ -1051,7 +1051,7 @@ 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, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_ViewerSelector);
|
||||
|
||||
@@ -1059,13 +1059,30 @@ void SelectMgr_ViewerSelector::DumpJson (Standard_OStream& theOStream, const Sta
|
||||
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, aNbOfSelectableObjects);
|
||||
|
||||
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, 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());
|
||||
}
|
||||
|
@@ -19,10 +19,10 @@
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_DumpSentry::Standard_DumpSentry (Standard_OStream& theOStream, const char* theClassName)
|
||||
Standard_DumpSentry::Standard_DumpSentry (Standard_OStream& theOStream, const char*)
|
||||
: myOStream (&theOStream)
|
||||
{
|
||||
(*myOStream) << "\"" << theClassName << "\": {";
|
||||
//(*myOStream) << "\"" << theClassName << "\": {";
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -31,7 +31,7 @@ Standard_DumpSentry::Standard_DumpSentry (Standard_OStream& theOStream, const ch
|
||||
// =======================================================================
|
||||
Standard_DumpSentry::~Standard_DumpSentry()
|
||||
{
|
||||
(*myOStream) << "}";
|
||||
//(*myOStream) << "}";
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -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 << ", ";
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void Standard_Dump::AddValuesSeparator (Standard_OStream& theOStream)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Standard_Dump::DumpKeyToClass (Standard_OStream& theOStream,
|
||||
const char* theKey,
|
||||
const TCollection_AsciiString& theKey,
|
||||
const TCollection_AsciiString& theField)
|
||||
{
|
||||
AddValuesSeparator (theOStream);
|
||||
@@ -104,9 +104,52 @@ 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);
|
||||
if (aText.Length () < theStreamPos)
|
||||
return Standard_False;
|
||||
|
||||
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();
|
||||
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ProcessFieldName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Standard_Dump::ProcessFieldName (const Standard_SStream& theStream,
|
||||
const TCollection_AsciiString& theName,
|
||||
Standard_Integer& theStreamPos)
|
||||
{
|
||||
TCollection_AsciiString aText = Text (theStream);
|
||||
if (aText.IsEmpty())
|
||||
return Standard_False;
|
||||
|
||||
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 aName = Standard_Dump::DumpFieldToName (theName.ToCString());
|
||||
TCollection_AsciiString aKeyName = TCollection_AsciiString (JsonKeyToString (Standard_JsonKey_Quote))
|
||||
+ aName
|
||||
+ TCollection_AsciiString (JsonKeyToString (Standard_JsonKey_Quote))
|
||||
+ JsonKeyToString (Standard_JsonKey_SeparatorKeyToValue);
|
||||
|
||||
Standard_Boolean aResult = aSubText.StartsWith (aKeyName);
|
||||
if (aResult)
|
||||
theStreamPos += aKeyName.Length();
|
||||
@@ -122,14 +165,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 +186,49 @@ Standard_Boolean Standard_Dump::InitRealValues (const Standard_SStream& theStrea
|
||||
if (!aValueText.IsRealValue())
|
||||
return Standard_False;
|
||||
|
||||
va_arg(vl, Standard_Real) = 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;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitRealValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Standard_Dump::InitRealValue (const Standard_SStream& theStream,
|
||||
Standard_Integer& theStreamPos,
|
||||
Standard_Real& theValue)
|
||||
{
|
||||
Standard_Integer aStreamPos = theStreamPos;
|
||||
|
||||
TCollection_AsciiString aText = Text (theStream);
|
||||
TCollection_AsciiString aSubText = aText.SubString (aStreamPos, aText.Length());
|
||||
|
||||
aStreamPos = 1;
|
||||
Standard_Integer aNextPos = aSubText.Location (JsonKeyToString (Standard_JsonKey_SeparatorValueToValue), aStreamPos, aSubText.Length());
|
||||
Standard_JsonKey aNextKey = Standard_JsonKey_SeparatorValueToValue;
|
||||
|
||||
Standard_Integer aCloseChildPos = aSubText.Location (JsonKeyToString (Standard_JsonKey_CloseChild), aStreamPos, aSubText.Length());
|
||||
Standard_Boolean isUseClosePos = (aNextPos > 0 && aCloseChildPos > 0 && aCloseChildPos < aNextPos) || !aNextPos;
|
||||
if (isUseClosePos)
|
||||
{
|
||||
aNextPos = aCloseChildPos;
|
||||
aNextKey = Standard_JsonKey_CloseChild;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aValueText = aNextPos ? aSubText.SubString (aStreamPos, aNextPos - 1) : aSubText;
|
||||
if (!aValueText.IsRealValue())
|
||||
return Standard_False;
|
||||
|
||||
theValue = aValueText.RealValue();
|
||||
theStreamPos = aNextPos ? (theStreamPos + (aNextPos - aStreamPos) + JsonKeyLength (aNextKey)) : aText.Length();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -196,17 +276,26 @@ TCollection_AsciiString Standard_Dump::GetPointerInfo (const void* thePointer, c
|
||||
// =======================================================================
|
||||
// DumpFieldToName
|
||||
// =======================================================================
|
||||
const char* Standard_Dump::DumpFieldToName (const char* theField)
|
||||
TCollection_AsciiString Standard_Dump::DumpFieldToName (const TCollection_AsciiString theField)
|
||||
{
|
||||
const char* aName = theField;
|
||||
|
||||
if (aName[0] == '&')
|
||||
TCollection_AsciiString aName = theField;
|
||||
if (theField.StartsWith ('&'))
|
||||
{
|
||||
aName = aName + 1;
|
||||
aName.Remove (1, 1);
|
||||
}
|
||||
if (::LowerCase (aName[0]) == 'm' && aName[1] == 'y')
|
||||
|
||||
if (::LowerCase (aName.Value(1)) == 'm' && aName.Value (2) == 'y')
|
||||
{
|
||||
aName = aName + 2;
|
||||
aName.Remove (1, 2);
|
||||
}
|
||||
|
||||
if (TCollection_AsciiString (aName).EndsWith (".get()"))
|
||||
{
|
||||
aName = aName.SubString (1, aName.Length() - TCollection_AsciiString (".get()").Length());
|
||||
}
|
||||
else if (TCollection_AsciiString (aName).EndsWith ("()"))
|
||||
{
|
||||
aName = aName.SubString (1, aName.Length() - TCollection_AsciiString ("()").Length());
|
||||
}
|
||||
return aName;
|
||||
}
|
||||
@@ -290,7 +379,7 @@ TCollection_AsciiString Standard_Dump::FormatJson (const Standard_SStream& theSt
|
||||
// SplitJson
|
||||
// ----------------------------------------------------------------------------
|
||||
Standard_Boolean Standard_Dump::SplitJson (const TCollection_AsciiString& theStreamStr,
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues)
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& theKeyToValues)
|
||||
{
|
||||
Standard_Integer /*anIndex = 1, */aNextIndex = 1;
|
||||
while (aNextIndex < theStreamStr.Length())
|
||||
@@ -305,7 +394,7 @@ Standard_Boolean Standard_Dump::SplitJson (const TCollection_AsciiString& theStr
|
||||
{
|
||||
case Standard_JsonKey_Quote:
|
||||
{
|
||||
aProcessed = splitKeyToValue (theStreamStr, aNextIndex/*anIndex*/, aNextIndex, theValues);
|
||||
aProcessed = splitKeyToValue (theStreamStr, aNextIndex/*anIndex*/, aNextIndex, theKeyToValues);
|
||||
//anIndex = aNextIndex;
|
||||
}
|
||||
break;
|
||||
@@ -319,7 +408,7 @@ Standard_Boolean Standard_Dump::SplitJson (const TCollection_AsciiString& theStr
|
||||
return Standard_False;
|
||||
|
||||
TCollection_AsciiString aSubStreamStr = theStreamStr.SubString (aStartIndex + JsonKeyLength (aKey), aNextIndex - 2);
|
||||
if (!SplitJson (aSubStreamStr, theValues))
|
||||
if (!SplitJson (aSubStreamStr, theKeyToValues))
|
||||
return Standard_False;
|
||||
|
||||
aNextIndex/*anIndex*/ = aClosePos + Standard_Integer (JsonKeyLength (Standard_JsonKey_CloseChild));
|
||||
@@ -339,15 +428,6 @@ Standard_Boolean Standard_Dump::SplitJson (const TCollection_AsciiString& theStr
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// JoinJson
|
||||
// ----------------------------------------------------------------------------
|
||||
void Standard_Dump::JoinJson (Standard_OStream& theOStream,
|
||||
const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// HierarchicalValueIndices
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -370,7 +450,7 @@ NCollection_List<Standard_Integer> Standard_Dump::HierarchicalValueIndices (
|
||||
Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString& theStreamStr,
|
||||
Standard_Integer theStartIndex,
|
||||
Standard_Integer& theNextIndex,
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues)
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& theValues)
|
||||
{
|
||||
// find key value: "key"
|
||||
Standard_Integer aStartIndex = theStartIndex;
|
||||
@@ -457,11 +537,13 @@ Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString&
|
||||
break;
|
||||
case Standard_JsonKey_None:
|
||||
{
|
||||
Standard_Integer aCloseIndex1 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_CloseChild) - 1;
|
||||
Standard_Integer aCloseIndex2 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_SeparatorValueToValue) - 1;
|
||||
aCloseIndex = aCloseIndex1 < aCloseIndex2 ? aCloseIndex1 : aCloseIndex2;
|
||||
|
||||
aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex);
|
||||
//if (aCloseIndex != aStartIndex) // case if the value is numerical and need not be closed
|
||||
{
|
||||
Standard_Integer aCloseIndex1 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_CloseChild) - 1;
|
||||
Standard_Integer aCloseIndex2 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_SeparatorValueToValue) - 1;
|
||||
aCloseIndex = aCloseIndex1 < aCloseIndex2 ? aCloseIndex1 : aCloseIndex2;
|
||||
}
|
||||
aSplitValue = aStartIndex <= aCloseIndex ? theStreamStr.SubString (aStartIndex, aCloseIndex) : "";
|
||||
theNextIndex = aCloseIndex + 1;
|
||||
}
|
||||
break;
|
||||
@@ -472,7 +554,7 @@ Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString&
|
||||
//TCollection_AsciiString aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex - 1);
|
||||
//theNextIndex = aCloseIndex + 1;
|
||||
|
||||
TCollection_AsciiString aValue;
|
||||
Standard_DumpValue aValue;
|
||||
if (theValues.FindFromKey (aSplitKey, aValue))
|
||||
{
|
||||
Standard_Integer anIndex = 1;
|
||||
@@ -486,7 +568,7 @@ Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString&
|
||||
aSplitKey = aSplitKey + anIndexedSuffix;
|
||||
}
|
||||
|
||||
theValues.Add (aSplitKey, aSplitValue);
|
||||
theValues.Add (aSplitKey, Standard_DumpValue (aSplitValue, aStartIndex));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
@@ -59,16 +59,30 @@ class Standard_DumpSentry;
|
||||
//! Append into output value: "Name": Field
|
||||
#define OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, theField) \
|
||||
{ \
|
||||
const char* aName = Standard_Dump::DumpFieldToName (#theField); \
|
||||
TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \
|
||||
Standard_Dump::AddValuesSeparator (theOStream); \
|
||||
theOStream << "\"" << aName << "\": " << theField; \
|
||||
}
|
||||
|
||||
//! @def OCCT_INIT_FIELD_VALUE_NUMERICAL
|
||||
//! 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_FIELD_VALUE_NUMERICAL(theOStream, theStreamPos, theField) \
|
||||
{ \
|
||||
Standard_Integer aStreamPos = theStreamPos; \
|
||||
if (!Standard_Dump::ProcessFieldName (theOStream, #theField, aStreamPos)) \
|
||||
return Standard_False; \
|
||||
if (!Standard_Dump::InitRealValue (theOStream, aStreamPos, theField)) \
|
||||
return Standard_False; \
|
||||
theStreamPos = aStreamPos; \
|
||||
}
|
||||
|
||||
//! @def OCCT_DUMP_FIELD_VALUE_STRING
|
||||
//! Append into output value: "Name": "Field"
|
||||
#define OCCT_DUMP_FIELD_VALUE_STRING(theOStream, theField) \
|
||||
{ \
|
||||
const char* aName = Standard_Dump::DumpFieldToName (#theField); \
|
||||
TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \
|
||||
Standard_Dump::AddValuesSeparator (theOStream); \
|
||||
theOStream << "\"" << aName << "\": \"" << theField << "\""; \
|
||||
}
|
||||
@@ -77,7 +91,7 @@ class Standard_DumpSentry;
|
||||
//! Append into output value: "Name": "address of the pointer"
|
||||
#define OCCT_DUMP_FIELD_VALUE_POINTER(theOStream, theField) \
|
||||
{ \
|
||||
const char* aName = Standard_Dump::DumpFieldToName (#theField); \
|
||||
TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \
|
||||
Standard_Dump::AddValuesSeparator (theOStream); \
|
||||
theOStream << "\"" << aName << "\": \"" << Standard_Dump::GetPointerInfo (theField) << "\""; \
|
||||
}
|
||||
@@ -90,16 +104,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); \
|
||||
const char* aName = Standard_Dump::DumpFieldToName (#theField); \
|
||||
(theField)->DumpJson (aFieldStream, theDepth - 1); \
|
||||
TCollection_AsciiString 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 +168,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.
|
||||
@@ -190,6 +218,17 @@ enum Standard_JsonKey
|
||||
Standard_JsonKey_SeparatorValueToValue //!< ", "
|
||||
};
|
||||
|
||||
//! Type for storing a dump value with the stream position
|
||||
struct Standard_DumpValue
|
||||
{
|
||||
Standard_DumpValue() {}
|
||||
Standard_DumpValue (const TCollection_AsciiString& theValue, const Standard_Integer& theStartPos)
|
||||
: myValue (theValue), myStartPosition (theStartPos) {}
|
||||
|
||||
TCollection_AsciiString myValue; //!< current string value
|
||||
Standard_Integer myStartPosition; //!< position of the value first char in the whole stream
|
||||
};
|
||||
|
||||
//! This interface has some tool methods for stream (in JSON format) processing.
|
||||
class Standard_Dump
|
||||
{
|
||||
@@ -219,13 +258,9 @@ public:
|
||||
//! The last value might be processed later using the same method.
|
||||
//!
|
||||
//! \param theStream stream value
|
||||
//! \param theValues [out] container of split values
|
||||
//! \param theKeyToValues [out] container of split values
|
||||
Standard_EXPORT static Standard_Boolean SplitJson (const TCollection_AsciiString& theStreamStr,
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues);
|
||||
|
||||
//! Unites container of values into Json output in form: key_1 : value_1, key_2: value_2, ... key_n: value_n
|
||||
Standard_EXPORT static void JoinJson (Standard_OStream& theOStream,
|
||||
const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues);
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& theKeyToValues);
|
||||
|
||||
//! Returns container of indices in values, that has hierarchical value
|
||||
Standard_EXPORT static NCollection_List<Standard_Integer> HierarchicalValueIndices (
|
||||
@@ -265,7 +300,7 @@ public:
|
||||
//! @param theKey a source value
|
||||
//! @param theField stream value
|
||||
Standard_EXPORT static void DumpKeyToClass (Standard_OStream& theOStream,
|
||||
const char* theKey,
|
||||
const TCollection_AsciiString& theKey,
|
||||
const TCollection_AsciiString& theField);
|
||||
|
||||
//! Unite values in one value using template: "value_1", "value_2", ..., "value_n"
|
||||
@@ -286,6 +321,14 @@ public:
|
||||
const TCollection_AsciiString& theName,
|
||||
Standard_Integer& theStreamPos);
|
||||
|
||||
//! Check whether the field name is equal to the name in the stream at position
|
||||
//! @param theSStream stream with values
|
||||
//! @param theName stream key field value
|
||||
//! @param theStreamPos current position in the stream
|
||||
Standard_EXPORT static Standard_Boolean ProcessFieldName (const Standard_SStream& theStream,
|
||||
const TCollection_AsciiString& theName,
|
||||
Standard_Integer& theStreamPos);
|
||||
|
||||
//! Unite values in one value using template: value_1, value_2, ..., value_n
|
||||
//! @param theSStream stream with values
|
||||
//! @param theStreamPos current position in the stream
|
||||
@@ -294,11 +337,19 @@ public:
|
||||
Standard_Integer& theStreamPos,
|
||||
int theCount, ...);
|
||||
|
||||
//! Returns real value
|
||||
//! @param theSStream stream with values
|
||||
//! @param theStreamPos current position in the stream
|
||||
//! @param theValue stream value
|
||||
Standard_EXPORT static Standard_Boolean InitRealValue (const Standard_SStream& theStream,
|
||||
Standard_Integer& theStreamPos,
|
||||
Standard_Real& theValue);
|
||||
|
||||
//! Convert field name into dump text value, removes "&" and "my" prefixes
|
||||
//! An example, for field myValue, theName is Value, for &myCLass, the name is Class
|
||||
//! @param theField a source value
|
||||
//! @param theName [out] an updated name
|
||||
Standard_EXPORT static const char* DumpFieldToName (const char* theField);
|
||||
Standard_EXPORT static TCollection_AsciiString DumpFieldToName (const TCollection_AsciiString theField);
|
||||
|
||||
private:
|
||||
//! Extracts from the string value a pair (key, value), add it into output container, update index value
|
||||
@@ -310,7 +361,7 @@ private:
|
||||
Standard_EXPORT static Standard_Boolean splitKeyToValue (const TCollection_AsciiString& theStreamStr,
|
||||
Standard_Integer theStartIndex,
|
||||
Standard_Integer& theNextIndex,
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues);
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& theValues);
|
||||
|
||||
|
||||
//! Returns key of json in the index position. Incement the index position to the next symbol in the row
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -1086,3 +1086,19 @@ Standard_Boolean StdSelect_ViewerSelector3d::ToPixMap (Image_PixMap&
|
||||
aFiller->Flush();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StdSelect_ViewerSelector3d::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_ViewerSelector);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myStructs.Length())
|
||||
for (Graphic3d_SequenceOfStructure::Iterator aStructsIt (myStructs); aStructsIt.More(); aStructsIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStructure = aStructsIt.Value();
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aStructure)
|
||||
}
|
||||
}
|
||||
|
@@ -93,6 +93,9 @@ public:
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToClearOthers = Standard_True);
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(StdSelect_ViewerSelector3d,SelectMgr_ViewerSelector)
|
||||
|
||||
protected:
|
||||
|
@@ -29,4 +29,25 @@ void TopoDS_TShape::DumpJson (Standard_OStream& theOStream, const Standard_Integ
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, TopoDS_TShape);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFlags);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ShapeType());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, NbChildren());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Free());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Free());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Locked());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Modified());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Checked());
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Orientable());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Closed());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Infinite());
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Convex());
|
||||
|
||||
//for (TopoDS_ListIteratorOfListOfShape anIterator (myShapes); anIterator.More(); anIterator.Next())
|
||||
//{
|
||||
// const TopoDS_Shape& subShape = anIterator.Value();
|
||||
// OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &subShape);
|
||||
//}
|
||||
}
|
||||
|
@@ -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,22 @@ 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)
|
||||
{
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
|
||||
gp_XYZ& anXYZLoc = loc.ChangeCoord();
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Location, aPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
|
||||
gp_XYZ aDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Direction, aPos, 3, &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
|
||||
SetDirection (aDir);
|
||||
|
||||
theStreamPos = aPos;
|
||||
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:
|
||||
|
||||
|
@@ -114,11 +114,36 @@ gp_Ax2 gp_Ax2::Mirrored(const gp_Ax2& A2) const
|
||||
return Temp;
|
||||
}
|
||||
|
||||
void gp_Ax2::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
void gp_Ax2::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, gp_Ax2);
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, Location, 3, axis.Location().X(), axis.Location().Y(), axis.Location().Z())
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, Direction, 3, axis.Direction().X(), axis.Direction().Y(), axis.Direction().Z())
|
||||
|
||||
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, XDirection, 3, vxdir.X(), vxdir.Y(), vxdir.Z())
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, YDirection, 3, vydir.X(), vydir.Y(), vydir.Z())
|
||||
}
|
||||
|
||||
Standard_Boolean gp_Ax2::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
|
||||
gp_XYZ anXYZLoc;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Location, aPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
|
||||
SetLocation (anXYZLoc);
|
||||
|
||||
gp_XYZ aDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Direction, aPos, 3, &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
|
||||
gp_XYZ aXDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, XDirection, aPos, 3, &aXDir.ChangeCoord (1), &aXDir.ChangeCoord (2), &aXDir.ChangeCoord (3))
|
||||
gp_XYZ anYDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, YDirection, aPos, 3, &anYDir.ChangeCoord (1), &anYDir.ChangeCoord (2), &anYDir.ChangeCoord (3))
|
||||
|
||||
SetXDirection (aXDir);
|
||||
SetYDirection (anYDir);
|
||||
|
||||
if (!Direction().IsEqual (aDir, Precision::Confusion()))
|
||||
return Standard_False;
|
||||
|
||||
theStreamPos = aPos;
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -326,6 +326,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)
|
||||
{
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
|
||||
gp_XYZ anXYZLoc;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Location, aPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
|
||||
SetLocation (anXYZLoc);
|
||||
|
||||
gp_XYZ aDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Direction, aPos, 3, &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
|
||||
gp_XYZ aXDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, XDirection, aPos, 3, &aXDir.ChangeCoord (1), &aXDir.ChangeCoord (2), &aXDir.ChangeCoord (3))
|
||||
gp_XYZ anYDir;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, YDirection, aPos, 3, &anYDir.ChangeCoord (1), &anYDir.ChangeCoord (2), &anYDir.ChangeCoord (3))
|
||||
|
||||
SetXDirection (aXDir);
|
||||
SetYDirection (anYDir);
|
||||
|
||||
theStreamPos = aPos;
|
||||
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,15 @@ 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)
|
||||
{
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, gp_Dir, aPos, 3, &coord.ChangeCoord (1), &coord.ChangeCoord (2), &coord.ChangeCoord (3))
|
||||
|
||||
theStreamPos = aPos;
|
||||
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,15 @@ 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)
|
||||
{
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, gp_Pnt, aPos, 3, &coord.ChangeCoord (1), &coord.ChangeCoord (2), &coord.ChangeCoord (3))
|
||||
|
||||
theStreamPos = aPos;
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -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:
|
||||
|
||||
|
@@ -857,11 +857,54 @@ void gp_Trsf::Orthogonalize()
|
||||
//=======================================================================
|
||||
void gp_Trsf::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
||||
{
|
||||
OCCT_DUMP_CLASS_BEGIN (theOStream, gp_Trsf);
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc);
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &matrix);
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, Location, 3, loc.X(), loc.Y(), loc.Z())
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, Matrix, 9, matrix.Value(1, 1), matrix.Value(1, 2), matrix.Value(1, 3),
|
||||
matrix.Value(2, 1), matrix.Value(2, 2), matrix.Value(2, 3),
|
||||
matrix.Value(3, 1), matrix.Value(3, 2), matrix.Value(3, 3))
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, shape);
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, scale);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitJson
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean gp_Trsf::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
|
||||
{
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
|
||||
gp_XYZ anXYZLoc;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Location, aPos, 3, &anXYZLoc.ChangeCoord (1), &anXYZLoc.ChangeCoord (2), &anXYZLoc.ChangeCoord (3))
|
||||
SetTranslation (anXYZLoc);
|
||||
|
||||
//OCCT_INIT_VECTOR_CLASS (theSStream, Matrix, aPos, 9, matrix.ChangeValue (1, 1), matrix.ChangeValue (1, 2), matrix.ChangeValue (1, 3),
|
||||
// matrix.ChangeValue (2, 1), matrix.ChangeValue (2, 2), matrix.ChangeValue (2, 3),
|
||||
// matrix.ChangeValue (3, 1), matrix.ChangeValue (3, 2), matrix.ChangeValue (3, 3))
|
||||
|
||||
Standard_Real mymatrix[3][3];
|
||||
//Standard_Real M00, M01, M02, M10, M11, M12, M20, M21, M22;
|
||||
//OCCT_INIT_VECTOR_CLASS (theSStream, Matrix, aPos, 9, &mymatrix[0][0], &mymatrix[0][1], &mymatrix[0][2],
|
||||
// &mymatrix[1][0], &mymatrix[1][1], &mymatrix[1][2],
|
||||
// &mymatrix[2][0], &mymatrix[2][1], &mymatrix[2][2])
|
||||
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, Matrix, aPos, 9, &mymatrix[0][0], &mymatrix[0][1], &mymatrix[0][2],
|
||||
&mymatrix[1][0], &mymatrix[1][1], &mymatrix[1][2],
|
||||
&mymatrix[2][0], &mymatrix[2][1], &mymatrix[2][2])
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
matrix.SetValue (i + 1, j + 1, mymatrix[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real myshape;
|
||||
OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, myshape);
|
||||
shape = (gp_TrsfForm)((Standard_Integer)myshape);
|
||||
|
||||
OCCT_INIT_FIELD_VALUE_NUMERICAL (theSStream, aPos, scale);
|
||||
|
||||
theStreamPos = aPos;
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -353,6 +353,9 @@ void operator *= (const gp_Trsf& T)
|
||||
//! 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);
|
||||
|
||||
friend class gp_GTrsf;
|
||||
|
||||
protected:
|
||||
|
@@ -47,30 +47,12 @@ 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();
|
||||
Standard_Integer aPos = theStreamPos;
|
||||
OCCT_INIT_VECTOR_CLASS (theSStream, gp_XYZ, aPos, 3, &x, &y, &z)
|
||||
|
||||
theStreamPos = aPos;
|
||||
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,12 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/Convert_Tools.hxx>
|
||||
#include <inspector/Convert_TransientShape.hxx>
|
||||
|
||||
#include <AIS_Plane.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Prs3d_PlaneAspect.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <Standard_Dump.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
@@ -27,10 +32,107 @@
|
||||
//function : CreateShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape Convert_Tools::CreateShape (const Bnd_Box& theBoundingBox)
|
||||
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_Ax2 anAx2;
|
||||
if (anAx2.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
Handle(Geom_Plane) aGeomPlane = new Geom_Plane (gp_Ax3 (anAx2));
|
||||
CreatePresentation (aGeomPlane, thePresentations);
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Ax3 anAx3; // should be after gp_Ax2
|
||||
if (anAx3.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
Handle(Geom_Plane) aGeomPlane = new Geom_Plane (anAx3);
|
||||
CreatePresentation (aGeomPlane, thePresentations);
|
||||
return;
|
||||
}
|
||||
|
||||
// should be after gp_Ax3
|
||||
gp_Ax1 anAxis;
|
||||
if (anAxis.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeEdge (anAxis.Location(), anAxis.Location().Coord() + anAxis.Direction().XYZ())));
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
if (aTrsf.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
CreatePresentation (aTrsf, thePresentations);
|
||||
return;
|
||||
}
|
||||
|
||||
Bnd_Box aBox;
|
||||
if (aBox.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
TopoDS_Shape aShape;
|
||||
if (Convert_Tools::CreateShape (aBox, aShape))
|
||||
thePresentations.Append (new Convert_TransientShape (aShape));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConvertStreamToColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Convert_Tools::ConvertStreamToColor (const Standard_SStream& theSStream,
|
||||
Quantity_Color& theColor)
|
||||
{
|
||||
Standard_Integer aStartPos = 1;
|
||||
Quantity_ColorRGBA aColorRGBA;
|
||||
if (aColorRGBA.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
theColor = aColorRGBA.GetRGB();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Quantity_Color aColor;
|
||||
if (aColor.InitJson (theSStream, aStartPos))
|
||||
{
|
||||
theColor = aColor;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CreateShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Convert_Tools::CreateShape (const Bnd_Box& theBoundingBox, TopoDS_Shape& theShape)
|
||||
{
|
||||
if (theBoundingBox.IsVoid() || theBoundingBox.IsWhole())
|
||||
return TopoDS_Shape();
|
||||
return Standard_False;
|
||||
|
||||
Standard_Real aXmin, anYmin, aZmin, aXmax, anYmax, aZmax;
|
||||
theBoundingBox.Get (aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
|
||||
@@ -38,17 +140,17 @@ TopoDS_Shape Convert_Tools::CreateShape (const Bnd_Box& theBoundingBox)
|
||||
gp_Pnt aPntMin = gp_Pnt (aXmin, anYmin, aZmin);
|
||||
gp_Pnt aPntMax = gp_Pnt (aXmax, anYmax, aZmax);
|
||||
|
||||
return CreateBoxShape (aPntMin, aPntMax);
|
||||
return CreateBoxShape (aPntMin, aPntMax, theShape);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CreateShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape Convert_Tools::CreateShape (const Bnd_OBB& theBoundingBox)
|
||||
Standard_Boolean Convert_Tools::CreateShape (const Bnd_OBB& theBoundingBox, TopoDS_Shape& theShape)
|
||||
{
|
||||
if (theBoundingBox.IsVoid())
|
||||
return TopoDS_Shape();
|
||||
return Standard_False;
|
||||
|
||||
TColgp_Array1OfPnt anArrPnts(0, 8);
|
||||
theBoundingBox.GetVertex(&anArrPnts(0));
|
||||
@@ -62,14 +164,15 @@ TopoDS_Shape Convert_Tools::CreateShape (const Bnd_OBB& theBoundingBox)
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(1)), gp_Pnt (anArrPnts.Value(3))));
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(2)), gp_Pnt (anArrPnts.Value(3))));
|
||||
|
||||
return aCompound;
|
||||
theShape = aCompound;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CreateBoxShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape Convert_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax)
|
||||
Standard_Boolean Convert_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax, TopoDS_Shape& theShape)
|
||||
{
|
||||
Standard_Boolean aThinOnX = fabs (thePntMin.X() - thePntMax.X()) < Precision::Confusion();
|
||||
Standard_Boolean aThinOnY = fabs (thePntMin.Y() - thePntMax.Y()) < Precision::Confusion();
|
||||
@@ -81,7 +184,8 @@ TopoDS_Shape Convert_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pn
|
||||
TopoDS_Compound aCompound;
|
||||
aBuilder.MakeCompound (aCompound);
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (thePntMin));
|
||||
return aCompound;
|
||||
theShape = aCompound;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (aThinOnX || aThinOnY || aThinOnZ)
|
||||
@@ -116,11 +220,66 @@ TopoDS_Shape Convert_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pn
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt3, aPnt4));
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt4, aPnt1));
|
||||
|
||||
return aCompound;
|
||||
theShape = aCompound;
|
||||
return Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
BRepPrimAPI_MakeBox aBoxBuilder (thePntMin, thePntMax);
|
||||
return aBoxBuilder.Shape();
|
||||
theShape = aBoxBuilder.Shape();
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CreatePresentation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Convert_Tools::CreatePresentation (const Handle(Geom_Plane)& thePlane,
|
||||
NCollection_List<Handle(Standard_Transient)>& thePresentations)
|
||||
{
|
||||
Handle(AIS_Plane) aPlanePrs = new AIS_Plane (thePlane);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CreatePresentation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Convert_Tools::CreatePresentation (const gp_Trsf& theTrsf,
|
||||
NCollection_List<Handle(Standard_Transient)>& thePresentations)
|
||||
{
|
||||
Bnd_Box aBox (gp_Pnt(), gp_Pnt(10., 10., 10));
|
||||
|
||||
TopoDS_Shape aBoxShape;
|
||||
if (!Convert_Tools::CreateShape (aBox, aBoxShape))
|
||||
return;
|
||||
|
||||
Handle(AIS_Shape) aSourcePrs = new AIS_Shape (aBoxShape);
|
||||
// TODO - default fields to be defined in another place
|
||||
aSourcePrs->SetColor (Quantity_NOC_WHITE);
|
||||
aSourcePrs->SetTransparency (0.5);
|
||||
thePresentations.Append (aSourcePrs);
|
||||
|
||||
Handle(AIS_Shape) aTransformedPrs = new AIS_Shape (aBoxShape);
|
||||
// TODO - default fields to be defined in another place
|
||||
aTransformedPrs->SetColor (Quantity_NOC_TOMATO);
|
||||
aTransformedPrs->SetTransparency (0.5);
|
||||
aTransformedPrs->SetLocalTransformation (theTrsf);
|
||||
thePresentations.Append (aTransformedPrs);
|
||||
}
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Bnd_OBB.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
@@ -29,12 +31,14 @@
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
class Geom_Plane;
|
||||
class Geom_Transformation;
|
||||
|
||||
//! \class Convert_Tools
|
||||
@@ -42,21 +46,48 @@ class Geom_Transformation;
|
||||
class Convert_Tools
|
||||
{
|
||||
public:
|
||||
//! Creates box shape
|
||||
//! \param theBoundingBox box shape parameters
|
||||
//! \return created shape
|
||||
Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_Box& theBoundingBox);
|
||||
//! 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 collect 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);
|
||||
|
||||
//! Converts stream to color if possible. It processes Quantity_Color, Quantity_ColorRGBA
|
||||
//! \param theStream source of presentation
|
||||
//! \param theColor [out] converted color
|
||||
//! \returns true if done
|
||||
Standard_EXPORT static Standard_Boolean ConvertStreamToColor (const Standard_SStream& theSStream,
|
||||
Quantity_Color& theColor);
|
||||
|
||||
//! Creates box shape
|
||||
//! \param theBoundingBox box shape parameters
|
||||
//! \return created shape
|
||||
Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_OBB& theBoundingBox);
|
||||
Standard_EXPORT static Standard_Boolean CreateShape (const Bnd_Box& theBoundingBox, TopoDS_Shape& theShape);
|
||||
|
||||
//! Creates box shape
|
||||
//! \param theBoundingBox box shape parameters
|
||||
//! \return created shape
|
||||
Standard_EXPORT static Standard_Boolean CreateShape (const Bnd_OBB& theBoundingBox, TopoDS_Shape& theShape);
|
||||
|
||||
//! Creates box shape
|
||||
//! \param thePntMin minimum point on the bounding box
|
||||
//! \param thePntMax maximum point on the bounding box
|
||||
//! \return created shape
|
||||
Standard_EXPORT static TopoDS_Shape CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax);
|
||||
Standard_EXPORT static Standard_Boolean CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax, TopoDS_Shape& theShape);
|
||||
|
||||
//! Creates presentation AIS_Plane
|
||||
//! \param thePlane source plane
|
||||
//! \param thePresentations container to collect new presentation/s
|
||||
Standard_EXPORT static void CreatePresentation (const Handle(Geom_Plane)& thePlane,
|
||||
NCollection_List<Handle(Standard_Transient)>& thePresentations);
|
||||
|
||||
//! Creates two presentations base on gp_Trsf: box in initial place and transformed box
|
||||
//! \param thePlane source plane
|
||||
//! \param thePresentations container to collect new presentation/s
|
||||
Standard_EXPORT static void CreatePresentation (const gp_Trsf& theTrsf,
|
||||
NCollection_List<Handle(Standard_Transient)>& thePresentations);
|
||||
|
||||
};
|
||||
|
||||
|
@@ -26,6 +26,9 @@
|
||||
|
||||
#include <Message_AlertExtended.hxx>
|
||||
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Quantity_ColorRGBA.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopoDS_AlertAttribute.hxx>
|
||||
|
||||
@@ -347,6 +350,45 @@ 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_Ax1
|
||||
{
|
||||
gp_Ax1 aCoords (gp_Pnt (1.3, 2.3, 3.4), gp_Dir (0.3, 0.3, 0.4));
|
||||
Standard_SStream aStream;
|
||||
aCoords.DumpJson (aStream);
|
||||
MESSAGE_INFO_STREAM(aStream, "gp_Ax1", "", &aPerfMeter, NULL);
|
||||
}
|
||||
// gp_Ax2
|
||||
{
|
||||
gp_Ax2 aCoords (gp_Pnt (10.3, 20.3, 30.4), gp_Dir (0.3, 0.3, 0.4));
|
||||
Standard_SStream aStream;
|
||||
aCoords.DumpJson (aStream);
|
||||
MESSAGE_INFO_STREAM(aStream, "gp_Ax2", "", &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);
|
||||
}
|
||||
// gp_Trsf
|
||||
{
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetRotation (gp::OZ(), 0.3);
|
||||
aTrsf.SetTranslationPart (gp_Vec (15., 15., 15.));
|
||||
aTrsf.SetScaleFactor (3.);
|
||||
|
||||
Standard_SStream aStream;
|
||||
aTrsf.DumpJson (aStream);
|
||||
MESSAGE_INFO_STREAM(aStream, "gp_Trsf", "", &aPerfMeter, NULL);
|
||||
}
|
||||
// Bnd_Box
|
||||
{
|
||||
Bnd_Box aBox (gp_Pnt (20., 15., 10.), gp_Pnt (25., 20., 15.));
|
||||
@@ -362,6 +404,29 @@ void MessageModel_Actions::OnTestPropertyPanel()
|
||||
anOBB.DumpJson (aStream);
|
||||
MESSAGE_INFO_STREAM(aStream, "Bnd_OBB", "", &aPerfMeter, NULL);
|
||||
}
|
||||
// Quantity_ColorRGBA
|
||||
{
|
||||
Quantity_ColorRGBA aColor (0.2f, 0.8f, 0.8f, 0.2f);
|
||||
Standard_SStream aStream;
|
||||
aColor.DumpJson (aStream);
|
||||
MESSAGE_INFO_STREAM(aStream, "Quantity_ColorRGBA", "", &aPerfMeter, NULL);
|
||||
}
|
||||
// Quantity_Color
|
||||
{
|
||||
Quantity_Color aColor (0.8, 0.8, 0.8, Quantity_TOC_RGB);
|
||||
Standard_SStream aStream;
|
||||
aColor.DumpJson (aStream);
|
||||
MESSAGE_INFO_STREAM(aStream, "Quantity_Color", "", &aPerfMeter, NULL);
|
||||
}
|
||||
|
||||
// SHAPE messages
|
||||
{
|
||||
BRepBuilderAPI_MakeEdge aBuilder (gp_Pnt (0., 0., 0.), gp_Pnt (20., 10., 20.));
|
||||
TopoDS_Shape aShape = aBuilder.Shape();
|
||||
|
||||
MESSAGE_INFO_SHAPE (aShape, "Shape message edge", "", &aPerfMeter, NULL);
|
||||
}
|
||||
|
||||
myTreeModel->UpdateTreeModel();
|
||||
#endif
|
||||
}
|
||||
|
@@ -207,26 +207,55 @@ int MessageModel_ItemAlert::initRowCount() const
|
||||
// =======================================================================
|
||||
void MessageModel_ItemAlert::GetStream (Standard_OStream& OS) const
|
||||
{
|
||||
//return;
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (getAlert());
|
||||
if (!anExtendedAlert.IsNull() && !anExtendedAlert->Attribute().IsNull())
|
||||
{
|
||||
Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
|
||||
if (!anAttribute.IsNull())
|
||||
{
|
||||
if (!Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
|
||||
{
|
||||
//if (GetProperties().IsNull())
|
||||
//{
|
||||
// TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
|
||||
// SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem));
|
||||
//}
|
||||
Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
|
||||
//Handle(MessageModel_ItemPropertiesAttributeStream) aProperties = Handle(MessageModel_ItemPropertiesAttributeStream)::DownCast (GetProperties());
|
||||
OS << anAttributeStream->GetStream().str();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (anExtendedAlert.IsNull() || anExtendedAlert->Attribute().IsNull())
|
||||
return;
|
||||
|
||||
Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
|
||||
if (anAttribute.IsNull())
|
||||
return;
|
||||
|
||||
if (Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
|
||||
return;
|
||||
|
||||
Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
|
||||
OS << anAttributeStream->GetStream().str();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetStream
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool MessageModel_ItemAlert::SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
|
||||
Standard_Integer& theLastPos) const
|
||||
{
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (getAlert());
|
||||
if (anExtendedAlert.IsNull() || anExtendedAlert->Attribute().IsNull())
|
||||
return false;
|
||||
|
||||
Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
|
||||
if (anAttribute.IsNull())
|
||||
return false;
|
||||
|
||||
if (Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
|
||||
return false;
|
||||
|
||||
Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
|
||||
TCollection_AsciiString aStreamValue = Standard_Dump::Text (anAttributeStream->GetStream());
|
||||
|
||||
TCollection_AsciiString aNewValue = Standard_Dump::Text (theSStream);
|
||||
|
||||
Standard_SStream aStream;
|
||||
aStream << aStreamValue.SubString (1, theStartPos - 1);
|
||||
aStream << aNewValue;
|
||||
if (theLastPos + 1 <= aStreamValue.Length())
|
||||
aStream << aStreamValue.SubString (theLastPos + 1, aStreamValue.Length());
|
||||
|
||||
//TCollection_AsciiString aStreamValue_debug = Standard_Dump::Text (aStream);
|
||||
|
||||
anAttributeStream->SetStream (aStream);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -268,33 +297,33 @@ void MessageModel_ItemAlert::Init()
|
||||
}
|
||||
}
|
||||
|
||||
/*Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(myAlert);
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(myAlert);
|
||||
if (!anExtendedAlert.IsNull() && !anExtendedAlert->Attribute().IsNull())
|
||||
{
|
||||
Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
|
||||
if (!anAttribute.IsNull())
|
||||
{
|
||||
if (!Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
|
||||
{
|
||||
if (GetProperties().IsNull())
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
|
||||
SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem));
|
||||
}
|
||||
Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
|
||||
Handle(MessageModel_ItemPropertiesAttributeStream) aProperties = Handle(MessageModel_ItemPropertiesAttributeStream)::DownCast (GetProperties());
|
||||
aProperties->Init (anAttributeStream->GetStream());
|
||||
}
|
||||
//if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
|
||||
// myPresentations.Append (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
|
||||
//if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
|
||||
// myPresentations.Append (new Convert_TransientShape (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape()));
|
||||
//if (!Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
|
||||
//{
|
||||
// if (GetProperties().IsNull())
|
||||
// {
|
||||
// TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
|
||||
// SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem));
|
||||
// }
|
||||
// Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
|
||||
// Handle(MessageModel_ItemPropertiesAttributeStream) aProperties = Handle(MessageModel_ItemPropertiesAttributeStream)::DownCast (GetProperties());
|
||||
// aProperties->Init (anAttributeStream->GetStream());
|
||||
//}
|
||||
////if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
|
||||
//// myPresentations.Append (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
|
||||
if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
|
||||
myPresentations.Append (new Convert_TransientShape (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape()));
|
||||
}
|
||||
//TCollection_AsciiString aDescription = anExtendedAlert->Attribute()->GetDescription();
|
||||
//Bnd_Box aBox;
|
||||
//if (aBox.Init (Standard_SStream (aDescription.ToCString())))
|
||||
// myPresentations.Append (new Convert_TransientShape (Convert_Tools::CreateShape (aBox)));
|
||||
}*/
|
||||
}
|
||||
MessageModel_ItemBase::Init();
|
||||
}
|
||||
|
||||
|
@@ -78,6 +78,11 @@ public:
|
||||
//! \return stream value or dummy
|
||||
Standard_EXPORT virtual void GetStream (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns stream value of the item to fulfill property panel.
|
||||
//! \return stream value or dummy
|
||||
Standard_EXPORT virtual bool SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
|
||||
Standard_Integer& theLastPos) const Standard_OVERRIDE;
|
||||
|
||||
//! Sets some shape to present the item
|
||||
//! \param theShape shape instance
|
||||
void SetCustomShape (const TopoDS_Shape& theShape) { myCustomShape = theShape; }
|
||||
|
@@ -198,3 +198,31 @@ Handle(Message_Report) MessageModel_ItemReport::FindReport (const MessageModel_I
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetStream
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_ItemReport::GetStream (Standard_OStream& theOStream) const
|
||||
{
|
||||
Handle(Message_Report) aReport = GetReport();
|
||||
if (aReport.IsNull())
|
||||
return;
|
||||
|
||||
aReport->DumpJson (theOStream);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetStream
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool MessageModel_ItemReport::SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
|
||||
Standard_Integer& theLastPos) const
|
||||
{
|
||||
Handle(Message_Report) aReport = GetReport();
|
||||
if (aReport.IsNull())
|
||||
return false;
|
||||
|
||||
Standard_Integer aStartPos = 1;
|
||||
return aReport->InitJson (theSStream, aStartPos);
|
||||
}
|
||||
|
@@ -78,6 +78,15 @@ public:
|
||||
//! Returns report of the item
|
||||
static Handle(Message_Report) FindReport (const MessageModel_ItemBasePtr& thetItem);
|
||||
|
||||
//! 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;
|
||||
|
||||
//! Returns stream value of the item to fulfill property panel.
|
||||
//! \return stream value or dummy
|
||||
Standard_EXPORT virtual bool SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
|
||||
Standard_Integer& theLastPos) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
|
@@ -101,7 +101,7 @@ TopoDS_Shape MessageView_VisibilityState::getShape (const QModelIndex& theIndex)
|
||||
if (!anAlertItem)
|
||||
return TopoDS_Shape();
|
||||
|
||||
if (!anAlertItem->GetCustomShape().IsNull())
|
||||
/*if (!anAlertItem->GetCustomShape().IsNull())
|
||||
return anAlertItem->GetCustomShape();
|
||||
|
||||
Handle(Message_Alert) anAlert = anAlertItem->GetAlert();
|
||||
@@ -115,7 +115,7 @@ TopoDS_Shape MessageView_VisibilityState::getShape (const QModelIndex& theIndex)
|
||||
Handle(TopoDS_AlertAttribute) aShapeAttribute = Handle(TopoDS_AlertAttribute)::DownCast (anAlertExtended->Attribute());
|
||||
if (!aShapeAttribute.IsNull())
|
||||
return aShapeAttribute->GetShape();
|
||||
|
||||
*/
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
@@ -188,11 +190,14 @@ MessageView_Window::MessageView_Window (QWidget* theParent)
|
||||
myPropertyPanelWidget->setWidget (myPropertyView->GetControl());
|
||||
myMainWindow->addDockWidget (Qt::RightDockWidgetArea, myPropertyPanelWidget);
|
||||
connect (myPropertyPanelWidget->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT (onPropertyPanelShown (bool)));
|
||||
connect (myPropertyView, SIGNAL (propertyViewSelectionChanged()), this, SLOT (onPropertyViewSelectionChanged ()));
|
||||
connect (myPropertyView, SIGNAL (propertyViewSelectionChanged()), this, SLOT (onPropertyViewSelectionChanged()));
|
||||
connect (myPropertyView, SIGNAL (propertyViewDataChanged()), this, SLOT (onPropertyViewDataChanged()));
|
||||
|
||||
|
||||
// view
|
||||
myViewWindow = new View_Window (myMainWindow, false);
|
||||
connect (myViewWindow, SIGNAL(eraseAllPerformed()), this, SLOT(onEraseAllPerformed()));
|
||||
connect (myViewWindow->GetViewToolBar(), SIGNAL (contextChanged()), this, SLOT (onContextSelected()));
|
||||
aVisibilityState->SetDisplayer (myViewWindow->GetDisplayer());
|
||||
aVisibilityState->SetPresentationType (View_PresentationType_Main);
|
||||
myViewWindow->GetView()->SetPredefinedSize (MESSAGEVIEW_DEFAULT_VIEW_WIDTH, MESSAGEVIEW_DEFAULT_VIEW_HEIGHT);
|
||||
@@ -363,6 +368,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 +415,7 @@ void MessageView_Window::addReport (const Handle(Message_Report)& theReport,
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onTreeViewSelectionChanged
|
||||
// function : onTreeViewVisibilityClicked
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageView_Window::onTreeViewVisibilityClicked(const QModelIndex& theIndex)
|
||||
@@ -430,37 +436,7 @@ void MessageView_Window::onTreeViewSelectionChanged (const QItemSelection&, cons
|
||||
return;
|
||||
|
||||
updatePropertyPanelBySelection();
|
||||
|
||||
NCollection_List<Handle(Standard_Transient)> aPresentations;
|
||||
MessageModel_ItemRootPtr aRootItem;
|
||||
QModelIndexList aSelectedIndices = myTreeView->selectionModel()->selectedIndexes();
|
||||
for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
|
||||
{
|
||||
QModelIndex anIndex = *aSelIt;
|
||||
if (anIndex.column() != 0)
|
||||
continue;
|
||||
|
||||
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||
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 ();
|
||||
if (anItemProperties)
|
||||
anItemProperties->GetPresentations (-1, -1, aPresentations);
|
||||
|
||||
MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
|
||||
if (!anAlertItem)
|
||||
continue;
|
||||
anAlertItem->GetPresentations (aPresentations);
|
||||
}
|
||||
updatePreviewPresentation (aPresentations);
|
||||
updatePreviewPresentation();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -553,15 +529,12 @@ void MessageView_Window::onPropertyViewSelectionChanged()
|
||||
if (!anAlertItem)
|
||||
return;
|
||||
|
||||
QList<ViewControl_Table*> aPropertyTables;
|
||||
myPropertyView->GetActiveTables (aPropertyTables);
|
||||
if (aPropertyTables.isEmpty())
|
||||
ViewControl_Table* aPropertyTable = myPropertyView->GetTable();
|
||||
if (!aPropertyTable->IsActive())
|
||||
return;
|
||||
|
||||
ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
|
||||
|
||||
QMap<int, QList<int>> aSelectedIndices;
|
||||
aFirstTable->GetSelectedIndices (aSelectedIndices);
|
||||
aPropertyTable->GetSelectedIndices (aSelectedIndices);
|
||||
|
||||
// clear presentation if selection is empty
|
||||
MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
|
||||
@@ -573,7 +546,7 @@ void MessageView_Window::onPropertyViewSelectionChanged()
|
||||
return;
|
||||
}
|
||||
|
||||
/*TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aFirstTable);
|
||||
/*TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aPropertyTable);
|
||||
if (aShapeOfSelection.IsNull())
|
||||
return;
|
||||
|
||||
@@ -596,6 +569,24 @@ void MessageView_Window::onPropertyViewSelectionChanged()
|
||||
}*/
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onPropertyViewDataChanged
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageView_Window::onPropertyViewDataChanged()
|
||||
{
|
||||
QItemSelectionModel* aModel = myTreeView->selectionModel();
|
||||
if (!aModel)
|
||||
return;
|
||||
QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
|
||||
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||
if (!anItemBase)
|
||||
return;
|
||||
|
||||
updatePropertyPanelBySelection();
|
||||
updatePreviewPresentation();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onEraseAllPerformed
|
||||
// purpose :
|
||||
@@ -703,6 +694,19 @@ void MessageView_Window::onReloadReport()
|
||||
aTreeModel->SetReport (aReportItem->Row(), aReport, aDescription);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onContextSelected
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageView_Window::onContextSelected()
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aContext = myViewWindow->GetViewToolBar()->GetCurrentContext();
|
||||
if (aContext.IsNull())
|
||||
return;
|
||||
|
||||
myDisplayPreview->SetContext (aContext);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : updatePropertyPanelBySelection
|
||||
// purpose :
|
||||
@@ -722,97 +726,62 @@ void MessageView_Window::updatePropertyPanelBySelection()
|
||||
MessageModel_Tools::GetPropertyTableValues (anItemBase, aTableValues);
|
||||
|
||||
myPropertyView->Init (aTableValues);*/
|
||||
QList<ViewControl_TableModelValues*> aTableValuesList;
|
||||
ViewControl_TableModelValues* aTableValues = 0;
|
||||
|
||||
QItemSelectionModel* aModel = myTreeView->selectionModel();
|
||||
if (!aModel)
|
||||
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();
|
||||
aTableValues = new ViewControl_TableModelValues();
|
||||
aTableValues->SetProperties (anItemProperties);
|
||||
aTableValuesList.append (aTableValues);
|
||||
}
|
||||
}
|
||||
myPropertyView->Init (aTableValuesList);
|
||||
myPropertyView->Init (aTableValues);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : updatePreviewPresentation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageView_Window::updatePreviewPresentation (const NCollection_List<Handle(Standard_Transient)>& thePresentations)
|
||||
void MessageView_Window::updatePreviewPresentation()
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aContext = myViewWindow->GetViewToolBar()->GetCurrentContext();
|
||||
if (aContext.IsNull())
|
||||
return;
|
||||
|
||||
if (!myPreviewPresentations.IsEmpty())
|
||||
NCollection_List<Handle(Standard_Transient)> aPresentations;
|
||||
MessageModel_ItemRootPtr aRootItem;
|
||||
QModelIndexList aSelectedIndices = myTreeView->selectionModel()->selectedIndexes();
|
||||
for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
|
||||
{
|
||||
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();
|
||||
QModelIndex anIndex = *aSelIt;
|
||||
if (anIndex.column() != 0)
|
||||
continue;
|
||||
|
||||
myPreviewPresentations = thePresentations;
|
||||
if (myPreviewPresentations.IsEmpty())
|
||||
return;
|
||||
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||
if (!anItemBase)
|
||||
continue;
|
||||
|
||||
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())
|
||||
Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->Properties();
|
||||
if (anItemProperties)
|
||||
{
|
||||
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);
|
||||
anItemProperties->GetPresentations (-1, -1, aPresentations);
|
||||
}
|
||||
else if (!Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value()).IsNull())
|
||||
|
||||
MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
|
||||
if (anAlertItem)
|
||||
{
|
||||
Handle(Convert_TransientShape) aShapeObject = Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value());
|
||||
aBuilder.Add (aCompound, aShapeObject->GetShape());
|
||||
anAlertItem->GetPresentations (aPresentations);
|
||||
}
|
||||
}
|
||||
|
||||
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, aPresentations);
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@
|
||||
|
||||
class View_Window;
|
||||
|
||||
class View_DisplayPreview;
|
||||
class ViewControl_PropertyView;
|
||||
class MessageModel_ReportCallBack;
|
||||
|
||||
@@ -139,6 +140,9 @@ protected slots:
|
||||
//! \param theDeselected container of selected table cells
|
||||
void onPropertyViewSelectionChanged();
|
||||
|
||||
//! Update tree view item, preview presentation by item value change
|
||||
void onPropertyViewDataChanged();
|
||||
|
||||
//! Updates visibility states by erase all in context
|
||||
void onEraseAllPerformed();
|
||||
|
||||
@@ -157,13 +161,15 @@ protected slots:
|
||||
//! Reads if possible report of a selected item and updates this report in tree view
|
||||
void onReloadReport();
|
||||
|
||||
//! Updates context in preview display
|
||||
void onContextSelected();
|
||||
|
||||
protected:
|
||||
//! Updates property panel content by item selected in tree view.
|
||||
void updatePropertyPanelBySelection();
|
||||
|
||||
//!< Updates presentation of preview for parameter shapes. Creates a compound of the shapes
|
||||
//!< \param theShape container of shapes
|
||||
void updatePreviewPresentation (const NCollection_List<Handle(Standard_Transient)>& thePresentations);
|
||||
void updatePreviewPresentation();
|
||||
|
||||
private:
|
||||
QMainWindow* myMainWindow; //!< main control, parent for all MessageView controls
|
||||
@@ -172,6 +178,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 +188,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();
|
||||
}
|
||||
|
||||
@@ -122,18 +128,46 @@ void TreeModel_ItemBase::Init()
|
||||
{
|
||||
m_bInitialized = true;
|
||||
|
||||
NCollection_List<Standard_Integer> aHierarchicalValues;
|
||||
//NCollection_List<Standard_Integer> aHierarchicalValues;
|
||||
int aStreamChildrenCount = 0;
|
||||
if (Column() == 0)
|
||||
{
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
|
||||
//NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
|
||||
Standard_SStream aStream;
|
||||
GetStream (aStream);
|
||||
Standard_Dump::SplitJson (Standard_Dump::Text (aStream), aValues);
|
||||
aHierarchicalValues = Standard_Dump::HierarchicalValueIndices (aValues);
|
||||
if (!Standard_Dump::Text (aStream).IsEmpty())
|
||||
{
|
||||
if (!myProperties)
|
||||
{
|
||||
myProperties = new TreeModel_ItemProperties();
|
||||
myProperties->SetItem (currentItem());
|
||||
}
|
||||
myProperties->Init();
|
||||
aStreamChildrenCount = myProperties->Children().Extent();
|
||||
}
|
||||
//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();
|
||||
m_iStreamChildren = aStreamChildrenCount;//aHierarchicalValues.Extent();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user