]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_ViewerProxy.h
Salome HOME
#1042 Sometimes when setting distance constraints, the input field is not displayed...
[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 #ifndef HAVE_SALOME
10   #include <AppElements_ViewWindow.h>
11 #endif
12
13 class XGUI_Workshop;
14 /**
15  * \ingroup GUI
16  * Proxy class which repersents or AppElements_Viewer or Salome Viewer
17  * dependently on current launching environment.
18  * It is reccomennded to use this class in operation for accessing to viewer 
19  * functionality instead of direct access to a viewer
20  */
21 class XGUI_EXPORT XGUI_ViewerProxy : public ModuleBase_IViewer
22 {
23 Q_OBJECT
24  public:
25    /// Constructor
26    /// \param theParent a parent object
27   XGUI_ViewerProxy(XGUI_Workshop* theParent);
28
29   //! Returns AIS_InteractiveContext from current OCCViewer
30   virtual Handle(AIS_InteractiveContext) AISContext() const;
31
32   //! Retrurns V3d_Vioewer from current viewer
33   virtual Handle(V3d_Viewer) v3dViewer() const;
34
35   //! Returns Vsd_View object from currently active view window
36   virtual Handle(V3d_View) activeView() const;
37
38   virtual QWidget* activeViewPort() const;
39
40   //! Enable or disable selection in the viewer
41   virtual void enableSelection(bool isEnabled);
42
43   //! Returns true if selection is enabled
44   virtual bool isSelectionEnabled() const;
45
46   //! Enable or disable multiselection in the viewer
47   virtual void enableMultiselection(bool isEnable);
48
49   //! Returns true if multiselection is enabled
50   virtual bool isMultiSelectionEnabled() const;
51
52   //! Enable or disable draw mode in the viewer
53   virtual bool enableDrawMode(bool isEnabled);
54
55   //! Sets the view projection
56   /// \param theX the X projection value
57   /// \param theY the Y projection value
58   /// \param theZ the Z projection value
59   /// \param theTwist the twist angle in radians
60   virtual void setViewProjection( double theX, double theY, double theZ,
61                                   double theTwist );
62
63   //! Sets the view fitted all
64   virtual void fitAll();
65
66   /// Connects to a viewer according to current environment
67   void connectToViewer();
68
69   /// Add selection filter to the viewer
70   virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
71
72   /// Remove selection filter from the viewer
73   virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
74
75   /// Returns true if the selection filter is set to the viewer
76   /// \param theFilter a selection filter
77   virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
78
79   /// Remove all selection filters from the viewer
80   virtual void clearSelectionFilters();
81
82   /// Update current viewer
83   virtual void update();
84
85   /// Method returns True if the viewer can process editing objects 
86   /// by mouse drugging. If this is impossible thet it has to return False.
87   virtual bool canDragByMouse() const;
88
89   // Fit all along Z (perpendicular to display)
90   virtual void Zfitall();
91
92 signals:
93   /// Emits by mouse entering the view port
94   void enterViewPort();
95
96   /// Emits by mouse leaving of the view port
97   void leaveViewPort();
98
99 protected:
100   /// processes the application signals to catch the mouse leaving state of the main window
101   /// \param theObject
102   /// \param theEvent
103   bool eventFilter(QObject *theObject, QEvent *theEvent);
104
105 private slots:
106   void onViewCreated(ModuleBase_IViewWindow* theWnd);
107
108 #ifndef HAVE_SALOME
109   void onTryCloseView(AppElements_ViewWindow*);
110   void onDeleteView(AppElements_ViewWindow*);
111   void onViewCreated(AppElements_ViewWindow*);
112   void onActivated(AppElements_ViewWindow*);
113
114   void onMousePress(AppElements_ViewWindow*, QMouseEvent*);
115   void onMouseRelease(AppElements_ViewWindow*, QMouseEvent*);
116   void onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*);
117   void onMouseMove(AppElements_ViewWindow*, QMouseEvent*);
118
119   void onKeyPress(AppElements_ViewWindow*, QKeyEvent*);
120   void onKeyRelease(AppElements_ViewWindow*, QKeyEvent*);
121
122   void onViewTransformed(AppElements_ViewWindow::OperationType);
123 #endif
124
125  private:
126   XGUI_Workshop* myWorkshop;
127 };
128
129 #endif