1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #ifndef ModuleBase_IViewer_H
4 #define ModuleBase_IViewer_H
6 #include "ModuleBase.h"
8 #include <AIS_InteractiveContext.hxx>
9 #include <V3d_View.hxx>
13 class QContextMenuEvent;
14 class ModuleBase_IViewWindow;
17 * A Base object for definition of connector object to
18 * Salome Viewer. Reimplemented in NewGeom_SalomeViewer class
20 class MODULEBASE_EXPORT ModuleBase_IViewer : public QObject
25 /// \param theParent a parent object
26 ModuleBase_IViewer(QObject* theParent)
31 //! Returns AIS_InteractiveContext from current OCCViewer
32 virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
34 //! Retrurns V3d_Vioewer from current viewer
35 virtual Handle(V3d_Viewer) v3dViewer() const = 0;
37 //! Returns Vsd_View object from currently active view window
38 virtual Handle(V3d_View) activeView() const = 0;
40 //! Enable or disable selection in the viewer
41 //! \param isEnabled is enable or disable flag
42 virtual void enableSelection(bool isEnabled) = 0;
44 //! Returns true if selection is enabled
45 virtual bool isSelectionEnabled() const = 0;
47 //! Enable or disable multiselection in the viewer
48 //! \param isEnable is enable or disable flag
49 virtual void enableMultiselection(bool isEnable) = 0;
51 //! Returns true if multiselection is enabled
52 virtual bool isMultiSelectionEnabled() const = 0;
54 //! Perfroms the fit all for the active view
55 virtual void fitAll() = 0;
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;
63 /// Add selection filter to the viewer
64 /// \param theFilter a selection filter
65 virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
67 /// Remove selection filter from the viewer
68 /// \param theFilter a selection filter
69 virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
71 /// Remove all selection filters from the viewer
72 virtual void clearSelectionFilters() = 0;
74 /// Update current viewer
75 virtual void update() = 0;
78 /// Signal emited when last view window is closed
79 void lastViewClosed();
81 /// Signal emited before view window is closed
82 void tryCloseView(ModuleBase_IViewWindow* theWnd);
84 /// Signal emited on delete view window
85 void deleteView(ModuleBase_IViewWindow* theWnd);
87 /// Signal emited on creation of view window
88 void viewCreated(ModuleBase_IViewWindow* theWnd);
90 /// Signal emited on key release
91 void activated(ModuleBase_IViewWindow* theWnd);
93 /// Signal emited on mouse press
94 void mousePress(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
96 /// Signal emited on mouse release
97 void mouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
99 /// Signal emited on mouse double click
100 void mouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
102 /// Signal emited on mouse move
103 void mouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
105 /// Signal emited on key press
106 void keyPress(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
108 /// Signal emited on key release
109 void keyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
111 /// Signal emited on selection changed
112 void selectionChanged();
114 /// Signal emited on selection changed
115 void contextMenuRequested(QContextMenuEvent*);