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;
114 void setArrowHeadWidth(
double width );
127 void setStartSvgMarkerPath(
const QString &path );
141 void setEndSvgMarkerPath(
const QString &path );
162 void setArrowHeadStrokeColor(
const QColor &color );
176 void setArrowHeadFillColor(
const QColor &color );
183 void setArrowHeadStrokeWidth(
double width );
194 bool _addNode(
int indexPoint, QPointF newPoint,
double radius )
override;
209 std::unique_ptr<QgsLineSymbol> mPolylineStyleSymbol;
217 double mArrowHeadWidth = 4.0;
220 double mStartArrowHeadHeight = 0.0;
223 double mEndArrowHeadHeight = 0.0;
226 QString mStartMarkerFile;
229 QString mEndMarkerFile;
232 double mArrowHeadStrokeWidth = 1.0;
234 QColor mArrowHeadStrokeColor = Qt::black;
235 QColor mArrowHeadFillColor = Qt::black;
238 void createDefaultPolylineStyleSymbol();
244 void refreshSymbol();
246 void drawStartMarker( QPainter *painter );
247 void drawEndMarker( QPainter *painter );
249 void drawArrow( QPainter *painter, QPointF center,
double angle );
251 void updateMarkerSvgSizes();
262 static void drawArrowHead( QPainter *p,
double x,
double y,
double angle,
double arrowHeadWidth );
263 void drawSvgMarker( QPainter *p, QPointF point,
double angle,
const QString &markerPath,
double height )
const;
265 double computeMarkerMargin()
const;
267 friend class TestQgsLayoutPolyline;
272 #endif // QGSLAYOUTITEMPOLYLINE_H double arrowHeadWidth() const
Returns the width of line arrow heads in mm.
virtual void _writeXmlStyle(QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context) const =0
Method called in writeXml.
The class is used as a container of context for various read/write operations on other objects...
virtual QIcon icon() const
Returns the item's icon.
bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context) override
Sets item state from a DOM element.
QString startSvgMarkerPath() const
Returns the path the an SVG marker drawn at the start of the line.
int type() const override
Returns a unique graphics item type identifier.
virtual void _draw(QgsLayoutItemRenderContext &context, const QStyleOptionGraphicsItem *itemStyle=nullptr)=0
Method called in paint.
MarkerMode
Vertex marker mode.
An abstract layout item that provides generic methods for node based shapes such as polygon or polyli...
bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Stores item state within an XML DOM element.
virtual bool _removeNode(int nodeIndex)=0
Method called in removeNode.
virtual void updateBoundingRect()
Called when the bounding rect of the item should recalculated.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
A line symbol type, for rendering LineString and MultiLineString geometries.
QColor arrowHeadFillColor() const
Returns the color used to fill the arrow head.
QgsLineSymbol * symbol()
Returns the line symbol used to draw the shape.
Layout item for node based polyline shapes.
double arrowHeadStrokeWidth() const
Returns the pen width in millimeters for the stroke of the arrow head.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
MarkerMode startMarker() const
Returns the start marker mode, which controls what marker is drawn at the start of the line...
Contains settings and helpers relating to a render of a QgsLayoutItem.
virtual QString displayName() const
Gets item display name.
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
QString endSvgMarkerPath() const
Returns the path the an SVG marker drawn at the end of the line.
MarkerMode endMarker() const
Returns the end marker mode, which controls what marker is drawn at the end of the line...
QColor arrowHeadStrokeColor() const
Returns the color used to draw the stroke around the the arrow head.
virtual void _readXmlStyle(const QDomElement &elmt, const QgsReadWriteContext &context)=0
Method called in readXml.
virtual bool _addNode(int nodeIndex, QPointF newNode, double radius)=0
Method called in addNode.