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 virtual QWidget* activeViewPort() const;
40 //! Enable or disable selection in the viewer
41 virtual void enableSelection(bool isEnabled);
43 //! Returns true if selection is enabled
44 virtual bool isSelectionEnabled() const;
46 //! Enable or disable multiselection in the viewer
47 virtual void enableMultiselection(bool isEnable);
49 //! Returns true if multiselection is enabled
50 virtual bool isMultiSelectionEnabled() const;
52 //! Enable or disable draw mode in the viewer
53 virtual bool enableDrawMode(bool isEnabled);
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,
63 //! Sets the view fitted all
64 virtual void fitAll();
66 /// Connects to a viewer according to current environment
67 void connectToViewer();
69 /// Add selection filter to the viewer
70 virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
72 /// Remove selection filter from the viewer
73 virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
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);
79 /// Remove all selection filters from the viewer
80 virtual void clearSelectionFilters();
82 /// Update current viewer
83 virtual void update();
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;
89 // Fit all along Z (perpendicular to display)
90 virtual void Zfitall();
93 /// Emits by mouse entering the view port
96 /// Emits by mouse leaving of the view port
100 /// processes the application signals to catch the mouse leaving state of the main window
103 bool eventFilter(QObject *theObject, QEvent *theEvent);
106 void onViewCreated(ModuleBase_IViewWindow* theWnd);
109 void onTryCloseView(AppElements_ViewWindow*);
110 void onDeleteView(AppElements_ViewWindow*);
111 void onViewCreated(AppElements_ViewWindow*);
112 void onActivated(AppElements_ViewWindow*);
114 void onMousePress(AppElements_ViewWindow*, QMouseEvent*);
115 void onMouseRelease(AppElements_ViewWindow*, QMouseEvent*);
116 void onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*);
117 void onMouseMove(AppElements_ViewWindow*, QMouseEvent*);
119 void onKeyPress(AppElements_ViewWindow*, QKeyEvent*);
120 void onKeyRelease(AppElements_ViewWindow*, QKeyEvent*);
122 void onViewTransformed(AppElements_ViewWindow::OperationType);
126 XGUI_Workshop* myWorkshop;