5 #include "XGUI_Constants.h"
11 #include <V3d_Viewer.hxx>
12 #include <AIS_InteractiveContext.hxx>
13 #include <AIS_Trihedron.hxx>
15 class XGUI_MainWindow;
17 class XGUI_ViewWindow;
23 * \brief Represents a 3d viewer. The viewer manages 3d scene and a set of view windows
24 * when each of view window is a one point of view on this scene.
26 class XGUI_EXPORT XGUI_Viewer: public QObject
30 static QString backgroundData(QStringList&, QIntList&, QIntList&);
32 XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron = true);
35 //! Creates a new view window
36 QMdiSubWindow* createView(V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
38 //! Return pointer on a main window - parent of the Viewer
39 XGUI_MainWindow* mainWindow() const
44 //! Returns OCCT object which manages 3d scene
45 Handle(V3d_Viewer) v3dViewer() const
50 //! Returns OCCT object which manages displaying and selection in 3d scene
51 Handle(AIS_InteractiveContext) AISContext() const
56 //! Trihedron 3d object shown in the viewer
57 Handle(AIS_Trihedron) trihedron() const
62 //! On/Off visibility of the trihedron object
63 void toggleTrihedron();
65 //! Returns true if trihedron is visible
66 bool isTrihedronVisible() const;
68 //! Returns true if trihedron is visible
69 void setTrihedronShown(bool on);
71 //! Returns trihedron size
72 double trihedronSize() const;
74 //! Sets trihedron size
75 void setTrihedronSize(const double sz, bool isRelative);
77 bool trihedronRelative() const
82 void updateTrihedron();
84 //! Compute trihedron size dependent on 3d scene size
85 bool computeTrihedronSize(double& theNewSize, double& theSize);
87 static void setHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
88 Qt::KeyboardModifiers theState, Qt::MouseButtons theButton);
89 static void getHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
90 Qt::KeyboardModifiers& theState, Qt::MouseButtons& theButton);
92 typedef QMap<XGUI::HotOperation, Qt::KeyboardModifiers> StatesMap;
93 typedef QMap<XGUI::HotOperation, Qt::MouseButtons> ButtonsMap;
95 typedef QMap<XGUI::InteractionStyle, StatesMap> InteractionStyle2StatesMap;
96 typedef QMap<XGUI::InteractionStyle, ButtonsMap> InteractionStyle2ButtonsMap;
98 static InteractionStyle2StatesMap myStateMap;
99 static InteractionStyle2ButtonsMap myButtonMap;
102 void lastViewClosed();
103 void tryCloseView(XGUI_ViewWindow* theWindow);
104 void deleteView(XGUI_ViewWindow* theWindow);
105 void viewCreated(XGUI_ViewWindow* theWindow);
106 void mousePress(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
107 void mouseRelease(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
108 void mouseDoubleClick(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
109 void mouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
110 void keyPress(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
111 void keyRelease(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
112 void activated(XGUI_ViewWindow* theWindow);
113 void selectionChanged();
116 void onWindowMinimized(QMdiSubWindow*);
117 void onWindowActivated(QMdiSubWindow*);
120 void onViewClosed(QMdiSubWindow*);
121 void onMouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
122 void onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
125 void addView(QMdiSubWindow* theView);
127 /*! Removes the View from internal Views list.*/
128 void removeView(QMdiSubWindow* theView);
131 XGUI_MainWindow* myMainWindow;
133 Handle(V3d_Viewer) myV3dViewer;Handle(AIS_Trihedron) myTrihedron;Handle(AIS_InteractiveContext) myAISContext;
135 XGUI::InteractionStyle myInteractionStyle;
137 bool myPreselectionEnabled;
138 bool mySelectionEnabled;
139 bool myMultiSelectionEnabled;
142 double myTrihedronSize;
144 QList<QMdiSubWindow*> myViews;
146 QMdiSubWindow* myActiveView;