18#ifndef _GAZEBO_GUI_BUILDING_RECTITEM_HH_
19#define _GAZEBO_GUI_BUILDING_RECTITEM_HH_
23#include <ignition/math/Vector2.hh>
24#include <ignition/math/Vector3.hh>
26#include <ignition/math/Color.hh>
42 class RectItemPrivate;
83 public:
void SetSize(
const ignition::math::Vector2i &_size);
129 public:
virtual void SetPosition(
const ignition::math::Vector2d &_pos);
134 public:
virtual void SetPosition(
const double _x,
const double _y);
150 public:
virtual ignition::math::Vector3d
Size()
const;
168 private:
virtual bool RotateEventFilter(
RotateHandle *_rotateHandle,
174 private:
virtual bool GrabberEventFilter(
GrabberHandle *_grabber,
181 private:
virtual void paint(QPainter *_painter,
182 const QStyleOptionGraphicsItem *_option, QWidget *_widget);
186 private:
void hoverEnterEvent(QGraphicsSceneHoverEvent *_event);
190 private:
void hoverMoveEvent(QGraphicsSceneHoverEvent *_event);
194 private:
void hoverLeaveEvent(QGraphicsSceneHoverEvent *_event);
198 private:
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *_event);
202 private:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *_event);
206 private:
virtual void mouseReleaseEvent(
207 QGraphicsSceneMouseEvent *_event);
211 private:
virtual void mousePressEvent(
212 QGraphicsSceneDragDropEvent *_event);
216 private:
virtual void mouseMoveEvent(
217 QGraphicsSceneDragDropEvent *_event);
221 private:
virtual void mouseDoubleClickEvent(
222 QGraphicsSceneMouseEvent *_event);
227 private:
virtual bool sceneEventFilter(QGraphicsItem *_watched,
234 private: QVariant itemChange(GraphicsItemChange _change,
235 const QVariant &_value);
239 private:
virtual void contextMenuEvent(
240 QGraphicsSceneContextMenuEvent *_event);
243 private:
virtual void SizeChanged();
248 private:
void AdjustSize(
const double _x,
const double _y);
251 private slots:
virtual void OnOpenInspector();
254 private slots:
virtual void OnDeleteItem();
293 private: std::unique_ptr<RectItemPrivate> dataPtr;
gui
Definition KeyEventHandler.hh:29
Base class of an item in the editor.
Definition EditorItem.hh:43
Definition GrabberHandle.hh:39
2D rectangle.
Definition RectItem.hh:51
virtual double SceneRotation() const
Get the scene rotation of the editor item.
ignition::math::Color borderColor
Border color of the rect item.
Definition RectItem.hh:275
void SetPositionOnWall(const double _positionOnWall)
Set the position of this item inside its parent wall.
virtual ignition::math::Vector3d ScenePosition() const
Get the scene position of editor item.
double Height() const
Get the height of the rect item.
virtual void SetResizeFlag(const unsigned int _flag)
Set the resize flag of the rect item.
virtual ~RectItem()
Destructor.
double AngleOnWall() const
Get the angle of this item inside its parent wall.
double rotationAngle
Rotation angle of the rect item in degrees.
Definition RectItem.hh:278
QAction * openInspectorAct
Qt action for opening the inspector.
Definition RectItem.hh:281
void DetachFromParent()
Detach the rect item from its parent.
void SetHeight(const int _height)
Set the height of the rect item.
virtual QRectF boundingRect() const
Get the bounding box of the rect item.
void SetAngleOnWall(const double _angleOnWall)
Set the angle of this item inside its parent wall.
virtual void SetPosition(const double _x, const double _y)
Set the position of the rect item.
std::vector< MeasureItem * > measures
A vector containing this item's measure items.
Definition RectItem.hh:289
void SetSize(const ignition::math::Vector2i &_size)
Set the size of the rect item.
void SetHighlighted(const bool _highlighted)
Set whether this item should be highlighted or not.
void ShowHandles(const bool _show)
Show the grabber and rotate handles of the rect item.
virtual void SetPosition(const ignition::math::Vector2d &_pos)
Set the position of the rect item.
void SetWidth(const int _width)
Set the width of the rect item.
void UpdateMeasures()
Update this item's measures.
double height
Height of rect item in pixels.
Definition RectItem.hh:260
double PositionOnWall() const
Get the position of this item inside its parent wall.
double drawingHeight
Actual height of rect item drawn in pixels.
Definition RectItem.hh:266
ResizeFlags
Resize flags used to indicate which dimension can be resized.
Definition RectItem.hh:56
@ ITEM_WIDTH
Width.
Definition RectItem.hh:61
@ ITEM_HEIGHT
Height.
Definition RectItem.hh:64
@ NONE
No dimensions.
Definition RectItem.hh:58
double width
Width of rect item in pixels.
Definition RectItem.hh:257
double drawingOriginX
X origin of the rect item in pixels.
Definition RectItem.hh:269
void UpdateCornerPositions()
Helper method for Updating the corner positions of the rect item.
double drawingOriginY
Y origin of the rect item in pixels.
Definition RectItem.hh:272
QAction * deleteItemAct
Qt action for deleting the item.
Definition RectItem.hh:284
void DrawBoundingBox(QPainter *_painter)
Draw bounding box.
double drawingWidth
Actual width of rect item drawn in pixels.
Definition RectItem.hh:263
double Width() const
Get the width of the rect item.
virtual ignition::math::Vector3d Size() const
Get the size of the item in pixels.
virtual double Rotation() const
Get the rotation of the rect item.
virtual void SetRotation(const double _angle)
Set the rotation of the rect item.
Handle for rotating an editor item.
Definition RotateHandle.hh:38
Forward declarations for the common classes.
Definition Animation.hh:27