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