EditorItem.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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 
18 #ifndef GAZEBO_GUI_BUILDING_EDITORITEM_HH_
19 #define GAZEBO_GUI_BUILDING_EDITORITEM_HH_
20 
21 #include <string>
22 #include <memory>
23 #include <ignition/math/Color.hh>
24 #include <ignition/math/Vector3.hh>
25 
26 #include "gazebo/gui/qt.h"
27 
28 #include "gazebo/util/system.hh"
29 
30 namespace gazebo
31 {
32  namespace gui
33  {
34  // Forward declare private data.
35  class EditorItemPrivate;
36 
39 
42  class GZ_GUI_VISIBLE EditorItem : public QObject
43  {
44  Q_OBJECT
45 
47  public: EditorItem();
48 
50  public: ~EditorItem();
51 
54  public: virtual ignition::math::Vector3d Size() const;
55 
58  public: virtual ignition::math::Vector3d ScenePosition() const;
59 
62  public: virtual double SceneRotation() const;
63 
66  public: virtual std::string ItemType() const;
67 
70  public: virtual std::string Name() const;
71 
73  public: int Level() const;
74 
77  public: double LevelBaseHeight() const;
78 
81  public: virtual ignition::math::Color Color3d() const;
82 
85  public: virtual std::string Texture3d() const;
86 
89  public: virtual void SetName(const std::string &_name);
90 
93  public: void SetLevel(const int _level);
94 
98  public: void SetLevelBaseHeight(const double _height);
99 
102  public: void SetColor3d(const ignition::math::Color &_color);
103 
106  public: void SetTexture3d(const std::string &_texture);
107 
110  public: void Set3dTransparency(const float _transparency);
111 
114  public: virtual void SetHighlighted(const bool _highlighted);
115 
118  public: int ZValueIdle() const;
119 
122  public: int ZValueSelected() const;
123 
128  Q_SIGNALS: void SizeChanged(const double _width, const double _depth,
129  const double _height);
130 
138  Q_SIGNALS: void PoseChanged(const double _x, const double _y,
139  const double _z, const double _roll, const double _pitch,
140  const double _yaw);
141 
149  Q_SIGNALS: void PoseOriginTransformed(const double _x, const double _y,
150  const double _z, const double _roll, const double _pitch,
151  const double _yaw);
152 
157  Q_SIGNALS: void PositionChanged(const double _x, const double _y,
158  const double _z);
159 
164  Q_SIGNALS: void RotationChanged(const double _roll, const double _pitch,
165  const double _yaw);
166 
169  Q_SIGNALS: void WidthChanged(const double _width);
170 
173  Q_SIGNALS: void DepthChanged(const double _depth);
174 
177  Q_SIGNALS: void HeightChanged(const double _height);
178 
182  Q_SIGNALS: void PosXChanged(const double _posX);
183 
187  Q_SIGNALS: void PosYChanged(const double _posY);
188 
192  Q_SIGNALS: void PosZChanged(const double _posZ);
193 
197  Q_SIGNALS: void YawChanged(const double _yaw);
198 
201  Q_SIGNALS: void LevelChanged(const int _level);
202 
206  Q_SIGNALS: void ColorChanged(const ignition::math::Color &_color);
207 
211  Q_SIGNALS: void TextureChanged(const std::string &_texture);
212 
216  Q_SIGNALS: void TransparencyChanged(const float _transparency);
217 
219  Q_SIGNALS: void ItemDeleted();
220 
223  private slots: void OnColorChanged(const ignition::math::Color &_color);
224 
227  private slots: void OnTextureChanged(const std::string &_texture);
228 
230  protected: int zValueIdle;
231 
233  protected: int zValueSelected;
234 
236  protected: std::string editorType;
237 
239  protected: std::string name;
240 
242  protected: int level;
243 
246  protected: double levelBaseHeight;
247 
249  protected: ignition::math::Color visual3dColor;
250 
252  protected: std::string visual3dTexture;
253 
255  protected: float visual3dTransparency;
256 
259  protected: bool highlighted;
260 
262  protected: double itemScale;
263 
266  private: std::unique_ptr<EditorItemPrivate> dataPtr;
267  };
269  }
270 }
271 
272 #endif
~EditorItem()
Destructor.
std::string editorType
Type of editor item.
Definition: EditorItem.hh:236
Forward declarations for the common classes.
Definition: Animation.hh:26
EditorItem()
Constructor.
Base class of an item in the editor.
Definition: EditorItem.hh:42
void Set3dTransparency(const float _transparency)
Set the transparency of the associated 3D visual.
A convenient structure for storing level information.
Definition: EditorView.hh:45
virtual ignition::math::Color Color3d() const
Get the associated 3D visual's color.
void SizeChanged(const double _width, const double _depth, const double _height)
Qt signal emitted when the editor item size has changed.
void SetLevelBaseHeight(const double _height)
Set the base height of this level relative to the ground plane.
int zValueSelected
Z ordering of the rect item when selected.
Definition: EditorItem.hh:233
virtual double SceneRotation() const
Get the scene rotation of the editor item.
void PosXChanged(const double _posX)
Qt signal emitted when the editor item's X position has changed.
virtual std::string Name() const
Get the name of the editor item.
void LevelChanged(const int _level)
Qt signal emitted when the editor item's level has changed.
void SetLevel(const int _level)
Set the level of this building item.
virtual void SetHighlighted(const bool _highlighted)
Set whether this item should be highlighted or not.
int ZValueIdle() const
Get the z value of this item when in idle state.
int level
Level that this item is on.
Definition: EditorItem.hh:242
double levelBaseHeight
Vertical distance from the building's base to the base of the level this editor is in.
Definition: EditorItem.hh:246
void PoseOriginTransformed(const double _x, const double _y, const double _z, const double _roll, const double _pitch, const double _yaw)
Qt signal emitted when the editor item pose origin has changed.
virtual void SetName(const std::string &_name)
Set the name of this editor item.
void YawChanged(const double _yaw)
Qt signal emitted when the editor item yaw rotation has changed.
int Level() const
Get the level in which this building item is located.
double itemScale
Scale for converting from pixel to metric units.
Definition: EditorItem.hh:262
float visual3dTransparency
Transparency of the associated 3D visual.
Definition: EditorItem.hh:255
std::string visual3dTexture
Texture of the associated 3D visual.
Definition: EditorItem.hh:252
void PosYChanged(const double _posY)
Qt signal emitted when the editor item's Y position has changed.
void ItemDeleted()
Qt signal emitted when the editor item is being deleted.
virtual std::string Texture3d() const
Get the associated 3D visual's texture.
double LevelBaseHeight() const
Get the base height of this level relative to the ground plane.
void SetColor3d(const ignition::math::Color &_color)
Set the associated 3D visual's color.
int zValueIdle
Z ordering of the rect item when idle (unselected.)
Definition: EditorItem.hh:230
void DepthChanged(const double _depth)
Qt signal emitted when the editor item depth has changed.
int ZValueSelected() const
Get the z value of this item when in selected state.
void TextureChanged(const std::string &_texture)
Qt signal emitted when the editor item's 3D texture has changed.
void PositionChanged(const double _x, const double _y, const double _z)
Qt signal emitted when the editor item position has changed.
void ColorChanged(const ignition::math::Color &_color)
Qt signal emitted when the editor item's 3D color has changed.
ignition::math::Color visual3dColor
Color of the associated 3D visual.
Definition: EditorItem.hh:249
void RotationChanged(const double _roll, const double _pitch, const double _yaw)
Qt signal emitted when the editor item rotation has changed.
virtual std::string ItemType() const
Get the type of the editor item.
bool highlighted
Flag to indicate whether this item is currently highlighted or not.
Definition: EditorItem.hh:259
std::string name
Name of editor item.
Definition: EditorItem.hh:239
void PoseChanged(const double _x, const double _y, const double _z, const double _roll, const double _pitch, const double _yaw)
Qt signal emitted when the editor item pose has changed.
virtual ignition::math::Vector3d Size() const
Get the size of the item in pixels.
void PosZChanged(const double _posZ)
Qt signal emitted when the editor item's Z position has changed.
void TransparencyChanged(const float _transparency)
Qt signal emitted when the editor item's 3D transparency has changed.
virtual ignition::math::Vector3d ScenePosition() const
Get the scene position of editor item.
void SetTexture3d(const std::string &_texture)
Set the associated 3D visual's texture.
void HeightChanged(const double _height)
Qt signal emitted when the editor item height has changed.
void WidthChanged(const double _width)
Qt signal emitted when the editor item width has changed.