From a4b95ed992cacad075d1ce6e1cffdeadf932cd4c Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 30 Sep 2019 19:09:08 +0300 Subject: [PATCH] Optimize updates of viewer --- src/XGUI/XGUI_ViewerProxy.cpp | 9 ++++++--- src/XGUI/XGUI_ViewerProxy.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index 84e45201e..4cc8abee1 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -486,16 +486,18 @@ void XGUI_ViewerProxy::displayHighlight(FeaturePtr theFeature, const TopoDS_Shap } } -void XGUI_ViewerProxy::eraseHighlight() +bool XGUI_ViewerProxy::eraseHighlight() { Handle(AIS_InteractiveContext) aContext = AISContext(); Handle(AIS_InteractiveObject) anAISIO; AIS_ListIteratorOfListOfInteractive aLIt; + bool isErased = myHighlights.Extent() > 0; for (aLIt.Initialize(myHighlights); aLIt.More(); aLIt.Next()) { anAISIO = aLIt.Value(); aContext->Remove(anAISIO, false); } myHighlights.Clear(); + return isErased; } void XGUI_ViewerProxy::updateHighlight() @@ -531,8 +533,9 @@ void XGUI_ViewerProxy::updateHighlight() } } if (!isDisplayed) { - eraseHighlight(); - aContext->UpdateCurrentViewer(); + if (eraseHighlight()) { + aContext->UpdateCurrentViewer(); + } myResult = ResultPtr(); } } diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index 723aae644..19e23ac3b 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -216,7 +216,7 @@ private slots: private: void displayHighlight(FeaturePtr theFeature, const TopoDS_Shape& theIgnoreShape); - void eraseHighlight(); + bool eraseHighlight(); XGUI_Workshop* myWorkshop; -- 2.30.2