]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
5.1.5 Sketcher: highlighting of the origin point of trihedron
authorvsv <vsv@opencascade.com>
Tue, 12 Nov 2019 14:12:29 +0000 (17:12 +0300)
committervsv <vsv@opencascade.com>
Tue, 12 Nov 2019 14:12:29 +0000 (17:12 +0300)
src/SHAPERGUI/SHAPERGUI.cpp
src/SHAPERGUI/SHAPERGUI.h
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h

index 7ba5bf25a0c084aab2f0ac16ad9e5bf61de414d2..53e372458ba3f0d2f40090438e2965b62a5e30ff 100644 (file)
@@ -322,6 +322,11 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
     XGUI_Displayer* aDisp = myWorkshop->displayer();
     QObjectPtrList aObjList = aDisp->displayedObjects();
 
+    if (myHighlightPointAspect.IsNull()) {
+      Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
+      myHighlightPointAspect =
+        new Graphic3d_AspectMarker3d(aTrihedron->getHighlightPointAspect()->Aspect().operator*());
+    }
     if (myOldSelectionColor.size() == 0)
       myOldSelectionColor = aDisp->selectionColor();
 
@@ -403,6 +408,11 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy)
   }
   // Delete selector because it has to be redefined on next activation
   if (mySelector) {
+    if (!myHighlightPointAspect.IsNull()) {
+      Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
+      aTrihedron->getHighlightPointAspect()->SetAspect(myHighlightPointAspect);
+      myHighlightPointAspect.Nullify();
+    }
     myWorkshop->displayer()->setSelectionColor(myOldSelectionColor);
     myProxyViewer->setSelector(0);
     delete mySelector;
@@ -537,6 +547,12 @@ SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr)
 {
   if (theMgr->getType() == OCCViewer_Viewer::Type()) {
     OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(theMgr->getViewModel());
+
+    if (myHighlightPointAspect.IsNull()) {
+      Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron();
+      myHighlightPointAspect =
+        new Graphic3d_AspectMarker3d(aTrihedron->getHighlightPointAspect()->Aspect().operator*());
+    }
     SHAPERGUI_OCCSelector* aSelector = new SHAPERGUI_OCCSelector(aViewer,
                                                                  getApp()->selectionMgr());
 #ifdef SALOME_PATCH_FOR_CTRL_WHEEL
index 4530fb9c34fd50b9d810b74158125a68c33d001a..1c52678385d50ea1ab3a12f52032bbd8579d5f45 100644 (file)
@@ -279,6 +279,7 @@ private slots:
   bool myIsToolbarsModified;
 
   std::vector<int> myOldSelectionColor;
+  Handle(Graphic3d_AspectMarker3d) myHighlightPointAspect;
 };
 
 #endif
index 333774a030d70a5f28b9d18d83f4115aa7e3aded..0cad0a338282492468c158ccff18a4955f5b6283 100644 (file)
@@ -123,7 +123,7 @@ QString qIntListInfo(const QIntList& theValues, const QString& theSeparator = QS
 //**************************************************************
 XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
 : myWorkshop(theWorkshop), myNeedUpdate(false),
-  myViewerBlockedRecursiveCount(0), myIsFirstAISContextUse(true)
+  myViewerBlockedRecursiveCount(0), myContextId(0)
 {
   myCustomPrs = std::shared_ptr<GeomAPI_ICustomPrs>(new XGUI_CustomPrs(theWorkshop));
 }
@@ -640,18 +640,19 @@ void XGUI_Displayer::updateViewer() const
 Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const
 {
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
-  if (!aContext.IsNull() && myIsFirstAISContextUse/*&& !aContext->HasOpenedContext()*/) {
-    XGUI_Displayer* aDisplayer = (XGUI_Displayer*)this;
-    aDisplayer->myIsFirstAISContextUse = false;
+  if (!aContext.IsNull() && (myContextId != aContext.get())) {
+    myContextId = aContext.get();
     if (!myWorkshop->selectionActivate()->isTrihedronActive())
       selectionActivate()->deactivateTrihedron(true);
     aContext->DefaultDrawer()->VIsoAspect()->SetNumber(0);
     aContext->DefaultDrawer()->UIsoAspect()->SetNumber(0);
 
-    ModuleBase_IViewer::DefaultHighlightDrawer = aContext->HighlightStyle();
-
+    Handle(AIS_Trihedron) aTrihedron = myWorkshop->viewer()->trihedron();
+    aTrihedron->getHighlightPointAspect()->SetScale(2.0);
+    aTrihedron->getHighlightPointAspect()->SetTypeOfMarker(Aspect_TOM_O_STAR);
 
     // Commented out according to discussion in bug #2825
+    //ModuleBase_IViewer::DefaultHighlightDrawer = aContext->HighlightStyle();
     //Handle(Prs3d_Drawer) aSelStyle = aContext->SelectionStyle();
     //double aDeflection =
     //  QString(ModelAPI_ResultConstruction::DEFAULT_DEFLECTION().c_str()).toDouble();
index eb976eb6ccff296df60f62c1bd3a923df45ee816..9a19711551c673b084e58da59be4c8e2b65a5474 100644 (file)
@@ -475,7 +475,7 @@ private:
   /// Number of blocking of the viewer update. The viewer is updated only if it is zero
   int myViewerBlockedRecursiveCount;
 
-  bool myIsFirstAISContextUse; ///< Flag: first asking of AIS context: trihedron activation
+  mutable void* myContextId;
   mutable bool myNeedUpdate; ///< A flag that update was requested but not done
 };