From f6d4c5cf8d76cebaaeb5fcccd72d9ecf66dec5c0 Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 4 Apr 2017 10:04:18 +0300 Subject: [PATCH] 0028621: Visualization - AIS_ColoredShape::UnsetTransparency() is not implemented --- src/AIS/AIS_ColoredShape.cxx | 27 +++++++++++++++++++++++++++ src/AIS/AIS_ColoredShape.hxx | 3 +++ tests/bugs/vis/bug28621 | 28 ++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 tests/bugs/vis/bug28621 diff --git a/src/AIS/AIS_ColoredShape.cxx b/src/AIS/AIS_ColoredShape.cxx index d271691087..223864d672 100644 --- a/src/AIS/AIS_ColoredShape.cxx +++ b/src/AIS/AIS_ColoredShape.cxx @@ -286,6 +286,33 @@ void AIS_ColoredShape::SetTransparency (const Standard_Real theValue) } } +//======================================================================= +//function : UnsetTransparency +//purpose : +//======================================================================= +void AIS_ColoredShape::UnsetTransparency() +{ + myDrawer->SetTransparency (0.0f); + if (myDrawer->HasOwnShadingAspect()) + { + myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel); + } + if (!HasColor() && !HasMaterial()) + { + myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)()); + } + + for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next()) + { + const Handle(Prs3d_Drawer)& aDrawer = anIter.Value(); + if (aDrawer->HasOwnShadingAspect()) + { + aDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel); + } + } + SynchronizeAspects(); +} + //======================================================================= //function : SetMaterial //purpose : diff --git a/src/AIS/AIS_ColoredShape.hxx b/src/AIS/AIS_ColoredShape.hxx index 604808b64a..ccd1679988 100644 --- a/src/AIS/AIS_ColoredShape.hxx +++ b/src/AIS/AIS_ColoredShape.hxx @@ -75,6 +75,9 @@ public: //! @name global aspects //! Sets transparency value. Standard_EXPORT virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE; + //! Removes the setting for transparency in the reconstructed compound shape. + Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE; + //! Sets the material aspect. Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theAspect) Standard_OVERRIDE; diff --git a/tests/bugs/vis/bug28621 b/tests/bugs/vis/bug28621 new file mode 100644 index 0000000000..fc3d9fa807 --- /dev/null +++ b/tests/bugs/vis/bug28621 @@ -0,0 +1,28 @@ +puts "=================================================================================================" +puts "0028621: Visualization - AIS_ColoredShape::UnsetTransparency() is not implemented" +puts "=================================================================================================" + +pload VISUALIZATION MODELING +box b 1 2 3 +vclear +vinit View1 +vdisplay -noupdate -dispMode 1 b +vfit + +# OK +set aColor11 [vreadpixel 250 250 rgb name] +vsettransparency b 0.8 +vunsettransparency b +set aColor12 [vreadpixel 250 250 rgb name] +if { "$aColor11" != "$aColor12" } { puts "Error: color is not set back" } + +explode b F +vaspects b -subShapes b_2 -setColor RED + +set aColor21 [vreadpixel 250 250 rgb name] +vsettransparency b 0.8 +vunsettransparency b +set aColor22 [vreadpixel 250 250 rgb name] +if { "$aColor21" != "$aColor22" } { puts "Error: color is not set back" } + +vdump $imagedir/${casename}.png