From e11850fd239fe18ce7e50ac2f7ae89ded12105dc Mon Sep 17 00:00:00 2001 From: vpa Date: Thu, 4 Jun 2015 14:37:52 +0300 Subject: [PATCH] 0026284: Visualization - eliminate recursion in SelectMgr_SelectionManager Small correction of test case for issue CR26284 --- src/QABugs/QABugs_19.cxx | 37 ++++++++++++++++++++ src/SelectMgr/SelectMgr_SelectionManager.cxx | 19 +++------- tests/bugs/vis/bug26284 | 15 ++++++++ 3 files changed, 56 insertions(+), 15 deletions(-) create mode 100644 tests/bugs/vis/bug26284 diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index 0fa1943827..6bcc1c3185 100755 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -3489,6 +3489,42 @@ static Standard_Integer OCC26172 (Draw_Interpretor& theDI, Standard_Integer theA return 0; } +//======================================================================= +//function : OCC26284 +//purpose : +//======================================================================= +static Standard_Integer OCC26284 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec) +{ + if (theArgNb != 1) + { + std::cerr << "Error: wrong number of arguments! See usage:\n"; + theDI.PrintHelp (theArgVec[0]); + return 1; + } + + Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext(); + if (anAISContext.IsNull()) + { + std::cerr << "Error: no active view. Please call vinit.\n"; + return 1; + } + + BRepPrimAPI_MakeSphere aSphereBuilder (gp_Pnt (0.0, 0.0, 0.0), 1.0); + Handle(AIS_Shape) aSphere = new AIS_Shape (aSphereBuilder.Shape()); + anAISContext->Display (aSphere); + for (Standard_Integer aChildIdx = 0; aChildIdx < 5; ++aChildIdx) + { + BRepPrimAPI_MakeSphere aBuilder (gp_Pnt (1.0 + aChildIdx, 1.0 + aChildIdx, 1.0 + aChildIdx), 1.0); + Handle(AIS_Shape) aChild = new AIS_Shape (aBuilder.Shape()); + aSphere->AddChild (aChild); + anAISContext->Display (aChild); + } + + anAISContext->RecomputeSelectionOnly (aSphere); + + return 0; +} + #include #include @@ -3698,5 +3734,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) { theCommands.Add ("xprojponf", "xprojponf p f", __FILE__, xprojponf, group); theCommands.Add ("OCC24923", "OCC24923", __FILE__, OCC24923, group); theCommands.Add ("OCC26139", "OCC26139 [-boxsize value] [-boxgrid value] [-compgrid value]", __FILE__, OCC26139, group); + theCommands.Add ("OCC26284", "OCC26284", __FILE__, OCC26284, group); return; } diff --git a/src/SelectMgr/SelectMgr_SelectionManager.cxx b/src/SelectMgr/SelectMgr_SelectionManager.cxx index 3ded691d2c..88ff77cbd2 100644 --- a/src/SelectMgr/SelectMgr_SelectionManager.cxx +++ b/src/SelectMgr/SelectMgr_SelectionManager.cxx @@ -515,7 +515,7 @@ void SelectMgr_SelectionManager::ClearSelectionStructures (const Handle(SelectMg { for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObj->Children()); anChildrenIter.More(); anChildrenIter.Next()) { - ClearSelectionStructures (theObj, theMode, theSelector); + ClearSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector); } if (!theObj->HasOwnPresentations()) @@ -575,7 +575,7 @@ void SelectMgr_SelectionManager::RestoreSelectionStructures (const Handle(Select { for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObj->Children()); anChildrenIter.More(); anChildrenIter.Next()) { - RestoreSelectionStructures (theObj, theMode, theSelector); + RestoreSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector); } if (!theObj->HasOwnPresentations()) @@ -687,7 +687,6 @@ void SelectMgr_SelectionManager::RecomputeSelection (const Handle(SelectMgr_Sele for(theObject->Init(); theObject->More(); theObject->Next()) { const Handle(SelectMgr_Selection)& aSelection = theObject->CurrentSelection(); - aSelection->UpdateStatus (SelectMgr_TOU_Full); Standard_Integer aSelMode = aSelection->Mode(); for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) @@ -695,23 +694,13 @@ void SelectMgr_SelectionManager::RecomputeSelection (const Handle(SelectMgr_Sele const Handle(SelectMgr_ViewerSelector)& aCurSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key()); if (aCurSelector->Status (aSelection) == SelectMgr_SOS_Activated) { - switch (aSelection->UpdateStatus()) - { - case SelectMgr_TOU_Full: ClearSelectionStructures (theObject, aSelMode, aCurSelector); theObject->RecomputePrimitives(aSelMode); RestoreSelectionStructures (theObject, aSelMode, aCurSelector); - case SelectMgr_TOU_Partial: - theObject->UpdateTransformations (aSelection); - aCurSelector->RebuildObjectsTree(); - aSelection->UpdateBVHStatus (SelectMgr_TBU_None); - break; - default: - break; - } - aSelection->UpdateStatus (SelectMgr_TOU_None); } } + aSelection->UpdateStatus (SelectMgr_TOU_None); + aSelection->UpdateBVHStatus (SelectMgr_TBU_None); } } diff --git a/tests/bugs/vis/bug26284 b/tests/bugs/vis/bug26284 new file mode 100644 index 0000000000..413c63670d --- /dev/null +++ b/tests/bugs/vis/bug26284 @@ -0,0 +1,15 @@ +puts "========" +puts "OCC26284" +puts "========" +puts "" +################################################################## +puts "Visualization - eliminate recursion in SelectMgr_SelectionManager" +################################################################## + +pload QAcommands VISUALIZATION + +vinit +OCC26284 + +vfit +set only_screen 1