Salome HOME
Merge branch 'Dev_0.7.1' of newgeom:newgeom.git into Dev_0.7.1
[modules/shaper.git] / src / ModuleBase / ModuleBase_IViewer.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #ifndef ModuleBase_IViewer_H
4 #define ModuleBase_IViewer_H
5
6 #include "ModuleBase.h"
7 #include <QObject>
8 #include <AIS_InteractiveContext.hxx>
9 #include <V3d_View.hxx>
10
11 class QMouseEvent;
12 class QKeyEvent;
13 class QContextMenuEvent;
14 class ModuleBase_IViewWindow;
15
16 /**
17  * \ingroup GUI
18  * A Base object for definition of connector object to
19  * Salome Viewer. Reimplemented in NewGeom_SalomeViewer class
20  */
21 class MODULEBASE_EXPORT ModuleBase_IViewer : public QObject
22 {
23 Q_OBJECT
24  public:
25    /// Constructor
26    /// \param theParent a parent object
27   ModuleBase_IViewer(QObject* theParent)
28       : QObject(theParent)
29   {
30   }
31
32   //! Returns AIS_InteractiveContext from current OCCViewer
33   virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
34
35   //! Retrurns V3d_Vioewer from current viewer
36   virtual Handle(V3d_Viewer) v3dViewer() const = 0;
37
38   //! Returns Vsd_View object from currently active view window
39   virtual Handle(V3d_View) activeView() const = 0;
40
41   //! Enable or disable selection in the viewer
42   //! \param isEnabled is enable or disable flag
43   virtual void enableSelection(bool isEnabled) = 0;
44
45   //! Returns true if selection is enabled
46   virtual bool isSelectionEnabled() const = 0;
47
48   //! Enable or disable multiselection in the viewer
49   //! \param isEnable is enable or disable flag
50   virtual void enableMultiselection(bool isEnable) = 0;
51
52   //! Returns true if multiselection is enabled
53   virtual bool isMultiSelectionEnabled() const = 0;
54
55   //! Perfroms the fit all for the active view
56   virtual void fitAll() = 0;
57
58   //! Sets the view projection
59   /// \param theX the X projection value
60   /// \param theY the Y projection value
61   /// \param theZ the Z projection value
62   virtual void setViewProjection(double theX, double theY, double theZ) = 0;
63
64   /// Add selection filter to the viewer
65   /// \param theFilter a selection filter
66   virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
67
68   /// Remove selection filter from the viewer
69   /// \param theFilter a selection filter
70   virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
71
72   /// Remove all selection filters from the viewer
73   virtual void clearSelectionFilters() = 0;
74
75   /// Update current viewer
76   virtual void update() = 0;
77
78 signals:
79   /// Signal emited when last view window is closed
80   void lastViewClosed();
81
82   /// Signal emited before view window is closed
83   void tryCloseView(ModuleBase_IViewWindow* theWnd);
84
85   /// Signal emited on delete view window
86   void deleteView(ModuleBase_IViewWindow* theWnd);
87
88   /// Signal emited on creation of view window
89   void viewCreated(ModuleBase_IViewWindow* theWnd);
90
91   /// Signal emited on key release
92   void activated(ModuleBase_IViewWindow* theWnd);
93
94   /// Signal emited on mouse press
95   void mousePress(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
96
97   /// Signal emited on mouse release
98   void mouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
99
100   /// Signal emited on mouse double click
101   void mouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
102
103   /// Signal emited on mouse move
104   void mouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
105
106   /// Signal emited on key press
107   void keyPress(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
108
109   /// Signal emited on key release
110   void keyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
111
112   /// Signal emited on selection changed
113   void selectionChanged();
114
115   /// Signal emited on selection changed
116   void contextMenuRequested(QContextMenuEvent*);
117 };
118
119 #endif