From: vsv Date: Fri, 31 Aug 2018 08:53:10 +0000 (+0300) Subject: Switch On optimization of presentation search and context selection X-Git-Tag: V9_2_0a1~75 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6e27c0b9861c2ea96b6e2d7ea6239e585bc962e0;p=modules%2Fshaper.git Switch On optimization of presentation search and context selection --- 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); }