From 8bb96a9760013ea61e1c5884bb8155db3bf6a465 Mon Sep 17 00:00:00 2001 From: aba Date: Thu, 13 Feb 2014 13:09:42 +0400 Subject: [PATCH] 0024358: TKV3d - connected structures are not re-computed on device lost Graphic3d_StructureManager::ReComputeStructures() method was corrected to consider all child (connected) structures. Corrected remarks: added image dump in test case; corrected method name. --- src/Graphic3d/Graphic3d_StructureManager.cdl | 7 ++++- src/Graphic3d/Graphic3d_StructureManager.cxx | 19 +++++++++++-- src/Visual3d/Visual3d_View.cxx | 2 +- tests/bugs/vis/bug24358 | 30 ++++++++++++++++++++ 4 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 tests/bugs/vis/bug24358 diff --git a/src/Graphic3d/Graphic3d_StructureManager.cdl b/src/Graphic3d/Graphic3d_StructureManager.cdl index 187548bfad..14652c3dce 100644 --- a/src/Graphic3d/Graphic3d_StructureManager.cdl +++ b/src/Graphic3d/Graphic3d_StructureManager.cdl @@ -459,10 +459,15 @@ is ---Purpose: Suppress the highlighting on the structure . ---Category: Private methods - ReComputeStructures (me: mutable); + RecomputeStructures (me: mutable); -- Purpose: Recomputes all displayed structures. Used to recompute GL -- resources after the last view has been closed without removing objects. + RecomputeStructures (me: mutable; + theStructures : MapOfStructure from Graphic3d) + is private; + ---Purpose: Recomputes all structures from theStructures. + -- fields diff --git a/src/Graphic3d/Graphic3d_StructureManager.cxx b/src/Graphic3d/Graphic3d_StructureManager.cxx index f64b974273..62324f22fd 100644 --- a/src/Graphic3d/Graphic3d_StructureManager.cxx +++ b/src/Graphic3d/Graphic3d_StructureManager.cxx @@ -369,13 +369,26 @@ const Handle(Graphic3d_GraphicDriver)& Graphic3d_StructureManager::GraphicDriver } -void Graphic3d_StructureManager::ReComputeStructures() +void Graphic3d_StructureManager::RecomputeStructures() { + // Go through all unique structures including child (connected) ones and ensure that they are computed. + Graphic3d_MapOfStructure aStructNetwork; + for (Graphic3d_MapIteratorOfMapOfStructure anIter(MyDisplayedStructure); anIter.More(); anIter.Next()) { Handle(Graphic3d_Structure) aStructure = anIter.Key(); + anIter.Key()->Network (anIter.Key(), Graphic3d_TOC_DESCENDANT, aStructNetwork); + } + + RecomputeStructures (aStructNetwork); +} - aStructure->Clear(); - aStructure->Compute(); +void Graphic3d_StructureManager::RecomputeStructures (const Graphic3d_MapOfStructure& theStructures) +{ + for (Graphic3d_MapIteratorOfMapOfStructure anIter (theStructures); anIter.More(); anIter.Next()) + { + Handle(Graphic3d_Structure) aStruct = anIter.Key(); + aStruct->Clear(); + aStruct->Compute(); } } diff --git a/src/Visual3d/Visual3d_View.cxx b/src/Visual3d/Visual3d_View.cxx index 6bd3d52e68..d5f3db9217 100644 --- a/src/Visual3d/Visual3d_View.cxx +++ b/src/Visual3d/Visual3d_View.cxx @@ -1117,7 +1117,7 @@ void Visual3d_View::Update (const Handle(Visual3d_Layer)& AnUnderLayer, const Ha if (MyGraphicDriver->IsDeviceLost()) { - MyViewManager->ReComputeStructures(); + MyViewManager->RecomputeStructures(); MyGraphicDriver->ResetDeviceLostFlag(); } diff --git a/tests/bugs/vis/bug24358 b/tests/bugs/vis/bug24358 new file mode 100644 index 0000000000..e6fb3cc8b7 --- /dev/null +++ b/tests/bugs/vis/bug24358 @@ -0,0 +1,30 @@ +puts "===========" +puts "OCC24358" +puts "===========" +puts "" +########################################################################### +# 0024358: TKV3d - connected structures are not re-computed on device lost +########################################################################### + +set Image1 $imagedir/${casename}_1.png +set Image2 $imagedir/${casename}_2.png + +pload MODELING +pload VISUALIZATION +box b1 0 0 0 1 2 3 +box b2 3 0 0 3 2 1 +vinit View1 +vclear +vaxo +vsetdispmode 1 +vconnectsh b1c -3 0 0 1 0 0 0 0 1 b1 b2 +vfit + +vdump $Image1 + +vclose View1 1 +vinit View1 +vdisplay b1c +vfit + +vdump $Image2 -- 2.20.1