Ignition Gazebo

API Reference

6.3.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 #include <ignition/math/Vector3.hh>
29 #include <ignition/utils/ImplPtr.hh>
30 #include "ignition/gazebo/gui/Export.hh"
32 #include "ignition/gazebo/config.hh"
33 
34 namespace ignition
35 {
36 namespace gazebo
37 {
38 namespace gui {
39 // Inline bracket to help doxygen filtering.
40 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
43 namespace events
44 {
46  class IGNITION_GAZEBO_GUI_VISIBLE EntitiesSelected : public QEvent
47  {
52  public: explicit EntitiesSelected(
53  const std::vector<Entity> &_entities, // NOLINT
54  bool _fromUser = false)
55  : QEvent(kType), entities(_entities), fromUser(_fromUser)
56  {
57  }
58 
61  public: std::vector<Entity> Data() const
62  {
63  return this->entities;
64  }
65 
68  public: bool FromUser() const
69  {
70  return this->fromUser;
71  }
72 
74  static const QEvent::Type kType = QEvent::Type(QEvent::User + 1);
75 
77  private: std::vector<Entity> entities;
78 
80  private: bool fromUser{false};
81  };
82 
84  class IGNITION_GAZEBO_GUI_VISIBLE DeselectAllEntities : public QEvent
85  {
89  public: explicit DeselectAllEntities(bool _fromUser = false)
90  : QEvent(kType), fromUser(_fromUser)
91  {
92  }
93 
96  public: bool FromUser() const
97  {
98  return this->fromUser;
99  }
100 
102  static const QEvent::Type kType = QEvent::Type(QEvent::User + 2);
103 
105  private: bool fromUser{false};
106  };
107 
111  class IGNITION_GAZEBO_GUI_VISIBLE GuiNewRemovedEntities : public QEvent
112  {
116  public: GuiNewRemovedEntities(const std::set<Entity> &_newEntities,
117  const std::set<Entity> &_removedEntities);
118 
120  public: const std::set<Entity> &NewEntities() const;
121 
123  public: const std::set<Entity> &RemovedEntities() const;
124 
126  static const QEvent::Type kType = QEvent::Type(QEvent::User + 3);
127 
130  IGN_UTILS_IMPL_PTR(dataPtr)
131  };
132 
137  class IGNITION_GAZEBO_GUI_VISIBLE NewRemovedEntities : public QEvent
138  {
142  public: NewRemovedEntities(const std::set<Entity> &_newEntities,
143  const std::set<Entity> &_removedEntities);
144 
146  public: const std::set<Entity> &NewEntities() const;
147 
149  public: const std::set<Entity> &RemovedEntities() const;
150 
152  static const QEvent::Type kType = QEvent::Type(QEvent::User + 4);
153 
156  IGN_UTILS_IMPL_PTR(dataPtr)
157  };
158 
161  class IGNITION_GAZEBO_GUI_VISIBLE TransformControlModeActive : public QEvent
162  {
165  public: explicit TransformControlModeActive(const bool _tranformModeActive)
166  : QEvent(kType), tranformModeActive(_tranformModeActive)
167  {
168  }
169 
171  static const QEvent::Type kType = QEvent::Type(QEvent::User + 6);
172 
174  public: bool TransformControlActive()
175  {
176  return this->tranformModeActive;
177  }
178 
180  private: bool tranformModeActive;
181  };
182 
184  class IGNITION_GAZEBO_GUI_VISIBLE ModelEditorAddEntity : public QEvent
185  {
190  public: explicit ModelEditorAddEntity(QString _entity, QString _type,
191  ignition::gazebo::Entity _parent);
192 
194  public: QString Entity() const;
195 
197  public: QString EntityType() const;
198 
199 
201  public: ignition::gazebo::Entity ParentEntity() const;
202 
205  public: QMap<QString, QString> &Data();
206 
207  static const QEvent::Type kType = QEvent::Type(QEvent::User + 7);
208 
211  IGN_UTILS_IMPL_PTR(dataPtr)
212  };
213 
214 } // namespace events
215 }
216 } // namespace gui
217 } // namespace gazebo
218 } // namespace ignition
219 
220 #endif // IGNITION_GAZEBO_GUI_GUIEVENTS_HH_
EntitiesSelected(const std::vector< Entity > &_entities, bool _fromUser=false)
Constructor.
Definition: GuiEvents.hh:52
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:89
std::vector< Entity > Data() const
Get the data sent with the event.
Definition: GuiEvents.hh:61
bool TransformControlActive()
Get the event&#39;s value.
Definition: GuiEvents.hh:174
Event that notifies an entity is to be added to the model editor.
Definition: GuiEvents.hh:184
Event that notifies when all entities have been deselected.
Definition: GuiEvents.hh:84
True if a transform control is currently active (translate / rotate / scale). False if we&#39;re in selec...
Definition: GuiEvents.hh:161
Event that notifies when new entities have been selected.
Definition: GuiEvents.hh:46
TransformControlModeActive(const bool _tranformModeActive)
Constructor.
Definition: GuiEvents.hh:165
Event that notifies when new entities have been created or removed on the server. This is a duplicati...
Definition: GuiEvents.hh:137
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:96
Event that contains entities newly created or removed from the GUI, but that aren&#39;t present on the se...
Definition: GuiEvents.hh:111
bool FromUser() const
Get whether the event was generated by the user.
Definition: GuiEvents.hh:68