From 6e27c0b9861c2ea96b6e2d7ea6239e585bc962e0 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 31 Aug 2018 11:53:10 +0300 Subject: [PATCH] Switch On optimization of presentation search and context selection --- src/XGUI/XGUI_Displayer.h | 2 ++ src/XGUI/XGUI_ViewerProxy.cpp | 61 +++++++++++++++++------------------ 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index 5989035e7..d409df927 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -48,6 +48,8 @@ class ModelAPI_Feature; class XGUI_SelectionActivate; class XGUI_Workshop; +#define OPTIMIZE_PRS + #ifdef TINSPECTOR class VInspectorAPI_CallBack; #endif diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index 8687cba06..d763573e3 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -319,37 +319,36 @@ void XGUI_ViewerProxy::eraseHighlight() void XGUI_ViewerProxy::onMouseMove(AppElements_ViewWindow* theWnd, QMouseEvent* theEvent) { - // vsv: Display prehighlighting of detected object - //Handle(AIS_InteractiveContext) aContext = AISContext(); - //if (!aContext.IsNull()) { - // Handle(SelectMgr_EntityOwner) aOwner; - // Handle(AIS_InteractiveObject) anIO; - // ObjectPtr aObj; - // bool isDisplayed = false; - // XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - // for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) { - // aOwner = aContext->DetectedOwner(); - // anIO = Handle(AIS_InteractiveObject)::DownCast(aOwner->Selectable()); - // aObj = aDisplayer->getObject(anIO); - // if (aObj.get()) { - // FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); - // if (aFeature.get()) { - // if (aFeature != myFeature) { - // eraseHighlight(); - // myFeature = aFeature; - // displayHighlight(); - // aContext->UpdateCurrentViewer(); - // } - // isDisplayed = true; - // } - // } - // } - // if (!isDisplayed) { - // eraseHighlight(); - // aContext->UpdateCurrentViewer(); - // myFeature = FeaturePtr(); - // } - //} + Handle(AIS_InteractiveContext) aContext = AISContext(); + if (!aContext.IsNull()) { + Handle(SelectMgr_EntityOwner) aOwner; + Handle(AIS_InteractiveObject) anIO; + ObjectPtr aObj; + bool isDisplayed = false; + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) { + aOwner = aContext->DetectedOwner(); + anIO = Handle(AIS_InteractiveObject)::DownCast(aOwner->Selectable()); + aObj = aDisplayer->getObject(anIO); + if (aObj.get()) { + FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); + if (aFeature.get()) { + if (aFeature != myFeature) { + eraseHighlight(); + myFeature = aFeature; + displayHighlight(); + aContext->UpdateCurrentViewer(); + } + isDisplayed = true; + } + } + } + if (!isDisplayed) { + eraseHighlight(); + aContext->UpdateCurrentViewer(); + myFeature = FeaturePtr(); + } + } emit mouseMove(theWnd, theEvent); } -- 2.39.2