From e2aba8ebf3f0d39a158a9ea78b0e7846a2ed73ce Mon Sep 17 00:00:00 2001 From: kgv Date: Wed, 11 Jul 2018 15:52:02 +0300 Subject: [PATCH] 0029947: Visualization - SelectMgr_SelectableObject::GetSelectPresentation() should copy object clipping planes Methods SelectMgr_SelectableObject::GetHilightPresentation(), ::GetSelectPresentation() and ::UpdateClipping() have been corrected to copy clipping planes of the object into highlighting and selection presentations. --- src/SelectMgr/SelectMgr_SelectableObject.cxx | 19 +++++++++++++++++++ src/SelectMgr/SelectMgr_SelectableObject.hxx | 3 +++ tests/bugs/vis/bug29947 | 20 ++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 tests/bugs/vis/bug29947 diff --git a/src/SelectMgr/SelectMgr_SelectableObject.cxx b/src/SelectMgr/SelectMgr_SelectableObject.cxx index 14f4d61ad6..e9e48bbda6 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.cxx +++ b/src/SelectMgr/SelectMgr_SelectableObject.cxx @@ -348,6 +348,7 @@ Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetHilightPresentation (c { myHilightPrs = new Prs3d_Presentation (theMgr->StructureManager()); myHilightPrs->SetTransformPersistence (TransformPersistence()); + myHilightPrs->SetClipPlanes (myClipPlanes); } return myHilightPrs; @@ -364,6 +365,7 @@ Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetSelectPresentation (co { mySelectionPrs = new Prs3d_Presentation (theMgr->StructureManager()); mySelectionPrs->SetTransformPersistence (TransformPersistence()); + mySelectionPrs->SetClipPlanes (myClipPlanes); } return mySelectionPrs; @@ -428,6 +430,23 @@ void SelectMgr_SelectableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId) } } +//======================================================================= +//function : UpdateClipping +//purpose : +//======================================================================= +void SelectMgr_SelectableObject::UpdateClipping() +{ + PrsMgr_PresentableObject::UpdateClipping(); + if (!mySelectionPrs.IsNull()) + { + mySelectionPrs->SetClipPlanes (myClipPlanes); + } + if (!myHilightPrs.IsNull()) + { + myHilightPrs->SetClipPlanes (myClipPlanes); + } +} + //======================================================================= //function : updateSelection //purpose : Sets update status FULL to selections of the object. Must be diff --git a/src/SelectMgr/SelectMgr_SelectableObject.hxx b/src/SelectMgr/SelectMgr_SelectableObject.hxx index 0ac59a910b..3132b5f220 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.hxx +++ b/src/SelectMgr/SelectMgr_SelectableObject.hxx @@ -198,6 +198,9 @@ protected: myGlobalSelMode = theMode > 0 ? theMode : 0; } + //! Update clipping planes state. + Standard_EXPORT virtual void UpdateClipping() Standard_OVERRIDE; + Standard_EXPORT virtual void updateSelection (const Standard_Integer theMode); protected: diff --git a/tests/bugs/vis/bug29947 b/tests/bugs/vis/bug29947 new file mode 100644 index 0000000000..555788083c --- /dev/null +++ b/tests/bugs/vis/bug29947 @@ -0,0 +1,20 @@ +puts "=============" +puts "0029947: Visualization - SelectMgr_SelectableObject::GetSelectPresentation() should copy object clipping planes" +puts "=============" + +pload MODELING VISUALIZATION XDE +vclear +vinit View1 +vaxo +meshfromstl m [locate_data_file shape.stl] +vfit +vdisplay -dispMode 2 m +vselmode m 8 1 +vselect 160 170 320 370 +if { [vreadpixel 230 260 rgb name] == "BLACK" } { puts "Error" } +vclipplane c -set m -equation 0 1 0 4 +if { [vreadpixel 230 260 rgb name] != "BLACK" } { puts "Error" } +vmoveto 75 172 +if { [vreadpixel 70 170 rgb name] != "BLACK" } { puts "Error" } + +vdump ${imagedir}/${casename}.png