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>
10 #include <AppElements_ViewWindow.h>
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
21 class XGUI_EXPORT XGUI_ViewerProxy : public ModuleBase_IViewer
26 /// \param theParent a parent object
27 XGUI_ViewerProxy(XGUI_Workshop* theParent);
29 //! Returns AIS_InteractiveContext from current OCCViewer
30 virtual Handle(AIS_InteractiveContext) AISContext() const;
32 //! Retrurns V3d_Vioewer from current viewer
33 virtual Handle(V3d_Viewer) v3dViewer() const;
35 //! Returns Vsd_View object from currently active view window
36 virtual Handle(V3d_View) activeView() const;
38 //! Enable or disable selection in the viewer
39 virtual void enableSelection(bool isEnabled);
41 //! Returns true if selection is enabled
42 virtual bool isSelectionEnabled() const;
44 //! Enable or disable multiselection in the viewer
45 virtual void enableMultiselection(bool isEnable);
47 //! Returns true if multiselection is enabled
48 virtual bool isMultiSelectionEnabled() const;
50 //! Enable or disable draw mode in the viewer
51 virtual bool enableDrawMode(bool isEnabled);
53 //! Sets the view projection
54 /// \param theX the X projection value
55 /// \param theY the Y projection value
56 /// \param theZ the Z projection value
57 /// \param theTwist the twist angle in radians
58 virtual void setViewProjection( double theX, double theY, double theZ,
61 //! Sets the view fitted all
62 virtual void fitAll();
64 /// Connects to a viewer according to current environment
65 void connectToViewer();
67 /// Add selection filter to the viewer
68 virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
70 /// Remove selection filter from the viewer
71 virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
73 /// Returns true if the selection filter is set to the viewer
74 /// \param theFilter a selection filter
75 virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
77 /// Remove all selection filters from the viewer
78 virtual void clearSelectionFilters();
80 /// Update current viewer
81 virtual void update();
83 /// Method returns True if the viewer can process editing objects
84 /// by mouse drugging. If this is impossible thet it has to return False.
85 virtual bool canDragByMouse() const;
87 // Fit all along Z (perpendicular to display)
88 virtual void Zfitall();
91 /// Emits by mouse entering the view port
94 /// Emits by mouse leaving of the view port
98 /// processes the application signals to catch the mouse leaving state of the main window
101 bool eventFilter(QObject *theObject, QEvent *theEvent);
104 void onViewCreated(ModuleBase_IViewWindow* theWnd);
107 void onTryCloseView(AppElements_ViewWindow*);
108 void onDeleteView(AppElements_ViewWindow*);
109 void onViewCreated(AppElements_ViewWindow*);
110 void onActivated(AppElements_ViewWindow*);
112 void onMousePress(AppElements_ViewWindow*, QMouseEvent*);
113 void onMouseRelease(AppElements_ViewWindow*, QMouseEvent*);
114 void onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*);
115 void onMouseMove(AppElements_ViewWindow*, QMouseEvent*);
117 void onKeyPress(AppElements_ViewWindow*, QKeyEvent*);
118 void onKeyRelease(AppElements_ViewWindow*, QKeyEvent*);
120 void onViewTransformed(AppElements_ViewWindow::OperationType);
124 XGUI_Workshop* myWorkshop;