From: vsv Date: Tue, 12 Nov 2019 14:12:29 +0000 (+0300) Subject: 5.1.5 Sketcher: highlighting of the origin point of trihedron X-Git-Tag: V9_5_0a1~166^2~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a8b21f826f83129ffacd97913880c910c5b77c2;p=modules%2Fshaper.git 5.1.5 Sketcher: highlighting of the origin point of trihedron --- diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index 7ba5bf25a..53e372458 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -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(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 diff --git a/src/SHAPERGUI/SHAPERGUI.h b/src/SHAPERGUI/SHAPERGUI.h index 4530fb9c3..1c5267838 100644 --- a/src/SHAPERGUI/SHAPERGUI.h +++ b/src/SHAPERGUI/SHAPERGUI.h @@ -279,6 +279,7 @@ private slots: bool myIsToolbarsModified; std::vector myOldSelectionColor; + Handle(Graphic3d_AspectMarker3d) myHighlightPointAspect; }; #endif diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 333774a03..0cad0a338 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -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(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(); diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index eb976eb6c..9a1971155 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -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 };