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>
8 #include <AppElements_ViewWindow.h>
13 * Proxy class which repersents or AppElements_Viewer or Salome Viewer
14 * dependently on current launching environment.
15 * It is reccomennded to use this class in operation for accessing to viewer
16 * functionality instead of direct access to a viewer
18 class XGUI_EXPORT XGUI_ViewerProxy : public ModuleBase_IViewer
23 /// \param theParent a parent object
24 XGUI_ViewerProxy(XGUI_Workshop* theParent);
26 //! Returns AIS_InteractiveContext from current OCCViewer
27 virtual Handle(AIS_InteractiveContext) AISContext() const;
29 //! Retrurns V3d_Vioewer from current viewer
30 virtual Handle(V3d_Viewer) v3dViewer() const;
32 //! Returns Vsd_View object from currently active view window
33 virtual Handle(V3d_View) activeView() const;
35 //! Enable or disable selection in the viewer
36 virtual void enableSelection(bool isEnabled);
38 //! Returns true if selection is enabled
39 virtual bool isSelectionEnabled() const;
41 //! Enable or disable multiselection in the viewer
42 virtual void enableMultiselection(bool isEnable);
44 //! Returns true if multiselection is enabled
45 virtual bool isMultiSelectionEnabled() const;
47 //! Sets the view projection
48 /// \param theX the X projection value
49 /// \param theY the Y projection value
50 /// \param theZ the Z projection value
51 virtual void setViewProjection(double theX, double theY, double theZ);
53 //! Sets the view fitted all
54 virtual void fitAll();
56 /// Connects to a viewer according to current environment
57 void connectToViewer();
59 /// Add selection filter to the viewer
60 virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
62 /// Remove selection filter from the viewer
63 virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
65 /// Returns true if the selection filter is set to the viewer
66 /// \param theFilter a selection filter
67 virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
69 /// Remove all selection filters from the viewer
70 virtual void clearSelectionFilters();
72 /// Update current viewer
73 virtual void update();
75 /// Method returns True if the viewer can process editing objects
76 /// by mouse drugging. If this is impossible thet it has to return False.
77 virtual bool canDragByMouse() const;
79 // Fit all along Z (perpendicular to display)
80 virtual void Zfitall();
83 /// Emits by mouse entering the view port
86 /// Emits by mouse leaving of the view port
90 /// processes the application signals to catch the mouse leaving state of the main window
93 bool eventFilter(QObject *theObject, QEvent *theEvent);
96 void onTryCloseView(AppElements_ViewWindow*);
97 void onDeleteView(AppElements_ViewWindow*);
98 void onViewCreated(ModuleBase_IViewWindow* theWnd);
99 void onViewCreated(AppElements_ViewWindow*);
100 void onActivated(AppElements_ViewWindow*);
102 void onMousePress(AppElements_ViewWindow*, QMouseEvent*);
103 void onMouseRelease(AppElements_ViewWindow*, QMouseEvent*);
104 void onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*);
105 void onMouseMove(AppElements_ViewWindow*, QMouseEvent*);
107 void onKeyPress(AppElements_ViewWindow*, QKeyEvent*);
108 void onKeyRelease(AppElements_ViewWindow*, QKeyEvent*);
110 void onViewTransformed(AppElements_ViewWindow::OperationType);
113 XGUI_Workshop* myWorkshop;