1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0032965: PMIVis - PMIVis_TOT_Vectorized text regressions

Added the ability to draw a shaded shape in the required group.
This commit is contained in:
sshutina 2022-05-16 12:11:15 +03:00 committed by smoskvin
parent 9b7f1aea28
commit 7eeb5d5fbf
2 changed files with 14 additions and 11 deletions

View File

@ -275,7 +275,8 @@ namespace
const gp_Pnt2d& theUVOrigin, const gp_Pnt2d& theUVOrigin,
const gp_Pnt2d& theUVRepeat, const gp_Pnt2d& theUVRepeat,
const gp_Pnt2d& theUVScale, 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); Handle(Graphic3d_ArrayOfTriangles) aPArray = fillTriangles (theShape, theHasTexels, theUVOrigin, theUVRepeat, theUVScale);
if (aPArray.IsNull()) if (aPArray.IsNull())
@ -283,7 +284,7 @@ namespace
return Standard_False; return Standard_False;
} }
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); Handle(Graphic3d_Group) aGroup = !theGroup.IsNull() ? theGroup : thePrs->NewGroup();
aGroup->SetClosed (theIsClosed); aGroup->SetClosed (theIsClosed);
aGroup->SetGroupPrimitivesAspect (theDrawer->ShadingAspect()->Aspect()); aGroup->SetGroupPrimitivesAspect (theDrawer->ShadingAspect()->Aspect());
aGroup->AddPrimitiveArray (aPArray); aGroup->AddPrimitiveArray (aPArray);
@ -507,11 +508,12 @@ void StdPrs_ShadedShape::ExploreSolids (const TopoDS_Shape& theShape,
void StdPrs_ShadedShape::Add (const Handle(Prs3d_Presentation)& thePrs, void StdPrs_ShadedShape::Add (const Handle(Prs3d_Presentation)& thePrs,
const TopoDS_Shape& theShape, const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer, const Handle(Prs3d_Drawer)& theDrawer,
const StdPrs_Volume theVolume) const StdPrs_Volume theVolume,
const Handle(Graphic3d_Group)& theGroup)
{ {
gp_Pnt2d aDummy; gp_Pnt2d aDummy;
StdPrs_ShadedShape::Add (thePrs, theShape, theDrawer, 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& theUVOrigin,
const gp_Pnt2d& theUVRepeat, const gp_Pnt2d& theUVRepeat,
const gp_Pnt2d& theUVScale, const gp_Pnt2d& theUVScale,
const StdPrs_Volume theVolume) const StdPrs_Volume theVolume,
const Handle(Graphic3d_Group)& theGroup)
{ {
if (theShape.IsNull()) if (theShape.IsNull())
{ {
@ -563,13 +566,13 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
if (aClosed.NbChildren() > 0) if (aClosed.NbChildren() > 0)
{ {
shadeFromShape (aClosed, thePrs, theDrawer, shadeFromShape (aClosed, thePrs, theDrawer,
theHasTexels, theUVOrigin, theUVRepeat, theUVScale, true); theHasTexels, theUVOrigin, theUVRepeat, theUVScale, true, theGroup);
} }
if (anOpened.NbChildren() > 0) if (anOpened.NbChildren() > 0)
{ {
shadeFromShape (anOpened, thePrs, theDrawer, shadeFromShape (anOpened, thePrs, theDrawer,
theHasTexels, theUVOrigin, theUVRepeat, theUVScale, false); theHasTexels, theUVOrigin, theUVRepeat, theUVScale, false, theGroup);
} }
} }
else 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 // if the shape type is not compound, composolid or solid, use autodetection back-facing filled
shadeFromShape (theShape, thePrs, theDrawer, shadeFromShape (theShape, thePrs, theDrawer,
theHasTexels, theUVOrigin, theUVRepeat, theUVScale, theHasTexels, theUVOrigin, theUVRepeat, theUVScale,
theVolume == StdPrs_Volume_Closed); theVolume == StdPrs_Volume_Closed, theGroup);
} }
if (theDrawer->FaceBoundaryDraw()) if (theDrawer->FaceBoundaryDraw())
{ {
if (Handle(Graphic3d_ArrayOfSegments) aBndSegments = fillFaceBoundaries (theShape, theDrawer->FaceBoundaryUpperContinuity())) 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->SetGroupPrimitivesAspect (theDrawer->FaceBoundaryAspect()->Aspect());
aPrsGrp->AddPrimitiveArray (aBndSegments); aPrsGrp->AddPrimitiveArray (aBndSegments);
} }

View File

@ -36,13 +36,13 @@ public:
//! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to activate back-face //! @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) //! culling and capping plane algorithms), as Open volumes (shells or solids with holes)
//! or to perform Autodetection (would split input shape into two groups) //! 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. //! Shades <theShape> with texture coordinates.
//! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to activate back-face //! @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) //! culling and capping plane algorithms), as Open volumes (shells or solids with holes)
//! or to perform Autodetection (would split input shape into two groups) //! 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 //! Searches closed and unclosed subshapes in shape structure and puts them
//! into two compounds for separate processing of closed and unclosed sub-shapes //! into two compounds for separate processing of closed and unclosed sub-shapes