Ignition Gazebo

API Reference

6.6.0
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 IGNITION_GAZEBO_GUI_GUIEVENTS_HH_
18 #define IGNITION_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 <ignition/math/Vector3.hh>
30 #include <ignition/utils/ImplPtr.hh>
31 #include <sdf/Element.hh>
32 
33 #include "ignition/gazebo/gui/Export.hh"
35 #include "ignition/gazebo/config.hh"
36 
37 namespace ignition
38 {
39 namespace gazebo
40 {
41 namespace gui {
42 // Inline bracket to help doxygen filtering.
43 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
46 namespace events
47 {
49  class IGNITION_GAZEBO_GUI_VISIBLE EntitiesSelected : public QEvent
50  {
55  public: explicit EntitiesSelected(
56  const std::vector<Entity> &_entities, // NOLINT
57  bool _fromUser = false)
58  : QEvent(kType), entities(_entities), fromUser(_fromUser)
59  {
60  }
61 
64  public: std::vector<Entity> Data() const
65  {
66  return this->entities;
67  }
68 
71  public: bool FromUser() const
72  {
73  return this->fromUser;
74  }
75 
77  static const QEvent::Type kType = QEvent::Type(QEvent::User + 1);
78 
80  private: std::vector<Entity> entities;
81 
83  private: bool fromUser{false};
84  };
85 
87  class IGNITION_GAZEBO_GUI_VISIBLE DeselectAllEntities : public QEvent
88  {
92  public: explicit DeselectAllEntities(bool _fromUser = false)
93  : QEvent(kType), fromUser(_fromUser)
94  {
95  }
96 
99  public: bool FromUser() const
100  {
101  return this->fromUser;
102  }
103 
105  static const QEvent::Type kType = QEvent::Type(QEvent::User + 2);
106 
108  private: bool fromUser{false};
109  };
110 
114  class IGNITION_GAZEBO_GUI_VISIBLE GuiNewRemovedEntities : public QEvent
115  {
119  public: GuiNewRemovedEntities(const std::set<Entity> &_newEntities,
120  const std::set<Entity> &_removedEntities);
121 
123  public: const std::set<Entity> &NewEntities() const;
124 
126  public: const std::set<Entity> &RemovedEntities() const;
127 
129  static const QEvent::Type kType = QEvent::Type(QEvent::User + 3);
130 
133  IGN_UTILS_IMPL_PTR(dataPtr)
134  };
135 
140  class IGNITION_GAZEBO_GUI_VISIBLE NewRemovedEntities : public QEvent
141  {
145  public: NewRemovedEntities(const std::set<Entity> &_newEntities,
146  const std::set<Entity> &_removedEntities);
147 
149  public: const std::set<Entity> &NewEntities() const;
150 
152  public: const std::set<Entity> &RemovedEntities() const;
153 
155  static const QEvent::Type kType = QEvent::Type(QEvent::User + 4);
156 
159  IGN_UTILS_IMPL_PTR(dataPtr)
160  };
161 
164  class IGNITION_GAZEBO_GUI_VISIBLE TransformControlModeActive : public QEvent
165  {
168  public: explicit TransformControlModeActive(const bool _tranformModeActive)
169  : QEvent(kType), tranformModeActive(_tranformModeActive)
170  {
171  }
172 
174  static const QEvent::Type kType = QEvent::Type(QEvent::User + 6);
175 
177  public: bool TransformControlActive()
178  {
179  return this->tranformModeActive;
180  }
181 
183  private: bool tranformModeActive;
184  };
185 
187  class IGNITION_GAZEBO_GUI_VISIBLE ModelEditorAddEntity : public QEvent
188  {
193  public: explicit ModelEditorAddEntity(QString _entity, QString _type,
194  ignition::gazebo::Entity _parent);
195 
197  public: QString Entity() const;
198 
200  public: QString EntityType() const;
201 
202 
204  public: ignition::gazebo::Entity ParentEntity() const;
205 
208  public: QMap<QString, QString> &Data();
209 
210  static const QEvent::Type kType = QEvent::Type(QEvent::User + 7);
211 
214  IGN_UTILS_IMPL_PTR(dataPtr)
215  };
216 
218  class IGNITION_GAZEBO_GUI_VISIBLE VisualPlugin: public QEvent
219  {
223  public: explicit VisualPlugin(ignition::gazebo::Entity _entity,
224  const sdf::ElementPtr &_elem);
225 
227  public: ignition::gazebo::Entity Entity() const;
228 
230  public: sdf::ElementPtr Element() const;
231 
232  static const QEvent::Type kType = QEvent::Type(QEvent::User + 8);
233 
236  IGN_UTILS_IMPL_PTR(dataPtr)
237  };
238 } // namespace events
239 }
240 } // namespace gui
241 } // namespace gazebo
242 } // namespace ignition
243 
244 #endif // IGNITION_GAZEBO_GUI_GUIEVENTS_HH_
EntitiesSelected(const std::vector< Entity > &_entities, bool _fromUser=false)
Constructor.
Definition: GuiEvents.hh:55
Component< Entity, class ParentEntityTag > ParentEntity
This component holds an entity&#39;s parent entity.
Definition: ParentEntity.hh:41
DeselectAllEntities(bool _fromUser=false)
Constructor.
Definition: GuiEvents.hh:92
std::vector< Entity > Data() const
Get the data sent with the event.
Definition: GuiEvents.hh:64
bool TransformControlActive()
Get the event&#39;s value.
Definition: GuiEvents.hh:177
Event that notifies an entity is to be added to the model editor.
Definition: GuiEvents.hh:187
Event that notifies when all entities have been deselected.
Definition: GuiEvents.hh:87
Event that notifies a visual plugin is to be loaded.
Definition: GuiEvents.hh:218
True if a transform control is currently active (translate / rotate / scale). False if we&#39;re in selec...
Definition: GuiEvents.hh:164
Event that notifies when new entities have been selected.
Definition: GuiEvents.hh:49
TransformControlModeActive(const bool _tranformModeActive)
Constructor.
Definition: GuiEvents.hh:168
Event that notifies when new entities have been created or removed on the server. This is a duplicati...
Definition: GuiEvents.hh:140
This library is part of the Ignition Robotics project.
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light. At its core, an Entity is just an identifier.
Definition: Entity.hh:59
bool FromUser() const
Get whether the event was generated by the user.
Definition: GuiEvents.hh:99
Event that contains entities newly created or removed from the GUI, but that aren&#39;t present on the se...
Definition: GuiEvents.hh:114
bool FromUser() const
Get whether the event was generated by the user.
Definition: GuiEvents.hh:71