]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Adapt Fitter to SALOME Custom_Fitter
authorvsv <vsv@opencascade.com>
Mon, 9 Sep 2019 16:46:26 +0000 (19:46 +0300)
committervsv <vsv@opencascade.com>
Mon, 9 Sep 2019 16:46:26 +0000 (19:46 +0300)
src/ModuleBase/ModuleBase_IViewer.h
src/PartSet/PartSet_SketcherMgr.cpp
src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp
src/SHAPERGUI/SHAPERGUI_SalomeViewer.h
src/XGUI/XGUI_ViewerProxy.h

index 825879490a387c63b1a17f6aa1386c9117d109ff..e4c4a7dcc3c750d87f72603acc3483314d9f4274 100644 (file)
@@ -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();
index 1576ff0b1e61b4cae4b34ded6ec5295608ccc9ac..0f2b51f3b0c5e7dd43e32df5d7cbb0e9dbfdfc3c 100644 (file)
@@ -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<XGUI_ModuleConnector*>(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;
index 785c67f2a6220c2018bdf86a3e33f05754755484..92113150bb02d245513679bcefcc0fee1a2b103b 100644 (file)
@@ -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()
index 588eafff0c1c958cbb39f28760f5f77601bf08a7..ba778d1dfd3f77f251ebef82c65ebefdd8d25f74 100644 (file)
@@ -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();
 
index d87e4fcfaa3a67274d7e3af3fa74cfdadd20862c..b1cbec119a6dfcfd7fd6e40ae16f0c77842b3175 100644 (file)
@@ -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