Ignition Gazebo

API Reference

3.2.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 <string>
22 #include <utility>
23 #include <vector>
24 #include <ignition/math/Vector3.hh>
26 #include "ignition/gazebo/config.hh"
27 
28 namespace ignition
29 {
30 namespace gazebo
31 {
32 namespace gui {
33 // Inline bracket to help doxygen filtering.
34 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
37 namespace events
38 {
40  class SnapIntervals : public QEvent
41  {
46  public: SnapIntervals(
47  const math::Vector3d &_xyz,
48  const math::Vector3d &_rpy,
49  const math::Vector3d &_scale)
50  : QEvent(kType), xyz(_xyz), rpy(_rpy), scale(_scale)
51  {
52  }
53 
56  public: math::Vector3d XYZ() const
57  {
58  return this->xyz;
59  }
60 
63  public: math::Vector3d RPY() const
64  {
65  return this->rpy;
66  }
67 
70  public: math::Vector3d Scale() const
71  {
72  return this->scale;
73  }
74 
76  static const QEvent::Type kType = QEvent::Type(QEvent::User);
77 
79  private: math::Vector3d xyz;
80 
82  private: math::Vector3d rpy;
83 
86  private: math::Vector3d scale;
87  };
88 
90  class EntitiesSelected : public QEvent
91  {
96  public: explicit EntitiesSelected(
97  const std::vector<Entity> &_entities, // NOLINT
98  bool _fromUser = false)
99  : QEvent(kType), entities(_entities), fromUser(_fromUser)
100  {
101  }
102 
105  public: std::vector<Entity> Data() const
106  {
107  return this->entities;
108  }
109 
112  public: bool FromUser() const
113  {
114  return this->fromUser;
115  }
116 
118  static const QEvent::Type kType = QEvent::Type(QEvent::User + 1);
119 
121  private: std::vector<Entity> entities;
122 
124  private: bool fromUser{false};
125  };
126 
128  class DeselectAllEntities : public QEvent
129  {
133  public: explicit DeselectAllEntities(bool _fromUser = false)
134  : QEvent(kType), fromUser(_fromUser)
135  {
136  }
137 
140  public: bool FromUser() const
141  {
142  return this->fromUser;
143  }
144 
146  static const QEvent::Type kType = QEvent::Type(QEvent::User + 2);
147 
149  private: bool fromUser{false};
150  };
151 
154  class Render : public QEvent
155  {
156  public: Render()
157  : QEvent(kType)
158  {
159  }
161  static const QEvent::Type kType = QEvent::Type(QEvent::User + 3);
162  };
163 
165  class SpawnPreviewModel : public QEvent
166  {
167  public: explicit SpawnPreviewModel(std::string &_modelSdfString)
168  : QEvent(kType), modelSdfString(_modelSdfString)
169  {
170  }
172  static const QEvent::Type kType = QEvent::Type(QEvent::User + 4);
173 
176  public: std::string ModelSdfString() const
177  {
178  return this->modelSdfString;
179  }
180 
183  };
184 } // namespace events
185 }
186 } // namespace gui
187 } // namespace gazebo
188 } // namespace ignition
189 
190 #endif // IGNITION_GAZEBO_GUI_GUIEVENTS_HH_
EntitiesSelected(const std::vector< Entity > &_entities, bool _fromUser=false)
Constructor.
Definition: GuiEvents.hh:96
math::Vector3d Scale() const
Get the scale snapping values.
Definition: GuiEvents.hh:70
std::string ModelSdfString() const
Get the sdf string of the model.
Definition: GuiEvents.hh:176
Render()
Definition: GuiEvents.hh:156
SnapIntervals(const math::Vector3d &_xyz, const math::Vector3d &_rpy, const math::Vector3d &_scale)
Constructor.
Definition: GuiEvents.hh:46
DeselectAllEntities(bool _fromUser=false)
Constructor.
Definition: GuiEvents.hh:133
std::vector< Entity > Data() const
Get the data sent with the event.
Definition: GuiEvents.hh:105
math::Vector3d RPY() const
Get the RPY snapping values.
Definition: GuiEvents.hh:63
math::Vector3d XYZ() const
Get the XYZ snapping values.
Definition: GuiEvents.hh:56
Event that notifies when all entities have been deselected.
Definition: GuiEvents.hh:128
STL class.
Event called in the render thread of a 3D scene. It&#39;s safe to make rendering calls in this event&#39;s ca...
Definition: GuiEvents.hh:154
Event that notifies when new entities have been selected.
Definition: GuiEvents.hh:90
The class for sending and receiving custom snap value events.
Definition: GuiEvents.hh:40
Event called to spawn a preview model. Used in shapes plugin.
Definition: GuiEvents.hh:165
This library is part of the Ignition Robotics project.
bool FromUser() const
Get whether the event was generated by the user.
Definition: GuiEvents.hh:140
SpawnPreviewModel(std::string &_modelSdfString)
Definition: GuiEvents.hh:167
std::string modelSdfString
The sdf string of the model to be previewed.
Definition: GuiEvents.hh:182
bool FromUser() const
Get whether the event was generated by the user.
Definition: GuiEvents.hh:112