Salome HOME
Merge branch 'Dev_0.6.1' of newgeom:newgeom.git into Dev_0.6.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   ModuleBase_IViewer(QObject* theParent)
25       : QObject(theParent)
26   {
27   }
28
29   //! Returns AIS_InteractiveContext from current OCCViewer
30   virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
31
32   //! Retrurns V3d_Vioewer from current viewer
33   virtual Handle(V3d_Viewer) v3dViewer() const = 0;
34
35   //! Returns Vsd_View object from currently active view window
36   virtual Handle(V3d_View) activeView() const = 0;
37
38   //! Enable or disable selection in the viewer
39   virtual void enableSelection(bool isEnabled) = 0;
40
41   //! Returns true if selection is enabled
42   virtual bool isSelectionEnabled() const = 0;
43
44   //! Enable or disable multiselection in the viewer
45   virtual void enableMultiselection(bool isEnable) = 0;
46
47   //! Returns true if multiselection is enabled
48   virtual bool isMultiSelectionEnabled() const = 0;
49
50   //! Perfroms the fit all for the active view
51   virtual void fitAll() = 0;
52
53   //! Sets the view projection
54   /// \param theX the X projection value
55   /// \param theY the Y projection value
56   /// \param theZ the Z projection value
57   virtual void setViewProjection(double theX, double theY, double theZ) = 0;
58
59   /// Add selection filter to the viewer
60   virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
61
62   /// Remove selection filter from the viewer
63   virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
64
65   /// Remove all selection filters from the viewer
66   virtual void clearSelectionFilters() = 0;
67
68   /// Update current viewer
69   virtual void update() = 0;
70
71 signals:
72   void lastViewClosed();
73   void tryCloseView(ModuleBase_IViewWindow* theWnd);
74   void deleteView(ModuleBase_IViewWindow* theWnd);
75   void viewCreated(ModuleBase_IViewWindow* theWnd);
76   void activated(ModuleBase_IViewWindow* theWnd);
77
78   void mousePress(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
79   void mouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
80   void mouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
81   void mouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
82
83   void keyPress(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
84   void keyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
85
86   void selectionChanged();
87   void contextMenuRequested(QContextMenuEvent*);
88 };
89
90 #endif