]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Switch On optimization of presentation search and context selection
authorvsv <vsv@opencascade.com>
Fri, 31 Aug 2018 08:53:10 +0000 (11:53 +0300)
committervsv <vsv@opencascade.com>
Fri, 31 Aug 2018 08:53:10 +0000 (11:53 +0300)
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_ViewerProxy.cpp

index 5989035e77546e069d7ee5703a3ff09ce5c9cfea..d409df9272a066f98dc93d8ddbb9fd30024c5539 100644 (file)
@@ -48,6 +48,8 @@ class ModelAPI_Feature;
 class XGUI_SelectionActivate;
 class XGUI_Workshop;
 
+#define OPTIMIZE_PRS
+
 #ifdef TINSPECTOR
 class VInspectorAPI_CallBack;
 #endif
index 8687cba0648e66485909f7e2492ff3f831f82dd5..d763573e353fb6cccda447eec738675b03c3ffdf 100644 (file)
@@ -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);
 }