CollisionConfig.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17
18#ifndef GAZEBO_GUI_MODEL_COLLISIONCONFIG_HH_
19#define GAZEBO_GUI_MODEL_COLLISIONCONFIG_HH_
20
21#include <map>
22#include <string>
23
24#include "gazebo/gui/qt.h"
26
27namespace gazebo
28{
29 namespace gui
30 {
31 class ConfigWidget;
32
35
38 class CollisionConfigData : public QWidget
39 {
40 Q_OBJECT
41
43 public slots: void RestoreOriginalData();
44
47 private slots: void OnToggleItem(bool _checked);
48
50 private slots: void OnGeometryChanged();
51
55 Q_SIGNALS: void CollisionChanged(const std::string &_name,
56 const std::string &_type);
57
59 public: int id;
60
62 public: std::string name;
63
66
68 public: QWidget *widget;
69
72 public: msgs::Collision originalDataMsg;
73 };
74
77 class GZ_GUI_VISIBLE CollisionConfig : public QWidget
78 {
79 Q_OBJECT
80
82 public: CollisionConfig();
83
86
88 public: void Init();
89
91 public slots: void RestoreOriginalData();
92
97 public: void AddCollision(const std::string &_name,
98 const msgs::Collision *_collisionMsg = NULL);
99
104 public: void UpdateCollision(const std::string &_name,
105 ConstCollisionPtr _collisionMsg);
106
108 public: void Reset();
109
112 public: unsigned int GetCollisionCount() const;
113
117 public: msgs::Collision *GetData(const std::string &_name) const;
118
123 public: void SetGeometry(const std::string &_name,
124 const ignition::math::Vector3d &_size, const std::string &_uri = "");
125
130 public: void Geometry(const std::string &_name,
131 ignition::math::Vector3d &_size, std::string &_uri) const;
132
136 public: void SetShowCollision(const bool _show, const std::string &_name);
137
140 public: const std::map<int, CollisionConfigData *> &ConfigData() const;
141
144 Q_SIGNALS: void CollisionRemoved(const std::string &_name);
145
150 Q_SIGNALS: void CollisionAdded(const std::string &_name,
151 const std::string &_collisionShape);
152
156 Q_SIGNALS: void ShowCollision(const bool _show, const std::string &_name);
157
159 Q_SIGNALS: void Applied();
160
164 private slots: void OnAddCollision(const QString &_collisionShape);
165
168 private slots: void OnRemoveCollision(int _id);
169
172 private slots: void OnShowCollision(const int _id);
173
178 private slots: void OnPoseChanged(const QString &_name,
179 const ignition::math::Pose3d &_value);
180
184 private slots: void OnCollisionChanged(
185 const std::string &_name, const std::string &_type);
186
190 Q_SIGNALS: void CollisionChanged(
191 const std::string &_name, const std::string &_type);
192
199 private slots: void OnGeometryChanged(const std::string &_name,
200 const std::string &_value,
201 const ignition::math::Vector3d &_dimensions,
202 const std::string &_uri);
203
205 private: std::map<int, CollisionConfigData *> configs;
206
208 private: std::map<int, CollisionConfigData *> deletedConfigs;
209
211 private: std::map<int, CollisionConfigData *> addedConfigs;
212
214 private: int counter;
215
217 private: QSignalMapper *mapperRemove;
218
220 private: QSignalMapper *mapperShow;
221
223 private: QSignalMapper *mapperAdd;
224
226 private: std::map<int, QTreeWidgetItem *> collisionItems;
227
229 private: QVBoxLayout *listLayout;
230 };
232 }
233}
234#endif
#define NULL
Definition CommonTypes.hh:31
gui
Definition KeyEventHandler.hh:29
A class of widgets used for configuring collision properties.
Definition CollisionConfig.hh:39
void CollisionChanged(const std::string &_name, const std::string &_type)
Signal to indicate a collision change.
msgs::Collision originalDataMsg
Message containing the data which was in the widget when first open.
Definition CollisionConfig.hh:72
QWidget * widget
Widget associated with this data.
Definition CollisionConfig.hh:68
ConfigWidget * configWidget
Config widget for configuring collision properties.
Definition CollisionConfig.hh:65
int id
Unique ID of this collision config.
Definition CollisionConfig.hh:59
void RestoreOriginalData()
Restore the widget's data to how it was when first opened.
std::string name
Name of the collision.
Definition CollisionConfig.hh:62
A tab for configuring collision properties of a link.
Definition CollisionConfig.hh:78
void CollisionRemoved(const std::string &_name)
Qt signal emitted when a collision is removed.
void UpdateCollision(const std::string &_name, ConstCollisionPtr _collisionMsg)
Update a collision widget from a collision msg.
void Init()
Initialize widget.
void SetShowCollision(const bool _show, const std::string &_name)
Set the state of a show collision button.
void ShowCollision(const bool _show, const std::string &_name)
Qt signal emitted requesting to show/hide a collision.
void Applied()
Qt signal emitted to indicate that changes should be applied.
void Reset()
Reset the collision tab.
void CollisionChanged(const std::string &_name, const std::string &_type)
Signal to indicate a collision change.
unsigned int GetCollisionCount() const
Get the number of collisions.
void SetGeometry(const std::string &_name, const ignition::math::Vector3d &_size, const std::string &_uri="")
Set the geometry data of a collision.
void RestoreOriginalData()
Restore the widget's data to how it was when first opened.
void Geometry(const std::string &_name, ignition::math::Vector3d &_size, std::string &_uri) const
Get the geometry data of a collision.
msgs::Collision * GetData(const std::string &_name) const
Get the msg containing all collision data.
void AddCollision(const std::string &_name, const msgs::Collision *_collisionMsg=NULL)
Add a collision widget to the tab.
void CollisionAdded(const std::string &_name, const std::string &_collisionShape)
Qt signal emitted when a collision is added.
const std::map< int, CollisionConfigData * > & ConfigData() const
Get collision config data.
A widget generated from a google protobuf message.
Definition ConfigWidget.hh:194
Forward declarations for the common classes.
Definition Animation.hh:27