Salome HOME
A sketcher operations manager is created
[modules/shaper.git] / src / XGUI / XGUI_ViewerProxy.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 #ifndef XGUI_VIEWERPROXY_H
4 #define XGUI_VIEWERPROXY_H
5
6 #include "XGUI.h"
7 #include <ModuleBase_IViewer.h>
8
9 class XGUI_Workshop;
10 class AppElements_ViewWindow;
11
12 /**
13  * Proxy class which repersents or AppElements_Viewer or Salome Viewer
14  * dependently on current launching environment.
15  * It is reccomennded to use this class in operation for accessing to viewer 
16  * functionality instead of direct access to a viewer
17  */
18 class XGUI_EXPORT XGUI_ViewerProxy : public ModuleBase_IViewer
19 {
20 Q_OBJECT
21  public:
22   XGUI_ViewerProxy(XGUI_Workshop* theParent);
23
24   //! Returns AIS_InteractiveContext from current OCCViewer
25   virtual Handle(AIS_InteractiveContext) AISContext() const;
26
27   //! Retrurns V3d_Vioewer from current viewer
28   virtual Handle(V3d_Viewer) v3dViewer() const;
29
30   //! Returns Vsd_View object from currently active view window
31   virtual Handle(V3d_View) activeView() const;
32
33   //! Enable or disable selection in the viewer
34   virtual void enableSelection(bool isEnabled);
35
36   //! Returns true if selection is enabled
37   virtual bool isSelectionEnabled() const;
38
39   //! Enable or disable multiselection in the viewer
40   virtual void enableMultiselection(bool isEnable);
41
42   //! Returns true if multiselection is enabled
43   virtual bool isMultiSelectionEnabled() const;
44
45   //! Sets the view projection
46   /// \param theX the X projection value
47   /// \param theY the Y projection value
48   /// \param theZ the Z projection value
49   virtual void setViewProjection(double theX, double theY, double theZ);
50
51   //! Sets the view fitted all
52   virtual void fitAll();
53
54   /// Connects to a viewer according to current environment
55   void connectToViewer();
56
57   /// Add selection filter to the viewer
58   virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
59
60   /// Remove selection filter from the viewer
61   virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
62
63   /// Remove all selection filters from the viewer
64   virtual void clearSelectionFilters();
65
66   /// Update current viewer
67   virtual void update();
68
69 private slots:
70   void onTryCloseView(AppElements_ViewWindow*);
71   void onDeleteView(AppElements_ViewWindow*);
72   void onViewCreated(AppElements_ViewWindow*);
73   void onActivated(AppElements_ViewWindow*);
74
75   void onMousePress(AppElements_ViewWindow*, QMouseEvent*);
76   void onMouseRelease(AppElements_ViewWindow*, QMouseEvent*);
77   void onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*);
78   void onMouseMove(AppElements_ViewWindow*, QMouseEvent*);
79
80   void onKeyPress(AppElements_ViewWindow*, QKeyEvent*);
81   void onKeyRelease(AppElements_ViewWindow*, QKeyEvent*);
82
83  private:
84   XGUI_Workshop* myWorkshop;
85 };
86
87 #endif