From: nds Date: Mon, 2 Mar 2020 12:58:19 +0000 (+0300) Subject: 0031494: Mesh - Dump improvement for BRepMesh classes X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=77242088bcef0a1f1c539f9887bbdd7e67a4451e;p=occt-copy.git 0031494: Mesh - Dump improvement for BRepMesh classes --- diff --git a/src/Adaptor2d/Adaptor2d_Curve2d.cxx b/src/Adaptor2d/Adaptor2d_Curve2d.cxx index aabbf95842..7924571a6a 100644 --- a/src/Adaptor2d/Adaptor2d_Curve2d.cxx +++ b/src/Adaptor2d/Adaptor2d_Curve2d.cxx @@ -378,3 +378,11 @@ Standard_Integer Adaptor2d_Curve2d::NbSamples() const return 20; } +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void Adaptor2d_Curve2d::DumpJson (Standard_OStream& theOStream, Standard_Integer) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor2d_Curve2d) +} diff --git a/src/Adaptor2d/Adaptor2d_Curve2d.hxx b/src/Adaptor2d/Adaptor2d_Curve2d.hxx index c845bcef7a..46f4cd1816 100644 --- a/src/Adaptor2d/Adaptor2d_Curve2d.hxx +++ b/src/Adaptor2d/Adaptor2d_Curve2d.hxx @@ -158,6 +158,8 @@ public: Standard_EXPORT virtual Handle(Geom2d_BSplineCurve) BSpline() const; Standard_EXPORT virtual ~Adaptor2d_Curve2d(); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; diff --git a/src/Adaptor2d/Adaptor2d_HCurve2d.hxx b/src/Adaptor2d/Adaptor2d_HCurve2d.hxx index 1e2f815751..4d99ec72c4 100644 --- a/src/Adaptor2d/Adaptor2d_HCurve2d.hxx +++ b/src/Adaptor2d/Adaptor2d_HCurve2d.hxx @@ -118,6 +118,9 @@ public: virtual Handle(Geom2d_BSplineCurve) BSpline() const; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + DEFINE_STANDARD_RTTIEXT(Adaptor2d_HCurve2d,Standard_Transient) }; diff --git a/src/Adaptor2d/Adaptor2d_HCurve2d.lxx b/src/Adaptor2d/Adaptor2d_HCurve2d.lxx index c8d728dc03..1f5e891c0d 100644 --- a/src/Adaptor2d/Adaptor2d_HCurve2d.lxx +++ b/src/Adaptor2d/Adaptor2d_HCurve2d.lxx @@ -294,3 +294,11 @@ inline Standard_Integer Adaptor2d_HCurve2d::NbKnots() const return Curve2d().BSpline(); } +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= + inline void Adaptor2d_HCurve2d::DumpJson (Standard_OStream& theOStream, Standard_Integer) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor2d_HCurve2d) +} diff --git a/src/Adaptor3d/Adaptor3d_Curve.cxx b/src/Adaptor3d/Adaptor3d_Curve.cxx index 49b02da158..12e4c5bf66 100644 --- a/src/Adaptor3d/Adaptor3d_Curve.cxx +++ b/src/Adaptor3d/Adaptor3d_Curve.cxx @@ -364,3 +364,12 @@ Handle(Geom_OffsetCurve) Adaptor3d_Curve::OffsetCurve() const { throw Standard_NotImplemented("Adaptor3d_Curve::OffsetCurve"); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void Adaptor3d_Curve::DumpJson (Standard_OStream& theOStream, Standard_Integer) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor3d_Curve) +} diff --git a/src/Adaptor3d/Adaptor3d_Curve.hxx b/src/Adaptor3d/Adaptor3d_Curve.hxx index de882dc430..15e48a7c2c 100644 --- a/src/Adaptor3d/Adaptor3d_Curve.hxx +++ b/src/Adaptor3d/Adaptor3d_Curve.hxx @@ -161,6 +161,8 @@ public: Standard_EXPORT virtual ~Adaptor3d_Curve(); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; diff --git a/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx b/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx index 43f8530b9a..b546560a03 100644 --- a/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx +++ b/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx @@ -1796,5 +1796,23 @@ void Adaptor3d_CurveOnSurface::LocatePart(const gp_Pnt2d& UV, const gp_Vec2d& DU } } +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void Adaptor3d_CurveOnSurface::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor3d_CurveOnSurface) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor3d_CurveOnSurface) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myType) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCirc) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myLin) + + if (!myIntervals.IsNull()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIntervals->Length()) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIntCont) +} diff --git a/src/Adaptor3d/Adaptor3d_CurveOnSurface.hxx b/src/Adaptor3d/Adaptor3d_CurveOnSurface.hxx index c7431f67a4..c3446f62c0 100644 --- a/src/Adaptor3d/Adaptor3d_CurveOnSurface.hxx +++ b/src/Adaptor3d/Adaptor3d_CurveOnSurface.hxx @@ -181,6 +181,9 @@ public: Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + diff --git a/src/Adaptor3d/Adaptor3d_HCurve.hxx b/src/Adaptor3d/Adaptor3d_HCurve.hxx index 3e4e321af0..16389fbcf2 100644 --- a/src/Adaptor3d/Adaptor3d_HCurve.hxx +++ b/src/Adaptor3d/Adaptor3d_HCurve.hxx @@ -137,6 +137,8 @@ public: Handle(Geom_OffsetCurve) OffsetCurve() const; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; DEFINE_STANDARD_RTTIEXT(Adaptor3d_HCurve,Standard_Transient) diff --git a/src/Adaptor3d/Adaptor3d_HCurve.lxx b/src/Adaptor3d/Adaptor3d_HCurve.lxx index 48b2d8d0d3..70826ca0f6 100644 --- a/src/Adaptor3d/Adaptor3d_HCurve.lxx +++ b/src/Adaptor3d/Adaptor3d_HCurve.lxx @@ -302,3 +302,12 @@ inline Standard_Integer Adaptor3d_HCurve::NbKnots() const { return Curve().OffsetCurve(); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= + inline void Adaptor3d_HCurve::DumpJson (Standard_OStream& theOStream, Standard_Integer) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor3d_HCurve) +} diff --git a/src/Adaptor3d/Adaptor3d_HCurveOnSurface.hxx b/src/Adaptor3d/Adaptor3d_HCurveOnSurface.hxx index 4ccc7d0e0d..f22050ad43 100644 --- a/src/Adaptor3d/Adaptor3d_HCurveOnSurface.hxx +++ b/src/Adaptor3d/Adaptor3d_HCurveOnSurface.hxx @@ -59,6 +59,8 @@ public: //! Returns the curve used to create the GenHCurve. Adaptor3d_CurveOnSurface& ChangeCurve(); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; diff --git a/src/Adaptor3d/Adaptor3d_HCurveOnSurface_0.cxx b/src/Adaptor3d/Adaptor3d_HCurveOnSurface_0.cxx index dedb934068..1f4328bd7d 100644 --- a/src/Adaptor3d/Adaptor3d_HCurveOnSurface_0.cxx +++ b/src/Adaptor3d/Adaptor3d_HCurveOnSurface_0.cxx @@ -40,3 +40,14 @@ #define Handle_Adaptor3d_GenHCurve Handle(Adaptor3d_HCurveOnSurface) #include +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void Adaptor3d_HCurveOnSurface::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor3d_HCurve) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCurve) +} diff --git a/src/Adaptor3d/Adaptor3d_HSurface.hxx b/src/Adaptor3d/Adaptor3d_HSurface.hxx index 80fd5f8199..8d75b2a4c0 100644 --- a/src/Adaptor3d/Adaptor3d_HSurface.hxx +++ b/src/Adaptor3d/Adaptor3d_HSurface.hxx @@ -161,6 +161,8 @@ public: Standard_Real OffsetValue() const; + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; diff --git a/src/Adaptor3d/Adaptor3d_HSurface.lxx b/src/Adaptor3d/Adaptor3d_HSurface.lxx index 3510b204ff..5c6c551f7a 100644 --- a/src/Adaptor3d/Adaptor3d_HSurface.lxx +++ b/src/Adaptor3d/Adaptor3d_HSurface.lxx @@ -483,3 +483,12 @@ inline Standard_Boolean Adaptor3d_HSurface::IsVRational() const { return Surface().OffsetValue(); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= + inline void Adaptor3d_HSurface::DumpJson (Standard_OStream& theOStream, Standard_Integer) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) +} diff --git a/src/Adaptor3d/Adaptor3d_Surface.cxx b/src/Adaptor3d/Adaptor3d_Surface.cxx index 42adac71bb..e53e28a15c 100644 --- a/src/Adaptor3d/Adaptor3d_Surface.cxx +++ b/src/Adaptor3d/Adaptor3d_Surface.cxx @@ -571,3 +571,12 @@ Standard_Real Adaptor3d_Surface::OffsetValue() const { throw Standard_NotImplemented("Adaptor3d_Surface::OffsetValue"); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void Adaptor3d_Surface::DumpJson (Standard_OStream& theOStream, Standard_Integer) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor3d_Surface) +} diff --git a/src/Adaptor3d/Adaptor3d_Surface.hxx b/src/Adaptor3d/Adaptor3d_Surface.hxx index 1f5c3061ee..03f65b9a3f 100644 --- a/src/Adaptor3d/Adaptor3d_Surface.hxx +++ b/src/Adaptor3d/Adaptor3d_Surface.hxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -211,6 +212,9 @@ public: Standard_EXPORT virtual Standard_Real OffsetValue() const; Standard_EXPORT virtual ~Adaptor3d_Surface(); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + diff --git a/src/BRepAdaptor/BRepAdaptor_Curve.cxx b/src/BRepAdaptor/BRepAdaptor_Curve.cxx index 4b75698d01..0be3408aa3 100644 --- a/src/BRepAdaptor/BRepAdaptor_Curve.cxx +++ b/src/BRepAdaptor/BRepAdaptor_Curve.cxx @@ -679,3 +679,19 @@ Handle(Geom_OffsetCurve) BRepAdaptor_Curve::OffsetCurve() const return myTrsf.Form() == gp_Identity ? anOffC : Handle(Geom_OffsetCurve)::DownCast(anOffC->Transformed(myTrsf)); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepAdaptor_Curve::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, BRepAdaptor_Curve) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor3d_Curve) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myTrsf) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCurve) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myConSurf.get()) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEdge) +} diff --git a/src/BRepAdaptor/BRepAdaptor_Curve.hxx b/src/BRepAdaptor/BRepAdaptor_Curve.hxx index 640505d6f7..cd9dfe31c5 100644 --- a/src/BRepAdaptor/BRepAdaptor_Curve.hxx +++ b/src/BRepAdaptor/BRepAdaptor_Curve.hxx @@ -226,6 +226,9 @@ public: Standard_EXPORT Handle(Geom_OffsetCurve) OffsetCurve() const Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + protected: diff --git a/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx b/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx index 2d121bed41..b24fabf9ed 100644 --- a/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx +++ b/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx @@ -77,4 +77,15 @@ const TopoDS_Face& BRepAdaptor_Curve2d::Face() const return myFace; } +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepAdaptor_Curve2d::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, BRepAdaptor_Curve2d) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2dAdaptor_Curve) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEdge) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myFace) +} diff --git a/src/BRepAdaptor/BRepAdaptor_Curve2d.hxx b/src/BRepAdaptor/BRepAdaptor_Curve2d.hxx index cf220cc57f..35f23350f4 100644 --- a/src/BRepAdaptor/BRepAdaptor_Curve2d.hxx +++ b/src/BRepAdaptor/BRepAdaptor_Curve2d.hxx @@ -61,6 +61,8 @@ public: //! Returns the Face. Standard_EXPORT const TopoDS_Face& Face() const; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; diff --git a/src/BRepAdaptor/BRepAdaptor_HCurve2d.hxx b/src/BRepAdaptor/BRepAdaptor_HCurve2d.hxx index 9549145068..a1d239b5e0 100644 --- a/src/BRepAdaptor/BRepAdaptor_HCurve2d.hxx +++ b/src/BRepAdaptor/BRepAdaptor_HCurve2d.hxx @@ -55,6 +55,8 @@ public: //! Returns the curve used to create the GenHCurve. BRepAdaptor_Curve2d& ChangeCurve2d(); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; diff --git a/src/BRepAdaptor/BRepAdaptor_HCurve2d_0.cxx b/src/BRepAdaptor/BRepAdaptor_HCurve2d_0.cxx index 008350d6b7..e519fb4063 100644 --- a/src/BRepAdaptor/BRepAdaptor_HCurve2d_0.cxx +++ b/src/BRepAdaptor/BRepAdaptor_HCurve2d_0.cxx @@ -40,3 +40,14 @@ #define Handle_Adaptor2d_GenHCurve2d Handle(BRepAdaptor_HCurve2d) #include +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepAdaptor_HCurve2d::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor2d_HCurve2d) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCurve) +} diff --git a/src/BRepAdaptor/BRepAdaptor_HSurface.hxx b/src/BRepAdaptor/BRepAdaptor_HSurface.hxx index cc544cf03f..195eca483d 100644 --- a/src/BRepAdaptor/BRepAdaptor_HSurface.hxx +++ b/src/BRepAdaptor/BRepAdaptor_HSurface.hxx @@ -55,6 +55,8 @@ public: //! Returns the surface used to create the GenHSurface. BRepAdaptor_Surface& ChangeSurface(); + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; diff --git a/src/BRepAdaptor/BRepAdaptor_HSurface_0.cxx b/src/BRepAdaptor/BRepAdaptor_HSurface_0.cxx index a29b8b11f5..a26b4ba22b 100644 --- a/src/BRepAdaptor/BRepAdaptor_HSurface_0.cxx +++ b/src/BRepAdaptor/BRepAdaptor_HSurface_0.cxx @@ -40,3 +40,14 @@ #define Handle_Adaptor3d_GenHSurface Handle(BRepAdaptor_HSurface) #include +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepAdaptor_HSurface::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor3d_HSurface) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &mySurf) +} diff --git a/src/BRepAdaptor/BRepAdaptor_Surface.cxx b/src/BRepAdaptor/BRepAdaptor_Surface.cxx index 850facead9..cdaa7a6110 100644 --- a/src/BRepAdaptor/BRepAdaptor_Surface.cxx +++ b/src/BRepAdaptor/BRepAdaptor_Surface.cxx @@ -442,3 +442,16 @@ Standard_Real BRepAdaptor_Surface::OffsetValue() const return mySurf.OffsetValue(); } +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepAdaptor_Surface::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, BRepAdaptor_Surface) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor3d_Surface) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &mySurf) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myTrsf) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myFace) +} diff --git a/src/BRepAdaptor/BRepAdaptor_Surface.hxx b/src/BRepAdaptor/BRepAdaptor_Surface.hxx index 70858bf8fa..32037fd8cf 100644 --- a/src/BRepAdaptor/BRepAdaptor_Surface.hxx +++ b/src/BRepAdaptor/BRepAdaptor_Surface.hxx @@ -247,6 +247,8 @@ public: Standard_EXPORT Standard_Real OffsetValue() const Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; diff --git a/src/BRepMesh/BRepMesh_BaseMeshAlgo.cxx b/src/BRepMesh/BRepMesh_BaseMeshAlgo.cxx index dce927a2c4..5e289f3d6c 100644 --- a/src/BRepMesh/BRepMesh_BaseMeshAlgo.cxx +++ b/src/BRepMesh/BRepMesh_BaseMeshAlgo.cxx @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include //======================================================================= @@ -61,7 +63,11 @@ void BRepMesh_BaseMeshAlgo::Perform( if (initDataStructure()) { + OCCT_SEND_DUMPJSON (myStructure.get()) + OCCT_SEND_SHAPE (myStructure->DumpToShape()); generateMesh(); + OCCT_SEND_DUMPJSON (myStructure.get()) + OCCT_SEND_SHAPE (myStructure->DumpToShape()); commitSurfaceTriangulation(); } } @@ -82,6 +88,10 @@ void BRepMesh_BaseMeshAlgo::Perform( //======================================================================= Standard_Boolean BRepMesh_BaseMeshAlgo::initDataStructure() { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("initDataStructure") + OCCT_SEND_DUMPJSON (this) + for (Standard_Integer aWireIt = 0; aWireIt < myDFace->WiresNb(); ++aWireIt) { const IMeshData::IWireHandle& aDWire = myDFace->GetWire(aWireIt); @@ -96,6 +106,9 @@ Standard_Boolean BRepMesh_BaseMeshAlgo::initDataStructure() { const IMeshData::IEdgeHandle aDEdge = aDWire->GetEdge(aEdgeIt); const IMeshData::ICurveHandle& aCurve = aDEdge->GetCurve(); + + OCCT_SEND_DUMPJSON (aCurve.get()) + const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve( myDFace.get(), aDWire->GetEdgeOrientation(aEdgeIt)); @@ -110,17 +123,29 @@ Standard_Boolean BRepMesh_BaseMeshAlgo::initDataStructure() aPCurve->GetPoint(aPointIt), BRepMesh_Frontier, Standard_False/*aPointIt > 0 && aPointIt < aLastPoint*/); + gp_Pnt aPnt1 = aCurve ->GetPoint(aPointIt); + gp_Pnt2d aPnt1_2d = aPCurve ->GetPoint(aPointIt); + gp_Pnt aPnt2 (aPnt1_2d.X(), aPnt1_2d.Y(), 0.0); + OCCT_SEND_DUMPJSON (&aPnt1) + OCCT_SEND_DUMPJSON (&aPnt2) + TCollection_AsciiString anIndexStr = TCollection_AsciiString ("Index = ") + aNodeIndex; + OCCT_SEND_MESSAGE (anIndexStr) + TCollection_AsciiString aPIndexStr = TCollection_AsciiString ("PrevNodeIndex = ") + aPrevNodeIndex; + OCCT_SEND_MESSAGE (aPIndexStr) + aPCurve->GetIndex(aPointIt) = aNodeIndex; myUsedNodes->Bind(aNodeIndex, aNodeIndex); if (aPrevNodeIndex != -1 && aPrevNodeIndex != aNodeIndex) { + OCCT_SEND_MESSAGE ("Add link") const Standard_Integer aLinksNb = myStructure->NbLinks(); const Standard_Integer aLinkIndex = addLinkToMesh(aPrevNodeIndex, aNodeIndex, aOri); if (aWireIt != 0 && aLinkIndex <= aLinksNb) { // Prevent holes around wire of zero area. BRepMesh_Edge& aLink = const_cast(myStructure->GetLink(aLinkIndex)); + OCCT_SEND_DUMPJSON (&aLink) aLink.SetMovability(BRepMesh_Fixed); } } @@ -130,6 +155,7 @@ Standard_Boolean BRepMesh_BaseMeshAlgo::initDataStructure() } } + OCCT_SEND_DUMPJSON (this) return Standard_True; } @@ -314,3 +340,39 @@ gp_Pnt2d BRepMesh_BaseMeshAlgo::getNodePoint2d( { return theVertex.Coord(); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMesh_BaseMeshAlgo::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshTools_MeshAlgo) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDFace.get()) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myParameters) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myStructure.get()) + + if (!myNodesMap.IsNull()) + { + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNodesMap->Size()) + for (VectorOfPnt::Iterator aNodesIt (*myNodesMap); aNodesIt.More(); aNodesIt.Next()) + { + const gp_Pnt aNodePoint = aNodesIt.Value(); + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aNodePoint) + } + } + if (!myUsedNodes.IsNull()) + { + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUsedNodes->Extent()) + for (DMapOfIntegerInteger::Iterator aUsedIt (*myUsedNodes); aUsedIt.More(); aUsedIt.Next()) + { + Standard_Integer aNodeIndex = aUsedIt.Key(); + Standard_Integer aUsedCount = aUsedIt.Value(); + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aNodeIndex) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aUsedCount) + } + } +} diff --git a/src/BRepMesh/BRepMesh_BaseMeshAlgo.hxx b/src/BRepMesh/BRepMesh_BaseMeshAlgo.hxx index 56c03b2e8a..bf853fcc32 100644 --- a/src/BRepMesh/BRepMesh_BaseMeshAlgo.hxx +++ b/src/BRepMesh/BRepMesh_BaseMeshAlgo.hxx @@ -44,6 +44,9 @@ public: const IMeshData::IFaceHandle& theDFace, const IMeshTools_Parameters& theParameters) Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_BaseMeshAlgo, IMeshTools_MeshAlgo) protected: diff --git a/src/BRepMesh/BRepMesh_Circle.hxx b/src/BRepMesh/BRepMesh_Circle.hxx index 15d748f1ca..ad227163f0 100644 --- a/src/BRepMesh/BRepMesh_Circle.hxx +++ b/src/BRepMesh/BRepMesh_Circle.hxx @@ -68,6 +68,13 @@ public: return myRadius; } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myLocation) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRadius) + } + private: gp_XY myLocation; diff --git a/src/BRepMesh/BRepMesh_CircleInspector.hxx b/src/BRepMesh/BRepMesh_CircleInspector.hxx index c954d7d50c..89eaf84a27 100644 --- a/src/BRepMesh/BRepMesh_CircleInspector.hxx +++ b/src/BRepMesh/BRepMesh_CircleInspector.hxx @@ -127,6 +127,22 @@ public: return (theIndex == theTargetIndex); } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + OCCT_DUMP_CLASS_BEGIN (theOStream, BRepMesh_VertexInspector) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySqTolerance) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myResIndices.Extent()) + + for (Standard_Integer anIt = 1; anIt <= myCircles.Length(); ++anIt) + { + const BRepMesh_Circle& aCircle = myCircles.Value(anIt - 1); + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aCircle) + } + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPoint) + } + private: Standard_Real mySqTolerance; IMeshData::ListOfInteger myResIndices; diff --git a/src/BRepMesh/BRepMesh_CircleTool.cxx b/src/BRepMesh/BRepMesh_CircleTool.cxx index 67aa20ee60..46c41ab3a9 100644 --- a/src/BRepMesh/BRepMesh_CircleTool.cxx +++ b/src/BRepMesh/BRepMesh_CircleTool.cxx @@ -186,3 +186,18 @@ void BRepMesh_CircleTool::MocBind(const Standard_Integer theIndex) BRepMesh_Circle aNullCir(gp::Origin2d().Coord(), -1.); mySelector.Bind(theIndex, aNullCir); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMesh_CircleTool::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, BRepMesh_CircleTool) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerance) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &mySelector) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myFaceMax) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myFaceMin) +} diff --git a/src/BRepMesh/BRepMesh_CircleTool.hxx b/src/BRepMesh/BRepMesh_CircleTool.hxx index 3f5701d63d..f0f649876a 100644 --- a/src/BRepMesh/BRepMesh_CircleTool.hxx +++ b/src/BRepMesh/BRepMesh_CircleTool.hxx @@ -133,6 +133,9 @@ public: //! @param thePoint bullet point. Standard_EXPORT IMeshData::ListOfInteger& Select(const gp_XY& thePoint); + //! Dumps the content of me into the stream + Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + private: //! Creates circle with the given parameters and binds it to the tool. diff --git a/src/BRepMesh/BRepMesh_ConstrainedBaseMeshAlgo.hxx b/src/BRepMesh/BRepMesh_ConstrainedBaseMeshAlgo.hxx index 7edd4aac23..3fe5fbddf3 100644 --- a/src/BRepMesh/BRepMesh_ConstrainedBaseMeshAlgo.hxx +++ b/src/BRepMesh/BRepMesh_ConstrainedBaseMeshAlgo.hxx @@ -19,6 +19,7 @@ #include #include #include +#include class BRepMesh_DataStructureOfDelaun; class BRepMesh_Delaun; @@ -39,6 +40,14 @@ public: { } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + (void)theDepth; + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, BRepMesh_BaseMeshAlgo) + } + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_BaseMeshAlgo) protected: diff --git a/src/BRepMesh/BRepMesh_Context.cxx b/src/BRepMesh/BRepMesh_Context.cxx index e48d038467..cbb0592aa7 100644 --- a/src/BRepMesh/BRepMesh_Context.cxx +++ b/src/BRepMesh/BRepMesh_Context.cxx @@ -43,3 +43,13 @@ BRepMesh_Context::BRepMesh_Context () BRepMesh_Context::~BRepMesh_Context () { } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMesh_Context::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshTools_Context) +} diff --git a/src/BRepMesh/BRepMesh_Context.hxx b/src/BRepMesh/BRepMesh_Context.hxx index a802a6b44b..d4e3a2ffb3 100644 --- a/src/BRepMesh/BRepMesh_Context.hxx +++ b/src/BRepMesh/BRepMesh_Context.hxx @@ -30,6 +30,9 @@ public: //! Destructor. Standard_EXPORT virtual ~BRepMesh_Context (); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_Context, IMeshTools_Context) }; diff --git a/src/BRepMesh/BRepMesh_CurveTessellator.cxx b/src/BRepMesh/BRepMesh_CurveTessellator.cxx index bb780d27e0..dd150f793a 100644 --- a/src/BRepMesh/BRepMesh_CurveTessellator.cxx +++ b/src/BRepMesh/BRepMesh_CurveTessellator.cxx @@ -340,3 +340,32 @@ void BRepMesh_CurveTessellator::splitSegment ( splitSegment (theSurf, theCurve2d, theFirst, midpar, theNbIter + 1); splitSegment (theSurf, theCurve2d, midpar, theLast, theNbIter + 1); } + +//======================================================================= +// Function: DumpJson +// Purpose : +//======================================================================= +void BRepMesh_CurveTessellator::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshTools_CurveTessellator) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDEdge.get()) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myParameters) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEdge) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCurve) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myDiscretTool) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myFirstVertex) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myLastVertex) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySquareEdgeDef) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySquareMinSize) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myEdgeSqTol) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceRangeU[0]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceRangeU[1]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceRangeV[0]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceRangeV[1]) +} diff --git a/src/BRepMesh/BRepMesh_CurveTessellator.hxx b/src/BRepMesh/BRepMesh_CurveTessellator.hxx index 4a666be6b8..1dae74f2d7 100644 --- a/src/BRepMesh/BRepMesh_CurveTessellator.hxx +++ b/src/BRepMesh/BRepMesh_CurveTessellator.hxx @@ -60,6 +60,9 @@ public: gp_Pnt& thePoint, Standard_Real& theParameter) const Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_CurveTessellator, IMeshTools_CurveTessellator) private: diff --git a/src/BRepMesh/BRepMesh_CustomBaseMeshAlgo.hxx b/src/BRepMesh/BRepMesh_CustomBaseMeshAlgo.hxx index e175091de9..89854306e0 100644 --- a/src/BRepMesh/BRepMesh_CustomBaseMeshAlgo.hxx +++ b/src/BRepMesh/BRepMesh_CustomBaseMeshAlgo.hxx @@ -41,6 +41,14 @@ public: { } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + (void)theDepth; + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, BRepMesh_ConstrainedBaseMeshAlgo) + } + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo) protected: diff --git a/src/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx b/src/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx index 7a49413c95..e64243f499 100644 --- a/src/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx +++ b/src/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -191,6 +192,8 @@ Standard_Integer BRepMesh_DataStructureOfDelaun::AddElement( { myElements.Append(theElement); Standard_Integer aElementIndex = myElements.Size(); + OCCT_SEND_MESSAGE (TCollection_AsciiString ("AddElement: ") + aElementIndex) + myElementsOfDomain.Add(aElementIndex); const Standard_Integer (&e)[3] = theElement.myEdges; @@ -207,6 +210,8 @@ Standard_Integer BRepMesh_DataStructureOfDelaun::AddElement( void BRepMesh_DataStructureOfDelaun::RemoveElement( const Standard_Integer theIndex) { + OCCT_SEND_MESSAGE (TCollection_AsciiString ("RemoveElement: ") + theIndex) + BRepMesh_Triangle& aElement = (BRepMesh_Triangle&)GetElement(theIndex); if (aElement.Movability() == BRepMesh_Deleted) return; @@ -482,6 +487,80 @@ void BRepMesh_DataStructureOfDelaun::Statistics(Standard_OStream& theStream) con theStream << "\n Elements : " << myElements.Size() << std::endl; } +//======================================================================= +//function : BRepMesh_DumpToShape +//purpose : +// Global function not declared in any public header, intended for use +// from debugger prompt (Command Window in Visual Studio). +// +// Stores the mesh data structure to BRep file with the given name. +//======================================================================= +TopoDS_Shape BRepMesh_DumpToShape(void* theMeshHandlePtr) +{ + if (theMeshHandlePtr == 0) + { + return TopoDS_Shape(); + } + + Handle(BRepMesh_DataStructureOfDelaun) aMeshData = + *(Handle(BRepMesh_DataStructureOfDelaun)*)theMeshHandlePtr; + + if (aMeshData.IsNull()) + return TopoDS_Shape(); + + TopoDS_Compound aMesh; + BRep_Builder aBuilder; + aBuilder.MakeCompound(aMesh); + + try + { + OCC_CATCH_SIGNALS + + if (aMeshData->LinksOfDomain().IsEmpty()) + { + const Standard_Integer aNodesNb = aMeshData->NbNodes(); + for (Standard_Integer i = 1; i <= aNodesNb; ++i) + { + const gp_XY& aNode = aMeshData->GetNode(i).Coord(); + gp_Pnt aPnt(aNode.X(), aNode.Y(), 0.); + aBuilder.Add(aMesh, BRepBuilderAPI_MakeVertex(aPnt)); + } + } + else + { + IMeshData::IteratorOfMapOfInteger aLinksIt(aMeshData->LinksOfDomain()); + for (; aLinksIt.More(); aLinksIt.Next()) + { + const BRepMesh_Edge& aLink = aMeshData->GetLink(aLinksIt.Key()); + gp_Pnt aPnt[2]; + for (Standard_Integer i = 0; i < 2; ++i) + { + const Standard_Integer aNodeId = + (i == 0) ? aLink.FirstNode() : aLink.LastNode(); + + const gp_XY& aNode = aMeshData->GetNode(aNodeId).Coord(); + aPnt[i] = gp_Pnt(aNode.X(), aNode.Y(), 0.); + } + + if (aPnt[0].SquareDistance(aPnt[1]) < Precision::SquareConfusion()) + continue; + + aBuilder.Add(aMesh, BRepBuilderAPI_MakeEdge(aPnt[0], aPnt[1])); + } + } + + //if (!BRepTools::Write(aMesh, theFileNameStr)) + // return "Error: write failed"; + } + catch (Standard_Failure const& anException) + { + //return anException.GetMessageString(); + } + return aMesh; + + //return theFileNameStr; +} + //======================================================================= //function : BRepMesh_Write //purpose : @@ -504,7 +583,11 @@ Standard_CString BRepMesh_Dump(void* theMeshHandlePtr, if (aMeshData.IsNull()) return "Error: mesh data is empty"; - TopoDS_Compound aMesh; + TopoDS_Shape aShape = BRepMesh_DumpToShape(theMeshHandlePtr); + if (!BRepTools::Write(aShape, theFileNameStr)) + return "Error: write failed"; + + /*TopoDS_Compound aMesh; BRep_Builder aBuilder; aBuilder.MakeCompound(aMesh); @@ -551,13 +634,48 @@ Standard_CString BRepMesh_Dump(void* theMeshHandlePtr, catch (Standard_Failure const& anException) { return anException.GetMessageString(); - } + }*/ return theFileNameStr; } +TopoDS_Shape BRepMesh_DataStructureOfDelaun::DumpToShape() +{ + Handle(BRepMesh_DataStructureOfDelaun) aMeshData (this); + return BRepMesh_DumpToShape((void*)&aMeshData); +} + void BRepMesh_DataStructureOfDelaun::Dump(Standard_CString theFileNameStr) { Handle(BRepMesh_DataStructureOfDelaun) aMeshData (this); BRepMesh_Dump((void*)&aMeshData, theFileNameStr); } + +void BRepMesh_DataStructureOfDelaun::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myNodes.get()) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNodeLinks.Size()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLinks.Size()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDelLinks.Size()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myElements.Size()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myElementsOfDomain.Extent()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLinksOfDomain.Extent()) + + for (IMeshData::VectorOfElements::Iterator aElementIt(myElements); aElementIt.More(); aElementIt.Next()) + { + const BRepMesh_Triangle& anElement = aElementIt.Value(); + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &anElement) + } + + for (IMeshData::IDMapOfLink::Iterator aLinkIt (myLinks); aLinkIt.More(); aLinkIt.Next()) + { + const BRepMesh_Edge& anEdge = aLinkIt.Key(); + const BRepMesh_PairOfIndex& aPair = aLinkIt.Value(); + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &anEdge) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aPair) + } +} diff --git a/src/BRepMesh/BRepMesh_DataStructureOfDelaun.hxx b/src/BRepMesh/BRepMesh_DataStructureOfDelaun.hxx index cc6b714153..e760b94720 100644 --- a/src/BRepMesh/BRepMesh_DataStructureOfDelaun.hxx +++ b/src/BRepMesh/BRepMesh_DataStructureOfDelaun.hxx @@ -59,7 +59,7 @@ public: //! @name API for accessing mesh nodes. //! Finds the index of the given node. //! @param theNode node to find. - //! @return index of the given element of zero if node is not in the mesh. + //! @return index of the given element or zero if node is not in the mesh. Standard_Integer IndexOf(const BRepMesh_Vertex& theNode) { return myNodes->FindIndex(theNode); @@ -218,6 +218,8 @@ public: //! @name API for accessing mesh elements. const BRepMesh_Triangle& theElement, Standard_Integer (&theNodes)[3]); + Standard_EXPORT TopoDS_Shape DumpToShape(); + Standard_EXPORT void Dump(Standard_CString theFileNameStr); @@ -251,6 +253,9 @@ public: //! @name Auxilary API clearDeletedNodes(); } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DataStructureOfDelaun, Standard_Transient) private: diff --git a/src/BRepMesh/BRepMesh_Delaun.cxx b/src/BRepMesh/BRepMesh_Delaun.cxx index 435aae6f15..782398b47b 100644 --- a/src/BRepMesh/BRepMesh_Delaun.cxx +++ b/src/BRepMesh/BRepMesh_Delaun.cxx @@ -32,6 +32,11 @@ #include #include +#include +#include +#include +#include + #include #include @@ -245,6 +250,10 @@ void BRepMesh_Delaun::perform(IMeshData::VectorOfInteger& theVertexIndices, const Standard_Integer theCellsCountU /* = -1 */, const Standard_Integer theCellsCountV /* = -1 */) { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("BRepMesh_Delaun::perform") + OCCT_SEND_DUMPJSON (this) + if (theVertexIndices.Length () <= 2) { return; @@ -267,6 +276,7 @@ void BRepMesh_Delaun::perform(IMeshData::VectorOfInteger& theVertexIndices, std::make_heap(theVertexIndices.begin(), theVertexIndices.end(), aCmp); std::sort_heap(theVertexIndices.begin(), theVertexIndices.end(), aCmp); + OCCT_SEND_DUMPJSON (this) compute( theVertexIndices ); } @@ -347,6 +357,9 @@ void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex, //======================================================================= void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes) { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("BRepMesh_Delaun::compute") + // Insertion of edges of super triangles in the list of free edges: Handle(NCollection_IncAllocator) aAllocator = new NCollection_IncAllocator( IMeshData::MEMORY_BLOCK_SIZE_HUGE); @@ -358,15 +371,18 @@ void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes) aLoopEdges.Bind( e[1], Standard_True ); aLoopEdges.Bind( e[2], Standard_True ); + OCCT_SEND_SHAPE (myMeshData->DumpToShape()); if ( theVertexIndexes.Length() > 0 ) { // Creation of 3 trianglers with the first node and the edges of the super triangle: Standard_Integer anVertexIdx = theVertexIndexes.Lower(); createTriangles( theVertexIndexes( anVertexIdx ), aLoopEdges ); + OCCT_SEND_SHAPE (myMeshData->DumpToShape()); // Add other nodes to the mesh createTrianglesOnNewVertices( theVertexIndexes ); } + OCCT_SEND_SHAPE (myMeshData->DumpToShape()); // Destruction of triangles containing a top of the super triangle BRepMesh_SelectorOfDataStructureOfDelaun aSelector( myMeshData ); @@ -399,6 +415,9 @@ void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes) void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIndex, IMeshData::MapOfIntegerInteger& thePoly) { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("createTriangles") + IMeshData::ListOfInteger aLoopEdges, anExternalEdges; const gp_XY& aVertexCoord = myMeshData->GetNode( theVertexIndex ).Coord(); @@ -520,6 +539,8 @@ void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexI void BRepMesh_Delaun::createTrianglesOnNewVertices( IMeshData::VectorOfInteger& theVertexIndexes) { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("createTrianglesOnNewVertices") Handle(NCollection_IncAllocator) aAllocator = new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE); @@ -611,6 +632,9 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices( //======================================================================= void BRepMesh_Delaun::insertInternalEdges() { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("insertInternalEdges") + Handle(IMeshData::MapOfInteger) anInternalEdges = InternalEdges(); // Destruction of triancles intersecting internal edges @@ -831,6 +855,10 @@ void BRepMesh_Delaun::cleanupMesh() //======================================================================= void BRepMesh_Delaun::frontierAdjust() { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("frontierAdjust") + OCCT_SEND_SHAPE (myMeshData->DumpToShape()); + Handle(IMeshData::MapOfInteger) aFrontier = Frontier(); Handle(NCollection_IncAllocator) aAllocator = @@ -904,7 +932,16 @@ void BRepMesh_Delaun::frontierAdjust() } } - cleanupMesh(); + OCCT_SEND_DUMPJSON (myMeshData.get()) + OCCT_SEND_SHAPE (myMeshData->DumpToShape()); + OCCT_SEND_MESSAGE ("cleanupMesh") + + //Standard_SStream aStream; + //myMeshData->Statistics (aStream); + //Message::DefaultMessenger() << aStream; + + OCCT_SEND_SHAPE (myMeshData->DumpToShape()); + //cleanupMesh(); // When the mesh has been cleaned up, try to process frontier edges // once again to fill the possible gaps that might be occured in case of "saw" - @@ -2549,3 +2586,22 @@ Standard_CString BRepMesh_DumpPoly(void* thePolygon, return theFileNameStr; } #endif + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMesh_Delaun::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, BRepMesh_Delaun) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myMeshData.get()) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCircles) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySupVert[0]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySupVert[1]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySupVert[2]) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &mySupTrian) +} diff --git a/src/BRepMesh/BRepMesh_Delaun.hxx b/src/BRepMesh/BRepMesh_Delaun.hxx index 5038e89bd8..59ea986aad 100755 --- a/src/BRepMesh/BRepMesh_Delaun.hxx +++ b/src/BRepMesh/BRepMesh_Delaun.hxx @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include #include #include @@ -90,6 +92,8 @@ public: //! Forces insertion of constraint edges into the base triangulation. inline void ProcessConstraints() { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("ProcessConstraints") insertInternalEdges(); // Adjustment of meshes to boundary edges @@ -147,6 +151,9 @@ public: const Standard_Real theSqTolerance, Standard_Integer& theEdgeOn) const; + //! Dumps the content of me into the stream + Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + private: enum ReplaceFlag diff --git a/src/BRepMesh/BRepMesh_DelaunayBaseMeshAlgo.cxx b/src/BRepMesh/BRepMesh_DelaunayBaseMeshAlgo.cxx index 1394bd7a4a..3c1147b365 100644 --- a/src/BRepMesh/BRepMesh_DelaunayBaseMeshAlgo.cxx +++ b/src/BRepMesh/BRepMesh_DelaunayBaseMeshAlgo.cxx @@ -16,6 +16,8 @@ #include #include #include +#include +#include //======================================================================= // Function: Constructor @@ -39,6 +41,8 @@ BRepMesh_DelaunayBaseMeshAlgo::~BRepMesh_DelaunayBaseMeshAlgo() //======================================================================= void BRepMesh_DelaunayBaseMeshAlgo::generateMesh() { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("generateMesh") const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = getStructure(); const Handle(VectorOfPnt)& aNodesMap = getNodesMap(); diff --git a/src/BRepMesh/BRepMesh_DelaunayBaseMeshAlgo.hxx b/src/BRepMesh/BRepMesh_DelaunayBaseMeshAlgo.hxx index 81bfdc7c9f..ba6e84b8ec 100644 --- a/src/BRepMesh/BRepMesh_DelaunayBaseMeshAlgo.hxx +++ b/src/BRepMesh/BRepMesh_DelaunayBaseMeshAlgo.hxx @@ -35,6 +35,14 @@ public: //! Destructor. Standard_EXPORT virtual ~BRepMesh_DelaunayBaseMeshAlgo(); + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + (void)theDepth; + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, BRepMesh_ConstrainedBaseMeshAlgo) + } + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo) protected: diff --git a/src/BRepMesh/BRepMesh_DiscretRoot.cxx b/src/BRepMesh/BRepMesh_DiscretRoot.cxx index e6d0978e63..753e536043 100644 --- a/src/BRepMesh/BRepMesh_DiscretRoot.cxx +++ b/src/BRepMesh/BRepMesh_DiscretRoot.cxx @@ -42,3 +42,15 @@ BRepMesh_DiscretRoot::~BRepMesh_DiscretRoot() void BRepMesh_DiscretRoot::init() { } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMesh_DiscretRoot::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myShape) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsDone) +} diff --git a/src/BRepMesh/BRepMesh_DiscretRoot.hxx b/src/BRepMesh/BRepMesh_DiscretRoot.hxx index 361cf0e242..c62201363f 100644 --- a/src/BRepMesh/BRepMesh_DiscretRoot.hxx +++ b/src/BRepMesh/BRepMesh_DiscretRoot.hxx @@ -48,6 +48,8 @@ public: //! Compute triangulation for set shape. virtual void Perform() = 0; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; DEFINE_STANDARD_RTTIEXT(BRepMesh_DiscretRoot,Standard_Transient) diff --git a/src/BRepMesh/BRepMesh_Edge.hxx b/src/BRepMesh/BRepMesh_Edge.hxx index 3ef8151311..5519168dd9 100644 --- a/src/BRepMesh/BRepMesh_Edge.hxx +++ b/src/BRepMesh/BRepMesh_Edge.hxx @@ -81,6 +81,15 @@ public: return IsEqual(Other); } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + OCCT_DUMP_CLASS_BEGIN (theOStream, BRepMesh_Edge) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, BRepMesh_OrientedEdge) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMovability) + } + private: BRepMesh_DegreeOfFreedom myMovability; diff --git a/src/BRepMesh/BRepMesh_EdgeDiscret.cxx b/src/BRepMesh/BRepMesh_EdgeDiscret.cxx index 4a305440d4..15881878d1 100644 --- a/src/BRepMesh/BRepMesh_EdgeDiscret.cxx +++ b/src/BRepMesh/BRepMesh_EdgeDiscret.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include //======================================================================= @@ -96,6 +97,7 @@ Standard_Boolean BRepMesh_EdgeDiscret::performInternal ( } OSD_Parallel::For (0, myModel->EdgesNb (), *this, !myParameters.InParallel); + OCCT_SEND_DUMPJSON (myModel.get()) myModel.Nullify(); // Do not hold link to model. return Standard_True; @@ -335,3 +337,16 @@ void BRepMesh_EdgeDiscret::Tessellate2d( } } } + +//======================================================================= +// Function: DumpJson +// Purpose : +//======================================================================= +void BRepMesh_EdgeDiscret::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshTools_ModelAlgo) + + OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myModel.get()) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myParameters) +} diff --git a/src/BRepMesh/BRepMesh_EdgeDiscret.hxx b/src/BRepMesh/BRepMesh_EdgeDiscret.hxx index 82ac8e48d2..334cf9ebb6 100644 --- a/src/BRepMesh/BRepMesh_EdgeDiscret.hxx +++ b/src/BRepMesh/BRepMesh_EdgeDiscret.hxx @@ -68,6 +68,9 @@ public: const IMeshData::IEdgeHandle& theDEdge, const Standard_Boolean theUpdateEnds); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo) protected: diff --git a/src/BRepMesh/BRepMesh_FaceDiscret.cxx b/src/BRepMesh/BRepMesh_FaceDiscret.cxx index ce6db2102e..792ffbc09f 100644 --- a/src/BRepMesh/BRepMesh_FaceDiscret.cxx +++ b/src/BRepMesh/BRepMesh_FaceDiscret.cxx @@ -54,8 +54,13 @@ Standard_Boolean BRepMesh_FaceDiscret::performInternal( return Standard_False; } - OSD_Parallel::For(0, myModel->FacesNb(), *this, !(myParameters.InParallel && myModel->FacesNb() > 1)); + for (int i = 0; i < myModel->FacesNb(); i++) + { + process (i); + } + //OSD_Parallel::For(0, myModel->FacesNb(), *this, !(myParameters.InParallel && myModel->FacesNb() > 1)); + OCCT_SEND_DUMPJSON (myModel.get()) myModel.Nullify(); // Do not hold link to model. return Standard_True; } @@ -93,3 +98,17 @@ void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex) const aDFace->SetStatus (IMeshData_Failure); } } + +//======================================================================= +// Function: DumpJson +// Purpose : +//======================================================================= +void BRepMesh_FaceDiscret::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshTools_ModelAlgo) + + //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myAlgoFactory) + OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myModel.get()) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myParameters) +} diff --git a/src/BRepMesh/BRepMesh_FaceDiscret.hxx b/src/BRepMesh/BRepMesh_FaceDiscret.hxx index 9ca86800b6..45b06e632a 100644 --- a/src/BRepMesh/BRepMesh_FaceDiscret.hxx +++ b/src/BRepMesh/BRepMesh_FaceDiscret.hxx @@ -41,6 +41,9 @@ public: process(theFaceIndex); } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo) protected: diff --git a/src/BRepMesh/BRepMesh_IncrementalMesh.cxx b/src/BRepMesh/BRepMesh_IncrementalMesh.cxx index 25627edc83..77c53be909 100644 --- a/src/BRepMesh/BRepMesh_IncrementalMesh.cxx +++ b/src/BRepMesh/BRepMesh_IncrementalMesh.cxx @@ -97,15 +97,21 @@ void BRepMesh_IncrementalMesh::Perform() //======================================================================= void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theContext) { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("BRepMesh_IncrementalMesh::Perform") initParameters(); theContext->SetShape(Shape()); theContext->ChangeParameters() = myParameters; theContext->ChangeParameters().CleanModel = Standard_False; + OCCT_SEND_DUMPJSON (this) + IMeshTools_MeshBuilder aIncMesh(theContext); aIncMesh.Perform(); + OCCT_SEND_DUMPJSON (&aIncMesh) + myStatus = IMeshData_NoError; const Handle(IMeshData_Model)& aModel = theContext->GetModel(); if (!aModel.IsNull()) @@ -164,5 +170,19 @@ void BRepMesh_IncrementalMesh::SetParallelDefault( IS_IN_PARALLEL = theInParallel; } +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMesh_IncrementalMesh::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, BRepMesh_DiscretRoot) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myParameters) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myModified) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myStatus) +} + //! Export Mesh Plugin entry function DISCRETPLUGIN(BRepMesh_IncrementalMesh) diff --git a/src/BRepMesh/BRepMesh_IncrementalMesh.hxx b/src/BRepMesh/BRepMesh_IncrementalMesh.hxx index 4831ffa434..317d22b2c3 100644 --- a/src/BRepMesh/BRepMesh_IncrementalMesh.hxx +++ b/src/BRepMesh/BRepMesh_IncrementalMesh.hxx @@ -129,6 +129,9 @@ public: //! @name plugin API //! Discret() static method (thus applied only to Mesh Factories). Standard_EXPORT static void SetParallelDefault(const Standard_Boolean isInParallel); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot) protected: diff --git a/src/BRepMesh/BRepMesh_ModelBuilder.cxx b/src/BRepMesh/BRepMesh_ModelBuilder.cxx index 1a15482cdf..8757ef3971 100644 --- a/src/BRepMesh/BRepMesh_ModelBuilder.cxx +++ b/src/BRepMesh/BRepMesh_ModelBuilder.cxx @@ -46,10 +46,14 @@ Handle (IMeshData_Model) BRepMesh_ModelBuilder::performInternal ( const TopoDS_Shape& theShape, const IMeshTools_Parameters& theParameters) { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("BRepMesh_ModelBuilder::performInternal") + Handle (BRepMeshData_Model) aModel; Bnd_Box aBox; BRepBndLib::Add (theShape, aBox, Standard_False); + OCCT_SEND_DUMPJSON (&aBox) if (!aBox.IsVoid ()) { @@ -71,6 +75,8 @@ Handle (IMeshData_Model) BRepMesh_ModelBuilder::performInternal ( Handle (IMeshTools_ShapeVisitor) aVisitor = new BRepMesh_ShapeVisitor (aModel); + OCCT_SEND_DUMPJSON (aModel.get()) + IMeshTools_ShapeExplorer aExplorer (theShape); aExplorer.Accept (aVisitor); SetStatus (Message_Done1); @@ -82,3 +88,14 @@ Handle (IMeshData_Model) BRepMesh_ModelBuilder::performInternal ( return aModel; } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMesh_ModelBuilder::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshTools_ModelBuilder) +} diff --git a/src/BRepMesh/BRepMesh_ModelBuilder.hxx b/src/BRepMesh/BRepMesh_ModelBuilder.hxx index 56898a1eeb..218fed2f7f 100644 --- a/src/BRepMesh/BRepMesh_ModelBuilder.hxx +++ b/src/BRepMesh/BRepMesh_ModelBuilder.hxx @@ -36,6 +36,9 @@ public: //! Destructor. Standard_EXPORT virtual ~BRepMesh_ModelBuilder (); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder) protected: diff --git a/src/BRepMesh/BRepMesh_ModelHealer.cxx b/src/BRepMesh/BRepMesh_ModelHealer.cxx index 6ad9b83f56..d4bfecb059 100644 --- a/src/BRepMesh/BRepMesh_ModelHealer.cxx +++ b/src/BRepMesh/BRepMesh_ModelHealer.cxx @@ -140,6 +140,7 @@ Standard_Boolean BRepMesh_ModelHealer::performInternal( } // TODO: Here we can process edges in order to remove close discrete points. + OCCT_ADD_MESSAGE_LEVEL_SENTRY OSD_Parallel::For(0, myModel->FacesNb(), *this, !isParallel()); amplifyEdges(); @@ -153,6 +154,7 @@ Standard_Boolean BRepMesh_ModelHealer::performInternal( aDFace->SetStatus(IMeshData_Failure); } } + OCCT_SEND_DUMPJSON (myModel.get()) myFaceIntersectingEdges.Nullify(); myModel.Nullify(); // Do not hold link to model. @@ -497,3 +499,13 @@ Standard_Boolean BRepMesh_ModelHealer::connectClosestPoints( return Standard_True; } + +//======================================================================= +// Function: DumpJson +// Purpose : +//======================================================================= +void BRepMesh_ModelHealer::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshTools_ModelAlgo) +} diff --git a/src/BRepMesh/BRepMesh_ModelHealer.hxx b/src/BRepMesh/BRepMesh_ModelHealer.hxx index 2e95c02da4..80da43f168 100644 --- a/src/BRepMesh/BRepMesh_ModelHealer.hxx +++ b/src/BRepMesh/BRepMesh_ModelHealer.hxx @@ -54,6 +54,9 @@ public: process(theDFace); } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelHealer, IMeshTools_ModelAlgo) protected: diff --git a/src/BRepMesh/BRepMesh_ModelPostProcessor.cxx b/src/BRepMesh/BRepMesh_ModelPostProcessor.cxx index 23150517d5..b439d8ad6f 100644 --- a/src/BRepMesh/BRepMesh_ModelPostProcessor.cxx +++ b/src/BRepMesh/BRepMesh_ModelPostProcessor.cxx @@ -188,5 +188,6 @@ Standard_Boolean BRepMesh_ModelPostProcessor::performInternal( // TODO: Force single threaded solution due to data races on edges sharing the same TShape OSD_Parallel::For(0, theModel->EdgesNb(), PolygonCommitter(theModel), Standard_True/*!theParameters.InParallel*/); + OCCT_SEND_DUMPJSON (theModel.get()) return Standard_True; } diff --git a/src/BRepMesh/BRepMesh_ModelPostProcessor.hxx b/src/BRepMesh/BRepMesh_ModelPostProcessor.hxx index 129ba74b9e..9155c4cc00 100644 --- a/src/BRepMesh/BRepMesh_ModelPostProcessor.hxx +++ b/src/BRepMesh/BRepMesh_ModelPostProcessor.hxx @@ -32,7 +32,12 @@ public: //! Destructor. Standard_EXPORT virtual ~BRepMesh_ModelPostProcessor(); - DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo) + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshTools_ModelAlgo) + } protected: diff --git a/src/BRepMesh/BRepMesh_ModelPreProcessor.cxx b/src/BRepMesh/BRepMesh_ModelPreProcessor.cxx index df9d9e48d9..a98be67233 100644 --- a/src/BRepMesh/BRepMesh_ModelPreProcessor.cxx +++ b/src/BRepMesh/BRepMesh_ModelPreProcessor.cxx @@ -309,6 +309,7 @@ Standard_Boolean BRepMesh_ModelPreProcessor::performInternal( } } } + OCCT_SEND_DUMPJSON (theModel.get()) return Standard_True; } diff --git a/src/BRepMesh/BRepMesh_ModelPreProcessor.hxx b/src/BRepMesh/BRepMesh_ModelPreProcessor.hxx index 031053aa38..488f61a504 100644 --- a/src/BRepMesh/BRepMesh_ModelPreProcessor.hxx +++ b/src/BRepMesh/BRepMesh_ModelPreProcessor.hxx @@ -33,6 +33,13 @@ public: //! Destructor. Standard_EXPORT virtual ~BRepMesh_ModelPreProcessor(); + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshTools_ModelAlgo) + } + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo) protected: diff --git a/src/BRepMesh/BRepMesh_OrientedEdge.hxx b/src/BRepMesh/BRepMesh_OrientedEdge.hxx index 976c1ba4a2..45766cc7b6 100644 --- a/src/BRepMesh/BRepMesh_OrientedEdge.hxx +++ b/src/BRepMesh/BRepMesh_OrientedEdge.hxx @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -76,6 +77,16 @@ public: return IsEqual(Other); } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + (void)theDepth; + OCCT_DUMP_CLASS_BEGIN (theOStream, BRepMesh_OrientedEdge) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFirstNode) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLastNode) + } + private: Standard_Integer myFirstNode; diff --git a/src/BRepMesh/BRepMesh_PairOfIndex.hxx b/src/BRepMesh/BRepMesh_PairOfIndex.hxx index 81808bcf5f..61c76860f9 100644 --- a/src/BRepMesh/BRepMesh_PairOfIndex.hxx +++ b/src/BRepMesh/BRepMesh_PairOfIndex.hxx @@ -122,6 +122,16 @@ public: myIndex[1] = -1; } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + (void)theDepth; + OCCT_DUMP_CLASS_BEGIN (theOStream, BRepMesh_PairOfIndex) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIndex[0]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIndex[1]) + } + private: Standard_Integer myIndex[2]; }; diff --git a/src/BRepMesh/BRepMesh_ShapeVisitor.cxx b/src/BRepMesh/BRepMesh_ShapeVisitor.cxx index 0705c13cf0..133071a2d4 100644 --- a/src/BRepMesh/BRepMesh_ShapeVisitor.cxx +++ b/src/BRepMesh/BRepMesh_ShapeVisitor.cxx @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include //======================================================================= // Function: Constructor @@ -59,6 +62,9 @@ void BRepMesh_ShapeVisitor::Visit(const TopoDS_Edge& theEdge) { if (!myDEdgeMap.IsBound (theEdge)) { + OCCT_SEND_MESSAGE ("BRepMesh_ShapeVisitor::Visit edge") + OCCT_SEND_SHAPE (theEdge) + myModel->AddEdge (theEdge); myDEdgeMap.Bind (theEdge, myModel->EdgesNb () - 1); } @@ -70,6 +76,9 @@ void BRepMesh_ShapeVisitor::Visit(const TopoDS_Edge& theEdge) //======================================================================= void BRepMesh_ShapeVisitor::Visit (const TopoDS_Face& theFace) { + OCCT_SEND_MESSAGE ("BRepMesh_ShapeVisitor::Visit face") + OCCT_SEND_SHAPE (theFace) + BRepTools::Update(theFace); const IMeshData::IFaceHandle& aDFace = myModel->AddFace (theFace); diff --git a/src/BRepMesh/BRepMesh_Triangle.hxx b/src/BRepMesh/BRepMesh_Triangle.hxx index 6cb531a56b..7315917552 100644 --- a/src/BRepMesh/BRepMesh_Triangle.hxx +++ b/src/BRepMesh/BRepMesh_Triangle.hxx @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -138,6 +139,21 @@ public: return IsEqual(theOther); } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + (void)theDepth; + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myEdges[0]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myEdges[1]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myEdges[2]) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myOrientations[0]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myOrientations[1]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myOrientations[2]) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMovability) + } Standard_Integer myEdges[3]; Standard_Boolean myOrientations[3]; BRepMesh_DegreeOfFreedom myMovability; diff --git a/src/BRepMesh/BRepMesh_Vertex.hxx b/src/BRepMesh/BRepMesh_Vertex.hxx index 73a31798ea..3eb23418f5 100644 --- a/src/BRepMesh/BRepMesh_Vertex.hxx +++ b/src/BRepMesh/BRepMesh_Vertex.hxx @@ -132,6 +132,15 @@ public: return IsEqual(Other); } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUV) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLocation3d) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMovability) + } + private: gp_XY myUV; diff --git a/src/BRepMesh/BRepMesh_VertexInspector.hxx b/src/BRepMesh/BRepMesh_VertexInspector.hxx index dfd51ae926..e815f5b529 100644 --- a/src/BRepMesh/BRepMesh_VertexInspector.hxx +++ b/src/BRepMesh/BRepMesh_VertexInspector.hxx @@ -149,6 +149,27 @@ public: return (theIndex == theTargetIndex); } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + OCCT_DUMP_CLASS_BEGIN (theOStream, BRepMesh_VertexInspector) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIndex) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMinSqDist) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerance[0]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerance[1]) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVertices->Length()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDelNodes.Extent()) + + for (Standard_Integer anIt = 1; anIt <= myVertices->Length(); ++anIt) + { + BRepMesh_Vertex& aVertex = myVertices->ChangeValue(anIt - 1); + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aVertex) + } + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPoint) + } + private: Standard_Integer myIndex; diff --git a/src/BRepMesh/BRepMesh_VertexTool.cxx b/src/BRepMesh/BRepMesh_VertexTool.cxx index fffa7ac4da..7613dac073 100644 --- a/src/BRepMesh/BRepMesh_VertexTool.cxx +++ b/src/BRepMesh/BRepMesh_VertexTool.cxx @@ -134,3 +134,35 @@ void BRepMesh_VertexTool::Statistics(Standard_OStream& theStream) const theStream << "\nStructure Statistics\n---------------\n\n"; theStream << "This structure has " << mySelector.NbVertices() << " Nodes\n\n"; } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMesh_VertexTool::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + + //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCellFilter) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerance[0]) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolerance[1]) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &mySelector) + + const NCollection_Map::Cell>& aCells = myCellFilter.Cells(); + const NCollection_Array1& aCellSizes = myCellFilter.CellSize(); + + for (NCollection_Map::Cell>::Iterator aCellsIt (aCells); aCellsIt.More(); aCellsIt.Next()) + { + const NCollection_LocalArray& anIndex = aCellsIt.Value().index; + + const std::size_t aDim = anIndex.Size(); + TCollection_AsciiString anIndexPair; + for (std::size_t i = 0; i < aDim; ++i) + { + if (!anIndexPair.IsEmpty()) anIndexPair += ", "; + anIndexPair += TCollection_AsciiString (anIndex[i]); + } + OCCT_DUMP_FIELD_VALUE_STRING (theOStream, anIndexPair) + } +} diff --git a/src/BRepMesh/BRepMesh_VertexTool.hxx b/src/BRepMesh/BRepMesh_VertexTool.hxx index 35aa778a8a..166aa1ecfe 100644 --- a/src/BRepMesh/BRepMesh_VertexTool.hxx +++ b/src/BRepMesh/BRepMesh_VertexTool.hxx @@ -158,6 +158,10 @@ public: //! Prints statistics. Standard_EXPORT void Statistics(Standard_OStream& theStream) const; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + + DEFINE_STANDARD_RTTI_INLINE(BRepMesh_VertexTool, Standard_Transient) private: diff --git a/src/BRepMeshData/BRepMeshData_Curve.cxx b/src/BRepMeshData/BRepMeshData_Curve.cxx index ac427f9946..bb1db87f48 100644 --- a/src/BRepMeshData/BRepMeshData_Curve.cxx +++ b/src/BRepMeshData/BRepMeshData_Curve.cxx @@ -124,3 +124,28 @@ void BRepMeshData_Curve::Clear(const Standard_Boolean isKeepEndPoints) myParameters.erase(myParameters.begin() + 1, myParameters.begin() + (myParameters.size() - 1)); } } + +//======================================================================= +// Function: DumpJson +// Purpose : +//======================================================================= +void BRepMeshData_Curve::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_Curve) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPoints.size()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myParameters.size()) + + for (IMeshData::Model::SequenceOfPnt::const_iterator aPointIt = myPoints.begin(); aPointIt != myPoints.end(); aPointIt++) + { + const gp_Pnt& aPoint = *aPointIt; + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aPoint) + } + + for (IMeshData::Model::SequenceOfReal::const_iterator aParamIt = myParameters.begin(); aParamIt != myParameters.end(); aParamIt++) + { + Standard_Real aParameter = *aParamIt; + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aParameter) + } +} diff --git a/src/BRepMeshData/BRepMeshData_Curve.hxx b/src/BRepMeshData/BRepMeshData_Curve.hxx index 1566a4d916..b006679fa9 100644 --- a/src/BRepMeshData/BRepMeshData_Curve.hxx +++ b/src/BRepMeshData/BRepMeshData_Curve.hxx @@ -60,6 +60,9 @@ public: //! Clears parameters list. Standard_EXPORT virtual void Clear(const Standard_Boolean isKeepEndPoints) Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Curve, IMeshData_Curve) protected: diff --git a/src/BRepMeshData/BRepMeshData_Edge.cxx b/src/BRepMeshData/BRepMeshData_Edge.cxx index 67ce8228ff..8f36f5a1bd 100644 --- a/src/BRepMeshData/BRepMeshData_Edge.cxx +++ b/src/BRepMeshData/BRepMeshData_Edge.cxx @@ -100,3 +100,23 @@ const IMeshData::IPCurveHandle& BRepMeshData_Edge::GetPCurve ( { return myPCurves (theIndex); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMeshData_Edge::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_Edge) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPCurves.Size()) + for (Standard_Integer aPCurveIt = 0; aPCurveIt < myPCurves.Size(); ++aPCurveIt) + { + const IMeshData::IPCurveHandle& aPCurve = myPCurves (aPCurveIt); + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aPCurve.get()) + } + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPCurvesMap.Size()) + //IMeshData::DMapOfIFacePtrsListOfInteger myPCurvesMap; +} diff --git a/src/BRepMeshData/BRepMeshData_Edge.hxx b/src/BRepMeshData/BRepMeshData_Edge.hxx index d30e550da7..47d2d2090a 100644 --- a/src/BRepMeshData/BRepMeshData_Edge.hxx +++ b/src/BRepMeshData/BRepMeshData_Edge.hxx @@ -53,6 +53,9 @@ public: Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve ( const Standard_Integer theIndex) const Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Edge, IMeshData_Edge) private: diff --git a/src/BRepMeshData/BRepMeshData_Face.cxx b/src/BRepMeshData/BRepMeshData_Face.cxx index 2dca22c8a4..5975323215 100644 --- a/src/BRepMeshData/BRepMeshData_Face.cxx +++ b/src/BRepMeshData/BRepMeshData_Face.cxx @@ -70,3 +70,20 @@ const IMeshData::IWireHandle& BRepMeshData_Face::GetWire ( { return myDWires (theIndex); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMeshData_Face::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_Face) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDWires.Size()) + for (int aWireIt = 0; aWireIt < myDWires.Size(); aWireIt++) + { + const IMeshData::IWireHandle& aWire = GetWire (aWireIt); + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aWire.get()) + } +} diff --git a/src/BRepMeshData/BRepMeshData_Face.hxx b/src/BRepMeshData/BRepMeshData_Face.hxx index 1f187f7cea..d8f1bdbc1a 100644 --- a/src/BRepMeshData/BRepMeshData_Face.hxx +++ b/src/BRepMeshData/BRepMeshData_Face.hxx @@ -47,6 +47,9 @@ public: const TopoDS_Wire& theWire, const Standard_Integer theEdgeNb = 0) Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Face, IMeshData_Face) private: diff --git a/src/BRepMeshData/BRepMeshData_Model.cxx b/src/BRepMeshData/BRepMeshData_Model.cxx index 08c07f8c96..f430063617 100644 --- a/src/BRepMeshData/BRepMeshData_Model.cxx +++ b/src/BRepMeshData/BRepMeshData_Model.cxx @@ -100,3 +100,33 @@ const IMeshData::IEdgeHandle& BRepMeshData_Model::GetEdge (const Standard_Intege { return myDEdges (theIndex); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMeshData_Model::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_Model) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxSize) + if (!myDFaces.IsEmpty()) + { + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDFaces.Size()) + for (Standard_Integer aFaceIt = 0; aFaceIt < FacesNb(); ++aFaceIt) + { + const IMeshData::IFaceHandle& aFace = GetFace(aFaceIt); + OCCT_SEND_DUMPJSON (aFace.get()) + } + } + if (!myDEdges.IsEmpty()) + { + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDEdges.Size()) + for (int anEdgeIt = 0; anEdgeIt < EdgesNb(); anEdgeIt++) + { + const IMeshData::IEdgeHandle& anEdge = GetEdge (anEdgeIt); + OCCT_SEND_DUMPJSON (anEdge.get()) + } + } +} diff --git a/src/BRepMeshData/BRepMeshData_Model.hxx b/src/BRepMeshData/BRepMeshData_Model.hxx index 2b19684a73..1bd2f541a1 100644 --- a/src/BRepMeshData/BRepMeshData_Model.hxx +++ b/src/BRepMeshData/BRepMeshData_Model.hxx @@ -70,6 +70,9 @@ public: //! @name discrete edges //! Gets model's edge with the given index. Standard_EXPORT virtual const IMeshData::IEdgeHandle& GetEdge (const Standard_Integer theIndex) const Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + private: Standard_Real myMaxSize; diff --git a/src/BRepMeshData/BRepMeshData_Wire.cxx b/src/BRepMeshData/BRepMeshData_Wire.cxx index 8139f6a84a..c1529f341d 100644 --- a/src/BRepMeshData/BRepMeshData_Wire.cxx +++ b/src/BRepMeshData/BRepMeshData_Wire.cxx @@ -84,3 +84,27 @@ TopAbs_Orientation BRepMeshData_Wire::GetEdgeOrientation ( { return myDEdgesOri (theIndex); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void BRepMeshData_Wire::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_Wire) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDEdges.Size()) + for (int anEdgeId = 0; anEdgeId < myDEdges.Size(); anEdgeId++) + { + const IMeshData::IEdgePtr& anEdge = GetEdge (anEdgeId); + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anEdge) + } + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDEdgesOri.Size()) + for (int anEdgeId = 0; anEdgeId < myDEdgesOri.Size(); anEdgeId++) + { + TopAbs_Orientation anEdgeOri = GetEdgeOrientation (anEdgeId); + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, &anEdgeOri) + } +} diff --git a/src/BRepMeshData/BRepMeshData_Wire.hxx b/src/BRepMeshData/BRepMeshData_Wire.hxx index bf55509684..a070b8a9da 100644 --- a/src/BRepMeshData/BRepMeshData_Wire.hxx +++ b/src/BRepMeshData/BRepMeshData_Wire.hxx @@ -52,6 +52,9 @@ public: Standard_EXPORT virtual TopAbs_Orientation GetEdgeOrientation ( const Standard_Integer theIndex) const Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Wire, IMeshData_Wire) private: diff --git a/src/GCPnts/GCPnts_TangentialDeflection.cxx b/src/GCPnts/GCPnts_TangentialDeflection.cxx index 7019e58c9b..ca2a329090 100644 --- a/src/GCPnts/GCPnts_TangentialDeflection.cxx +++ b/src/GCPnts/GCPnts_TangentialDeflection.cxx @@ -174,6 +174,29 @@ Standard_Real GCPnts_TangentialDeflection::ArcAngularStep( return Du; } +//======================================================================= +// Function: DumpJson +// Purpose : +//======================================================================= +void GCPnts_TangentialDeflection::DumpJson (Standard_OStream& theOStream, Standard_Integer) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, GCPnts_TangentialDeflection) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, angularDeflection) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, curvatureDeflection) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, uTol) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, minNbPnts) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMinLen) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, lastu) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, firstu) + + if (!points.IsEmpty()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, points.Length()) + + if (!parameters.IsEmpty()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, parameters.Length()) +} + #include #include #include diff --git a/src/GCPnts/GCPnts_TangentialDeflection.hxx b/src/GCPnts/GCPnts_TangentialDeflection.hxx index 0e66213137..1134e1f2b1 100644 --- a/src/GCPnts/GCPnts_TangentialDeflection.hxx +++ b/src/GCPnts/GCPnts_TangentialDeflection.hxx @@ -114,6 +114,10 @@ public: //! Computes angular step for the arc using the given parameters. Standard_EXPORT static Standard_Real ArcAngularStep (const Standard_Real theRadius, const Standard_Real theLinearDeflection, const Standard_Real theAngularDeflection, const Standard_Real theMinLength); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + + private: Standard_EXPORT void PerformLinear (const Adaptor3d_Curve& C); diff --git a/src/GeomAdaptor/GeomAdaptor_Curve.cxx b/src/GeomAdaptor/GeomAdaptor_Curve.cxx index 390673cc31..5e4f2dce3e 100644 --- a/src/GeomAdaptor/GeomAdaptor_Curve.cxx +++ b/src/GeomAdaptor/GeomAdaptor_Curve.cxx @@ -999,3 +999,24 @@ Handle(Geom_OffsetCurve) GeomAdaptor_Curve::OffsetCurve() const throw Standard_NoSuchObject("GeomAdaptor_Curve::OffsetCurve"); return Handle(Geom_OffsetCurve)::DownCast(myCurve); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void GeomAdaptor_Curve::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, GeomAdaptor_Curve) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor3d_Curve) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myCurve.get()) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeCurve) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFirst) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLast) + + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myBSplineCurve.get()) + //mutable Handle(BSplCLib_Cache) myCurveCache; ///< Cached data for B-spline or Bezier curve + //Handle(GeomEvaluator_Curve) myNestedEvaluator; ///< Calculates value of offset curve +} diff --git a/src/GeomAdaptor/GeomAdaptor_Curve.hxx b/src/GeomAdaptor/GeomAdaptor_Curve.hxx index 6e138872a6..2b993bd9a0 100644 --- a/src/GeomAdaptor/GeomAdaptor_Curve.hxx +++ b/src/GeomAdaptor/GeomAdaptor_Curve.hxx @@ -213,6 +213,9 @@ public: Standard_EXPORT Handle(Geom_OffsetCurve) OffsetCurve() const Standard_OVERRIDE; + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + friend class GeomAdaptor_Surface; diff --git a/src/GeomAdaptor/GeomAdaptor_Surface.cxx b/src/GeomAdaptor/GeomAdaptor_Surface.cxx index 621220dae0..ac2cdb909b 100644 --- a/src/GeomAdaptor/GeomAdaptor_Surface.cxx +++ b/src/GeomAdaptor/GeomAdaptor_Surface.cxx @@ -1439,3 +1439,30 @@ void GeomAdaptor_Surface::Span(const Standard_Integer Side, } } } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void GeomAdaptor_Surface::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_CLASS_BEGIN (theOStream, GeomAdaptor_Surface) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor3d_Surface) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySurface.get()) + + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUFirst) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myULast) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVFirst) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVLast) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolU) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTolV) + + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myBSplineSurface.get()) + //mutable Handle(BSplSLib_Cache) mySurfaceCache; ///< Cached data for B-spline or Bezier surface + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySurfaceType) + //Handle(GeomEvaluator_Surface) myNestedEvaluator; ///< Calculates values of nested complex surfaces (offset surface, surface of extrusion or revolution) +} diff --git a/src/GeomAdaptor/GeomAdaptor_Surface.hxx b/src/GeomAdaptor/GeomAdaptor_Surface.hxx index 2f0d4838c3..7d1e0f4f7b 100644 --- a/src/GeomAdaptor/GeomAdaptor_Surface.hxx +++ b/src/GeomAdaptor/GeomAdaptor_Surface.hxx @@ -239,7 +239,8 @@ public: Standard_EXPORT Standard_Real OffsetValue() const Standard_OVERRIDE; - + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; protected: diff --git a/src/IMeshData/IMeshData_Curve.hxx b/src/IMeshData/IMeshData_Curve.hxx index 505efad262..f9b4f0ce01 100644 --- a/src/IMeshData/IMeshData_Curve.hxx +++ b/src/IMeshData/IMeshData_Curve.hxx @@ -17,6 +17,7 @@ #define _IMeshData_Curve_HeaderFile #include +#include #include class gp_Pnt; @@ -49,6 +50,14 @@ public: //! Removes point with the given index. Standard_EXPORT virtual void RemovePoint (const Standard_Integer theIndex) = 0; + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_ParametersList) + } + + DEFINE_STANDARD_RTTI_INLINE(IMeshData_Curve, IMeshData_ParametersList) protected: diff --git a/src/IMeshData/IMeshData_Edge.hxx b/src/IMeshData/IMeshData_Edge.hxx index 162d2a20fa..b51f75edb1 100644 --- a/src/IMeshData/IMeshData_Edge.hxx +++ b/src/IMeshData/IMeshData_Edge.hxx @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -25,6 +26,8 @@ #include #include #include +#include +#include class IMeshData_Face; @@ -140,6 +143,20 @@ public: myDegenerated = theValue; } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_TessellatedShape) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySameParam) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySameRange) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDegenerated) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAngDeflection) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myCurve.get()) + } + DEFINE_STANDARD_RTTI_INLINE(IMeshData_Edge, IMeshData_TessellatedShape) protected: diff --git a/src/IMeshData/IMeshData_Face.hxx b/src/IMeshData/IMeshData_Face.hxx index 4db215de1a..df490b2e23 100644 --- a/src/IMeshData/IMeshData_Face.hxx +++ b/src/IMeshData/IMeshData_Face.hxx @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -72,6 +73,15 @@ public: IsEqual(IMeshData_UnorientedWire)); } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_TessellatedShape) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySurface.get()) + } + DEFINE_STANDARD_RTTI_INLINE(IMeshData_Face, IMeshData_TessellatedShape) protected: diff --git a/src/IMeshData/IMeshData_Model.hxx b/src/IMeshData/IMeshData_Model.hxx index 773ab6e973..89a96047a9 100644 --- a/src/IMeshData/IMeshData_Model.hxx +++ b/src/IMeshData/IMeshData_Model.hxx @@ -17,6 +17,7 @@ #define _IMeshData_Model_HeaderFile #include +#include #include #include #include @@ -63,6 +64,13 @@ public: //! @name discrete edges //! Gets model's edge with the given index. Standard_EXPORT virtual const IMeshData::IEdgeHandle& GetEdge (const Standard_Integer theIndex) const = 0; + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_Shape) + } + protected: //! Constructor. diff --git a/src/IMeshData/IMeshData_PCurve.hxx b/src/IMeshData/IMeshData_PCurve.hxx index 4c6530cf0e..8195988826 100644 --- a/src/IMeshData/IMeshData_PCurve.hxx +++ b/src/IMeshData/IMeshData_PCurve.hxx @@ -17,6 +17,7 @@ #define _IMeshData_PCurve_HeaderFile #include +#include #include #include @@ -77,6 +78,16 @@ public: return myDFace; } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_ParametersList) + + OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myDFace) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myOrientation) + } + DEFINE_STANDARD_RTTI_INLINE(IMeshData_PCurve, IMeshData_ParametersList) protected: diff --git a/src/IMeshData/IMeshData_ParametersList.hxx b/src/IMeshData/IMeshData_ParametersList.hxx index 8190fd2f32..7dad861787 100644 --- a/src/IMeshData/IMeshData_ParametersList.hxx +++ b/src/IMeshData/IMeshData_ParametersList.hxx @@ -17,6 +17,7 @@ #define _IMeshData_ParametersList_HeaderFile #include +#include #include //! Interface class representing list of parameters on curve. @@ -38,6 +39,13 @@ public: //! Clears parameters list. Standard_EXPORT virtual void Clear(const Standard_Boolean isKeepEndPoints) = 0; + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + (void)theDepth; + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + } + DEFINE_STANDARD_RTTI_INLINE(IMeshData_ParametersList, Standard_Transient) protected: diff --git a/src/IMeshData/IMeshData_Shape.hxx b/src/IMeshData/IMeshData_Shape.hxx index eb5100a42a..fe11013e5b 100644 --- a/src/IMeshData/IMeshData_Shape.hxx +++ b/src/IMeshData/IMeshData_Shape.hxx @@ -17,6 +17,7 @@ #define _IMeshData_Shape_HeaderFile #include +#include #include //! Interface class representing model with associated TopoDS_Shape. @@ -43,6 +44,13 @@ public: return myShape; } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myShape) + } + DEFINE_STANDARD_RTTI_INLINE(IMeshData_Shape, Standard_Transient) protected: diff --git a/src/IMeshData/IMeshData_TessellatedShape.hxx b/src/IMeshData/IMeshData_TessellatedShape.hxx index 94001b032d..ab62fe63c2 100644 --- a/src/IMeshData/IMeshData_TessellatedShape.hxx +++ b/src/IMeshData/IMeshData_TessellatedShape.hxx @@ -17,6 +17,7 @@ #define _IMeshData_TessellatedShape_HeaderFile #include +#include #include #include @@ -42,6 +43,16 @@ public: myDeflection = theValue; } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_Shape) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDeflection) + } + + DEFINE_STANDARD_RTTI_INLINE(IMeshData_TessellatedShape, IMeshData_Shape) protected: diff --git a/src/IMeshData/IMeshData_Wire.hxx b/src/IMeshData/IMeshData_Wire.hxx index e2c2634f71..4e9314fccf 100644 --- a/src/IMeshData/IMeshData_Wire.hxx +++ b/src/IMeshData/IMeshData_Wire.hxx @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -59,6 +60,13 @@ public: Standard_EXPORT virtual TopAbs_Orientation GetEdgeOrientation ( const Standard_Integer theIndex) const = 0; + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_TessellatedShape) + } + DEFINE_STANDARD_RTTI_INLINE(IMeshData_Wire, IMeshData_TessellatedShape) protected: diff --git a/src/IMeshTools/FILES b/src/IMeshTools/FILES index e582bc1d1b..579ebd6d0b 100644 --- a/src/IMeshTools/FILES +++ b/src/IMeshTools/FILES @@ -1,3 +1,4 @@ +IMeshTools_Context.cxx IMeshTools_Context.hxx IMeshTools_CurveTessellator.hxx IMeshTools_MeshAlgo.hxx @@ -7,6 +8,7 @@ IMeshTools_MeshBuilder.cxx IMeshTools_ModelAlgo.hxx IMeshTools_ModelBuilder.hxx IMeshTools_Parameters.hxx +IMeshTools_Parameters.cxx IMeshTools_ShapeExplorer.hxx IMeshTools_ShapeExplorer.cxx IMeshTools_ShapeVisitor.hxx diff --git a/src/IMeshTools/IMeshTools_Context.cxx b/src/IMeshTools/IMeshTools_Context.cxx new file mode 100644 index 0000000000..803a862764 --- /dev/null +++ b/src/IMeshTools/IMeshTools_Context.cxx @@ -0,0 +1,36 @@ +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void IMeshTools_Context::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, IMeshData_Shape) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myModelBuilder.get()) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myModel.get()) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myEdgeDiscret.get()) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myModelHealer.get()) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPreProcessor.get()) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFaceDiscret.get()) + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPostProcessor.get()) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myParameters) +} + diff --git a/src/IMeshTools/IMeshTools_Context.hxx b/src/IMeshTools/IMeshTools_Context.hxx index fe77996c2e..401c5ef0b6 100644 --- a/src/IMeshTools/IMeshTools_Context.hxx +++ b/src/IMeshTools/IMeshTools_Context.hxx @@ -23,6 +23,9 @@ #include #include +#include +#include + //! Interface class representing context of BRepMesh algorithm. //! Intended to cache discrete model and instances of tools for //! its processing. @@ -63,6 +66,9 @@ public: return Standard_False; } + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("DiscretizeEdges") + // Discretize edges of a model. return myEdgeDiscret->Perform(myModel, myParameters); } @@ -77,6 +83,8 @@ public: return Standard_False; } + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("HealModel") return myModelHealer.IsNull() ? Standard_True : myModelHealer->Perform(myModel, myParameters); @@ -92,6 +100,8 @@ public: return Standard_False; } + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("PreProcessModel") return myPreProcessor.IsNull() ? Standard_True : myPreProcessor->Perform(myModel, myParameters); @@ -106,6 +116,8 @@ public: return Standard_False; } + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("DiscretizeFaces") // Discretize faces of a model. return myFaceDiscret->Perform(myModel, myParameters); } @@ -119,6 +131,8 @@ public: return Standard_False; } + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("PostProcessModel") return myPostProcessor.IsNull() ? Standard_True : myPostProcessor->Perform(myModel, myParameters); @@ -223,6 +237,9 @@ public: return myModel; } + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(IMeshTools_Context, IMeshData_Shape) private: diff --git a/src/IMeshTools/IMeshTools_CurveTessellator.hxx b/src/IMeshTools/IMeshTools_CurveTessellator.hxx index 2cbd66bfd6..b112a3496a 100644 --- a/src/IMeshTools/IMeshTools_CurveTessellator.hxx +++ b/src/IMeshTools/IMeshTools_CurveTessellator.hxx @@ -17,6 +17,7 @@ #define _IMeshTools_EdgeTessellator_HeaderFile #include +#include #include class gp_Pnt; @@ -44,6 +45,13 @@ public: gp_Pnt& thePoint, Standard_Real& theParameter) const = 0; + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + (void)theDepth; + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + } + DEFINE_STANDARD_RTTI_INLINE(IMeshTools_CurveTessellator, Standard_Transient) protected: diff --git a/src/IMeshTools/IMeshTools_MeshAlgo.hxx b/src/IMeshTools/IMeshTools_MeshAlgo.hxx index fb8e0b6d49..dc17157523 100644 --- a/src/IMeshTools/IMeshTools_MeshAlgo.hxx +++ b/src/IMeshTools/IMeshTools_MeshAlgo.hxx @@ -17,6 +17,7 @@ #define _IMeshTools_MeshAlgo_HeaderFile #include +#include #include #include @@ -37,6 +38,13 @@ public: const IMeshData::IFaceHandle& theDFace, const IMeshTools_Parameters& theParameters) = 0; + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + (void)theDepth; + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + } + DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshAlgo, Standard_Transient) protected: diff --git a/src/IMeshTools/IMeshTools_MeshBuilder.cxx b/src/IMeshTools/IMeshTools_MeshBuilder.cxx index 3b67a6c798..4242aa639a 100644 --- a/src/IMeshTools/IMeshTools_MeshBuilder.cxx +++ b/src/IMeshTools/IMeshTools_MeshBuilder.cxx @@ -15,6 +15,8 @@ #include #include +#include +#include #include //======================================================================= @@ -58,6 +60,9 @@ void IMeshTools_MeshBuilder::Perform () return; } + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("IMeshTools_MeshBuilder::Perform") + if (aContext->BuildModel ()) { if (aContext->DiscretizeEdges ()) @@ -116,3 +121,15 @@ void IMeshTools_MeshBuilder::Perform () aContext->Clean (); } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void IMeshTools_MeshBuilder::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Message_Algorithm) + OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myContext.get()) +} diff --git a/src/IMeshTools/IMeshTools_MeshBuilder.hxx b/src/IMeshTools/IMeshTools_MeshBuilder.hxx index 8c0d314224..e94a4df41c 100644 --- a/src/IMeshTools/IMeshTools_MeshBuilder.hxx +++ b/src/IMeshTools/IMeshTools_MeshBuilder.hxx @@ -64,6 +64,9 @@ public: //! Performs meshing ot the shape using current context. Standard_EXPORT virtual void Perform (); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshBuilder, Message_Algorithm) private: diff --git a/src/IMeshTools/IMeshTools_ModelAlgo.hxx b/src/IMeshTools/IMeshTools_ModelAlgo.hxx index 963c880c75..4dd99675f3 100644 --- a/src/IMeshTools/IMeshTools_ModelAlgo.hxx +++ b/src/IMeshTools/IMeshTools_ModelAlgo.hxx @@ -20,6 +20,7 @@ #include #include #include +#include class IMeshData_Model; struct IMeshTools_Parameters; @@ -51,6 +52,13 @@ public: } } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const + { + (void)theDepth; + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + } + DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ModelAlgo, Standard_Transient) protected: diff --git a/src/IMeshTools/IMeshTools_ModelBuilder.hxx b/src/IMeshTools/IMeshTools_ModelBuilder.hxx index 5d6d416932..4146dfc137 100644 --- a/src/IMeshTools/IMeshTools_ModelBuilder.hxx +++ b/src/IMeshTools/IMeshTools_ModelBuilder.hxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -61,6 +62,13 @@ public: } } + //! Dumps the content of me into the stream + virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE + { + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Message_Algorithm) + } + DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ModelBuilder, Message_Algorithm) protected: diff --git a/src/IMeshTools/IMeshTools_Parameters.cxx b/src/IMeshTools/IMeshTools_Parameters.cxx new file mode 100644 index 0000000000..a6ee5eada7 --- /dev/null +++ b/src/IMeshTools/IMeshTools_Parameters.cxx @@ -0,0 +1,38 @@ +// Created on: 2016-04-07 +// Copyright (c) 2016 OPEN CASCADE SAS +// Created by: Oleg AGASHIN +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include + +//======================================================================= +// Function: Constructor +// Purpose : +//======================================================================= +void IMeshTools_Parameters::DumpJson (Standard_OStream& theOStream, Standard_Integer) const +{ + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Angle) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Deflection) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, AngleInterior) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, DeflectionInterior) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, MinSize) + + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, InParallel) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Relative) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, InternalVerticesMode) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ControlSurfaceDeflection) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, CleanModel) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, AdjustMinSize) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ForceFaceDeflection) +} diff --git a/src/IMeshTools/IMeshTools_Parameters.hxx b/src/IMeshTools/IMeshTools_Parameters.hxx index 17c3591113..4f47d56f4b 100644 --- a/src/IMeshTools/IMeshTools_Parameters.hxx +++ b/src/IMeshTools/IMeshTools_Parameters.hxx @@ -47,6 +47,9 @@ struct IMeshTools_Parameters { return 0.1; } + //! Dumps the content of me into the stream + Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + //! Angular deflection used to tessellate the boundary edges Standard_Real Angle; diff --git a/src/IMeshTools/IMeshTools_ShapeExplorer.cxx b/src/IMeshTools/IMeshTools_ShapeExplorer.cxx index a6214ee700..dd6397ea90 100644 --- a/src/IMeshTools/IMeshTools_ShapeExplorer.cxx +++ b/src/IMeshTools/IMeshTools_ShapeExplorer.cxx @@ -24,6 +24,8 @@ #include #include #include +#include +#include namespace { @@ -79,11 +81,16 @@ IMeshTools_ShapeExplorer::~IMeshTools_ShapeExplorer () void IMeshTools_ShapeExplorer::Accept ( const Handle (IMeshTools_ShapeVisitor)& theVisitor) { + OCCT_ADD_MESSAGE_LEVEL_SENTRY + OCCT_SEND_MESSAGE ("IMeshTools_ShapeExplorer::Accept") + // Explore all free edges in shape. + OCCT_SEND_MESSAGE ("visit free edges") visitEdges (theVisitor, GetShape (), Standard_True, TopAbs_EDGE, TopAbs_FACE); // Explore all related to some face edges in shape. // make array of faces suitable for processing (excluding faces without surface) + OCCT_SEND_MESSAGE ("explore all related to some face edges in shape") TopTools_ListOfShape aFaceList; BRepLib::ReverseSortFaces (GetShape (), aFaceList); TopTools_MapOfShape aFaceMap; diff --git a/src/Message/Message_Algorithm.cxx b/src/Message/Message_Algorithm.cxx index df663d3567..898b560c1a 100644 --- a/src/Message/Message_Algorithm.cxx +++ b/src/Message/Message_Algorithm.cxx @@ -431,3 +431,22 @@ TCollection_ExtendedString Message_Algorithm::PrepareReport } return aNewReport; } + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void Message_Algorithm::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) + + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myStatus) + OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMessenger) + + if (!myReportIntegers.IsNull()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myReportIntegers->Length()) + if (!myReportStrings.IsNull()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myReportStrings->Length()) + if (!myReportMessages.IsNull()) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myReportMessages->Length()) +} diff --git a/src/Message/Message_Algorithm.hxx b/src/Message/Message_Algorithm.hxx index 8b8df3a378..3637133821 100644 --- a/src/Message/Message_Algorithm.hxx +++ b/src/Message/Message_Algorithm.hxx @@ -197,6 +197,9 @@ public: //! in theReportSeq sequence, but not more than theMaxCount Standard_EXPORT static TCollection_ExtendedString PrepareReport (const TColStd_SequenceOfHExtendedString& theReportSeq, const Standard_Integer theMaxCount); + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + diff --git a/src/NCollection/NCollection_CellFilter.hxx b/src/NCollection/NCollection_CellFilter.hxx index dc447eabb9..c02cff447b 100644 --- a/src/NCollection/NCollection_CellFilter.hxx +++ b/src/NCollection/NCollection_CellFilter.hxx @@ -237,7 +237,7 @@ public: // work-around against obsolete SUN WorkShop 5.3 compiler #else protected: #endif - + public: /** * Auxiliary class for storing points belonging to the cell as the list */ @@ -317,6 +317,8 @@ protected: return Standard_True; } + const NCollection_LocalArray& Index() const { return index; } + //! Returns hash code for this cell, in the range [1, theUpperBound] //! @param theUpperBound the upper bound of the range a computing hash code must be within //! @return a computed hash code, in the range [1, theUpperBound] @@ -340,6 +342,9 @@ protected: ListNode *Objects; }; + const NCollection_Map& Cells() const { return myCells; } + const NCollection_Array1& CellSize() const { return myCellSize; } + //! Returns hash code for the given cell, in the range [1, theUpperBound] //! @param theCell the cell object which hash code is to be computed //! @param theUpperBound the upper bound of the range a computing hash code must be within diff --git a/src/TopoDS/TopoDS_TShape.cxx b/src/TopoDS/TopoDS_TShape.cxx index 82489573d7..555686d046 100644 --- a/src/TopoDS/TopoDS_TShape.cxx +++ b/src/TopoDS/TopoDS_TShape.cxx @@ -29,7 +29,7 @@ void TopoDS_TShape::DumpJson (Standard_OStream& theOStream, Standard_Integer) co { OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) - OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, this) + //OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, this) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ShapeType()) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, NbChildren()) diff --git a/src/gp/gp_Circ.cxx b/src/gp/gp_Circ.cxx index bd859ac98a..3d56c37924 100644 --- a/src/gp/gp_Circ.cxx +++ b/src/gp/gp_Circ.cxx @@ -51,3 +51,8 @@ gp_Circ gp_Circ::Mirrored (const gp_Ax2& A2) const return C; } +void gp_Circ::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &pos) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, radius) +} diff --git a/src/gp/gp_Circ.hxx b/src/gp/gp_Circ.hxx index 1347755168..4de36c87df 100644 --- a/src/gp/gp_Circ.hxx +++ b/src/gp/gp_Circ.hxx @@ -207,6 +207,8 @@ public: //! Translates a circle from the point P1 to the point P2. Standard_NODISCARD gp_Circ Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + //! Dumps the content of me into the stream + Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; diff --git a/src/gp/gp_Lin.cxx b/src/gp/gp_Lin.cxx index b91d56cd5b..5678894f86 100644 --- a/src/gp/gp_Lin.cxx +++ b/src/gp/gp_Lin.cxx @@ -69,3 +69,8 @@ gp_Lin gp_Lin::Mirrored (const gp_Ax2& A2) const return L; } +void gp_Lin::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + pos.DumpJson (theOStream, theDepth); +} + diff --git a/src/gp/gp_Lin.hxx b/src/gp/gp_Lin.hxx index 94de6a7bf4..7eb026882b 100644 --- a/src/gp/gp_Lin.hxx +++ b/src/gp/gp_Lin.hxx @@ -185,6 +185,8 @@ public: //! Translates a line from the point P1 to the point P2. Standard_NODISCARD gp_Lin Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + //! Dumps the content of me into the stream + Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; diff --git a/src/gp/gp_XY.cxx b/src/gp/gp_XY.cxx index 5b93d58053..78a2563a7d 100644 --- a/src/gp/gp_XY.cxx +++ b/src/gp/gp_XY.cxx @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -31,3 +32,24 @@ Standard_Boolean gp_XY::IsEqual (const gp_XY& Other, return Standard_True; } +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void gp_XY::DumpJson (Standard_OStream& theOStream, Standard_Integer) const +{ + OCCT_DUMP_VECTOR_CLASS (theOStream, "gp_XY", 2, x, y) +} + +//======================================================================= +//function : InitFromJson +//purpose : +//======================================================================= +Standard_Boolean gp_XY::InitFromJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos) +{ + Standard_Integer aPos = theStreamPos; + OCCT_INIT_VECTOR_CLASS (theSStream, "gp_XY", aPos, 2, &x, &y) + + theStreamPos = aPos; + return Standard_True; +} diff --git a/src/gp/gp_XY.hxx b/src/gp/gp_XY.hxx index 254fce65f9..9afaedc125 100644 --- a/src/gp/gp_XY.hxx +++ b/src/gp/gp_XY.hxx @@ -22,6 +22,8 @@ #include #include #include +#include +#include class Standard_ConstructionError; class Standard_OutOfRange; class gp_Mat2d; @@ -268,6 +270,11 @@ public: return Subtracted(Right); } + //! Dumps the content of me into the stream + Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + + //! Inits the content of me into the stream + Standard_EXPORT Standard_Boolean InitFromJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);