17 #ifndef GAZEBO_GUI_BUILDING_SEGMENTITEM_HH_
18 #define GAZEBO_GUI_BUILDING_SEGMENTITEM_HH_
22 #include <ignition/math/Vector2.hh>
23 #include <ignition/math/Vector3.hh>
37 class SegmentItemPrivate;
49 public:
explicit SegmentItem(QGraphicsItem *_parent = 0);
57 public:
void SetLine(
const ignition::math::Vector2d &_start,
58 const ignition::math::Vector2d &_end);
62 public:
void SetStartPoint(
const ignition::math::Vector2d &_start);
66 public: ignition::math::Vector2d StartPoint()
const;
70 public:
void SetEndPoint(
const ignition::math::Vector2d &_end);
74 public: ignition::math::Vector2d EndPoint()
const;
78 public:
void SetThickness(
const double _thickness);
82 public:
double Thickness()
const;
86 public:
double Scale()
const;
90 public:
void SetScale(
const double _scale);
94 public:
void SetColor(
const ignition::math::Color &_color);
98 public:
void ShowHandles(
const bool _show);
101 public:
void SegmentChanged();
104 public: ignition::math::Vector3d Size()
const;
107 public: ignition::math::Vector3d ScenePosition()
const;
110 public:
double SceneRotation()
const;
114 public: std::vector<GrabberHandle *>Grabbers()
const;
117 protected:
virtual void SegmentUpdated();
122 protected:
void UpdateLinkedGrabbers(
GrabberHandle *_grabber,
123 const ignition::math::Vector2d &_pos);
129 private:
bool sceneEventFilter(QGraphicsItem *watched,
141 private:
void hoverEnterEvent(QGraphicsSceneHoverEvent *_event);
145 private:
void hoverMoveEvent(QGraphicsSceneHoverEvent *_event);
149 private:
void hoverLeaveEvent(QGraphicsSceneHoverEvent *_event);
153 private:
void mouseMoveEvent(QGraphicsSceneMouseEvent *_event);
157 private:
void mousePressEvent(QGraphicsSceneMouseEvent *_event);
161 private:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *_event);
167 private:
void paint(QPainter *_painter,
168 const QStyleOptionGraphicsItem *_option, QWidget *_widget);
182 private: std::unique_ptr<SegmentItemPrivate> dataPtr;
Base class of an item in the editor.
Definition: EditorItem.hh:42
static const double SnapAngle
Angle to snap in degrees.
Definition: SegmentItem.hh:171
static const double SnapLength
Length to snap in meters.
Definition: SegmentItem.hh:174
2D line segment.
Definition: SegmentItem.hh:44
Definition: GrabberHandle.hh:38
std::vector< GrabberHandle * > grabbers
A list of grabber handles for this item.
Definition: SegmentItem.hh:178