4 #include "XGUI_Constants.h"
10 #include <V3d_Viewer.hxx>
11 #include <AIS_InteractiveContext.hxx>
12 #include <AIS_Trihedron.hxx>
14 class XGUI_MainWindow;
16 class XGUI_ViewWindow;
22 * \brief Represents a 3d viewer. The viewer manages 3d scene and a set of view windows
23 * when each of view window is a one point of view on this scene.
25 class XGUI_Viewer: public QObject
29 static QString backgroundData(QStringList&, QIntList&, QIntList&);
31 XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron = true);
34 //! Creates a new view window
35 QMdiSubWindow* createView(V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
37 //! Return pointer on a main window - parent of the Viewer
38 XGUI_MainWindow* mainWindow() const
43 //! Returns OCCT object which manages 3d scene
44 Handle(V3d_Viewer) v3dViewer() const
49 //! Returns OCCT object which manages displaying and selection in 3d scene
50 Handle(AIS_InteractiveContext) AISContext() const
55 //! Trihedron 3d object shown in the viewer
56 Handle(AIS_Trihedron) trihedron() const
61 //! On/Off visibility of the trihedron object
62 void toggleTrihedron();
64 //! Returns true if trihedron is visible
65 bool isTrihedronVisible() const;
67 //! Returns true if trihedron is visible
68 void setTrihedronShown(bool on);
70 //! Returns trihedron size
71 double trihedronSize() const;
73 //! Sets trihedron size
74 void setTrihedronSize(const double sz, bool isRelative);
76 bool trihedronRelative() const
81 void updateTrihedron();
83 //! Compute trihedron size dependent on 3d scene size
84 bool computeTrihedronSize(double& theNewSize, double& theSize);
86 static void setHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
87 Qt::KeyboardModifiers theState, Qt::MouseButtons theButton);
88 static void getHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
89 Qt::KeyboardModifiers& theState, Qt::MouseButtons& theButton);
91 typedef QMap<XGUI::HotOperation, Qt::KeyboardModifiers> StatesMap;
92 typedef QMap<XGUI::HotOperation, Qt::MouseButtons> ButtonsMap;
94 typedef QMap<XGUI::InteractionStyle, StatesMap> InteractionStyle2StatesMap;
95 typedef QMap<XGUI::InteractionStyle, ButtonsMap> InteractionStyle2ButtonsMap;
97 static InteractionStyle2StatesMap myStateMap;
98 static InteractionStyle2ButtonsMap myButtonMap;
101 void lastViewClosed();
102 void tryCloseView(XGUI_ViewWindow* theWindow);
103 void deleteView(XGUI_ViewWindow* theWindow);
104 void viewCreated(XGUI_ViewWindow* theWindow);
105 void mousePress(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
106 void mouseRelease(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
107 void mouseDoubleClick(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
108 void mouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
109 void keyPress(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
110 void keyRelease(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
111 void activated(XGUI_ViewWindow* theWindow);
114 void onViewClosed(QMdiSubWindow*);
115 //void onViewMapped();
116 void onWindowActivated(QMdiSubWindow*);
119 void addView(QMdiSubWindow* theView);
121 /*! Removes the View from internal Views list.*/
122 void removeView(QMdiSubWindow* theView);
125 XGUI_MainWindow* myMainWindow;
127 Handle(V3d_Viewer) myV3dViewer;Handle(AIS_Trihedron) myTrihedron;Handle(AIS_InteractiveContext) myAISContext;
129 XGUI::InteractionStyle myInteractionStyle;
131 bool myPreselectionEnabled;
132 bool mySelectionEnabled;
133 bool myMultiSelectionEnabled;
136 double myTrihedronSize;
138 QList<QMdiSubWindow*> myViews;
140 QMdiSubWindow* myActiveView;