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 _COLLISION_CONFIG_HH_
19 #define _COLLISION_CONFIG_HH_
20 
21 #include <map>
22 #include <string>
23 
24 #include "gazebo/math/Pose.hh"
25 
26 #include "gazebo/gui/qt.h"
28 
29 namespace gazebo
30 {
31  namespace gui
32  {
33  class ConfigWidget;
34 
37 
40  class CollisionConfigData : public QWidget
41  {
42  Q_OBJECT
43 
46  private slots: void OnToggleItem(bool _checked);
47 
49  public: int id;
50 
52  public: std::string name;
53 
56 
58  public: QWidget *widget;
59  };
60 
63  class CollisionConfig : public QWidget
64  {
65  Q_OBJECT
66 
68  public: CollisionConfig();
69 
71  public: ~CollisionConfig();
72 
77  public: void AddCollision(const std::string &_name,
78  const msgs::Collision *_collisionMsg = NULL);
79 
84  public: void UpdateCollision(const std::string &_name,
85  ConstCollisionPtr _collisionMsg);
86 
88  public: void Reset();
89 
92  public: unsigned int GetCollisionCount() const;
93 
97  public: msgs::Collision *GetData(const std::string &_name) const;
98 
103  public: void SetGeometry(const std::string &_name,
104  const math::Vector3 &_size, const std::string &_uri = "");
105 
108  Q_SIGNALS: void CollisionRemoved(const std::string &_name);
109 
112  Q_SIGNALS: void CollisionAdded(const std::string &_name);
113 
115  private slots: void OnAddCollision();
116 
119  private slots: void OnRemoveCollision(int _id);
120 
122  private: std::map<int, CollisionConfigData *> configs;
123 
125  private: int counter;
126 
128  private: QSignalMapper *signalMapper;
129 
131  private: std::map<int, QTreeWidgetItem *> collisionItems;
132 
134  private: QVBoxLayout *listLayout;
135  };
137  }
138 }
139 #endif
unsigned int GetCollisionCount() const
Get the number of collisions.
void UpdateCollision(const std::string &_name, ConstCollisionPtr _collisionMsg)
Update a collision widget from a collision msg.
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
void SetGeometry(const std::string &_name, const math::Vector3 &_size, const std::string &_uri="")
Set the geometry data of a collision.
void Reset()
Reset the collision tab.
msgs::Collision * GetData(const std::string &_name) const
Get the msg containing all collision data.
void CollisionRemoved(const std::string &_name)
Qt signal emitted when a collision is removed.
A class of widgets used for configuring collision properties.
Definition: CollisionConfig.hh:40
A widget generated from a google protobuf message.
Definition: ConfigWidget.hh:139
std::string name
Name of the collision.
Definition: CollisionConfig.hh:52
QWidget * widget
Widget associated with this data.
Definition: CollisionConfig.hh:58
CollisionConfig()
Constructor.
void AddCollision(const std::string &_name, const msgs::Collision *_collisionMsg=NULL)
Add a collision widget to the tab.
ConfigWidget * configWidget
Config widget for configuring collision properties.
Definition: CollisionConfig.hh:55
#define NULL
Definition: CommonTypes.hh:30
void CollisionAdded(const std::string &_name)
Qt signal emitted when a collision is added.
A tab for configuring collision properties of a link.
Definition: CollisionConfig.hh:63
int id
Unique ID of this collision config.
Definition: CollisionConfig.hh:49