0032965: PMIVis - PMIVis_TOT_Vectorized text regressions
authorsshutina <sshutina@opencascade.com>
Mon, 16 May 2022 09:11:15 +0000 (12:11 +0300)
committersmoskvin <smoskvin@opencascade.com>
Sun, 4 Dec 2022 10:44:52 +0000 (13:44 +0300)
Added the ability to draw a shaded shape in the required group.

src/StdPrs/StdPrs_ShadedShape.cxx
src/StdPrs/StdPrs_ShadedShape.hxx

index 248b11c..fe2f667 100644 (file)
@@ -275,7 +275,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())
@@ -283,7 +284,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);
@@ -507,11 +508,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);
 }
 
 // =======================================================================
@@ -525,7 +527,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())
   {
@@ -563,13 +566,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
@@ -577,14 +580,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);
     }
index 18efa63..3752555 100644 (file)
@@ -36,13 +36,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 <theShape> 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