Ignition Gazebo

API Reference

6.1.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 <set>
22 #include <string>
23 #include <utility>
24 #include <vector>
25 #include <ignition/math/Vector3.hh>
26 #include <ignition/utils/ImplPtr.hh>
27 #include "ignition/gazebo/gui/Export.hh"
29 #include "ignition/gazebo/config.hh"
30 
31 namespace ignition
32 {
33 namespace gazebo
34 {
35 namespace gui {
36 // Inline bracket to help doxygen filtering.
37 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
40 namespace events
41 {
43  class IGNITION_GAZEBO_GUI_VISIBLE EntitiesSelected : public QEvent
44  {
49  public: explicit EntitiesSelected(
50  const std::vector<Entity> &_entities, // NOLINT
51  bool _fromUser = false)
52  : QEvent(kType), entities(_entities), fromUser(_fromUser)
53  {
54  }
55 
58  public: std::vector<Entity> Data() const
59  {
60  return this->entities;
61  }
62 
65  public: bool FromUser() const
66  {
67  return this->fromUser;
68  }
69 
71  static const QEvent::Type kType = QEvent::Type(QEvent::User + 1);
72 
74  private: std::vector<Entity> entities;
75 
77  private: bool fromUser{false};
78  };
79 
81  class IGNITION_GAZEBO_GUI_VISIBLE DeselectAllEntities : public QEvent
82  {
86  public: explicit DeselectAllEntities(bool _fromUser = false)
87  : QEvent(kType), fromUser(_fromUser)
88  {
89  }
90 
93  public: bool FromUser() const
94  {
95  return this->fromUser;
96  }
97 
99  static const QEvent::Type kType = QEvent::Type(QEvent::User + 2);
100 
102  private: bool fromUser{false};
103  };
104 
108  class IGNITION_GAZEBO_GUI_VISIBLE GuiNewRemovedEntities : public QEvent
109  {
113  public: GuiNewRemovedEntities(const std::set<Entity> &_newEntities,
114  const std::set<Entity> &_removedEntities);
115 
117  public: const std::set<Entity> &NewEntities() const;
118 
120  public: const std::set<Entity> &RemovedEntities() const;
121 
123  static const QEvent::Type kType = QEvent::Type(QEvent::User + 3);
124 
127  IGN_UTILS_IMPL_PTR(dataPtr)
128  };
129 
134  class IGNITION_GAZEBO_GUI_VISIBLE NewRemovedEntities : public QEvent
135  {
139  public: NewRemovedEntities(const std::set<Entity> &_newEntities,
140  const std::set<Entity> &_removedEntities);
141 
143  public: const std::set<Entity> &NewEntities() const;
144 
146  public: const std::set<Entity> &RemovedEntities() const;
147 
149  static const QEvent::Type kType = QEvent::Type(QEvent::User + 4);
150 
153  IGN_UTILS_IMPL_PTR(dataPtr)
154  };
155 
158  class IGNITION_GAZEBO_GUI_VISIBLE TransformControlModeActive : public QEvent
159  {
162  public: explicit TransformControlModeActive(const bool _tranformModeActive)
163  : QEvent(kType), tranformModeActive(_tranformModeActive)
164  {
165  }
166 
168  static const QEvent::Type kType = QEvent::Type(QEvent::User + 6);
169 
171  public: bool TransformControlActive()
172  {
173  return this->tranformModeActive;
174  }
175 
177  private: bool tranformModeActive;
178  };
179 } // namespace events
180 }
181 } // namespace gui
182 } // namespace gazebo
183 } // namespace ignition
184 
185 #endif // IGNITION_GAZEBO_GUI_GUIEVENTS_HH_
EntitiesSelected(const std::vector< Entity > &_entities, bool _fromUser=false)
Constructor.
Definition: GuiEvents.hh:49
DeselectAllEntities(bool _fromUser=false)
Constructor.
Definition: GuiEvents.hh:86
std::vector< Entity > Data() const
Get the data sent with the event.
Definition: GuiEvents.hh:58
bool TransformControlActive()
Get the event&#39;s value.
Definition: GuiEvents.hh:171
Event that notifies when all entities have been deselected.
Definition: GuiEvents.hh:81
True if a transform control is currently active (translate / rotate / scale). False if we&#39;re in selec...
Definition: GuiEvents.hh:158
Event that notifies when new entities have been selected.
Definition: GuiEvents.hh:43
TransformControlModeActive(const bool _tranformModeActive)
Constructor.
Definition: GuiEvents.hh:162
Event that notifies when new entities have been created or removed on the server. This is a duplicati...
Definition: GuiEvents.hh:134
This library is part of the Ignition Robotics project.
bool FromUser() const
Get whether the event was generated by the user.
Definition: GuiEvents.hh:93
Event that contains entities newly created or removed from the GUI, but that aren&#39;t present on the se...
Definition: GuiEvents.hh:108
bool FromUser() const
Get whether the event was generated by the user.
Definition: GuiEvents.hh:65