]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Make dynamic highlighting of nodes by ball pictures
authorvsv <vsv@opencascade.com>
Wed, 21 Mar 2018 10:45:46 +0000 (13:45 +0300)
committervsv <vsv@opencascade.com>
Wed, 21 Mar 2018 10:45:46 +0000 (13:45 +0300)
src/ModuleBase/ModuleBase_IViewer.cpp
src/ModuleBase/ModuleBase_IViewer.h
src/ModuleBase/ModuleBase_Tools.cpp
src/XGUI/XGUI_Displayer.cpp

index dc7b8a202ac2a53edf4bba3b5bd03784f0453e79..bb514d31fd0f55ce856cfef67811b942e60b66c7 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "ModuleBase_IViewer.h"
 
+Handle(Prs3d_Drawer) ModuleBase_IViewer::DefaultHighlightDrawer;
+
 ModuleBase_IViewer::ModuleBase_IViewer(QObject* theParent) : QObject(theParent)
 {
 
index 087488ad985a5480922989217ee07fb74c9fa508..c58173af9169b6146c9a1a7b93685e136113fc7e 100644 (file)
@@ -129,6 +129,8 @@ Q_OBJECT
   /// Fit all along Z (perpendicular to display)
   //virtual void Zfitall() = 0;
 
+  static Handle(Prs3d_Drawer) DefaultHighlightDrawer;
+
 signals:
   /// Signal emited when last view window is closed
   void lastViewClosed();
@@ -179,6 +181,7 @@ signals:
   protected:
     /// A map for storing a scale factors dependent on view object
     QMap<Handle(V3d_View), double> myWindowScale;
+
 };
 
 #endif
index 402e40bd886217928741e54bd877951eb59b811f..bd50ee6873953b540653130d56877a4836106cd3 100755 (executable)
@@ -25,6 +25,7 @@
 #include <ModuleBase_WidgetFactory.h>
 #include <ModuleBase_IWorkshop.h>
 #include <ModuleBase_IModule.h>
+#include <ModuleBase_IViewer.h>
 #include <ModuleBase_IconFactory.h>
 #include <ModuleBase_ResultPrs.h>
 #include <ModuleBase_ViewerPrs.h>
@@ -53,6 +54,9 @@
 
 #include <StdSelect_BRepOwner.hxx>
 #include <TopoDS_Iterator.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_PlaneAspect.hxx>
 
 #include <GeomDataAPI_Point2D.h>
 #include <Events_InfoMessage.h>
@@ -1137,11 +1141,13 @@ void setPointBallHighlighting(AIS_Shape* theAIS)
   }
 
   Handle(Graphic3d_AspectMarker3d) anAspect;
-  Handle(Prs3d_Drawer) aDrawer = theAIS->HilightAttributes();
-#ifdef USE_OCCT_720
-  // to do: implement ball highlighting, in 7.2.0 this drawer is NULL
-#else
-/*
+  Handle(Prs3d_Drawer) aDrawer = theAIS->DynamicHilightAttributes();
+  if (aDrawer.IsNull()) {
+    aDrawer = new Prs3d_Drawer(*ModuleBase_IViewer::DefaultHighlightDrawer);
+    if (!aDrawer->HasOwnPointAspect()) {
+      aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_BALL, Quantity_NOC_BLACK, 2.0));
+    }
+  }
   if(aDrawer->HasOwnPointAspect()) {
     Handle(Prs3d_PointAspect) aPntAspect = aDrawer->PointAspect();
     if(aPixMap->IsEmpty()) {
@@ -1157,10 +1163,8 @@ void setPointBallHighlighting(AIS_Shape* theAIS)
       aPntAspect->SetAspect(anAspect);
     }
     aDrawer->SetPointAspect(aPntAspect);
-    theAIS->SetHilightAttributes(aDrawer);
+         theAIS->SetDynamicHilightAttributes(aDrawer);
   }
-  */
-#endif
 }
 
 } // namespace ModuleBase_Tools
index b0dec532345a4f86c6e01b08a53a488e3d879609..6c2f216e38dc4f4b9f61017dab69fbb0c9b61295 100644 (file)
@@ -45,6 +45,7 @@
 #include <ModuleBase_ResultPrs.h>
 #include <ModuleBase_Tools.h>
 #include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_IViewer.h>
 
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_IPresentable.h>
@@ -662,6 +663,7 @@ Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const
       selectionActivate()->deactivateTrihedron(true);
     aContext->DefaultDrawer()->VIsoAspect()->SetNumber(0);
     aContext->DefaultDrawer()->UIsoAspect()->SetNumber(0);
+    ModuleBase_IViewer::DefaultHighlightDrawer = aContext->HighlightStyle();
   }
   return aContext;
 }