From aeb722e31a3d48c22cba68acf1b5e0716df69df4 Mon Sep 17 00:00:00 2001 From: san Date: Thu, 21 Aug 2014 11:43:33 +0400 Subject: [PATCH] 0024610: Visualization, Visual3d_View::MinMaxValues() - skip erased objects while computing bounding box for Fit All operations "vfit" takes into account erased objects Visual3d_View::MinMaxValues() corrected to ignore hidden Graphic3d_Structure instances, unused Graphic3d_StructureManager::MinMaxValues() removed. Correction of test-case --- src/Graphic3d/Graphic3d_StructureManager.cdl | 9 ------ src/Graphic3d/Graphic3d_StructureManager.cxx | 34 -------------------- src/Visual3d/Visual3d_View.cxx | 3 ++ tests/bugs/vis/bug24610 | 24 ++++++++++++++ 4 files changed, 27 insertions(+), 43 deletions(-) create mode 100644 tests/bugs/vis/bug24610 diff --git a/src/Graphic3d/Graphic3d_StructureManager.cdl b/src/Graphic3d/Graphic3d_StructureManager.cdl index 557fe41453..f800563d4e 100644 --- a/src/Graphic3d/Graphic3d_StructureManager.cdl +++ b/src/Graphic3d/Graphic3d_StructureManager.cdl @@ -231,15 +231,6 @@ is ---Purpose: Returns the values of the current default attributes. ---Category: Inquire methods - MinMaxValues ( me; - XMin, YMin, ZMin : out Real from Standard; - XMax, YMax, ZMax : out Real from Standard ) - is static; - ---Level: Public - ---Purpose: Returns the coordinates of the boundary box of all - -- structures displayed in the manager . - ---Category: Inquire methods - PrimitivesAspect ( me; CTXL : out AspectLine3d from Graphic3d; CTXT : out AspectText3d from Graphic3d; diff --git a/src/Graphic3d/Graphic3d_StructureManager.cxx b/src/Graphic3d/Graphic3d_StructureManager.cxx index d1ea78a4e4..8c7a92b364 100644 --- a/src/Graphic3d/Graphic3d_StructureManager.cxx +++ b/src/Graphic3d/Graphic3d_StructureManager.cxx @@ -271,40 +271,6 @@ void Graphic3d_StructureManager::PickStructures (Graphic3d_MapOfStructure& SG) c } -void Graphic3d_StructureManager::MinMaxValues (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const { - -Standard_Boolean Flag = Standard_True; -Standard_Real Xm, Ym, Zm, XM, YM, ZM, RL, RF; - - RL = RealLast (); - RF = RealFirst (); - - XMin = YMin = ZMin = RL; - XMax = YMax = ZMax = RF; - - Graphic3d_MapIteratorOfMapOfStructure it(MyDisplayedStructure); - for (; it.More(); it.Next()) { - Handle(Graphic3d_Structure) SG = it.Key(); - if (! (SG->IsEmpty() || SG->IsInfinite ())) { - SG->MinMaxValues (Xm, Ym, Zm, XM, YM, ZM); - if (Xm < XMin) XMin = Xm; - if (Ym < YMin) YMin = Ym; - if (Zm < ZMin) ZMin = Zm; - if (XM > XMax) XMax = XM; - if (YM > YMax) YMax = YM; - if (ZM > ZMax) ZMax = ZM; - Flag = Standard_False; - } - } - - // If all structures are empty or infinite - if (Flag) { - XMin = YMin = ZMin = RF; - XMax = YMax = ZMax = RL; - } - -} - Standard_Integer Graphic3d_StructureManager::NewIdentification () { Standard_Integer Id = MyStructGenId.Next (); diff --git a/src/Visual3d/Visual3d_View.cxx b/src/Visual3d/Visual3d_View.cxx index 1e48b74c70..3a98b341c1 100644 --- a/src/Visual3d/Visual3d_View.cxx +++ b/src/Visual3d/Visual3d_View.cxx @@ -1766,6 +1766,9 @@ void Visual3d_View::MinMaxValues (const Graphic3d_MapOfStructure& theSet, { const Handle(Graphic3d_Structure)& aStructure = anIterator.Key(); + if (!aStructure->IsVisible()) + continue; + if (aStructure->IsInfinite() && !theToIgnoreInfiniteFlag) { //XMin, YMin .... ZMax are initialized by means of infinite line data diff --git a/tests/bugs/vis/bug24610 b/tests/bugs/vis/bug24610 new file mode 100644 index 0000000000..9f6b7cddcc --- /dev/null +++ b/tests/bugs/vis/bug24610 @@ -0,0 +1,24 @@ +puts "============" +puts "OCC24610" +puts "============" +puts "" +####################################################################### +# Erased AIS object should not be taken into account by FitAll operation +####################################################################### + +pload VISUALIZATION +vinit +box b1 200 200 200 +vdisplay b1 +vfit +box b2 2 2 2 +vdisplay b2 +set color_1 [vreadpixel 32 305] +verase b1 +vfit +set color_2 [vreadpixel 32 305] +if {$color_1 == $color_2} { + puts "ERROR: OCC24610 is reproduced" +} + +set only_screen 1