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;
18 * A Base object for definition of connector object to
19 * Salome Viewer. Reimplemented in NewGeom_SalomeViewer class
21 class MODULEBASE_EXPORT ModuleBase_IViewer : public QObject
26 /// \param theParent a parent object
27 ModuleBase_IViewer(QObject* theParent)
32 //! Returns AIS_InteractiveContext from current OCCViewer
33 virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
35 //! Retrurns V3d_Vioewer from current viewer
36 virtual Handle(V3d_Viewer) v3dViewer() const = 0;
38 //! Returns Vsd_View object from currently active view window
39 virtual Handle(V3d_View) activeView() const = 0;
41 //! Enable or disable selection in the viewer
42 //! \param isEnabled is enable or disable flag
43 virtual void enableSelection(bool isEnabled) = 0;
45 //! Returns true if selection is enabled
46 virtual bool isSelectionEnabled() const = 0;
48 //! Enable or disable multiselection in the viewer
49 //! \param isEnable is enable or disable flag
50 virtual void enableMultiselection(bool isEnable) = 0;
52 //! Returns true if multiselection is enabled
53 virtual bool isMultiSelectionEnabled() const = 0;
55 //! Perfroms the fit all for the active view
56 virtual void fitAll() = 0;
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;
64 /// Add selection filter to the viewer
65 /// \param theFilter a selection filter
66 virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
68 /// Remove selection filter from the viewer
69 /// \param theFilter a selection filter
70 virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
72 /// Remove all selection filters from the viewer
73 virtual void clearSelectionFilters() = 0;
75 /// Update current viewer
76 virtual void update() = 0;
78 /// Method returns True if the viewer can process editing objects
79 /// by mouse drugging. If this is impossible thet it has to return False.
80 virtual bool canDragByMouse() const { return true; }
83 /// Signal emited when last view window is closed
84 void lastViewClosed();
86 /// Signal emited before view window is closed
87 void tryCloseView(ModuleBase_IViewWindow* theWnd);
89 /// Signal emited on delete view window
90 void deleteView(ModuleBase_IViewWindow* theWnd);
92 /// Signal emited on creation of view window
93 void viewCreated(ModuleBase_IViewWindow* theWnd);
95 /// Signal emited on key release
96 void activated(ModuleBase_IViewWindow* theWnd);
98 /// Signal emited on mouse press
99 void mousePress(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
101 /// Signal emited on mouse release
102 void mouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
104 /// Signal emited on mouse double click
105 void mouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
107 /// Signal emited on mouse move
108 void mouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
110 /// Signal emited on key press
111 void keyPress(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
113 /// Signal emited on key release
114 void keyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
116 /// Signal emited on selection changed
117 void selectionChanged();
119 /// Signal emited on selection changed
120 void contextMenuRequested(QContextMenuEvent*);
122 /// Signal emitted on transformation of view point in view window
123 /// \param theTransformation type of transformation (see AppElements_ViewWindow::OperationType)
124 void viewTransformed(int theTransformation);