17 #ifndef QGSLAYOUTITEMPOLYLINE_H
18 #define QGSLAYOUTITEMPOLYLINE_H
20 #include "qgis_core.h"
23 #include <QGraphicsPathItem>
64 int type()
const override;
65 QIcon
icon()
const override;
67 QPainterPath shape()
const override;
73 QgsLineSymbol *symbol() {
return mPolylineStyleSymbol.get(); }
87 MarkerMode startMarker()
const {
return mStartMarker; }
94 void setStartMarker( MarkerMode mode );
101 MarkerMode endMarker()
const {
return mEndMarker; }
108 void setEndMarker( MarkerMode mode );
114 void setArrowHeadWidth(
double width );
120 double arrowHeadWidth()
const {
return mArrowHeadWidth; }
127 void setStartSvgMarkerPath(
const QString &path );
134 QString startSvgMarkerPath()
const {
return mStartMarkerFile; }
141 void setEndSvgMarkerPath(
const QString &path );
148 QString endSvgMarkerPath()
const {
return mEndMarkerFile; }
155 QColor arrowHeadStrokeColor()
const {
return mArrowHeadStrokeColor; }
162 void setArrowHeadStrokeColor(
const QColor &color );
169 QColor arrowHeadFillColor()
const {
return mArrowHeadFillColor; }
176 void setArrowHeadFillColor(
const QColor &color );
183 void setArrowHeadStrokeWidth(
double width );
190 double arrowHeadStrokeWidth()
const {
return mArrowHeadStrokeWidth; }
196 bool _addNode(
int indexPoint, QPointF newPoint,
double radius )
override;
211 std::unique_ptr<QgsLineSymbol> mPolylineStyleSymbol;
219 double mArrowHeadWidth = 4.0;
222 double mStartArrowHeadHeight = 0.0;
225 double mEndArrowHeadHeight = 0.0;
228 QString mStartMarkerFile;
231 QString mEndMarkerFile;
234 double mArrowHeadStrokeWidth = 1.0;
236 QColor mArrowHeadStrokeColor = Qt::black;
237 QColor mArrowHeadFillColor = Qt::black;
240 void createDefaultPolylineStyleSymbol();
246 void refreshSymbol();
248 void drawStartMarker( QPainter *painter );
249 void drawEndMarker( QPainter *painter );
251 void drawArrow( QPainter *painter, QPointF center,
double angle );
253 void updateMarkerSvgSizes();
264 static void drawArrowHead( QPainter *p,
double x,
double y,
double angle,
double arrowHeadWidth );
265 void drawSvgMarker( QPainter *p, QPointF point,
double angle,
const QString &markerPath,
double height )
const;
267 double computeMarkerMargin()
const;
269 friend class TestQgsLayoutPolyline;
274 #endif // QGSLAYOUTITEMPOLYLINE_H