Gazebo Gazebo

API Reference

3.15.1
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 <string>
22 #include <utility>
23 #include <vector>
24 #include <gz/math/Vector3.hh>
25 #include "gz/sim/Entity.hh"
26 #include "gz/sim/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 
166  class SpawnPreviewModel : public QEvent
167  {
170  public: explicit SpawnPreviewModel(std::string &_modelSdfString)
171  : QEvent(kType), modelSdfString(_modelSdfString)
172  {
173  }
174 
176  static const QEvent::Type kType = QEvent::Type(QEvent::User + 4);
177 
180  public: std::string ModelSdfString() const
181  {
182  return this->modelSdfString;
183  }
184 
187  };
188 
191  class SpawnPreviewPath : public QEvent
192  {
195  public: explicit SpawnPreviewPath(const std::string &_filePath)
196  : QEvent(kType), filePath(_filePath)
197  {
198  }
199 
201  static const QEvent::Type kType = QEvent::Type(QEvent::User + 5);
202 
205  public: std::string FilePath() const
206  {
207  return this->filePath;
208  }
209 
212  };
213 } // namespace events
214 }
215 } // namespace gui
216 } // namespace gazebo
217 } // namespace ignition
218 
219 #endif // GZ_GAZEBO_GUI_GUIEVENTS_HH_
std::string modelSdfString
The sdf string of the model to be previewed.
Definition: gz/sim/gui/GuiEvents.hh:186
This library is part of the Ignition Robotics project.
STL class.
SpawnPreviewModel(std::string &_modelSdfString)
Constructor.
Definition: gz/sim/gui/GuiEvents.hh:170
Event called to spawn a preview resource, which takes the path to the SDF file. Used by plugins that ...
Definition: gz/sim/gui/GuiEvents.hh:191
static const QEvent::Type kType
Unique type for this event.
Definition: gz/sim/gui/GuiEvents.hh:118
Event called to spawn a preview model. Used by plugins that spawn models.
Definition: gz/sim/gui/GuiEvents.hh:166
Event that notifies when new entities have been selected.
Definition: gz/sim/gui/GuiEvents.hh:90
Event that notifies when all entities have been deselected.
Definition: gz/sim/gui/GuiEvents.hh:128
Event called in the render thread of a 3D scene. It's safe to make rendering calls in this event's ca...
Definition: gz/sim/gui/GuiEvents.hh:154
EntitiesSelected(const std::vector< Entity > &_entities, bool _fromUser=false)
Constructor.
Definition: gz/sim/gui/GuiEvents.hh:96
std::vector< Entity > Data() const
Get the data sent with the event.
Definition: gz/sim/gui/GuiEvents.hh:105
static const QEvent::Type kType
The QEvent representing a snap event occurrence.
Definition: gz/sim/gui/GuiEvents.hh:76
bool FromUser() const
Get whether the event was generated by the user.
Definition: gz/sim/gui/GuiEvents.hh:112
math::Vector3d Scale() const
Get the scale snapping values.
Definition: gz/sim/gui/GuiEvents.hh:70
The class for sending and receiving custom snap value events.
Definition: gz/sim/gui/GuiEvents.hh:40
static const QEvent::Type kType
Unique type for this event.
Definition: gz/sim/gui/GuiEvents.hh:161
static const QEvent::Type kType
Unique type for this event.
Definition: gz/sim/gui/GuiEvents.hh:146
Render()
Definition: gz/sim/gui/GuiEvents.hh:156
static const QEvent::Type kType
Unique type for this event.
Definition: gz/sim/gui/GuiEvents.hh:201
SnapIntervals(const math::Vector3d &_xyz, const math::Vector3d &_rpy, const math::Vector3d &_scale)
Constructor.
Definition: gz/sim/gui/GuiEvents.hh:46
std::string FilePath() const
Get the path of the SDF file.
Definition: gz/sim/gui/GuiEvents.hh:205
math::Vector3d RPY() const
Get the RPY snapping values.
Definition: gz/sim/gui/GuiEvents.hh:63
math::Vector3d XYZ() const
Get the XYZ snapping values.
Definition: gz/sim/gui/GuiEvents.hh:56
std::string ModelSdfString() const
Get the sdf string of the model.
Definition: gz/sim/gui/GuiEvents.hh:180
std::string filePath
The path of SDF file to be previewed.
Definition: gz/sim/gui/GuiEvents.hh:211
static const QEvent::Type kType
Unique type for this event.
Definition: gz/sim/gui/GuiEvents.hh:176
DeselectAllEntities(bool _fromUser=false)
Constructor.
Definition: gz/sim/gui/GuiEvents.hh:133
bool FromUser() const
Get whether the event was generated by the user.
Definition: gz/sim/gui/GuiEvents.hh:140
SpawnPreviewPath(const std::string &_filePath)
Constructor.
Definition: gz/sim/gui/GuiEvents.hh:195