QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgslayoutitempolyline.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutitempolyline.cpp
3 begin : March 2016
4 copyright : (C) 2016 Paul Blottiere, Oslandia
5 email : paul dot blottiere at oslandia dot com
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
18
19#include <limits>
20
21#include "qgscolorutils.h"
22#include "qgslayout.h"
25#include "qgslayoututils.h"
26#include "qgslinesymbol.h"
27#include "qgsreadwritecontext.h"
29#include "qgssvgcache.h"
30#include "qgssymbol.h"
31#include "qgssymbollayerutils.h"
32
33#include <QGraphicsPathItem>
34#include <QSvgRenderer>
35#include <QVector2D>
36
37#include "moc_qgslayoutitempolyline.cpp"
38
41{
42 createDefaultPolylineStyleSymbol();
43}
44
46 : QgsLayoutNodesItem( polyline, layout )
47{
48 createDefaultPolylineStyleSymbol();
49}
50
52
57
62
64{
65 return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemPolyline.svg" ) );
66}
67
68bool QgsLayoutItemPolyline::_addNode( const int indexPoint,
69 QPointF newPoint,
70 const double radius )
71{
72 const double distStart = computeDistance( newPoint, mPolygon[0] );
73 const double distEnd = computeDistance( newPoint, mPolygon[mPolygon.size() - 1] );
74
75 if ( indexPoint == ( mPolygon.size() - 1 ) )
76 {
77 if ( distEnd < radius )
78 mPolygon.append( newPoint );
79 else if ( distStart < radius )
80 mPolygon.insert( 0, newPoint );
81 }
82 else
83 mPolygon.insert( indexPoint + 1, newPoint );
84
85 return true;
86}
87
89{
90 if ( index < 0 || index >= mPolygon.size() || mPolygon.size() <= 2 )
91 return false;
92
93 mPolygon.remove( index );
94
95 int newSelectNode = index;
96 if ( index >= mPolygon.size() )
97 newSelectNode = mPolygon.size() - 1;
98 setSelectedNode( newSelectNode );
99
100 return true;
101}
102
103void QgsLayoutItemPolyline::createDefaultPolylineStyleSymbol()
104{
105 QVariantMap properties;
106 properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
107 properties.insert( QStringLiteral( "width" ), QStringLiteral( "0.3" ) );
108 properties.insert( QStringLiteral( "capstyle" ), QStringLiteral( "square" ) );
109
110 mPolylineStyleSymbol = QgsLineSymbol::createSimple( properties );
111 refreshSymbol();
112}
113
114void QgsLayoutItemPolyline::refreshSymbol()
115{
116 if ( auto *lLayout = layout() )
117 {
118 const QgsRenderContext rc = QgsLayoutUtils::createRenderContextForLayout( lLayout, nullptr, lLayout->renderContext().dpi() );
119 mMaxSymbolBleed = ( 25.4 / lLayout->renderContext().dpi() ) * QgsSymbolLayerUtils::estimateMaxSymbolBleed( mPolylineStyleSymbol.get(), rc );
120 }
121
123
124 emit frameChanged();
125}
126
127void QgsLayoutItemPolyline::drawStartMarker( QPainter *painter )
128{
129 if ( mPolygon.size() < 2 )
130 return;
131
132 switch ( mStartMarker )
133 {
135 break;
136
138 {
139 // calculate angle at start of line
140 const QLineF startLine( mPolygon.at( 0 ), mPolygon.at( 1 ) );
141 const double angle = startLine.angle();
142 drawArrow( painter, mPolygon.at( 0 ), angle );
143 break;
144 }
145
147 {
148 // calculate angle at start of line
149 const QLineF startLine( mPolygon.at( 0 ), mPolygon.at( 1 ) );
150 const double angle = startLine.angle();
151 drawSvgMarker( painter, mPolygon.at( 0 ), angle, mStartMarkerFile, mStartArrowHeadHeight );
152 break;
153 }
154 }
155
156}
157
158void QgsLayoutItemPolyline::drawEndMarker( QPainter *painter )
159{
160 if ( mPolygon.size() < 2 )
161 return;
162
163 switch ( mEndMarker )
164 {
166 break;
167
169 {
170 // calculate angle at end of line
171 const QLineF endLine( mPolygon.at( mPolygon.count() - 2 ), mPolygon.at( mPolygon.count() - 1 ) );
172 const double angle = endLine.angle();
173
174 //move end point depending on arrow width
175 const QVector2D dir = QVector2D( endLine.dx(), endLine.dy() ).normalized();
176 QPointF endPoint = endLine.p2();
177 endPoint += ( dir * 0.5 * mArrowHeadWidth ).toPointF();
178
179 drawArrow( painter, endPoint, angle );
180 break;
181 }
183 {
184 // calculate angle at end of line
185 const QLineF endLine( mPolygon.at( mPolygon.count() - 2 ), mPolygon.at( mPolygon.count() - 1 ) );
186 const double angle = endLine.angle();
187 drawSvgMarker( painter, endLine.p2(), angle, mEndMarkerFile, mEndArrowHeadHeight );
188 break;
189 }
190 }
191}
192
193void QgsLayoutItemPolyline::drawArrow( QPainter *painter, QPointF center, double angle )
194{
195 // translate angle from ccw from axis to cw from north
196 angle = 90 - angle;
197 QPen p;
198 p.setColor( mArrowHeadStrokeColor );
199 p.setWidthF( mArrowHeadStrokeWidth );
200 painter->setPen( p );
201 QBrush b;
202 b.setColor( mArrowHeadFillColor );
203 painter->setBrush( b );
204
205 drawArrowHead( painter, center.x(), center.y(), angle, mArrowHeadWidth );
206}
207
208void QgsLayoutItemPolyline::updateMarkerSvgSizes()
209{
210 setStartSvgMarkerPath( mStartMarkerFile );
211 setEndSvgMarkerPath( mEndMarkerFile );
212}
213
214void QgsLayoutItemPolyline::drawArrowHead( QPainter *p, const double x, const double y, const double angle, const double arrowHeadWidth )
215{
216 if ( !p )
217 return;
218
219 const double angleRad = angle / 180.0 * M_PI;
220 const QPointF middlePoint( x, y );
221
222 //rotate both arrow points
223 const QPointF p1 = QPointF( -arrowHeadWidth / 2.0, arrowHeadWidth );
224 const QPointF p2 = QPointF( arrowHeadWidth / 2.0, arrowHeadWidth );
225
226 QPointF p1Rotated, p2Rotated;
227 p1Rotated.setX( p1.x() * std::cos( angleRad ) + p1.y() * -std::sin( angleRad ) );
228 p1Rotated.setY( p1.x() * std::sin( angleRad ) + p1.y() * std::cos( angleRad ) );
229 p2Rotated.setX( p2.x() * std::cos( angleRad ) + p2.y() * -std::sin( angleRad ) );
230 p2Rotated.setY( p2.x() * std::sin( angleRad ) + p2.y() * std::cos( angleRad ) );
231
232 QPolygonF arrowHeadPoly;
233 arrowHeadPoly << middlePoint;
234 arrowHeadPoly << QPointF( middlePoint.x() + p1Rotated.x(), middlePoint.y() + p1Rotated.y() );
235 arrowHeadPoly << QPointF( middlePoint.x() + p2Rotated.x(), middlePoint.y() + p2Rotated.y() );
236 QPen arrowPen = p->pen();
237 arrowPen.setJoinStyle( Qt::RoundJoin );
238 QBrush arrowBrush = p->brush();
239 arrowBrush.setStyle( Qt::SolidPattern );
240 p->setPen( arrowPen );
241 p->setBrush( arrowBrush );
242 arrowBrush.setStyle( Qt::SolidPattern );
243 p->drawPolygon( arrowHeadPoly );
244}
245
246void QgsLayoutItemPolyline::drawSvgMarker( QPainter *p, QPointF point, double angle, const QString &markerPath, double height ) const
247{
248 // translate angle from ccw from axis to cw from north
249 angle = 90 - angle;
250
251 if ( mArrowHeadWidth <= 0 || height <= 0 )
252 {
253 //bad image size
254 return;
255 }
256
257 if ( markerPath.isEmpty() )
258 return;
259
260 QSvgRenderer r;
261 const QByteArray &svgContent = QgsApplication::svgCache()->svgContent( markerPath, mArrowHeadWidth, mArrowHeadFillColor, mArrowHeadStrokeColor, mArrowHeadStrokeWidth,
262 1.0 );
263 r.load( svgContent );
264
265 const QgsScopedQPainterState painterState( p );
266 p->translate( point.x(), point.y() );
267 p->rotate( angle );
268 p->translate( -mArrowHeadWidth / 2.0, -height / 2.0 );
269 r.render( p, QRectF( 0, 0, mArrowHeadWidth, height ) );
270}
271
273{
274 if ( !id().isEmpty() )
275 return id();
276
277 return tr( "<Polyline>" );
278}
279
280void QgsLayoutItemPolyline::_draw( QgsLayoutItemRenderContext &context, const QStyleOptionGraphicsItem * )
281{
282 QgsRenderContext renderContext = context.renderContext();
283 // symbol clipping messes with geometry generators used in the symbol for this item, and has no
284 // valid use here. See https://github.com/qgis/QGIS/issues/58909
286
287 const QgsScopedQPainterState painterState( renderContext.painter() );
288 //setup painter scaling to dots so that raster symbology is drawn to scale
289 const double scale = renderContext.convertToPainterUnits( 1, Qgis::RenderUnit::Millimeters );
290 const QTransform t = QTransform::fromScale( scale, scale );
291
292 mPolylineStyleSymbol->startRender( renderContext );
293 mPolylineStyleSymbol->renderPolyline( t.map( mPolygon ), nullptr, renderContext );
294 mPolylineStyleSymbol->stopRender( renderContext );
295
296 // painter is scaled to dots, so scale back to layout units
297 renderContext.painter()->scale( renderContext.scaleFactor(), renderContext.scaleFactor() );
298
299 drawStartMarker( renderContext.painter() );
300 drawEndMarker( renderContext.painter() );
301}
302
303void QgsLayoutItemPolyline::_readXmlStyle( const QDomElement &elmt, const QgsReadWriteContext &context )
304{
305 mPolylineStyleSymbol = QgsSymbolLayerUtils::loadSymbol<QgsLineSymbol>( elmt, context );
306}
307
309{
310 mPolylineStyleSymbol.reset( static_cast<QgsLineSymbol *>( symbol->clone() ) );
311 refreshSymbol();
312}
313
315{
316 mStartMarker = mode;
317 update();
318}
319
321{
322 mEndMarker = mode;
323 update();
324}
325
327{
328 mArrowHeadWidth = width;
329 updateMarkerSvgSizes();
330 update();
331}
332
334{
335 QPainterPath path;
336 path.addPolygon( mPolygon );
337
338 QPainterPathStroker ps;
339
340 ps.setWidth( 2 * mMaxSymbolBleed );
341 const QPainterPath strokedOutline = ps.createStroke( path );
342
343 return strokedOutline;
344}
345
347{
348 // A Polyline is valid if it has at least 2 unique points
349 QList<QPointF> uniquePoints;
350 int seen = 0;
351 for ( QPointF point : mPolygon )
352 {
353 if ( !uniquePoints.contains( point ) )
354 {
355 uniquePoints.append( point );
356 if ( ++seen > 1 )
357 return true;
358 }
359 }
360 return false;
361}
362
364{
365 return mPolylineStyleSymbol.get();
366}
367
369{
370 QSvgRenderer r;
371 mStartMarkerFile = path;
372 if ( path.isEmpty() || !r.load( path ) )
373 {
374 mStartArrowHeadHeight = 0;
375 }
376 else
377 {
378 //calculate mArrowHeadHeight from svg file and mArrowHeadWidth
379 const QRect viewBox = r.viewBox();
380 mStartArrowHeadHeight = mArrowHeadWidth / viewBox.width() * viewBox.height();
381 }
383}
384
386{
387 QSvgRenderer r;
388 mEndMarkerFile = path;
389 if ( path.isEmpty() || !r.load( path ) )
390 {
391 mEndArrowHeadHeight = 0;
392 }
393 else
394 {
395 //calculate mArrowHeadHeight from svg file and mArrowHeadWidth
396 const QRect viewBox = r.viewBox();
397 mEndArrowHeadHeight = mArrowHeadWidth / viewBox.width() * viewBox.height();
398 }
400}
401
403{
404 mArrowHeadStrokeColor = color;
405 update();
406}
407
409{
410 mArrowHeadFillColor = color;
411 update();
412}
413
415{
416 mArrowHeadStrokeWidth = width;
418 update();
419}
420
422{
423 if ( mPolylineStyleSymbol )
424 {
425 QgsStyleSymbolEntity entity( mPolylineStyleSymbol.get() );
426 if ( !visitor->visit( QgsStyleEntityVisitorInterface::StyleLeaf( &entity, uuid(), displayName() ) ) )
427 return false;
428 }
429
430 return true;
431}
432
433void QgsLayoutItemPolyline::_writeXmlStyle( QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context ) const
434{
435 const QDomElement pe = QgsSymbolLayerUtils::saveSymbol( QString(),
436 mPolylineStyleSymbol.get(),
437 doc,
438 context );
439 elmt.appendChild( pe );
440}
441
442bool QgsLayoutItemPolyline::writePropertiesToElement( QDomElement &elmt, QDomDocument &doc, const QgsReadWriteContext &context ) const
443{
445
446 // absolute paths to relative
447 const QString startMarkerPath = QgsSymbolLayerUtils::svgSymbolPathToName( mStartMarkerFile, context.pathResolver() );
448 const QString endMarkerPath = QgsSymbolLayerUtils::svgSymbolPathToName( mEndMarkerFile, context.pathResolver() );
449
450 elmt.setAttribute( QStringLiteral( "arrowHeadWidth" ), QString::number( mArrowHeadWidth ) );
451 elmt.setAttribute( QStringLiteral( "arrowHeadFillColor" ), QgsColorUtils::colorToString( mArrowHeadFillColor ) );
452 elmt.setAttribute( QStringLiteral( "arrowHeadOutlineColor" ), QgsColorUtils::colorToString( mArrowHeadStrokeColor ) );
453 elmt.setAttribute( QStringLiteral( "outlineWidth" ), QString::number( mArrowHeadStrokeWidth ) );
454 elmt.setAttribute( QStringLiteral( "markerMode" ), mEndMarker );
455 elmt.setAttribute( QStringLiteral( "startMarkerMode" ), mStartMarker );
456 elmt.setAttribute( QStringLiteral( "startMarkerFile" ), startMarkerPath );
457 elmt.setAttribute( QStringLiteral( "endMarkerFile" ), endMarkerPath );
458
459 return true;
460}
461
462bool QgsLayoutItemPolyline::readPropertiesFromElement( const QDomElement &elmt, const QDomDocument &doc, const QgsReadWriteContext &context )
463{
464 mArrowHeadWidth = elmt.attribute( QStringLiteral( "arrowHeadWidth" ), QStringLiteral( "2.0" ) ).toDouble();
465 mArrowHeadFillColor = QgsColorUtils::colorFromString( elmt.attribute( QStringLiteral( "arrowHeadFillColor" ), QStringLiteral( "0,0,0,255" ) ) );
466 mArrowHeadStrokeColor = QgsColorUtils::colorFromString( elmt.attribute( QStringLiteral( "arrowHeadOutlineColor" ), QStringLiteral( "0,0,0,255" ) ) );
467 mArrowHeadStrokeWidth = elmt.attribute( QStringLiteral( "outlineWidth" ), QStringLiteral( "1.0" ) ).toDouble();
468 // relative paths to absolute
469 const QString startMarkerPath = elmt.attribute( QStringLiteral( "startMarkerFile" ), QString() );
470 const QString endMarkerPath = elmt.attribute( QStringLiteral( "endMarkerFile" ), QString() );
473 mEndMarker = static_cast< QgsLayoutItemPolyline::MarkerMode >( elmt.attribute( QStringLiteral( "markerMode" ), QStringLiteral( "0" ) ).toInt() );
474 mStartMarker = static_cast< QgsLayoutItemPolyline::MarkerMode >( elmt.attribute( QStringLiteral( "startMarkerMode" ), QStringLiteral( "0" ) ).toInt() );
475
477
479 return true;
480}
481
483{
484 QRectF br = rect();
485
486 double margin = std::max( mMaxSymbolBleed, computeMarkerMargin() );
487 if ( mEndMarker == ArrowHead )
488 {
489 margin += 0.5 * mArrowHeadWidth;
490 }
491 br.adjust( -margin, -margin, margin, margin );
492 prepareGeometryChange();
494
495 // update
496 update();
497}
498
499
500double QgsLayoutItemPolyline::computeMarkerMargin() const
501{
502 double margin = 0;
503
504 if ( mStartMarker == ArrowHead || mEndMarker == ArrowHead )
505 {
506 margin = mArrowHeadStrokeWidth / 2.0 + mArrowHeadWidth * M_SQRT2;
507 }
508
509 if ( mStartMarker == SvgMarker )
510 {
511 const double startMarkerMargin = std::sqrt( 0.25 * ( mStartArrowHeadHeight * mStartArrowHeadHeight + mArrowHeadWidth * mArrowHeadWidth ) );
512 margin = std::max( startMarkerMargin, margin );
513 }
514
515 if ( mEndMarker == SvgMarker )
516 {
517 const double endMarkerMargin = std::sqrt( 0.25 * ( mEndArrowHeadHeight * mEndArrowHeadHeight + mArrowHeadWidth * mArrowHeadWidth ) );
518 margin = std::max( endMarkerMargin, margin );
519 }
520
521 return margin;
522}
@ Millimeters
Millimeters.
Definition qgis.h:5184
@ DisableSymbolClippingToExtent
Force symbol clipping to map extent to be disabled in all situations. This will result in slower rend...
Definition qgis.h:2770
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
static QColor colorFromString(const QString &string)
Decodes a string into a color value.
static QString colorToString(const QColor &color)
Encodes a color into a string value.
bool isValid() const override
Must be reimplemented in subclasses.
void setArrowHeadWidth(double width)
Sets the width of line arrow heads in mm.
void setEndMarker(MarkerMode mode)
Sets the end marker mode, which controls what marker is drawn at the end of the line.
void setEndSvgMarkerPath(const QString &path)
Sets the path to a SVG marker to draw at the end of the line.
void _writeXmlStyle(QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context) const override
Method called in writeXml.
void setArrowHeadStrokeWidth(double width)
Sets the pen width in millimeters for the stroke of the arrow head.
void _readXmlStyle(const QDomElement &elmt, const QgsReadWriteContext &context) override
Method called in readXml.
void setArrowHeadFillColor(const QColor &color)
Sets the color used to fill the arrow head.
bool _removeNode(int nodeIndex) override
Method called in removeNode.
QgsLineSymbol * symbol()
Returns the line symbol used to draw the shape.
void setArrowHeadStrokeColor(const QColor &color)
Sets the color used to draw the stroke around the arrow head.
void setStartMarker(MarkerMode mode)
Sets the start marker mode, which controls what marker is drawn at the start of the line.
MarkerMode
Vertex marker mode.
@ ArrowHead
Show arrow marker.
@ NoMarker
Don't show marker.
QPainterPath shape() const override
~QgsLayoutItemPolyline() override
bool accept(QgsStyleEntityVisitorInterface *visitor) const override
Accepts the specified style entity visitor, causing it to visit all style entities associated with th...
bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context) override
Sets item state from a DOM element.
QString displayName() const override
Gets item display name.
static QgsLayoutItemPolyline * create(QgsLayout *layout)
Returns a new polyline item for the specified layout.
bool _addNode(int indexPoint, QPointF newPoint, double radius) override
Method called in addNode.
void setSymbol(QgsLineSymbol *symbol)
Sets the symbol used to draw the shape.
QIcon icon() const override
Returns the item's icon.
double arrowHeadWidth() const
Returns the width of line arrow heads in mm.
bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Stores item state within an XML DOM element.
void _draw(QgsLayoutItemRenderContext &context, const QStyleOptionGraphicsItem *itemStyle=nullptr) override
Method called in paint.
void setStartSvgMarkerPath(const QString &path)
Sets the path to a SVG marker to draw at the start of the line.
QgsLayoutItemPolyline(QgsLayout *layout)
Constructor for QgsLayoutItemPolyline for the specified layout.
@ LayoutPolyline
Polyline shape item.
Contains settings and helpers relating to a render of a QgsLayoutItem.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
friend class QgsLayout
virtual QString uuid() const
Returns the item identification string.
QString id() const
Returns the item's ID name.
void frameChanged()
Emitted if the item's frame style changes.
double mMaxSymbolBleed
Max symbol bleed.
QRectF mCurrentRectangle
Current bounding rectangle of shape.
bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context) override
Sets item state from a DOM element.
bool setSelectedNode(int index)
Selects a node by index.
bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Stores item state within an XML DOM element.
void updateSceneRect()
Update the current scene rectangle for this item.
double computeDistance(QPointF pt1, QPointF pt2) const
Compute an euclidean distance between 2 nodes.
QgsLayoutNodesItem(QgsLayout *layout)
Constructor for QgsLayoutNodesItem, attached to the specified layout.
QPolygonF mPolygon
Shape's nodes.
const QgsLayout * layout() const
Returns the layout the object is attached to.
static QgsRenderContext createRenderContextForLayout(QgsLayout *layout, QPainter *painter, double dpi=-1)
Creates a render context suitable for the specified layout and painter destination.
A line symbol type, for rendering LineString and MultiLineString geometries.
static std::unique_ptr< QgsLineSymbol > createSimple(const QVariantMap &properties)
Create a line symbol with one symbol layer: SimpleLine with specified properties.
A container for the context for various read/write operations on objects.
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.
Contains information about the context of a rendering operation.
double scaleFactor() const
Returns the scaling factor for the render to convert painter units to physical sizes.
double convertToPainterUnits(double size, Qgis::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) const
Converts a size from the specified units to painter units (pixels).
QPainter * painter()
Returns the destination QPainter for the render operation.
void setFlag(Qgis::RenderContextFlag flag, bool on=true)
Enable or disable a particular flag (other flags are not affected).
Scoped object for saving and restoring a QPainter object's state.
An interface for classes which can visit style entity (e.g.
virtual bool visit(const QgsStyleEntityVisitorInterface::StyleLeaf &entity)
Called when the visitor will visit a style entity.
A symbol entity for QgsStyle databases.
Definition qgsstyle.h:1397
QByteArray svgContent(const QString &path, double size, const QColor &fill, const QColor &stroke, double strokeWidth, double widthScaleFactor, double fixedAspectRatio=0, bool blocking=false, const QMap< QString, QString > &parameters=QMap< QString, QString >(), bool *isMissingImage=nullptr)
Gets the SVG content corresponding to the given path.
static QString svgSymbolPathToName(const QString &path, const QgsPathResolver &pathResolver)
Determines an SVG symbol's name from its path.
static std::unique_ptr< QgsSymbol > loadSymbol(const QDomElement &element, const QgsReadWriteContext &context)
Attempts to load a symbol from a DOM element.
static QString svgSymbolNameToPath(const QString &name, const QgsPathResolver &pathResolver)
Determines an SVG symbol's path from its name.
static QDomElement saveSymbol(const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
static double estimateMaxSymbolBleed(QgsSymbol *symbol, const QgsRenderContext &context)
Returns the maximum estimated bleed for the symbol.
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).
Contains information relating to the style entity currently being visited.