ModelData.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013-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 #ifndef _MODEL_DATA_HH_
18 #define _MODEL_DATA_HH_
19 
20 #include <map>
21 #include <string>
22 #include <vector>
23 
26 
27 namespace boost
28 {
29  class recursive_mutex;
30 }
31 
32 namespace boost
33 {
34  class recursive_mutex;
35 }
36 
37 namespace gazebo
38 {
39  namespace gui
40  {
41  class LinkInspector;
42 
43  class ModelData
44  {
47  public: static std::string GetTemplateSDFString();
48 
51  public: static double GetEditTransparency();
52  };
53 
56  class LinkData : public QObject
57  {
58  Q_OBJECT
59 
61  public: LinkData();
62 
64  public: ~LinkData();
65 
68  public: std::string GetName() const;
69 
72  public: void SetName(const std::string &_name);
73 
76  public: math::Pose GetPose() const;
77 
80  public: void SetPose(const math::Pose &_pose);
81 
84  public: void Load(sdf::ElementPtr _sdf);
85 
88  public: math::Vector3 GetScale() const;
89 
92  public: void SetScale(const math::Vector3 &_scale);
93 
96  public: void AddVisual(rendering::VisualPtr _visual);
97 
100  public: void AddCollision(rendering::VisualPtr _collisionVis);
101 
103  public: void UpdateConfig();
104 
108  public: LinkData *Clone(const std::string &_newName);
109 
111  private: void Update();
112 
115  private: bool Apply();
116 
119  private slots: void OnAccept();
120 
123  private slots: void OnApply();
124 
127  private slots: void OnAddVisual(const std::string &_name);
128 
131  private slots: void OnAddCollision(const std::string &_name);
132 
135  private slots: void OnRemoveVisual(const std::string &_name);
136 
139  private slots: void OnRemoveCollision(const std::string &_name);
140 
142  private: std::vector<event::ConnectionPtr> connections;
143 
145  private: boost::recursive_mutex *updateMutex;
146 
148  public: sdf::ElementPtr linkSDF;
149 
152 
155 
157  public: std::map<rendering::VisualPtr, msgs::Visual> visuals;
158 
160  public: std::vector<msgs::Visual *> visualUpdateMsgs;
161 
163  public: std::vector<msgs::Collision *> collisionUpdateMsgs;
164 
166  public: std::map<rendering::VisualPtr, msgs::Collision> collisions;
167 
170  };
171  }
172 }
173 
174 #endif
Definition: LinkInspector.hh:33
std::map< rendering::VisualPtr, msgs::Collision > collisions
Collisions of the link.
Definition: ModelData.hh:166
std::vector< msgs::Visual * > visualUpdateMsgs
Msgs for updating visuals.
Definition: ModelData.hh:160
void UpdateConfig()
Update the inspector widget if necessary.
math::Pose GetPose() const
Get the pose of the link.
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
rendering::VisualPtr linkVisual
Visual representing this link.
Definition: ModelData.hh:154
sdf::ElementPtr linkSDF
SDF representing the link data.
Definition: ModelData.hh:148
static double GetEditTransparency()
Get the default transparency setting for entities in model editor.
Definition: ModelData.hh:43
LinkInspector * inspector
Inspector for configuring link properties.
Definition: ModelData.hh:169
void AddVisual(rendering::VisualPtr _visual)
Add a visual to the link.
void Load(sdf::ElementPtr _sdf)
Load the link with data from SDF.
std::map< rendering::VisualPtr, msgs::Visual > visuals
Visuals of the link.
Definition: ModelData.hh:157
static std::string GetTemplateSDFString()
Get a template SDF string of a simple model.
void SetName(const std::string &_name)
Set the name of the link.
LinkData()
Constructor.
void AddCollision(rendering::VisualPtr _collisionVis)
Add a collision to the link.
std::vector< msgs::Collision * > collisionUpdateMsgs
Msgs for updating collision visuals.
Definition: ModelData.hh:163
LinkData * Clone(const std::string &_newName)
Clone the link data.
math::Vector3 scale
Scale of link.
Definition: ModelData.hh:151
math::Vector3 GetScale() const
Get the scale of the link.
Helper class to store link data.
Definition: ModelData.hh:56
void SetScale(const math::Vector3 &_scale)
Set the scale of the link.
~LinkData()
Destructor.
boost::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:107
void SetPose(const math::Pose &_pose)
Set the pose of the link.
std::string GetName() const
Get the name of the link.