6#include <ibase/ICommandsProvider.h>
7#include <iqtgui/TDesignerGuiObserverCompBase.h>
8#include <iqtgui/CHierarchicalCommand.h>
9#include <iqtgui/TRestorableGuiWrap.h>
12#include <imt3dview/IScene3dProvider.h>
13#include <imt3dview/IScene3dCamera.h>
14#include <imt3dgui/ISceneEventHandler.h>
15#include <imt3dgui/COpenGLWidget.h>
22class CView3dProviderCompAttrPart1:
23 public iqtgui::TRestorableGuiWrap<iqtgui::TGuiComponentBase<COpenGLWidget>>
26 typedef iqtgui::TRestorableGuiWrap<iqtgui::TGuiComponentBase<COpenGLWidget>> BaseClass;
28 I_BEGIN_BASE_COMPONENT(CView3dProviderCompAttrPart1);
29 I_ASSIGN(m_showViewCommandsAttrPtr,
"ShowViewCommands",
"Show view commands",
true,
true);
30 I_ASSIGN(m_showEditCommandsAttrPtr,
"ShowEditCommands",
"Show commands for editing the 3D-objects",
true,
true);
31 I_ASSIGN(m_showRotationCommandsAttrPtr,
"ShowRotationModeCommands",
"Show rotation mode commands",
true,
true);
32 I_ASSIGN(m_showZoomCommandsAttrPtr,
"ShowZoomCommands",
"Show zoom-in/zoom-out commands",
true,
true);
33 I_ASSIGN(m_showSceneDecorationsCommandsAttrPtr,
"ShowSceneDecorationsCommands",
"Show grid/axis/ruler commands",
true,
true);
34 I_ASSIGN(m_showViewpointCommandsAttrPtr,
"ShowViewpointCommands",
"Show view point commands",
true,
true);
35 I_ASSIGN(m_showViewModeCommandsAttrPtr,
"ShowViewModeCommands",
"Show view mode commands",
true,
true);
36 I_ASSIGN(m_showZoomInCommandAttrPtr,
"ShowShowZoomInCommand",
"Enable command for zoom-in",
true,
false);
37 I_ASSIGN(m_showZoomOutCommandAttrPtr,
"ShowShowZoomOutCommand",
"Enable command for zoom-out",
true,
false);
38 I_ASSIGN(m_showShowGridCommandAttrPtr,
"ShowShowGridCommand",
"Enable command for show/hide grid",
true,
false);
39 I_ASSIGN(m_showShowAxisCommandAttrPtr,
"ShowShowAxisCommands",
"Enable command for show/hide axis",
true,
false);
40 I_ASSIGN(m_showShowRulerCommandAttrPtr,
"ShowShowRulerCommands",
"Enable command for show/hide ruler",
true,
false);
45 I_ATTR(
bool, m_showViewCommandsAttrPtr);
46 I_ATTR(
bool, m_showEditCommandsAttrPtr);
47 I_ATTR(
bool, m_showRotationCommandsAttrPtr);
48 I_ATTR(
bool, m_showZoomCommandsAttrPtr);
49 I_ATTR(
bool, m_showSceneDecorationsCommandsAttrPtr);
50 I_ATTR(
bool, m_showViewpointCommandsAttrPtr);
51 I_ATTR(
bool, m_showViewModeCommandsAttrPtr);
54 I_ATTR(
bool, m_showZoomInCommandAttrPtr);
55 I_ATTR(
bool, m_showZoomOutCommandAttrPtr);
58 I_ATTR(
bool, m_showShowGridCommandAttrPtr);
59 I_ATTR(
bool, m_showShowAxisCommandAttrPtr);
60 I_ATTR(
bool, m_showShowRulerCommandAttrPtr);
63class CView3dProviderCompAttrPart2:
public CView3dProviderCompAttrPart1
66 typedef CView3dProviderCompAttrPart1 BaseClass;
68 I_BEGIN_BASE_COMPONENT(CView3dProviderCompAttrPart2);
69 I_ASSIGN(m_showSetViewFromRightCommandAttrPtr,
"ShowSetViewFromRightCommand",
"Enable command for view from right",
true,
false);
70 I_ASSIGN(m_showSetViewFromFrontCommandAttrPtr,
"ShowSetViewFromFrontCommand",
"Enable command for view from front",
true,
false);
71 I_ASSIGN(m_showSetViewFromTopCommandAttrPtr,
"ShowSetViewFromTopCommand",
"Enable command for view from top",
true,
false);
72 I_ASSIGN(m_showSetViewFromLeftCommandAttrPtr,
"ShowSetViewFromLeftCommand",
"Enable command for view from left",
true,
false);
73 I_ASSIGN(m_showSetViewFromBottomCommandAttrPtr,
"ShowSetViewFromBottomCommand",
"Enable command for view from bottom",
true,
false);
74 I_ASSIGN(m_showSetViewFromBackCommandAttrPtr,
"ShowSetViewFromBackCommand",
"Enable command for view from back",
true,
false);
75 I_ASSIGN(m_showResetViewCommandAttrPtr,
"ShowResetViewCommand",
"Enable command for reset view",
true,
false);
76 I_ASSIGN(m_showPointSelectionCommandAttrPtr,
"ShowPointSelectionCommand",
"Enable command for point selection",
true,
false);
77 I_ASSIGN(m_showBoxSelectionCommandAttrPtr,
"ShowBoxSelectionCommand",
"Enable command for box selection",
true,
false);
78 I_ASSIGN(m_showCircleSelectionCommandAttrPtr,
"ShowCircleSelectionCommand",
"Enable command for circle selection",
true,
false);
79 I_ASSIGN(m_showClearSelectionCommandAttrPtr,
"ShowClearSelectionCommand",
"Enable command for clear selection",
true,
false);
80 I_ASSIGN(m_showAllSelectionCommandAttrPtr,
"ShowAllSelectionCommand",
"Enable command for all selection",
true,
false);
81 I_ASSIGN(m_showInvertSelectionCommandAttrPtr,
"ShowInvertSelectionCommand",
"Enable command for invert selection",
true,
false);
82 I_ASSIGN(m_showDeleteSelectionCommandAttrPtr,
"ShowDeleteSelectionCommand",
"Enable command for delete selection",
true,
false);
87 I_ATTR(
bool, m_showSetViewFromRightCommandAttrPtr);
88 I_ATTR(
bool, m_showSetViewFromFrontCommandAttrPtr);
89 I_ATTR(
bool, m_showSetViewFromTopCommandAttrPtr);
90 I_ATTR(
bool, m_showSetViewFromLeftCommandAttrPtr);
91 I_ATTR(
bool, m_showSetViewFromBottomCommandAttrPtr);
92 I_ATTR(
bool, m_showSetViewFromBackCommandAttrPtr);
93 I_ATTR(
bool, m_showResetViewCommandAttrPtr);
96 I_ATTR(
bool, m_showPointSelectionCommandAttrPtr);
97 I_ATTR(
bool, m_showBoxSelectionCommandAttrPtr);
98 I_ATTR(
bool, m_showCircleSelectionCommandAttrPtr);
99 I_ATTR(
bool, m_showClearSelectionCommandAttrPtr);
100 I_ATTR(
bool, m_showAllSelectionCommandAttrPtr);
101 I_ATTR(
bool, m_showInvertSelectionCommandAttrPtr);
102 I_ATTR(
bool, m_showDeleteSelectionCommandAttrPtr);
106class CView3dProviderCompAttrPart3:
public CView3dProviderCompAttrPart2
109 typedef CView3dProviderCompAttrPart2 BaseClass;
111 I_BEGIN_BASE_COMPONENT(CView3dProviderCompAttrPart3);
112 I_ASSIGN(m_showFreeRotationCommandAttrPtr,
"ShowFreeRotationCommand",
"Enable command for free rotation",
true,
false);
113 I_ASSIGN(m_showRotationAroundXCommandAttrPtr,
"ShowRotationAroundXCommand",
"Enable command for rotation around axis X",
true,
false);
114 I_ASSIGN(m_showRotationAroundYCommandAttrPtr,
"ShowRotationAroundYCommand",
"Enable command for rotation around axis Y",
true,
false);
115 I_ASSIGN(m_showRotationAroundZCommandAttrPtr,
"ShowRotationAroundZCommand",
"Enable command for rotation around axis Z",
true,
false);
116 I_ASSIGN(m_showViewModeCommandAttrPtr,
"ShowViewModeCommand",
"Show view mode command",
true,
false);
117 I_ASSIGN(m_showSelectionModeCommandAttrPtr,
"ShowSelectionModeCommand",
"Show selection mode command",
true,
false);
118 I_ASSIGN(m_defaultsUseAntialiasingAttrPtr,
"UseAntialiasing",
"Use rendering antialiasing",
true,
true);
119 I_ASSIGN(m_defaultsUseCullfaceAttrPtr,
"UseCullFace",
"Use cull face mode",
true,
true);
120 I_ASSIGN(m_defaultsUseBlendAttrPtr,
"UseBlend",
"Use blending mode",
true,
true);
125 I_ATTR(
bool, m_showFreeRotationCommandAttrPtr);
126 I_ATTR(
bool, m_showRotationAroundXCommandAttrPtr);
127 I_ATTR(
bool, m_showRotationAroundYCommandAttrPtr);
128 I_ATTR(
bool, m_showRotationAroundZCommandAttrPtr);
131 I_ATTR(
bool, m_showViewModeCommandAttrPtr);
132 I_ATTR(
bool, m_showSelectionModeCommandAttrPtr);
135 I_ATTR(
bool, m_defaultsUseAntialiasingAttrPtr);
136 I_ATTR(
bool, m_defaultsUseCullfaceAttrPtr);
137 I_ATTR(
bool, m_defaultsUseBlendAttrPtr);
141class CView3dProviderComp:
142 public CView3dProviderCompAttrPart3,
143 virtual public ibase::ICommandsProvider,
144 virtual public imt3dview::IScene3dProvider,
145 virtual public ISceneEventHandler
150 typedef CView3dProviderCompAttrPart3 BaseClass;
159 CG_SELECTION_ACTIONS,
166 I_BEGIN_COMPONENT(CView3dProviderComp);
167 I_REGISTER_INTERFACE(ibase::ICommandsProvider);
168 I_REGISTER_INTERFACE(imt3dview::IScene3dProvider);
169 I_REGISTER_SUBELEMENT(Scene);
171 I_ASSIGN(m_cameraCompPtr,
"Camera",
"Camera",
true,
"Camera");
174 CView3dProviderComp();
177 virtual void OnShowGrid(
bool show)
override;
178 virtual void OnShowAxis(
bool show)
override;
179 virtual void OnShowRuler(
bool show)
override;
180 virtual void OnPointSelection(
const QPoint& point,
bool clearPreviousSelection)
override;
181 virtual void OnBoxSelection(
const QRect& rect,
bool clearPreviousSelection)
override;
182 virtual void OnCircleSelection(
const QRect& rect,
bool clearPreviousSelection)
override;
183 virtual void OnClearSelection()
override;
184 virtual void OnAllSelection()
override;
185 virtual void OnInvertSelection()
override;
186 virtual void OnDeleteSelection()
override;
187 virtual bool OnMousePress(QMouseEvent& e)
override;
188 virtual bool OnMouseMove(QMouseEvent& e)
override;
189 virtual bool OnMouseRelease(QMouseEvent& e)
override;
195 virtual const ibase::IHierarchicalCommand* GetCommands()
const override;
199 virtual void OnRestoreSettings(
const QSettings& settings)
override;
200 virtual void OnSaveSettings(QSettings& settings)
const override;
203 virtual void OnGuiCreated()
override;
204 virtual void OnGuiRetranslate()
override;
205 virtual void OnGuiDesignChanged()
override;
208 iqtgui::CHierarchicalCommand& GetShowGridCommand();
209 iqtgui::CHierarchicalCommand& GetShowAxisCommand();
214 void OnShowGridCommand(
bool checked);
215 void OnShowAxisCommand(
bool checked);
216 void OnShowRulerCommand(
bool checked);
218 void OnViewFromRight();
219 void OnViewFromFront();
220 void OnViewFromTop();
221 void OnViewFromLeft();
222 void OnViewFromBottom();
223 void OnViewFromBack();
224 void OnUseAntialiasingCommand(
bool checked);
225 void OnUseCullFaceCommand(
bool checked);
226 void OnPointSelectionCommand(
bool checked);
227 void OnBoxSelectionCommand(
bool checked);
228 void OnCircleSelectionCommand(
bool checked);
229 void OnClearSelectionCommand();
230 void OnAllSelectionCommand();
231 void OnInvertSelectionCommand();
232 void OnDeleteSelectionCommand();
233 void OnFreeRotationCommand();
234 void OnRotationAroundXCommand();
235 void OnRotationAroundYCommand();
236 void OnRotationAroundZCommand();
237 void OnViewModeCommand();
238 void OnSelectionModeCommand();
239 void OnPerspectiveModeCommand();
240 void OnOrthoModeCommand();
244 template <
class InterfaceType>
245 static InterfaceType* ExtractScene(CView3dProviderComp& component)
247 COpenGLWidget* widgetPtr =
dynamic_cast<COpenGLWidget*
>(component.GetWidget());
248 if (widgetPtr != NULL){
249 return widgetPtr->GetScene();
255 void EnableCommands(COpenGLWidget::ViewMode viewMode);
256 void UpdateCommands();
260 iqtgui::CHierarchicalCommand m_rootCommands;
261 iqtgui::CHierarchicalCommand m_viewCommands;
262 iqtgui::CHierarchicalCommand m_editCommands;
263 iqtgui::CHierarchicalCommand m_rotationCommands;
266 iqtgui::CHierarchicalCommand m_zoomInCommand;
267 iqtgui::CHierarchicalCommand m_zoomOutCommand;
270 iqtgui::CHierarchicalCommand m_showGridCommand;
271 iqtgui::CHierarchicalCommand m_showAxisCommand;
272 iqtgui::CHierarchicalCommand m_showRulerCommand;
275 iqtgui::CHierarchicalCommand m_setViewFromRightCommand;
276 iqtgui::CHierarchicalCommand m_setViewFromFrontCommand;
277 iqtgui::CHierarchicalCommand m_setViewFromTopCommand;
278 iqtgui::CHierarchicalCommand m_setViewFromLeftCommand;
279 iqtgui::CHierarchicalCommand m_setViewFromBottomCommand;
280 iqtgui::CHierarchicalCommand m_setViewFromBackCommand;
281 iqtgui::CHierarchicalCommand m_resetViewCommand;
284 iqtgui::CHierarchicalCommand m_useAntialiasingCommand;
285 iqtgui::CHierarchicalCommand m_useCullFaceCommand;
288 iqtgui::CHierarchicalCommand m_pointSelectionCommand;
289 iqtgui::CHierarchicalCommand m_boxSelectionCommand;
290 iqtgui::CHierarchicalCommand m_circleSelectionCommand;
291 iqtgui::CHierarchicalCommand m_clearSelectionCommand;
292 iqtgui::CHierarchicalCommand m_allSelectionCommand;
293 iqtgui::CHierarchicalCommand m_invertSelectionCommand;
294 iqtgui::CHierarchicalCommand m_deleteSelectionCommand;
297 iqtgui::CHierarchicalCommand m_freeRotationCommand;
298 iqtgui::CHierarchicalCommand m_rotationAroundXCommand;
299 iqtgui::CHierarchicalCommand m_rotationAroundYCommand;
300 iqtgui::CHierarchicalCommand m_rotationAroundZCommand;
303 iqtgui::CHierarchicalCommand m_viewModeCommand;
304 iqtgui::CHierarchicalCommand m_selectionModeCommand;
307 iqtgui::CHierarchicalCommand m_perspectiveModeCommand;
308 iqtgui::CHierarchicalCommand m_orthoModeCommand;