1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 #ifndef XGUI_VIEWERPROXY_H
4 #define XGUI_VIEWERPROXY_H
7 #include <ModuleBase_IViewer.h>
9 #include <AIS_Trihedron.hxx>
12 #include <AppElements_ViewWindow.h>
18 * Proxy class which repersents or AppElements_Viewer or Salome Viewer
19 * dependently on current launching environment.
20 * It is reccomennded to use this class in operation for accessing to viewer
21 * functionality instead of direct access to a viewer
23 class XGUI_EXPORT XGUI_ViewerProxy : public ModuleBase_IViewer
28 /// \param theParent a parent object
29 XGUI_ViewerProxy(XGUI_Workshop* theParent);
31 /// Connects some signals to the viewer from the module connector
32 void connectViewProxy();
34 //! Returns AIS_InteractiveContext from current OCCViewer
35 virtual Handle(AIS_InteractiveContext) AISContext() const;
37 //! Trihedron 3d object shown in the viewer
38 virtual Handle(AIS_Trihedron) trihedron() const;
40 //! Retrurns V3d_Vioewer from current viewer
41 virtual Handle(V3d_Viewer) v3dViewer() const;
43 //! Returns Vsd_View object from currently active view window
44 virtual Handle(V3d_View) activeView() const;
46 virtual QWidget* activeViewPort() const;
48 //! Enable or disable selection in the viewer
49 virtual void enableSelection(bool isEnabled);
51 //! Returns true if selection is enabled
52 virtual bool isSelectionEnabled() const;
54 //! Enable or disable multiselection in the viewer
55 virtual void enableMultiselection(bool isEnable);
57 //! Returns true if multiselection is enabled
58 virtual bool isMultiSelectionEnabled() const;
60 //! Enable or disable draw mode in the viewer
61 virtual bool enableDrawMode(bool isEnabled);
63 //! Sets the view projection
64 /// \param theX the X projection value
65 /// \param theY the Y projection value
66 /// \param theZ the Z projection value
67 /// \param theTwist the twist angle in radians
68 virtual void setViewProjection( double theX, double theY, double theZ,
71 //! Sets the view fitted all
72 virtual void fitAll();
74 /// Connects to a viewer according to current environment
75 void connectToViewer();
77 /// Add selection filter to the viewer
78 virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
80 /// Remove selection filter from the viewer
81 virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
83 /// Returns true if the selection filter is set to the viewer
84 /// \param theFilter a selection filter
85 virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
87 /// Remove all selection filters from the viewer
88 virtual void clearSelectionFilters();
90 /// Update current viewer
91 virtual void update();
93 /// Method returns True if the viewer can process editing objects
94 /// by mouse drugging. If this is impossible thet it has to return False.
95 virtual bool canDragByMouse() const;
97 // Fit all along Z (perpendicular to display)
98 //virtual void Zfitall();
101 /// Emits by mouse entering the view port
102 void enterViewPort();
104 /// Emits by mouse leaving of the view port
105 void leaveViewPort();
108 /// processes the application signals to catch the mouse leaving state of the main window
111 bool eventFilter(QObject *theObject, QEvent *theEvent);
114 void onViewCreated(ModuleBase_IViewWindow* theWnd);
117 void onTryCloseView(AppElements_ViewWindow*);
118 void onDeleteView(AppElements_ViewWindow*);
119 void onViewCreated(AppElements_ViewWindow*);
120 void onActivated(AppElements_ViewWindow*);
122 void onMousePress(AppElements_ViewWindow*, QMouseEvent*);
123 void onMouseRelease(AppElements_ViewWindow*, QMouseEvent*);
124 void onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*);
125 void onMouseMove(AppElements_ViewWindow*, QMouseEvent*);
127 void onKeyPress(AppElements_ViewWindow*, QKeyEvent*);
128 void onKeyRelease(AppElements_ViewWindow*, QKeyEvent*);
130 void onViewTransformed(AppElements_ViewWindow::OperationType);
134 XGUI_Workshop* myWorkshop;