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