From: vsv Date: Mon, 9 Sep 2019 16:46:26 +0000 (+0300) Subject: Adapt Fitter to SALOME X-Git-Tag: V9_4_0a2~4^2~119^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=be50c0a41def4063277aff4eddac4a8667250f8b;p=modules%2Fshaper.git Adapt Fitter to SALOME --- diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h index 825879490..e4c4a7dcc 100644 --- a/src/ModuleBase/ModuleBase_IViewer.h +++ b/src/ModuleBase/ModuleBase_IViewer.h @@ -32,6 +32,11 @@ class QMouseEvent; class QKeyEvent; class QContextMenuEvent; class ModuleBase_IViewWindow; +#ifdef HAVE_SALOME +class OCCViewer_Fitter; +#else +class AppElements_Fitter; +#endif /** * \ingroup GUI @@ -192,8 +197,20 @@ Q_OBJECT myShowHighlight = false; } +#ifdef HAVE_SALOME + virtual void setFitter(OCCViewer_Fitter* theFitter) = 0; + virtual OCCViewer_Fitter* currentFitter() const = 0; +#else + virtual void setFitter(AppElements_Fitter* theFitter) = 0; + virtual AppElements_Fitter* currentFitter() const = 0; +#endif + + virtual void unsetFitter() = 0; + + static Handle(Prs3d_Drawer) DefaultHighlightDrawer; + signals: /// Signal emited when last view window is closed void lastViewClosed(); diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 1576ff0b1..0f2b51f3b 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -1101,16 +1101,14 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) workshop()->viewer()->set2dMode(true); PartSet_Fitter* aFitter = new PartSet_Fitter(myCurrentSketch); - XGUI_Workshop* aWorkshop = aConnector->workshop(); - aWorkshop->viewer()->setFitter(aFitter); + myModule->workshop()->viewer()->setFitter(aFitter); } void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) { XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); - XGUI_Workshop* aWorkshop = aConnector->workshop(); - PartSet_Fitter* aFitter = (PartSet_Fitter*)aWorkshop->viewer()->currentFitter(); - aWorkshop->viewer()->unsetFitter(); + PartSet_Fitter* aFitter = (PartSet_Fitter*)myModule->workshop()->viewer()->currentFitter(); + myModule->workshop()->viewer()->unsetFitter(); delete aFitter; myIsMouseOverWindow = false; diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp index 785c67f2a..92113150b 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp @@ -576,6 +576,24 @@ void SHAPERGUI_SalomeViewer::setColorScaleTitle(const QString& theText) } } +void SHAPERGUI_SalomeViewer::setFitter(OCCViewer_Fitter* theFitter) +{ + if (mySelector) + mySelector->viewer()->setFitter(theFitter); +} + +OCCViewer_Fitter* SHAPERGUI_SalomeViewer::currentFitter() const +{ + if (mySelector) + return mySelector->viewer()->currentFitter(); + return 0; +} + +void SHAPERGUI_SalomeViewer::unsetFitter() +{ + if (mySelector) + mySelector->viewer()->unsetFitter(); +} //void SHAPERGUI_SalomeViewer::Zfitall() diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h index 588eafff0..ba778d1df 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h @@ -208,6 +208,10 @@ Q_OBJECT // \param theText is a title virtual void setColorScaleTitle(const QString& theText); + virtual void setFitter(OCCViewer_Fitter* theFitter); + virtual OCCViewer_Fitter* currentFitter() const; + virtual void unsetFitter(); + // Fit all along Z (perpendicular to display) //virtual void Zfitall(); diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index d87e4fcfa..b1cbec119 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -170,14 +170,14 @@ Q_OBJECT //virtual void Zfitall(); #ifdef HAVE_SALOME - void setFitter(OCCViewer_Fitter* theFitter); - OCCViewer_Fitter* currentFitter() const; + virtual void setFitter(OCCViewer_Fitter* theFitter); + virtual OCCViewer_Fitter* currentFitter() const; #else - void setFitter(AppElements_Fitter* theFitter); - AppElements_Fitter* currentFitter() const; + virtual void setFitter(AppElements_Fitter* theFitter); + virtual AppElements_Fitter* currentFitter() const; #endif - void unsetFitter(); + virtual void unsetFitter(); signals: /// Emits by mouse entering the view port