Gazebo Gazebo

API Reference

6.16.0
gz/sim/gui/GuiEvents.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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 GZ_GAZEBO_GUI_GUIEVENTS_HH_
18 #define GZ_GAZEBO_GUI_GUIEVENTS_HH_
19 
20 #include <QEvent>
21 #include <QMap>
22 #include <QString>
23 
24 #include <set>
25 #include <string>
26 #include <utility>
27 #include <vector>
28 
29 #include <gz/math/Vector3.hh>
30 #include <gz/utils/ImplPtr.hh>
31 #include <sdf/Element.hh>
32 #include <sdf/Plugin.hh>
33 
34 #include "gz/sim/gui/Export.hh"
35 #include "gz/sim/Entity.hh"
36 #include "gz/sim/config.hh"
37 
38 namespace ignition
39 {
40 namespace gazebo
41 {
42 namespace gui {
43 // Inline bracket to help doxygen filtering.
44 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
47 namespace events
48 {
50  class IGNITION_GAZEBO_GUI_VISIBLE EntitiesSelected : public QEvent
51  {
56  public: explicit EntitiesSelected(
57  const std::vector<Entity> &_entities, // NOLINT
58  bool _fromUser = false)
59  : QEvent(kType), entities(_entities), fromUser(_fromUser)
60  {
61  }
62 
65  public: std::vector<Entity> Data() const
66  {
67  return this->entities;
68  }
69 
72  public: bool FromUser() const
73  {
74  return this->fromUser;
75  }
76 
78  static const QEvent::Type kType = QEvent::Type(QEvent::User + 1);
79 
81  private: std::vector<Entity> entities;
82 
84  private: bool fromUser{false};
85  };
86 
88  class IGNITION_GAZEBO_GUI_VISIBLE DeselectAllEntities : public QEvent
89  {
93  public: explicit DeselectAllEntities(bool _fromUser = false)
94  : QEvent(kType), fromUser(_fromUser)
95  {
96  }
97 
100  public: bool FromUser() const
101  {
102  return this->fromUser;
103  }
104 
106  static const QEvent::Type kType = QEvent::Type(QEvent::User + 2);
107 
109  private: bool fromUser{false};
110  };
111 
115  class IGNITION_GAZEBO_GUI_VISIBLE GuiNewRemovedEntities : public QEvent
116  {
120  public: GuiNewRemovedEntities(const std::set<Entity> &_newEntities,
121  const std::set<Entity> &_removedEntities);
122 
124  public: const std::set<Entity> &NewEntities() const;
125 
127  public: const std::set<Entity> &RemovedEntities() const;
128 
130  static const QEvent::Type kType = QEvent::Type(QEvent::User + 3);
131 
134  IGN_UTILS_IMPL_PTR(dataPtr)
135  };
136 
141  class IGNITION_GAZEBO_GUI_VISIBLE NewRemovedEntities : public QEvent
142  {
146  public: NewRemovedEntities(const std::set<Entity> &_newEntities,
147  const std::set<Entity> &_removedEntities);
148 
150  public: const std::set<Entity> &NewEntities() const;
151 
153  public: const std::set<Entity> &RemovedEntities() const;
154 
156  static const QEvent::Type kType = QEvent::Type(QEvent::User + 4);
157 
160  IGN_UTILS_IMPL_PTR(dataPtr)
161  };
162 
165  class IGNITION_GAZEBO_GUI_VISIBLE TransformControlModeActive : public QEvent
166  {
169  public: explicit TransformControlModeActive(const bool _tranformModeActive)
170  : QEvent(kType), tranformModeActive(_tranformModeActive)
171  {
172  }
173 
175  static const QEvent::Type kType = QEvent::Type(QEvent::User + 6);
176 
178  public: bool TransformControlActive()
179  {
180  return this->tranformModeActive;
181  }
182 
184  private: bool tranformModeActive;
185  };
186 
188  class IGNITION_GAZEBO_GUI_VISIBLE ModelEditorAddEntity : public QEvent
189  {
194  public: explicit ModelEditorAddEntity(QString _entity, QString _type,
195  gz::sim::Entity _parent);
196 
198  public: QString Entity() const;
199 
201  public: QString EntityType() const;
202 
203 
205  public: gz::sim::Entity ParentEntity() const;
206 
209  public: QMap<QString, QString> &Data();
210 
211  static const QEvent::Type kType = QEvent::Type(QEvent::User + 7);
212 
215  IGN_UTILS_IMPL_PTR(dataPtr)
216  };
217 
221  class IGNITION_GAZEBO_GUI_VISIBLE VisualPlugin: public QEvent
222  {
226  public: explicit VisualPlugin(ignition::gazebo::Entity _entity,
227  const sdf::ElementPtr &_elem);
228 
230  public: ignition::gazebo::Entity Entity() const;
231 
233  public: sdf::ElementPtr Element() const;
234 
235  static const QEvent::Type kType = QEvent::Type(QEvent::User + 8);
236 
239  IGN_UTILS_IMPL_PTR(dataPtr)
240  };
241 
243  class IGNITION_GAZEBO_GUI_VISIBLE VisualPlugins: public QEvent
244  {
248  public: explicit VisualPlugins(ignition::gazebo::Entity _entity,
249  const sdf::Plugins &_plugins);
250 
252  public: ignition::gazebo::Entity Entity() const;
253 
255  public: const sdf::Plugins &Plugins() const;
256 
257  static const QEvent::Type kType = QEvent::Type(QEvent::User + 9);
258 
261  IGN_UTILS_IMPL_PTR(dataPtr)
262  };
263 } // namespace events
264 }
265 } // namespace gui
266 } // namespace gazebo
267 } // namespace ignition
268 
269 #endif // GZ_GAZEBO_GUI_GUIEVENTS_HH_
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:58
Event that contains entities newly created or removed from the GUI, but that aren't present on the se...
Definition: gz/sim/gui/GuiEvents.hh:115
This library is part of the Gazebo project.
True if a transform control is currently active (translate / rotate / scale). False if we're in selec...
Definition: gz/sim/gui/GuiEvents.hh:165
Component< Entity, class ParentEntityTag > ParentEntity
This component holds an entity's parent entity.
Definition: gz/sim/components/ParentEntity.hh:41
Event that notifies an entity is to be added to the model editor.
Definition: gz/sim/gui/GuiEvents.hh:188
Event that notifies when new entities have been selected.
Definition: gz/sim/gui/GuiEvents.hh:50
Event that notifies when all entities have been deselected.
Definition: gz/sim/gui/GuiEvents.hh:88
EntitiesSelected(const std::vector< Entity > &_entities, bool _fromUser=false)
Constructor.
Definition: gz/sim/gui/GuiEvents.hh:56
Event that notifies a visual plugin is to be loaded.
Definition: gz/sim/gui/GuiEvents.hh:221
Event that notifies a visual plugin is to be loaded.
Definition: gz/sim/gui/GuiEvents.hh:243
bool TransformControlActive()
Get the event's value.
Definition: gz/sim/gui/GuiEvents.hh:178
std::vector< Entity > Data() const
Get the data sent with the event.
Definition: gz/sim/gui/GuiEvents.hh:65
Event that notifies when new entities have been created or removed on the server. This is a duplicati...
Definition: gz/sim/gui/GuiEvents.hh:141
bool FromUser() const
Get whether the event was generated by the user.
Definition: gz/sim/gui/GuiEvents.hh:72
TransformControlModeActive(const bool _tranformModeActive)
Constructor.
Definition: gz/sim/gui/GuiEvents.hh:169
DeselectAllEntities(bool _fromUser=false)
Constructor.
Definition: gz/sim/gui/GuiEvents.hh:93
bool FromUser() const
Get whether the event was generated by the user.
Definition: gz/sim/gui/GuiEvents.hh:100