CollisionConfig.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 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_COLLISION_CONFIG_HH_
19 #define _GAZEBO_COLLISION_CONFIG_HH_
20 
21 #include <map>
22 #include <string>
23 
24 #include "gazebo/gui/qt.h"
26 
27 namespace 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 
85  public: ~CollisionConfig();
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 
135  public: const std::map<int, CollisionConfigData *> &ConfigData() const;
136 
139  Q_SIGNALS: void CollisionRemoved(const std::string &_name);
140 
143  Q_SIGNALS: void CollisionAdded(const std::string &_name);
144 
146  Q_SIGNALS: void Applied();
147 
149  private slots: void OnAddCollision();
150 
153  private slots: void OnRemoveCollision(int _id);
154 
159  private slots: void OnPoseChanged(const QString &_name,
160  const ignition::math::Pose3d &_value);
161 
165  private slots: void OnCollisionChanged(
166  const std::string &_name, const std::string &_type);
167 
171  Q_SIGNALS: void CollisionChanged(
172  const std::string &_name, const std::string &_type);
173 
180  private slots: void OnGeometryChanged(const std::string &_name,
181  const std::string &_value,
182  const ignition::math::Vector3d &_dimensions,
183  const std::string &_uri);
184 
186  private: std::map<int, CollisionConfigData *> configs;
187 
189  private: int counter;
190 
192  private: QSignalMapper *signalMapper;
193 
195  private: std::map<int, QTreeWidgetItem *> collisionItems;
196 
198  private: QVBoxLayout *listLayout;
199  };
201  }
202 }
203 #endif
void RestoreOriginalData()
Restore the widget's data to how it was when first opened.
A class of widgets used for configuring collision properties.
Definition: CollisionConfig.hh:38
msgs::Collision originalDataMsg
Message containing the data which was in the widget when first open.
Definition: CollisionConfig.hh:72
A widget generated from a google protobuf message.
Definition: ConfigWidget.hh:193
ConfigWidget * configWidget
Config widget for configuring collision properties.
Definition: CollisionConfig.hh:65
std::string name
Name of the collision.
Definition: CollisionConfig.hh:62
#define NULL
Definition: CommonTypes.hh:31
int id
Unique ID of this collision config.
Definition: CollisionConfig.hh:59
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
QWidget * widget
Widget associated with this data.
Definition: CollisionConfig.hh:68
void CollisionChanged(const std::string &_name, const std::string &_type)
Signal to indicate a collision change.
A tab for configuring collision properties of a link.
Definition: CollisionConfig.hh:77