Ignition Gazebo

API Reference

5.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 <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 IGN_DEPRECATED(5) 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 IGN_DEPRECATED(5) 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 IGN_DEPRECATED(5) SpawnPreviewModel : public QEvent
167  {
170  public: explicit SpawnPreviewModel(const 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 IGN_DEPRECATED(5) 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 // IGNITION_GAZEBO_GUI_GUIEVENTS_HH_
std::string filePath
The path of SDF file to be previewed.
Definition: GuiEvents.hh:211
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:180
Event called to spawn a preview resource, which takes the path to the SDF file. Used by plugins that ...
Definition: GuiEvents.hh:191
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
std::string FilePath() const
Get the path of the SDF file.
Definition: GuiEvents.hh:205
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
SpawnPreviewModel(const std::string &_modelSdfString)
Constructor.
Definition: GuiEvents.hh:170
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 by plugins that spawn models.
Definition: GuiEvents.hh:166
#define IGN_DEPRECATED(version)
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
SpawnPreviewPath(const std::string &_filePath)
Constructor.
Definition: GuiEvents.hh:195
std::string modelSdfString
The sdf string of the model to be previewed.
Definition: GuiEvents.hh:186
bool FromUser() const
Get whether the event was generated by the user.
Definition: GuiEvents.hh:112