WidgetController.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-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 VisionX::gui-plugins::WidgetController
19 * @author Philipp Schmidt ( ufedv at student dot kit dot edu )
20 * @date 2015
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#pragma once
26
27#include <mutex>
28
29// QT
30#include <QColorDialog>
31#include <QListWidgetItem>
32
33// Point Cloud Library
34#include <pcl/point_types.h>
35#include <pcl/visualization/pcl_visualizer.h>
36
37// ArmarX
38#include <Ice/BuiltinSequences.h>
39
41
45
46#include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
47
48// Point Cloud Processor
50
51// User interface
52#include <VisionX/gui-plugins/PointCloudViewer/ui_Widget.h>
53
54#include "Manager.h"
55#include "SaveDialog.h"
56
57/* NOTES for developers:
58 *
59 * The code has two invariancies:
60 *
61 * 1.: The topic and proxies of a provider are used, exactly if it is listed in the list widget "providerList".
62 * 2.: If a provider is checked in the list widget "providerList" it has an entry in the manager
63 * and is shown in the viewer with the next render call renderClouds() with its ID.
64 */
65
66
67namespace visionx
68{
69 /**
70 \page VisionX-GuiPlugins-PointCloudViewer PointCloudViewer
71 \brief ...
72
73 API Documentation \ref WidgetController
74
75 \see GuiPlugin
76 */
77
78 /**
79 * \class WidgetController
80 * \brief WidgetController brief one line description
81 *
82 * Detailed description
83 */
87 {
88 Q_OBJECT
89
90 using PointT = pcl::PointXYZRGBL;
91
92 public:
93 /// Controller constructor.
94 explicit WidgetController();
95
96 /// Controller destructor
97 ~WidgetController() override;
98
99 /// @see ArmarXWidgetController::loadSettings()
100 void loadSettings(QSettings* settings) override;
101
102 /// @see ArmarXWidgetController::saveSettings()
103 void saveSettings(QSettings* settings) override;
104
105 /// Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
106 static QString
108 {
109 return "VisionX.PointCloudViewer";
110 }
111
112 /// @see visionx::PointCloudProcessor::onInitPointCloudProcessor()
113 void onInitPointCloudProcessor() override;
114
115 /// @see visionx::PointCloudProcessor::onConnectPointCloudProcessor()
116 ///
117 void onConnectPointCloudProcessor() override;
118 /// @see visionx::PointCloudProcessor::onDisconnectPointCloudProcessor()
119 void onDisconnectPointCloudProcessor() override;
120
121 /// @see visionx::PointCloudProcessor::onExitPointCloudProcessor()
122 void onExitPointCloudProcessor() override;
123
124
125 /// @see visionx::PointCloudProcessor::process()
126 void process() override;
127
128 void postDocking() override;
129
130 void onLockWidget() override;
131 void onUnlockWidget() override;
132
133 signals:
134
135 void newPointCloudReceived(QString providerName, CoinPointCloud* cloud);
136
137
138 public slots:
139
140 void refreshProviderList();
141 void showPointCloudInfo(QListWidgetItem* item);
142 void pointCloudChecked(QListWidgetItem* item);
143 void selectColor();
144 void savePointCloud();
145 void processPointCloud(QString providerName, CoinPointCloud* cloud);
146
147
148 void updateProviderList(IceGrid::ObjectInfoSeq objects);
149
150
151 private slots:
152
153 void setPointSize(double value);
154 void disconnectQt();
155
156
157 private:
158 template <class PointCloudT>
159 void getPointCloudAs(const std::string& providerName, PointCloudT& targetPointCloud);
160 template <class PointCloudT>
161 static void storePointCloudAs(const std::string& filename, const PointCloudT& pointCloud);
162
163 private:
164 QPointer<QWidget> m_widget;
165
166 /// Widget Form
167 Ui::Widget widget;
168
169 /// Cloud Manager
170 Manager* manager;
171
172 /// Color dialog
173 QColorDialog colorDialog;
174
175 /// Camera reset flag
176 bool recenterCamera;
177
178 std::mutex mutex;
179
180 std::atomic<float> pointSize{1};
181 };
182} // namespace visionx
#define ARMARXCOMPONENT_IMPORT_EXPORT
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
void newPointCloudReceived(QString providerName, CoinPointCloud *cloud)
WidgetController()
Controller constructor.
void updateProviderList(IceGrid::ObjectInfoSeq objects)
void loadSettings(QSettings *settings) override
void saveSettings(QSettings *settings) override
void processPointCloud(QString providerName, CoinPointCloud *cloud)
void showPointCloudInfo(QListWidgetItem *item)
void pointCloudChecked(QListWidgetItem *item)
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
ArmarX headers.