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