From: vsv Date: Mon, 30 Sep 2019 16:09:08 +0000 (+0300) Subject: Optimize updates of viewer X-Git-Tag: V9_4_0a2~4^2~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a4b95ed992cacad075d1ce6e1cffdeadf932cd4c;p=modules%2Fshaper.git Optimize updates of viewer --- 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;