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 
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  public: int id;
51 
53  public: std::string name;
54 
57 
59  public: QWidget *widget;
60 
63  public: msgs::Collision originalDataMsg;
64  };
65 
68  class GZ_GUI_VISIBLE CollisionConfig : public QWidget
69  {
70  Q_OBJECT
71 
73  public: CollisionConfig();
74 
76  public: ~CollisionConfig();
77 
79  public: void Init();
80 
82  public slots: void RestoreOriginalData();
83 
88  public: void AddCollision(const std::string &_name,
89  const msgs::Collision *_collisionMsg = NULL);
90 
95  public: void UpdateCollision(const std::string &_name,
96  ConstCollisionPtr _collisionMsg);
97 
99  public: void Reset();
100 
103  public: unsigned int GetCollisionCount() const;
104 
108  public: msgs::Collision *GetData(const std::string &_name) const;
109 
114  public: void SetGeometry(const std::string &_name,
115  const ignition::math::Vector3d &_size, const std::string &_uri = "");
116 
121  public: void Geometry(const std::string &_name,
122  ignition::math::Vector3d &_size, std::string &_uri) const;
123 
127  public: void SetShowCollision(const bool _show, const std::string &_name);
128 
131  public: const std::map<int, CollisionConfigData *> &ConfigData() const;
132 
135  Q_SIGNALS: void CollisionRemoved(const std::string &_name);
136 
139  Q_SIGNALS: void CollisionAdded(const std::string &_name);
140 
144  Q_SIGNALS: void ShowCollision(const bool _show, const std::string &_name);
145 
147  Q_SIGNALS: void Applied();
148 
150  private slots: void OnAddCollision();
151 
154  private slots: void OnRemoveCollision(int _id);
155 
158  private slots: void OnShowCollision(const int _id);
159 
164  private slots: void OnPoseChanged(const QString &_name,
165  const ignition::math::Pose3d &_value);
166 
173  private slots: void OnGeometryChanged(const std::string &_name,
174  const std::string &_value,
175  const ignition::math::Vector3d &_dimensions,
176  const std::string &_uri);
177 
179  private: std::map<int, CollisionConfigData *> configs;
180 
182  private: std::map<int, CollisionConfigData *> deletedConfigs;
183 
185  private: std::map<int, CollisionConfigData *> addedConfigs;
186 
188  private: int counter;
189 
191  private: QSignalMapper *mapperRemove;
192 
194  private: QSignalMapper *mapperShow;
195 
197  private: std::map<int, QTreeWidgetItem *> collisionItems;
198 
200  private: QVBoxLayout *listLayout;
201  };
203  }
204 }
205 #endif
void RestoreOriginalData()
Restore the widget&#39;s data to how it was when first opened.
Forward declarations for the common classes.
Definition: Animation.hh:33
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:63
A widget generated from a google protobuf message.
Definition: ConfigWidget.hh:147
ConfigWidget * configWidget
Config widget for configuring collision properties.
Definition: CollisionConfig.hh:56
std::string name
Name of the collision.
Definition: CollisionConfig.hh:53
#define NULL
Definition: CommonTypes.hh:31
int id
Unique ID of this collision config.
Definition: CollisionConfig.hh:50
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:59
A tab for configuring collision properties of a link.
Definition: CollisionConfig.hh:68