GraspCandidateViewerWidgetController.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 RobotAPI::gui-plugins::GraspCandidateViewerWidgetController
17 * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18 * @date 2020
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22#pragma once
23
24#include <deque>
25
27
31
34#include <RobotAPI/gui-plugins/GraspCandidateViewer/ui_GraspCandidateViewerWidget.h>
38
39namespace armarx
40{
41 /**
42 \page RobotAPI-GuiPlugins-GraspCandidateViewer GraspCandidateViewer
43 \brief The GraspCandidateViewer allows visualizing ...
44
45 \image html GraspCandidateViewer.png
46 The user can
47
48 API Documentation \ref GraspCandidateViewerWidgetController
49
50 \see GraspCandidateViewerGuiPlugin
51 */
52
53
54 /**
55 * \class GraspCandidateViewerGuiPlugin
56 * \ingroup ArmarXGuiPlugins
57 * \brief GraspCandidateViewerGuiPlugin brief description
58 *
59 * Detailed description
60 */
61
62 /**
63 * \class GraspCandidateViewerWidgetController
64 * \brief GraspCandidateViewerWidgetController brief one line description
65 *
66 * Detailed description
67 */
70 GraspCandidateViewerWidgetController>,
71 virtual public RobotStateComponentPluginUser,
72 virtual public ArVizComponentPluginUser,
74 {
75 Q_OBJECT
76
77 struct entry_gc;
78 struct entry_prov;
79
80 public:
83
84 static QString
86 {
87 return "Grasping.GraspCandidateViewer";
88 }
89
90 void
91 onInitComponent() override
92 {
93 }
94
95 void
97 {
98 _robot = addRobot("state robot", VirtualRobot::RobotIO::eStructure);
99 }
100
101 void
103 {
104 }
105
106 void
108 {
109 }
110
111 public:
112 void loadSettings(QSettings* settings) override;
113 void saveSettings(QSettings* settings) override;
114 QPointer<QDialog> getConfigDialog(QWidget* parent) override;
115 void configured() override;
116 public slots:
117 void update_gc();
118 void selected_item_changed();
119 void check_state_changed();
120
121 private:
122 void show_entry(entry_gc* e);
123
124 private:
125 struct entry_prov
126 {
127 QTreeWidgetItem* item = nullptr;
128 std::string provider_name;
129 std::deque<entry_gc> candidates;
130 };
131
132 struct entry_gc
133 {
134 QTreeWidgetItem* item = nullptr;
135 grasping::GraspCandidatePtr gc = nullptr;
136 entry_prov* provider = nullptr;
137 int idx = -1;
138 bool show = false;
139
140 std::string
141 name() const
142 {
143 return provider->provider_name + "_" + std::to_string(idx + 1);
144 }
145 };
146
147 mutable std::recursive_mutex _mutex;
148 QPointer<SimpleConfigDialog> _dialog;
149 Ui::GraspCandidateViewerWidget _ui;
151 std::map<std::string, entry_prov> _providers;
152 std::map<QTreeWidgetItem*, entry_gc*> _tree_item_to_gc;
153 };
154} // namespace armarx
#define ARMARXCOMPONENT_IMPORT_EXPORT
void onInitComponent() override
Pure virtual hook for the subclass.
void onConnectComponent() override
Pure virtual hook for the subclass.
VirtualRobot::RobotPtr addRobot(const std::string &id, const VirtualRobot::RobotPtr &robot, const VirtualRobot::RobotNodeSetPtr &rns={}, const VirtualRobot::RobotNodePtr &node={})
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.