43 if ( props.contains( QStringLiteral(
"arrow_width" ) ) )
44 l->
setArrowWidth( props[QStringLiteral(
"arrow_width" )].toDouble() );
46 if ( props.contains( QStringLiteral(
"arrow_width_unit" ) ) )
49 if ( props.contains( QStringLiteral(
"arrow_width_unit_scale" ) ) )
52 if ( props.contains( QStringLiteral(
"arrow_start_width" ) ) )
55 if ( props.contains( QStringLiteral(
"arrow_start_width_unit" ) ) )
58 if ( props.contains( QStringLiteral(
"arrow_start_width_unit_scale" ) ) )
61 if ( props.contains( QStringLiteral(
"is_curved" ) ) )
62 l->
setIsCurved( props[QStringLiteral(
"is_curved" )].toInt() == 1 );
64 if ( props.contains( QStringLiteral(
"is_repeated" ) ) )
65 l->
setIsRepeated( props[QStringLiteral(
"is_repeated" )].toInt() == 1 );
67 if ( props.contains( QStringLiteral(
"head_length" ) ) )
68 l->
setHeadLength( props[QStringLiteral(
"head_length" )].toDouble() );
70 if ( props.contains( QStringLiteral(
"head_length_unit" ) ) )
73 if ( props.contains( QStringLiteral(
"head_length_unit_scale" ) ) )
76 if ( props.contains( QStringLiteral(
"head_thickness" ) ) )
79 if ( props.contains( QStringLiteral(
"head_thickness_unit" ) ) )
82 if ( props.contains( QStringLiteral(
"head_thickness_unit_scale" ) ) )
85 if ( props.contains( QStringLiteral(
"head_type" ) ) )
88 if ( props.contains( QStringLiteral(
"arrow_type" ) ) )
91 if ( props.contains( QStringLiteral(
"offset" ) ) )
92 l->
setOffset( props[QStringLiteral(
"offset" )].toDouble() );
94 if ( props.contains( QStringLiteral(
"offset_unit" ) ) )
97 if ( props.contains( QStringLiteral(
"offset_unit_scale" ) ) )
100 if ( props.contains( QStringLiteral(
"ring_filter" ) ) )
121 return QStringLiteral(
"ArrowLine" );
128 map[QStringLiteral(
"arrow_width" )] = QString::number(
arrowWidth() );
132 map[QStringLiteral(
"arrow_start_width" )] = QString::number(
arrowStartWidth() );
136 map[QStringLiteral(
"is_curved" )] = QString::number(
isCurved() ? 1 : 0 );
137 map[QStringLiteral(
"is_repeated" )] = QString::number(
isRepeated() ? 1 : 0 );
139 map[QStringLiteral(
"head_length" )] = QString::number(
headLength() );
143 map[QStringLiteral(
"head_thickness" )] = QString::number(
headThickness() );
147 map[QStringLiteral(
"head_type" )] = QString::number(
headType() );
148 map[QStringLiteral(
"arrow_type" )] = QString::number(
arrowType() );
150 map[QStringLiteral(
"offset" )] = QString::number(
offset() );
154 map[QStringLiteral(
"ring_filter" )] = QString::number(
static_cast< int >(
mRingFilter ) );
163 attributes.unite( mSymbol->usedAttributes( context ) );
172 if ( mSymbol && mSymbol->hasDataDefinedProperties() )
208 return std::sqrt( ( po.x() - pd.x() ) * ( po.x() - pd.x() ) + ( po.y() - pd.y() ) * ( po.y() - pd.y() ) );
212 qreal startWidth, qreal width,
213 qreal headWidth, qreal headHeight,
224 po = pd - ( pd - po ) / length * headWidth;
229 pd = po + ( pd - po ) / length * headWidth;
234 QPointF v = ( pd - po ) / length * headWidth;
235 QPointF npo = ( po + pd ) / 2.0 - v;
236 QPointF npd = ( po + pd ) / 2.0 + v;
239 length = 2 * headWidth;
242 qreal bodyLength = length - headWidth;
245 QPointF unitVec = ( pd - po ) / length;
247 QPointF perpVec( -unitVec.y(), unitVec.x() );
250 po += perpVec * offset;
251 pd += perpVec * offset;
259 polygon << po + unitVec *headWidth + perpVec *headHeight;
260 polygon << po + unitVec *headWidth + perpVec * ( width * 0.5 );
262 polygon << po + unitVec *bodyLength + perpVec * ( width * 0.5 );
265 polygon << po + unitVec *bodyLength + perpVec *headHeight;
271 polygon << po + unitVec *bodyLength - perpVec *headHeight;
272 polygon << po + unitVec *bodyLength - perpVec * ( width * 0.5 );
275 polygon << po + unitVec *headWidth - perpVec * ( width * 0.5 );
276 polygon << po + unitVec *headWidth - perpVec *headHeight;
283 polygon << po + perpVec * ( startWidth * 0.5 );
284 polygon << po + unitVec *bodyLength + perpVec * ( width * 0.5 );
285 polygon << po + unitVec *bodyLength + perpVec *headHeight;
294 polygon << po + unitVec *bodyLength - perpVec *headHeight;
295 polygon << po + unitVec *bodyLength - perpVec * ( width * 0.5 );
296 polygon << po - perpVec * ( startWidth * 0.5 );
308 polygon << po + unitVec *headWidth + perpVec *headHeight;
309 polygon << po + unitVec *headWidth + perpVec * ( width * 0.5 );
311 polygon << pd + perpVec * ( startWidth * 0.5 );
319 polygon << pd - perpVec * ( startWidth * 0.5 );
321 polygon << po + unitVec *headWidth - perpVec * ( width * 0.5 );
322 polygon << po + unitVec *headWidth - perpVec *headHeight;
330 polygon << polygon.first();
349 bool pointsToCircle( QPointF a, QPointF b, QPointF
c, QPointF ¢er, qreal &radius )
358 QPointF ab2 = ( a + b ) / 2.0;
359 QPointF bc2 = ( b +
c ) / 2.0;
362 if ( std::fabs( ab.x() * bc.y() - ab.y() * bc.x() ) < 0.001 )
369 cy = bc2.y() - ( cx - bc2.x() ) * bc.x() / bc.y();
372 else if ( bc.y() == 0 )
375 cy = ab2.y() - ( cx - ab2.x() ) * ab.x() / ab.y();
380 cx = ( bc2.y() - ab2.y() + bc.x() * bc2.x() / bc.y() - ab.x() * ab2.x() / ab.y() ) / ( bc.x() / bc.y() - ab.x() / ab.y() );
381 cy = bc2.y() - ( cx - bc2.x() ) * bc.x() / bc.y();
384 radius = std::sqrt( ( a.x() - cx ) * ( a.x() - cx ) + ( a.y() - cy ) * ( a.y() - cy ) );
394 return QPointF( std::cos( -
angle ) * radius + center.x(), std::sin( -
angle ) * radius + center.y() );
397 void pathArcTo( QPainterPath &path, QPointF circleCenter, qreal circleRadius, qreal angle_o, qreal angle_d,
int direction )
399 QRectF circleRect( circleCenter - QPointF( circleRadius, circleRadius ), circleCenter + QPointF( circleRadius, circleRadius ) );
400 if ( direction == 1 )
402 if ( angle_o < angle_d )
403 path.arcTo( circleRect, angle_o / M_PI * 180.0, ( angle_d - angle_o ) / M_PI * 180.0 );
405 path.arcTo( circleRect, angle_o / M_PI * 180.0, 360.0 - ( angle_o - angle_d ) / M_PI * 180.0 );
409 if ( angle_o < angle_d )
410 path.arcTo( circleRect, angle_o / M_PI * 180.0, - ( 360.0 - ( angle_d - angle_o ) / M_PI * 180.0 ) );
412 path.arcTo( circleRect, angle_o / M_PI * 180.0, ( angle_d - angle_o ) / M_PI * 180.0 );
417 void spiralArcTo( QPainterPath &path, QPointF center, qreal startAngle, qreal startRadius, qreal endAngle, qreal endRadius,
int direction )
420 QPointF A =
circlePoint( center, startRadius, startAngle );
422 QPointF B =
circlePoint( center, endRadius, endAngle );
426 deltaAngle = endAngle - startAngle;
427 if ( direction * deltaAngle < 0.0 )
428 deltaAngle = deltaAngle + direction * 2 * M_PI;
430 QPointF I1 =
circlePoint( center, 0.75 * startRadius + 0.25 * endRadius, startAngle + 0.25 * deltaAngle );
431 QPointF I2 =
circlePoint( center, 0.50 * startRadius + 0.50 * endRadius, startAngle + 0.50 * deltaAngle );
432 QPointF I3 =
circlePoint( center, 0.25 * startRadius + 0.75 * endRadius, startAngle + 0.75 * deltaAngle );
445 qreal a1 = std::atan2( cCenter.y() - A.y(), A.x() - cCenter.x() );
446 qreal a2 = std::atan2( cCenter.y() - I2.y(), I2.x() - cCenter.x() );
447 pathArcTo( path, cCenter, cRadius, a1, a2, direction );
459 qreal a1 = std::atan2( cCenter.y() - I2.y(), I2.x() - cCenter.x() );
460 qreal a2 = std::atan2( cCenter.y() - B.y(), B.x() - cCenter.x() );
461 pathArcTo( path, cCenter, cRadius, a1, a2, direction );
466 qreal startWidth, qreal width,
467 qreal headWidth, qreal headHeight,
472 QPointF circleCenter;
476 return straightArrow( po, pd, startWidth, width, headWidth, headHeight, headType, arrowType, offset );
480 qreal angle_o =
clampAngle( std::atan2( circleCenter.y() - po.y(), po.x() - circleCenter.x() ) );
481 qreal angle_m =
clampAngle( std::atan2( circleCenter.y() - pm.y(), pm.x() - circleCenter.x() ) );
482 qreal angle_d =
clampAngle( std::atan2( circleCenter.y() - pd.y(), pd.x() - circleCenter.x() ) );
494 qreal deltaAngle = angle_d - angle_o;
495 if ( direction * deltaAngle < 0.0 )
496 deltaAngle = deltaAngle + direction * 2 * M_PI;
504 return straightArrow( po, pd, startWidth, width, headWidth, headHeight, headType, arrowType, offset );
508 circleRadius += offset;
509 po =
circlePoint( circleCenter, circleRadius, angle_o );
510 pm =
circlePoint( circleCenter, circleRadius, angle_m );
511 pd =
circlePoint( circleCenter, circleRadius, angle_d );
513 qreal headAngle = direction * std::atan( headWidth / circleRadius );
523 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_o + headAngle ) );
525 pathArcTo( path, circleCenter, circleRadius + direction * width / 2, angle_o + headAngle, angle_d - headAngle, direction );
528 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_d - headAngle ) );
533 pathArcTo( path, circleCenter, circleRadius, angle_o, angle_d, direction );
537 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_d - headAngle ) );
539 pathArcTo( path, circleCenter, circleRadius - direction * width / 2, angle_d - headAngle, angle_o + headAngle, -direction );
542 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_o + headAngle ) );
547 pathArcTo( path, circleCenter, circleRadius, angle_d, angle_o, -direction );
554 path.moveTo(
circlePoint( circleCenter, circleRadius + direction * startWidth / 2, angle_o ) );
556 spiralArcTo( path, circleCenter, angle_o, circleRadius + direction * startWidth / 2, angle_d - headAngle, circleRadius + direction * width / 2, direction );
559 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_d - headAngle ) );
565 pathArcTo( path, circleCenter, circleRadius, angle_o, angle_d, direction );
569 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_d - headAngle ) );
571 spiralArcTo( path, circleCenter, angle_d - headAngle, circleRadius - direction * width / 2, angle_o, circleRadius - direction * startWidth / 2, -direction );
573 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * startWidth / 2, angle_o ) );
577 pathArcTo( path, circleCenter, circleRadius, angle_d, angle_o, -direction );
578 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * startWidth / 2, angle_o ) );
586 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_o + headAngle ) );
587 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * width / 2, angle_o + headAngle ) );
589 spiralArcTo( path, circleCenter, angle_o + headAngle, circleRadius + direction * width / 2, angle_d, circleRadius + direction * startWidth / 2, direction );
593 pathArcTo( path, circleCenter, circleRadius, angle_o, angle_d, direction );
597 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * startWidth / 2, angle_d ) );
599 spiralArcTo( path, circleCenter, angle_d, circleRadius - direction * startWidth / 2, angle_o + headAngle, circleRadius - direction * width / 2, - direction );
601 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_o + headAngle ) );
607 pathArcTo( path, circleCenter, circleRadius, angle_d, angle_o, -direction );
611 return path.toSubpathPolygons().at( 0 );
624 double w = exprVal.toDouble( &ok );
634 double w = exprVal.toDouble( &ok );
644 double w = exprVal.toDouble( &ok );
654 double w = exprVal.toDouble( &ok );
664 double w = exprVal.toDouble( &ok );
678 mComputedHeadType = h;
689 mComputedArrowType = h;
707 const double prevOpacity = mSymbol->opacity();
708 mSymbol->setOpacity( prevOpacity * context.
opacity() );
712 _resolveDataDefined( context );
716 if ( points.size() >= 3 )
719 QPointF po( points.at( 0 ) );
721 QPointF pm( points.at( points.size() / 2 ) );
723 QPointF pd( points.back() );
725 QPolygonF poly =
curvedArrow( po, pm, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
729 else if ( points.size() == 2 )
732 QPointF po( points.at( 0 ) );
734 QPointF pd( points.at( 1 ) );
736 QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
742 for (
int pIdx = 0; pIdx < points.size() - 1; pIdx += 2 )
748 _resolveDataDefined( context );
750 if ( points.size() - pIdx >= 3 )
753 QPointF po( points.at( pIdx ) );
755 QPointF pm( points.at( pIdx + 1 ) );
757 QPointF pd( points.at( pIdx + 2 ) );
759 QPolygonF poly =
curvedArrow( po, pm, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
763 else if ( points.size() - pIdx == 2 )
766 QPointF po( points.at( pIdx ) );
768 QPointF pd( points.at( pIdx + 1 ) );
770 QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
780 _resolveDataDefined( context );
782 if ( !points.isEmpty() )
785 QPointF po( points.at( 0 ) );
787 QPointF pd( points.back() );
789 QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
796 for (
int pIdx = 0; pIdx < points.size() - 1; pIdx++ )
802 _resolveDataDefined( context );
805 QPointF po( points.at( pIdx ) );
807 QPointF pd( points.at( pIdx + 1 ) );
809 QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
816 mSymbol->setOpacity( prevOpacity );
823 mSymbol->setColor(
c );
830 return mSymbol.get() ? mSymbol->color() :
mColor;
Line symbol layer used for representing lines as arrows.
bool isCurved() const
Returns whether it is a curved arrow or a straight one.
QgsUnitTypes::RenderUnit headLengthUnit() const
Gets the unit for the head length.
ArrowType arrowType() const
Gets the current arrow type.
QString layerType() const override
Returns a string that represents this layer type.
HeadType
Possible head types.
HeadType headType() const
Gets the current head type.
void setArrowStartWidth(double width)
Sets the arrow start width.
bool isRepeated() const
Returns whether the arrow is repeated along the line or not.
bool hasDataDefinedProperties() const override
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
QgsUnitTypes::RenderUnit arrowWidthUnit() const
Gets the unit for the arrow width.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void setArrowWidth(double width)
Sets the arrow width.
QgsUnitTypes::RenderUnit arrowStartWidthUnit() const
Gets the unit for the arrow start width.
void setArrowType(ArrowType type)
Sets the arrow type.
void setHeadLengthUnitScale(const QgsMapUnitScale &scale)
Sets the scale for the head length.
QgsMapUnitScale headThicknessUnitScale() const
Gets the scale for the head height.
void setIsCurved(bool isCurved)
Sets whether it is a curved arrow or a straight one.
bool canCauseArtifactsBetweenAdjacentTiles() const override
Returns true if the symbol layer rendering can cause visible artifacts across a single feature when t...
void setHeadThickness(double thickness)
Sets the arrow head height.
QgsArrowSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setIsRepeated(bool isRepeated)
Sets whether the arrow is repeated along the line.
QColor color() const override
The fill color.
double arrowStartWidth() const
Gets current arrow start width. Only meaningful for single headed arrows.
QgsUnitTypes::RenderUnit headThicknessUnit() const
Gets the unit for the head height.
void setArrowStartWidthUnitScale(const QgsMapUnitScale &scale)
Sets the scale for the arrow start width.
void setHeadThicknessUnitScale(const QgsMapUnitScale &scale)
Sets the scale for the head height.
void setHeadType(HeadType type)
Sets the head type.
QgsMapUnitScale arrowStartWidthUnitScale() const
Gets the scale for the arrow start width.
double headThickness() const
Gets the current arrow head height.
bool setSubSymbol(QgsSymbol *symbol) override
Sets layer's subsymbol. takes ownership of the passed symbol.
void setArrowWidthUnitScale(const QgsMapUnitScale &scale)
Sets the scale for the arrow width.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Create a new QgsArrowSymbolLayer.
void setColor(const QColor &c) override
The fill color.
ArrowType
Possible arrow types.
void setArrowWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the arrow width.
double arrowWidth() const
Gets current arrow width.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
QgsMapUnitScale arrowWidthUnitScale() const
Gets the scale for the arrow width.
void setArrowStartWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the arrow start width.
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context) override
Renders the line symbol layer along the line joining points, using the given render context.
void setHeadLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the head length.
void setHeadThicknessUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the head height.
QgsMapUnitScale headLengthUnitScale() const
Gets the scale for the head length.
QgsArrowSymbolLayer()
Simple constructor.
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
void setHeadLength(double length)
Sets the arrow head length.
double headLength() const
Gets the current arrow head length.
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the layer.
Single scope for storing variables and functions for use within a QgsExpressionContext.
static const QString EXPR_GEOMETRY_POINT_COUNT
Inbuilt variable name for point count variable.
QgsExpressionContextScope * popScope()
Removes the last scope from the expression context and return it.
static const QString EXPR_GEOMETRY_POINT_NUM
Inbuilt variable name for point number variable.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
static QgsFillSymbol * createSimple(const QVariantMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties.
RenderRingFilter
Options for filtering rings when the line symbol layer is being used to render a polygon's rings.
QgsUnitTypes::RenderUnit mWidthUnit
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the line's offset.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the line's offset.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the line's offset.
void setOffset(double offset)
Sets the line's offset.
RenderRingFilter mRingFilter
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the line's offset.
void setRingFilter(QgsLineSymbolLayer::RenderRingFilter filter)
Sets the line symbol layer's ring filter, which controls which rings are rendered when the line symbo...
double offset() const
Returns the line's offset.
QgsUnitTypes::RenderUnit mOffsetUnit
QVariant value(int key, const QgsExpressionContext &context, const QVariant &defaultValue=QVariant()) const override
Returns the calculated value of the property with the specified key from within the collection.
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
Contains information about the context of a rendering operation.
QPainter * painter()
Returns the destination QPainter for the render operation.
QgsExpressionContext & expressionContext()
Gets the expression context.
bool renderingStopped() const
Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled...
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to painter units (pixels).
static QgsArrowSymbolLayer::HeadType decodeArrowHeadType(const QVariant &value, bool *ok=nullptr)
Decodes a value representing an arrow head type.
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
static QgsArrowSymbolLayer::ArrowType decodeArrowType(const QVariant &value, bool *ok=nullptr)
Decodes a value representing an arrow type.
@ PropertyArrowStartWidth
Arrow tail start width.
@ PropertyArrowHeadLength
Arrow head length.
@ PropertyArrowHeadThickness
Arrow head thickness.
@ PropertyOffset
Symbol offset.
@ PropertyArrowHeadType
Arrow head type.
@ PropertyArrowType
Arrow type.
@ PropertyArrowWidth
Arrow tail width.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
void copyDataDefinedProperties(QgsSymbolLayer *destLayer) const
Copies all data defined properties of this layer to another symbol layer.
void restoreOldDataDefinedProperties(const QVariantMap &stringMap)
Restores older data defined properties from string map.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
void copyPaintEffect(QgsSymbolLayer *destLayer) const
Copies paint effect of this layer to another symbol layer.
QgsPropertyCollection mDataDefinedProperties
virtual bool hasDataDefinedProperties() const
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
bool selected() const
Returns true if symbols should be rendered using the selected symbol coloring and style.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
const QgsFeature * feature() const
Returns the current feature being rendered.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for data defined symbology.
qreal opacity() const
Returns the opacity for the symbol.
Abstract base class for all rendered symbols.
SymbolType type() const
Returns the symbol's type.
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
static Q_INVOKABLE QgsUnitTypes::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
@ RenderMetersInMapUnits
Meters value as Map units.
@ RenderMillimeters
Millimeters.
@ RenderMapUnits
Map units.
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)
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
void pathArcTo(QPainterPath &path, QPointF circleCenter, qreal circleRadius, qreal angle_o, qreal angle_d, int direction)
void spiralArcTo(QPainterPath &path, QPointF center, qreal startAngle, qreal startRadius, qreal endAngle, qreal endRadius, int direction)
qreal euclidean_distance(QPointF po, QPointF pd)
QPointF circlePoint(QPointF center, qreal radius, qreal angle)
QPolygonF straightArrow(QPointF po, QPointF pd, qreal startWidth, qreal width, qreal headWidth, qreal headHeight, QgsArrowSymbolLayer::HeadType headType, QgsArrowSymbolLayer::ArrowType arrowType, qreal offset)
bool pointsToCircle(QPointF a, QPointF b, QPointF c, QPointF ¢er, qreal &radius)
Compute the circumscribed circle from three points.
qreal clampAngle(qreal a)
QPolygonF curvedArrow(QPointF po, QPointF pm, QPointF pd, qreal startWidth, qreal width, qreal headWidth, qreal headHeight, QgsArrowSymbolLayer::HeadType headType, QgsArrowSymbolLayer::ArrowType arrowType, qreal offset)
Single variable definition for use within a QgsExpressionContextScope.