QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
17 #ifndef QGSLAYOUTITEMPOLYLINE_H
18 #define QGSLAYOUTITEMPOLYLINE_H
20 #include "qgis_core.h"
22 #include <QGraphicsPathItem>
66 int type()
const override;
67 QIcon
icon()
const override;
69 QPainterPath shape()
const override;
96 void setStartMarker( MarkerMode mode );
110 void setEndMarker( MarkerMode mode );
116 void setArrowHeadWidth(
double width );
129 void setStartSvgMarkerPath(
const QString &path );
143 void setEndSvgMarkerPath(
const QString &path );
164 void setArrowHeadStrokeColor(
const QColor &color );
178 void setArrowHeadFillColor(
const QColor &color );
185 void setArrowHeadStrokeWidth(
double width );
198 bool _addNode(
int indexPoint, QPointF newPoint,
double radius )
override;
213 std::unique_ptr<QgsLineSymbol> mPolylineStyleSymbol;
216 MarkerMode mStartMarker = NoMarker;
218 MarkerMode mEndMarker = NoMarker;
221 double mArrowHeadWidth = 4.0;
224 double mStartArrowHeadHeight = 0.0;
227 double mEndArrowHeadHeight = 0.0;
230 QString mStartMarkerFile;
233 QString mEndMarkerFile;
236 double mArrowHeadStrokeWidth = 1.0;
238 QColor mArrowHeadStrokeColor = Qt::black;
239 QColor mArrowHeadFillColor = Qt::black;
242 void createDefaultPolylineStyleSymbol();
248 void refreshSymbol();
250 void drawStartMarker( QPainter *painter );
251 void drawEndMarker( QPainter *painter );
253 void drawArrow( QPainter *painter, QPointF center,
double angle );
255 void updateMarkerSvgSizes();
266 static void drawArrowHead( QPainter *p,
double x,
double y,
double angle,
double arrowHeadWidth );
267 void drawSvgMarker( QPainter *p, QPointF point,
double angle,
const QString &markerPath,
double height )
const;
269 double computeMarkerMargin()
const;
271 friend class TestQgsLayoutPolyline;
276 #endif // QGSLAYOUTITEMPOLYLINE_H
The class is used as a container of context for various read/write operations on other objects.
bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context) override
Sets item state from a DOM element.
virtual QIcon icon() const
Returns the item's icon.
Layout item for node based polyline shapes.
QString startSvgMarkerPath() const
Returns the path the an SVG marker drawn at the start of the line.
Contains settings and helpers relating to a render of a QgsLayoutItem.
MarkerMode startMarker() const
Returns the start marker mode, which controls what marker is drawn at the start of the line.
virtual bool _removeNode(int nodeIndex)=0
Method called in removeNode.
An interface for classes which can visit style entity (e.g. symbol) nodes (using the visitor pattern)...
QColor arrowHeadStrokeColor() const
Returns the color used to draw the stroke around the the arrow head.
int type() const override
Returns a unique graphics item type identifier.
@ SvgMarker
Show SVG marker.
MarkerMode
Vertex marker mode.
virtual void _draw(QgsLayoutItemRenderContext &context, const QStyleOptionGraphicsItem *itemStyle=nullptr)=0
Method called in paint.
double arrowHeadWidth() const
Returns the width of line arrow heads in mm.
MarkerMode endMarker() const
Returns the end marker mode, which controls what marker is drawn at the end of the line.
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified style entity visitor, causing it to visit all style entities associated with th...
A line symbol type, for rendering LineString and MultiLineString geometries.
double arrowHeadStrokeWidth() const
Returns the pen width in millimeters for the stroke of the arrow head.
bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Stores item state within an XML DOM element.
QString endSvgMarkerPath() const
Returns the path the an SVG marker drawn at the end of the line.
@ ArrowHead
Show arrow marker.
virtual void _readXmlStyle(const QDomElement &elmt, const QgsReadWriteContext &context)=0
Method called in readXml.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
An abstract layout item that provides generic methods for node based shapes such as polygon or polyli...
virtual QString displayName() const
Gets item display name.
@ NoMarker
Don't show marker.
virtual void updateBoundingRect()
Called when the bounding rect of the item should recalculated.
virtual void _writeXmlStyle(QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context) const =0
Method called in writeXml.
QColor arrowHeadFillColor() const
Returns the color used to fill the arrow head.
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)
virtual bool _addNode(int nodeIndex, QPointF newNode, double radius)=0
Method called in addNode.