Go to the documentation of this file.
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;
~SegmentItem()
Destructor.
std::vector< GrabberHandle * > Grabbers() const
Get the grabber handles.
double Scale() const
Get the scale of the segment item.
ignition::math::Vector3d Size() const
Get the size of the item in pixels.
Forward declarations for the common classes.
Definition: Animation.hh:26
Base class of an item in the editor.
Definition: EditorItem.hh:42
virtual void SegmentUpdated()
Update item.
static const double SnapLength
Length to snap in meters.
Definition: SegmentItem.hh:174
ignition::math::Vector2d StartPoint() const
Get the start point of the segment.
double Thickness() const
Get the thickness of the segment item.
Definition: GrabberHandle.hh:38
void SetEndPoint(const ignition::math::Vector2d &_end)
Set the end point of the segment.
void SetColor(const ignition::math::Color &_color)
Set the color of the segment item.
void SetThickness(const double _thickness)
Set the thickness of the segment item on the 2d view.
ignition::math::Vector3d ScenePosition() const
Get the scene position of editor item.
void SetScale(const double _scale)
Set the scale of the segment item.
void SetLine(const ignition::math::Vector2d &_start, const ignition::math::Vector2d &_end)
Set the segment's line.
void SetStartPoint(const ignition::math::Vector2d &_start)
Set the start point of the segment.
ignition::math::Vector2d EndPoint() const
Get the end point of the segment.
void SegmentChanged()
Emit segment changed Qt signals.
gui
Definition: KeyEventHandler.hh:29
2D line segment.
Definition: SegmentItem.hh:44
void UpdateLinkedGrabbers(GrabberHandle *_grabber, const ignition::math::Vector2d &_pos)
Update the position of all grabbers linked to the given one.
double SceneRotation() const
Get the scene rotation of the editor item.
static const double SnapAngle
Angle to snap in degrees.
Definition: SegmentItem.hh:171
SegmentItem(QGraphicsItem *_parent=0)
Constructor.
void ShowHandles(const bool _show)
Show the grabber handles of the segment item.
std::vector< GrabberHandle * > grabbers
A list of grabber handles for this item.
Definition: SegmentItem.hh:178