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>
42 class RectItemPrivate;
75 public:
void SetWidth(
const int _width);
79 public:
void SetHeight(
const int _height);
83 public:
void SetSize(
const ignition::math::Vector2i &_size);
87 public:
double Width()
const;
91 public:
double Height()
const;
95 public:
void SetPositionOnWall(
const double _positionOnWall);
99 public:
double PositionOnWall()
const;
103 public:
void SetAngleOnWall(
const double _angleOnWall);
107 public:
double AngleOnWall()
const;
111 public:
void ShowHandles(
const bool _show);
114 public:
void SetHighlighted(
const bool _highlighted);
117 public:
void DetachFromParent();
121 protected:
void UpdateCornerPositions();
125 protected:
void DrawBoundingBox(QPainter *_painter);
129 public:
virtual void SetPosition(
const ignition::math::Vector2d &_pos);
134 public:
virtual void SetPosition(
const double _x,
const double _y);
138 public:
virtual void SetRotation(
const double _angle);
143 public:
virtual void SetResizeFlag(
const unsigned int _flag);
147 public:
virtual double Rotation()
const;
150 public:
virtual ignition::math::Vector3d Size()
const;
153 public:
virtual ignition::math::Vector3d ScenePosition()
const;
156 public:
virtual double SceneRotation()
const;
160 protected:
virtual QRectF boundingRect()
const;
163 protected:
void UpdateMeasures();
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;
ResizeFlags
Resize flags used to indicate which dimension can be resized.
Definition: RectItem.hh:55
Base class of an item in the editor.
Definition: EditorItem.hh:43
double drawingOriginY
Y origin of the rect item in pixels.
Definition: RectItem.hh:272
double height
Height of rect item in pixels.
Definition: RectItem.hh:260
2D rectangle.
Definition: RectItem.hh:49
QAction * openInspectorAct
Qt action for opening the inspector.
Definition: RectItem.hh:281
QAction * deleteItemAct
Qt action for deleting the item.
Definition: RectItem.hh:284
double drawingWidth
Actual width of rect item drawn in pixels.
Definition: RectItem.hh:263
common::Color borderColor
Border color of the rect item.
Definition: RectItem.hh:275
double width
Width of rect item in pixels.
Definition: RectItem.hh:257
double drawingHeight
Actual height of rect item drawn in pixels.
Definition: RectItem.hh:266
Handle for rotating an editor item.
Definition: RotateHandle.hh:37
std::vector< MeasureItem * > measures
A vector containing this item's measure items.
Definition: RectItem.hh:289
Defines a color.
Definition: Color.hh:36
double rotationAngle
Rotation angle of the rect item in degrees.
Definition: RectItem.hh:278
Definition: GrabberHandle.hh:42
double drawingOriginX
X origin of the rect item in pixels.
Definition: RectItem.hh:269