From 8a5dfb383399612b096bff2c81a46c44f61bccca Mon Sep 17 00:00:00 2001 From: apl Date: Mon, 18 May 2015 20:11:22 +0300 Subject: [PATCH] 0026163: Visualization - AIS_Shape::SetWidth() should not overwrite the free boundary color --- src/AIS/AIS_Shape.cxx | 62 +++++++++++++++++++++++++++++++++++------ tests/bugs/vis/bug26163 | 29 +++++++++++++++++++ 2 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 tests/bugs/vis/bug26163 diff --git a/src/AIS/AIS_Shape.cxx b/src/AIS/AIS_Shape.cxx index b8bfede8da..cda29b33e4 100644 --- a/src/AIS/AIS_Shape.cxx +++ b/src/AIS/AIS_Shape.cxx @@ -474,10 +474,30 @@ void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer, *theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect(); } } - // disable dedicated line aspects - theDrawer->SetFreeBoundaryAspect (theDrawer->LineAspect()); - theDrawer->SetUnFreeBoundaryAspect(theDrawer->LineAspect()); - theDrawer->SetSeenLineAspect (theDrawer->LineAspect()); + if (!theDrawer->HasOwnFreeBoundaryAspect()) + { + theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); + if (theDrawer->HasLink()) + { + *theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect(); + } + } + if (!theDrawer->HasOwnUnFreeBoundaryAspect()) + { + theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); + if (theDrawer->HasLink()) + { + *theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect(); + } + } + if (!theDrawer->HasOwnSeenLineAspect()) + { + theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); + if (theDrawer->HasLink()) + { + *theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect(); + } + } // override color theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel); @@ -485,6 +505,9 @@ void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer, theDrawer->LineAspect()->SetColor (theColor); theDrawer->WireAspect()->SetColor (theColor); theDrawer->PointAspect()->SetColor (theColor); + theDrawer->FreeBoundaryAspect()->SetColor (theColor); + theDrawer->UnFreeBoundaryAspect()->SetColor (theColor); + theDrawer->SeenLineAspect()->SetColor (theColor); } //======================================================================= @@ -695,14 +718,37 @@ void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer, *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect(); } } - // disable dedicated line aspects - theDrawer->SetFreeBoundaryAspect (theDrawer->LineAspect()); - theDrawer->SetUnFreeBoundaryAspect(theDrawer->LineAspect()); - theDrawer->SetSeenLineAspect (theDrawer->LineAspect()); + if (!theDrawer->HasOwnFreeBoundaryAspect()) + { + theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); + if (theDrawer->HasLink()) + { + *theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect(); + } + } + if (!theDrawer->HasOwnUnFreeBoundaryAspect()) + { + theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); + if (theDrawer->HasLink()) + { + *theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect(); + } + } + if (!theDrawer->HasOwnSeenLineAspect()) + { + theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); + if (theDrawer->HasLink()) + { + *theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect(); + } + } // override width theDrawer->LineAspect()->SetWidth (theLineWidth); theDrawer->WireAspect()->SetWidth (theLineWidth); + theDrawer->FreeBoundaryAspect()->SetWidth (theLineWidth); + theDrawer->UnFreeBoundaryAspect()->SetWidth (theLineWidth); + theDrawer->SeenLineAspect()->SetWidth (theLineWidth); } //======================================================================= diff --git a/tests/bugs/vis/bug26163 b/tests/bugs/vis/bug26163 new file mode 100644 index 0000000000..9051b8f439 --- /dev/null +++ b/tests/bugs/vis/bug26163 @@ -0,0 +1,29 @@ +puts "============" +puts "CR26163" +puts "============" +puts "" + +########################################################################################## +puts "Visualization - AIS_Shape::SetWidth() should not overwrite the free boundary color" +########################################################################################## + +set check_x 252 +set check_y 170 + +pload VISUALIZATION MODELING + +vinit View1 w=400 h=400 +vclear +vaxo + +restore [locate_data_file bug26163.brep] s +vdisplay s +vfit +vsetwidth s 4 + +# check that free boundary color is kept +if { [checkcolor $check_x $check_y 0.0 1.0 0.0] != 1 } { + puts "Error: free boundary aspect unexpectedly changed." +} + +vdump ${imagedir}/${casename}.png