ViewerWidget.h
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @package ArmarX::
17* @author Mirko Waechter ( mirko.waechter at kit dot edu)
18* @date 2012
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#pragma once
24
25#include <QWidget>
26
29
30#define ARMARX_VIEWER_NAME "Visualization.3D Viewer"
31
32class SoSeparator;
33
34class QComboBox;
35class QPushButton;
36class QLabel;
37class QToolBar;
38class Ui_Viewer3DWidget;
39class Ui_ViewerWidgetConfigDialog;
40
41namespace armarx
42{
44 {
45 float position[3];
46 float orientation[4];
47 float focalDistance = 5.f;
48 };
49
50 struct Viewer3DInfo;
51
52 /**
53 * \brief The Viewer3DWidget class
54 */
56 {
57 Q_OBJECT
58
59 public:
60 explicit Viewer3DWidget(QWidget* parent = 0);
61 ~Viewer3DWidget() override;
62
63 // inherited from ArmarXWidgetController
64 QString
65 getWidgetName() const override
66 {
67 return GetWidgetName();
68 }
69
70 static QString
72 {
73 return ARMARX_VIEWER_NAME;
74 }
75
76 void loadSettings(QSettings* settings) override;
77 void saveSettings(QSettings* settings) override;
78 void setMainWindow(QMainWindow* mainWindow) override;
79
80 void postDocking() override;
81
82 /*!
83 * \brief This mutex is used to protect 3d scene updates.
84 * \param mutex3D
85 */
86 void setMutex3D(RecursiveMutexPtr const& mutex3D) override;
87
88 QPointer<QWidget> getCustomTitlebarWidget(QWidget* parent = 0) override;
89
91 SoSeparator* emptyNode;
92 QPointer<QComboBox> cb3DViewers;
93 QPointer<QPushButton> sceneConfigDialogButton;
94 QPointer<QLabel> label;
95 void setNode(int index);
96
97 public slots:
98 void select3DView(int index);
99 void sceneListUpdated(QMap<QString, Viewer3DInfo> sceneMap);
100 void configDialogOpen();
104 void configDialogPickColor(QColor color = QColor::Invalid);
105 void toggleViewingMode();
106 void viewAll();
107
108 private:
109 Ui_Viewer3DWidget* ui;
110 QMap<QString, Viewer3DInfo> sceneMap;
111 std::vector<SoNode*> selectedViews;
112
113 QToolBar* customToolbar;
114 QPointer<QDialog> configDialog;
115 Ui_ViewerWidgetConfigDialog* configDialogUi;
116 const std::string settingsFile;
117 QSettings settings;
118 QAction* viewingModeAction;
119
120 std::map<QString, CameraPose> initialCameraPoses;
121
122 // ArmarXWidgetController interface
123 public:
124 QIcon
125 getWidgetIcon() const override
126 {
127 return GetWidgetIcon();
128 }
129
130 static QIcon
132 {
133 return QIcon(":icons/Outline-3D.png");
134 }
135
136 // ManagedIceObject interface
137 protected:
138 void onInitComponent() override;
139 void onConnectComponent() override;
140 // ArmarXWidgetController interface
141 public:
142 void onLockWidget() override;
143 void onUnlockWidget() override;
144 };
145
147} // namespace armarx
uint8_t index
#define ARMARX_VIEWER_NAME
std::shared_ptr< RecursiveMutex > RecursiveMutexPtr
std::shared_ptr< std::recursive_mutex > mutex3D
void select3DView(int index)
QPointer< QLabel > label
void onInitComponent() override
Pure virtual hook for the subclass.
QPointer< QPushButton > sceneConfigDialogButton
QIcon getWidgetIcon() const override
Implement this function to supply an icon for the menu.
QPointer< QWidget > getCustomTitlebarWidget(QWidget *parent=0) override
getTitleToolbar returns a pointer to the a toolbar widget of this controller.
Viewer3DWidget(QWidget *parent=0)
void configDialogPickColor(QColor color=QColor::Invalid)
void setNode(int index)
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
void onUnlockWidget() override
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
void setMutex3D(RecursiveMutexPtr const &mutex3D) override
This mutex is used to protect 3d scene updates.
SoSeparator * emptyNode
QPointer< QComboBox > cb3DViewers
void postDocking() override
postDocking is called after the widget has been docked into the main window.
QString getWidgetName() const override
Implement this function to specify the default name of your Widget.
void sceneListUpdated(QMap< QString, Viewer3DInfo > sceneMap)
void onConnectComponent() override
Pure virtual hook for the subclass.
void setMainWindow(QMainWindow *mainWindow) override
static QString GetWidgetName()
void onLockWidget() override
static QIcon GetWidgetIcon()
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< Viewer3DWidget > Viewer3DWidgetPtr
std::shared_ptr< CoinViewer > CoinViewerPtr
Definition CoinViewer.h:75