ScenegraphWidget.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package MemoryX::gui-plugins::SceneEditor
19 * @date 2015
20 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21 * GNU General Public License
22 */
23
24#pragma once
25
26/* Qt headers */
27#include <QDragEnterEvent>
28#include <QDragMoveEvent>
29#include <QDropEvent>
30#include <QWidget>
31
32/* coin headers */
35#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
36#include <Inventor/nodes/SoPerspectiveCamera.h>
37
38using SceneViewerPtr = std::shared_ptr<scene3D::SceneViewer>;
39
40namespace gui
41{
42 /**
43 * This class provides a widget which holds a scene3D::SceneViewer in which the scene graph is rendered.
44 *
45 * @see scene3D::SceneViewer
46 *
47 */
48 class ScenegraphWidget : public QWidget
49 {
50 Q_OBJECT
51 public:
52 /**
53 * Constructor.
54 * Constructs a scene graph widget.
55 * Expects a controller::ControllerPtr.
56 *
57 * @param control shared pointer to controller::controller
58 * @param parent parent widget
59 *
60 */
61 explicit ScenegraphWidget(const controller::ControllerPtr control, QWidget* parent = 0);
62
63 /**
64 * Destructor.
65 *
66 */
67 ~ScenegraphWidget() override;
68
69 void postDocking();
70
71 protected:
72 /**
73 * Reimplements the function Qt::QWidget:dropEvent().
74 *
75 * This event handler is called when the drag is dropped on this widget.
76 * The event is passed in the <i>event</i> parameter.
77 *
78 * @param dropEvent Qt::DropEvent
79 * @see Qt::DropEvent
80 * @see Qt::QWidget:dropEvent()
81 *
82 */
83 void dropEvent(QDropEvent* de) override;
84
85 /**
86 * Reimplements the function Qt::QWidget:dragMoveEvent();.
87 *
88 * This event handler is called if a drag is in progress, and when any of the following conditions occur:
89 * the cursor enters this widget, the cursor moves within this widget, or a modifier key is pressed on the keyboard while this widget has the focus.
90 * The event is passed in the <i>event</i> parameter.
91 *
92 * @param dropEvent Qt::QDragMoveEvent
93 * @see Qt::QDragMoveEvent
94 * @see Qt::QWidget:dragMoveEvent();
95 *
96 */
97 void dragMoveEvent(QDragMoveEvent* de) override;
98
99 /**
100 * Reimplements the function Qt::QWidget:dragEnterEvent();.
101 *
102 * This event handler is called when a drag is in progress and the mouse enters this widget.
103 * The event is passed in the <i>event</i> parameter.
104 *
105 * @param dropEvent Qt::DragEnterEvent
106 * @see Qt::QDragEnterEvent
107 * @see Qt::QWidget:dragEnterEvent();
108 *
109 */
110 void dragEnterEvent(QDragEnterEvent* event) override;
111
112 Q_SIGNALS:
113
114 public Q_SLOTS:
115 void cameraViewAll();
116 void cameraViewFromX();
117 void cameraViewFromNegX();
118 void cameraViewFromY();
119 void cameraViewFromNegY();
120 void cameraViewFromZ();
121 void cameraViewFromNegZ();
122 void selectToggleAll();
123 void copy();
124 void paste();
125 void duplicate();
126 void resetRotation();
127 void resetTranslation();
128
129 private:
131 SceneViewerPtr viewer;
132 SoPerspectiveCamera* camera;
133 controller::ControllerPtr mainController;
134
135 std::shared_ptr<std::vector<controller::AddOperationPtr>> copyBuffer;
136 };
137} // namespace gui
std::shared_ptr< scene3D::SceneViewer > SceneViewerPtr
void dragEnterEvent(QDragEnterEvent *event) override
Reimplements the function Qt::QWidget:dragEnterEvent();.
ScenegraphWidget(const controller::ControllerPtr control, QWidget *parent=0)
Constructor.
~ScenegraphWidget() override
Destructor.
void dropEvent(QDropEvent *de) override
Reimplements the function Qt::QWidget:dropEvent().
void dragMoveEvent(QDragMoveEvent *de) override
Reimplements the function Qt::QWidget:dragMoveEvent();.
This file is part of ArmarX.
std::weak_ptr< Controller > ControllerWeakPtr
std::shared_ptr< Controller > ControllerPtr