Salome HOME
Merge branch 'Dev_1.2.0' of newgeom:newgeom into Dev_1.2.0
[modules/shaper.git] / src / NewGeom / NewGeom_SalomeViewer.h
index c0d1ec6ce7008a2a24c40396520ad68ede17f7d3..b02058daa824f627f902124eeb499148cd240597 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 
 #ifndef NewGeom_SalomeViewer_H
 #define NewGeom_SalomeViewer_H
@@ -5,19 +7,69 @@
 #include "NewGeom.h"
 
 #include <ModuleBase_IViewer.h>
+#include <ModuleBase_IViewWindow.h>
+
+#include <OCCViewer_ViewWindow.h>
+
+#include <V3d_View.hxx>
 
 class SUIT_ViewWindow;
 class QMouseEvent;
 class QKeyEvent;
 
 class NewGeom_OCCSelector;
+class OCCViewer_Viewer;
+class SUIT_ViewManager;
+
+/**
+* \ingroup Salome
+* A class for providing access of NewGeom functionality to 
+* SALOME view window functionality
+*/
+class NewGeom_SalomeView: public ModuleBase_IViewWindow
+{
+public:
+  /// Constructor
+  /// \param theViewer a reference to a viewer
+  NewGeom_SalomeView(OCCViewer_Viewer* theViewer);
+
+  virtual Handle(V3d_View) v3dView() const;
 
+  /// Returns the view window view port
+  virtual QWidget* viewPort() const;
+
+  /// Set the current viewer
+  /// \param theViewer a viewer instance
+  void setViewer(OCCViewer_Viewer* theViewer) { myViewer = theViewer; }
+
+  /// Returns current viewer
+  OCCViewer_Viewer* viewer() const { return myViewer; }
+
+  /// Sets the current view
+  void setCurrentView(SUIT_ViewWindow* theView) { myCurrentView = theView; }
+
+private:
+  /// A reference to a viewer
+  OCCViewer_Viewer* myViewer;
+  SUIT_ViewWindow* myCurrentView;
+};
+
+
+/**
+* \ingroup Salome
+* A class for providing access of NewGeom functionality to 
+* SALOME viewer functionality
+*/
 class NewGeom_SalomeViewer : public ModuleBase_IViewer
 {
 Q_OBJECT
  public:
+   /// Constructor
+   /// \param theParent a parent object
   NewGeom_SalomeViewer(QObject* theParent);
 
+  ~NewGeom_SalomeViewer();
+
   //! Returns AIS_InteractiveContext from current OCCViewer
   virtual Handle(AIS_InteractiveContext) AISContext() const;
 
@@ -48,6 +100,8 @@ Q_OBJECT
   /// \param theZ the Z projection value
   virtual void setViewProjection(double theX, double theY, double theZ);
 
+  /// Set selector
+  /// \param theSel a selector instance
   void setSelector(NewGeom_OCCSelector* theSel);
 
   /// Add selection filter to the viewer
@@ -59,23 +113,40 @@ Q_OBJECT
   /// Remove all selection filters from the viewer
   virtual void clearSelectionFilters();
 
+  /// Returns current selector
   NewGeom_OCCSelector* selector() const
   {
     return mySelector;
   }
 
+  /// Update current viewer
+  virtual void update();
+
+  /// Method returns True if the viewer can process editing objects 
+  /// by mouse drugging. If this is impossible thet it has to return False.
+  virtual bool canDragByMouse() const;
+
  private slots:
-  // TODO: Provide ModuleBase_IViewWindow interface
-  //void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
-  //void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
-  //void onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*);
-  //void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
-  //void onKeyPress(SUIT_ViewWindow*, QKeyEvent*);
-  //void onKeyRelease(SUIT_ViewWindow*, QKeyEvent*);
+  void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
+  void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
+  void onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*);
+  void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
+  void onKeyPress(SUIT_ViewWindow*, QKeyEvent*);
+  void onKeyRelease(SUIT_ViewWindow*, QKeyEvent*);
+
+  void onTryCloseView(SUIT_ViewWindow*);
+  void onDeleteView(SUIT_ViewWindow*);
+  void onViewCreated(SUIT_ViewWindow*);
+  void onActivated(SUIT_ViewWindow*);
+
+  void onSelectionChanged();
+  void onViewTransformed(OCCViewer_ViewWindow::OperationType);
 
  private:
   NewGeom_OCCSelector* mySelector;
-
+  NewGeom_SalomeView* myView;
+  bool myIsSelectionChanged;
 };
 
+
 #endif