]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_ViewerProxy.h
Salome HOME
Update code documentation
[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    /// Constructor
23    /// \param theParent a parent object
24   XGUI_ViewerProxy(XGUI_Workshop* theParent);
25
26   //! Returns AIS_InteractiveContext from current OCCViewer
27   virtual Handle(AIS_InteractiveContext) AISContext() const;
28
29   //! Retrurns V3d_Vioewer from current viewer
30   virtual Handle(V3d_Viewer) v3dViewer() const;
31
32   //! Returns Vsd_View object from currently active view window
33   virtual Handle(V3d_View) activeView() const;
34
35   //! Enable or disable selection in the viewer
36   virtual void enableSelection(bool isEnabled);
37
38   //! Returns true if selection is enabled
39   virtual bool isSelectionEnabled() const;
40
41   //! Enable or disable multiselection in the viewer
42   virtual void enableMultiselection(bool isEnable);
43
44   //! Returns true if multiselection is enabled
45   virtual bool isMultiSelectionEnabled() const;
46
47   //! Sets the view projection
48   /// \param theX the X projection value
49   /// \param theY the Y projection value
50   /// \param theZ the Z projection value
51   virtual void setViewProjection(double theX, double theY, double theZ);
52
53   //! Sets the view fitted all
54   virtual void fitAll();
55
56   /// Connects to a viewer according to current environment
57   void connectToViewer();
58
59   /// Add selection filter to the viewer
60   virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
61
62   /// Remove selection filter from the viewer
63   virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
64
65   /// Remove all selection filters from the viewer
66   virtual void clearSelectionFilters();
67
68   /// Update current viewer
69   virtual void update();
70
71 private slots:
72   void onTryCloseView(AppElements_ViewWindow*);
73   void onDeleteView(AppElements_ViewWindow*);
74   void onViewCreated(AppElements_ViewWindow*);
75   void onActivated(AppElements_ViewWindow*);
76
77   void onMousePress(AppElements_ViewWindow*, QMouseEvent*);
78   void onMouseRelease(AppElements_ViewWindow*, QMouseEvent*);
79   void onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*);
80   void onMouseMove(AppElements_ViewWindow*, QMouseEvent*);
81
82   void onKeyPress(AppElements_ViewWindow*, QKeyEvent*);
83   void onKeyRelease(AppElements_ViewWindow*, QKeyEvent*);
84
85  private:
86   XGUI_Workshop* myWorkshop;
87 };
88
89 #endif