From 072c986e7d141fac8f9d1bd3524f52b3c0d509d9 Mon Sep 17 00:00:00 2001 From: sshutina Date: Mon, 16 May 2022 12:11:15 +0300 Subject: [PATCH] 0032965: PMIVis - PMIVis_TOT_Vectorized text regressions Added the ability to draw a shaded shape in the required group. --- src/StdPrs/StdPrs_ShadedShape.cxx | 21 ++++++++++++--------- src/StdPrs/StdPrs_ShadedShape.hxx | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/StdPrs/StdPrs_ShadedShape.cxx b/src/StdPrs/StdPrs_ShadedShape.cxx index dde6a7900f..5bca49161f 100644 --- a/src/StdPrs/StdPrs_ShadedShape.cxx +++ b/src/StdPrs/StdPrs_ShadedShape.cxx @@ -282,7 +282,8 @@ namespace const gp_Pnt2d& theUVOrigin, const gp_Pnt2d& theUVRepeat, const gp_Pnt2d& theUVScale, - const bool theIsClosed) + const bool theIsClosed, + const Handle(Graphic3d_Group)& theGroup = NULL) { Handle(Graphic3d_ArrayOfTriangles) aPArray = fillTriangles (theShape, theHasTexels, theUVOrigin, theUVRepeat, theUVScale); if (aPArray.IsNull()) @@ -290,7 +291,7 @@ namespace return Standard_False; } - Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); + Handle(Graphic3d_Group) aGroup = !theGroup.IsNull() ? theGroup : thePrs->NewGroup(); aGroup->SetClosed (theIsClosed); aGroup->SetGroupPrimitivesAspect (theDrawer->ShadingAspect()->Aspect()); aGroup->AddPrimitiveArray (aPArray); @@ -514,11 +515,12 @@ void StdPrs_ShadedShape::ExploreSolids (const TopoDS_Shape& theShape, void StdPrs_ShadedShape::Add (const Handle(Prs3d_Presentation)& thePrs, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, - const StdPrs_Volume theVolume) + const StdPrs_Volume theVolume, + const Handle(Graphic3d_Group)& theGroup) { gp_Pnt2d aDummy; StdPrs_ShadedShape::Add (thePrs, theShape, theDrawer, - Standard_False, aDummy, aDummy, aDummy, theVolume); + Standard_False, aDummy, aDummy, aDummy, theVolume, theGroup); } // ======================================================================= @@ -532,7 +534,8 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs, const gp_Pnt2d& theUVOrigin, const gp_Pnt2d& theUVRepeat, const gp_Pnt2d& theUVScale, - const StdPrs_Volume theVolume) + const StdPrs_Volume theVolume, + const Handle(Graphic3d_Group)& theGroup) { if (theShape.IsNull()) { @@ -570,13 +573,13 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs, if (aClosed.NbChildren() > 0) { shadeFromShape (aClosed, thePrs, theDrawer, - theHasTexels, theUVOrigin, theUVRepeat, theUVScale, true); + theHasTexels, theUVOrigin, theUVRepeat, theUVScale, true, theGroup); } if (anOpened.NbChildren() > 0) { shadeFromShape (anOpened, thePrs, theDrawer, - theHasTexels, theUVOrigin, theUVRepeat, theUVScale, false); + theHasTexels, theUVOrigin, theUVRepeat, theUVScale, false, theGroup); } } else @@ -584,14 +587,14 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs, // if the shape type is not compound, composolid or solid, use autodetection back-facing filled shadeFromShape (theShape, thePrs, theDrawer, theHasTexels, theUVOrigin, theUVRepeat, theUVScale, - theVolume == StdPrs_Volume_Closed); + theVolume == StdPrs_Volume_Closed, theGroup); } if (theDrawer->FaceBoundaryDraw()) { if (Handle(Graphic3d_ArrayOfSegments) aBndSegments = fillFaceBoundaries (theShape, theDrawer->FaceBoundaryUpperContinuity())) { - Handle(Graphic3d_Group) aPrsGrp = thePrs->NewGroup(); + Handle(Graphic3d_Group) aPrsGrp = !theGroup.IsNull() ? theGroup : thePrs->NewGroup(); aPrsGrp->SetGroupPrimitivesAspect (theDrawer->FaceBoundaryAspect()->Aspect()); aPrsGrp->AddPrimitiveArray (aBndSegments); } diff --git a/src/StdPrs/StdPrs_ShadedShape.hxx b/src/StdPrs/StdPrs_ShadedShape.hxx index f65e762ce2..26c212fcf4 100644 --- a/src/StdPrs/StdPrs_ShadedShape.hxx +++ b/src/StdPrs/StdPrs_ShadedShape.hxx @@ -38,13 +38,13 @@ public: //! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to activate back-face //! culling and capping plane algorithms), as Open volumes (shells or solids with holes) //! or to perform Autodetection (would split input shape into two groups) - Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection); + Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection, const Handle(Graphic3d_Group)& theGroup = NULL); //! Shades with texture coordinates. //! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to activate back-face //! culling and capping plane algorithms), as Open volumes (shells or solids with holes) //! or to perform Autodetection (would split input shape into two groups) - Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, const Standard_Boolean theHasTexels, const gp_Pnt2d& theUVOrigin, const gp_Pnt2d& theUVRepeat, const gp_Pnt2d& theUVScale, const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection); + Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, const Standard_Boolean theHasTexels, const gp_Pnt2d& theUVOrigin, const gp_Pnt2d& theUVRepeat, const gp_Pnt2d& theUVScale, const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection, const Handle(Graphic3d_Group)& theGroup = NULL); //! Searches closed and unclosed subshapes in shape structure and puts them //! into two compounds for separate processing of closed and unclosed sub-shapes