48 if ( props.contains( QStringLiteral(
"arrow_width" ) ) )
49 l->
setArrowWidth( props[QStringLiteral(
"arrow_width" )].toDouble() );
51 if ( props.contains( QStringLiteral(
"arrow_width_unit" ) ) )
54 if ( props.contains( QStringLiteral(
"arrow_width_unit_scale" ) ) )
57 if ( props.contains( QStringLiteral(
"arrow_start_width" ) ) )
60 if ( props.contains( QStringLiteral(
"arrow_start_width_unit" ) ) )
63 if ( props.contains( QStringLiteral(
"arrow_start_width_unit_scale" ) ) )
66 if ( props.contains( QStringLiteral(
"is_curved" ) ) )
67 l->
setIsCurved( props[QStringLiteral(
"is_curved" )].toInt() == 1 );
69 if ( props.contains( QStringLiteral(
"is_repeated" ) ) )
70 l->
setIsRepeated( props[QStringLiteral(
"is_repeated" )].toInt() == 1 );
72 if ( props.contains( QStringLiteral(
"head_length" ) ) )
73 l->
setHeadLength( props[QStringLiteral(
"head_length" )].toDouble() );
75 if ( props.contains( QStringLiteral(
"head_length_unit" ) ) )
78 if ( props.contains( QStringLiteral(
"head_length_unit_scale" ) ) )
81 if ( props.contains( QStringLiteral(
"head_thickness" ) ) )
84 if ( props.contains( QStringLiteral(
"head_thickness_unit" ) ) )
87 if ( props.contains( QStringLiteral(
"head_thickness_unit_scale" ) ) )
90 if ( props.contains( QStringLiteral(
"head_type" ) ) )
93 if ( props.contains( QStringLiteral(
"arrow_type" ) ) )
96 if ( props.contains( QStringLiteral(
"offset" ) ) )
97 l->
setOffset( props[QStringLiteral(
"offset" )].toDouble() );
99 if ( props.contains( QStringLiteral(
"offset_unit" ) ) )
102 if ( props.contains( QStringLiteral(
"offset_unit_scale" ) ) )
105 if ( props.contains( QStringLiteral(
"ring_filter" ) ) )
126 return mSymbol.get();
131 return QStringLiteral(
"ArrowLine" );
138 map[QStringLiteral(
"arrow_width" )] = QString::number(
arrowWidth() );
142 map[QStringLiteral(
"arrow_start_width" )] = QString::number(
arrowStartWidth() );
146 map[QStringLiteral(
"is_curved" )] = QString::number(
isCurved() ? 1 : 0 );
147 map[QStringLiteral(
"is_repeated" )] = QString::number(
isRepeated() ? 1 : 0 );
149 map[QStringLiteral(
"head_length" )] = QString::number(
headLength() );
153 map[QStringLiteral(
"head_thickness" )] = QString::number(
headThickness() );
157 map[QStringLiteral(
"head_type" )] = QString::number(
headType() );
158 map[QStringLiteral(
"arrow_type" )] = QString::number(
arrowType() );
160 map[QStringLiteral(
"offset" )] = QString::number(
offset() );
164 map[QStringLiteral(
"ring_filter" )] = QString::number(
static_cast< int >(
mRingFilter ) );
173 attributes.unite( mSymbol->usedAttributes( context ) );
182 if ( mSymbol && mSymbol->hasDataDefinedProperties() )
200 mArrowWidthUnit = unit;
201 mArrowStartWidthUnit = unit;
202 mHeadLengthUnit = unit;
203 mHeadThicknessUnit = unit;
227 return std::sqrt( ( po.x() - pd.x() ) * ( po.x() - pd.x() ) + ( po.y() - pd.y() ) * ( po.y() - pd.y() ) );
231 qreal startWidth, qreal width,
232 qreal headWidth, qreal headHeight,
243 po = pd - ( pd - po ) / length * headWidth;
248 pd = po + ( pd - po ) / length * headWidth;
253 const QPointF v = ( pd - po ) / length * headWidth;
254 const QPointF npo = ( po + pd ) / 2.0 - v;
255 const QPointF npd = ( po + pd ) / 2.0 + v;
258 length = 2 * headWidth;
261 const qreal bodyLength = length - headWidth;
264 const QPointF unitVec = ( pd - po ) / length;
266 const QPointF perpVec( -unitVec.y(), unitVec.x() );
269 po += perpVec * offset;
270 pd += perpVec * offset;
278 polygon << po + unitVec *headWidth + perpVec *headHeight;
279 polygon << po + unitVec *headWidth + perpVec * ( width * 0.5 );
281 polygon << po + unitVec *bodyLength + perpVec * ( width * 0.5 );
284 polygon << po + unitVec *bodyLength + perpVec *headHeight;
290 polygon << po + unitVec *bodyLength - perpVec *headHeight;
291 polygon << po + unitVec *bodyLength - perpVec * ( width * 0.5 );
294 polygon << po + unitVec *headWidth - perpVec * ( width * 0.5 );
295 polygon << po + unitVec *headWidth - perpVec *headHeight;
302 polygon << po + perpVec * ( startWidth * 0.5 );
303 polygon << po + unitVec *bodyLength + perpVec * ( width * 0.5 );
304 polygon << po + unitVec *bodyLength + perpVec *headHeight;
313 polygon << po + unitVec *bodyLength - perpVec *headHeight;
314 polygon << po + unitVec *bodyLength - perpVec * ( width * 0.5 );
315 polygon << po - perpVec * ( startWidth * 0.5 );
327 polygon << po + unitVec *headWidth + perpVec *headHeight;
328 polygon << po + unitVec *headWidth + perpVec * ( width * 0.5 );
330 polygon << pd + perpVec * ( startWidth * 0.5 );
338 polygon << pd - perpVec * ( startWidth * 0.5 );
340 polygon << po + unitVec *headWidth - perpVec * ( width * 0.5 );
341 polygon << po + unitVec *headWidth - perpVec *headHeight;
349 polygon << polygon.first();
373 const QPointF ab = b - a;
374 const QPointF bc =
c - b;
377 const QPointF ab2 = ( a + b ) / 2.0;
378 const QPointF bc2 = ( b +
c ) / 2.0;
381 if ( std::fabs( ab.x() * bc.y() - ab.y() * bc.x() ) < 0.001 )
388 cy = bc2.y() - ( cx - bc2.x() ) * bc.x() / bc.y();
391 else if ( bc.y() == 0 )
394 cy = ab2.y() - ( cx - ab2.x() ) * ab.x() / ab.y();
399 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() );
400 cy = bc2.y() - ( cx - bc2.x() ) * bc.x() / bc.y();
403 radius = std::sqrt( ( a.x() - cx ) * ( a.x() - cx ) + ( a.y() - cy ) * ( a.y() - cy ) );
413 return QPointF( std::cos( -angle ) * radius + center.x(), std::sin( -angle ) * radius + center.y() );
416void pathArcTo( QPainterPath &path, QPointF circleCenter, qreal circleRadius, qreal angle_o, qreal angle_d,
int direction )
418 const QRectF circleRect( circleCenter - QPointF( circleRadius, circleRadius ), circleCenter + QPointF( circleRadius, circleRadius ) );
419 if ( direction == 1 )
421 if ( angle_o < angle_d )
422 path.arcTo( circleRect, angle_o / M_PI * 180.0, ( angle_d - angle_o ) / M_PI * 180.0 );
424 path.arcTo( circleRect, angle_o / M_PI * 180.0, 360.0 - ( angle_o - angle_d ) / M_PI * 180.0 );
428 if ( angle_o < angle_d )
429 path.arcTo( circleRect, angle_o / M_PI * 180.0, - ( 360.0 - ( angle_d - angle_o ) / M_PI * 180.0 ) );
431 path.arcTo( circleRect, angle_o / M_PI * 180.0, ( angle_d - angle_o ) / M_PI * 180.0 );
436void spiralArcTo( QPainterPath &path, QPointF center, qreal startAngle, qreal startRadius, qreal endAngle, qreal endRadius,
int direction )
439 const QPointF A =
circlePoint( center, startRadius, startAngle );
441 const QPointF B =
circlePoint( center, endRadius, endAngle );
445 deltaAngle = endAngle - startAngle;
446 if ( direction * deltaAngle < 0.0 )
447 deltaAngle = deltaAngle + direction * 2 * M_PI;
449 const QPointF I1 =
circlePoint( center, 0.75 * startRadius + 0.25 * endRadius, startAngle + 0.25 * deltaAngle );
450 const QPointF I2 =
circlePoint( center, 0.50 * startRadius + 0.50 * endRadius, startAngle + 0.50 * deltaAngle );
451 const QPointF I3 =
circlePoint( center, 0.25 * startRadius + 0.75 * endRadius, startAngle + 0.75 * deltaAngle );
464 const qreal a1 = std::atan2( cCenter.y() - A.y(), A.x() - cCenter.x() );
465 const qreal a2 = std::atan2( cCenter.y() - I2.y(), I2.x() - cCenter.x() );
466 pathArcTo( path, cCenter, cRadius, a1, a2, direction );
478 const qreal a1 = std::atan2( cCenter.y() - I2.y(), I2.x() - cCenter.x() );
479 const qreal a2 = std::atan2( cCenter.y() - B.y(), B.x() - cCenter.x() );
480 pathArcTo( path, cCenter, cRadius, a1, a2, direction );
485 qreal startWidth, qreal width,
486 qreal headWidth, qreal headHeight,
491 QPointF circleCenter;
495 return straightArrow( po, pd, startWidth, width, headWidth, headHeight, headType, arrowType, offset );
499 const qreal angle_o =
clampAngle( std::atan2( circleCenter.y() - po.y(), po.x() - circleCenter.x() ) );
500 const qreal angle_m =
clampAngle( std::atan2( circleCenter.y() - pm.y(), pm.x() - circleCenter.x() ) );
501 const qreal angle_d =
clampAngle( std::atan2( circleCenter.y() - pd.y(), pd.x() - circleCenter.x() ) );
504 const int direction =
clampAngle( angle_m - angle_o ) <
clampAngle( angle_m - angle_d ) ? 1 : -1;
513 qreal deltaAngle = angle_d - angle_o;
514 if ( direction * deltaAngle < 0.0 )
515 deltaAngle = deltaAngle + direction * 2 * M_PI;
523 return straightArrow( po, pd, startWidth, width, headWidth, headHeight, headType, arrowType, offset );
527 circleRadius += offset;
528 po =
circlePoint( circleCenter, circleRadius, angle_o );
529 pm =
circlePoint( circleCenter, circleRadius, angle_m );
530 pd =
circlePoint( circleCenter, circleRadius, angle_d );
532 const qreal headAngle = direction * std::atan( headWidth / circleRadius );
542 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_o + headAngle ) );
544 pathArcTo( path, circleCenter, circleRadius + direction * width / 2, angle_o + headAngle, angle_d - headAngle, direction );
547 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_d - headAngle ) );
552 pathArcTo( path, circleCenter, circleRadius, angle_o, angle_d, direction );
556 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_d - headAngle ) );
558 pathArcTo( path, circleCenter, circleRadius - direction * width / 2, angle_d - headAngle, angle_o + headAngle, -direction );
561 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_o + headAngle ) );
566 pathArcTo( path, circleCenter, circleRadius, angle_d, angle_o, -direction );
573 path.moveTo(
circlePoint( circleCenter, circleRadius + direction * startWidth / 2, angle_o ) );
575 spiralArcTo( path, circleCenter, angle_o, circleRadius + direction * startWidth / 2, angle_d - headAngle, circleRadius + direction * width / 2, direction );
578 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_d - headAngle ) );
584 pathArcTo( path, circleCenter, circleRadius, angle_o, angle_d, direction );
588 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_d - headAngle ) );
590 spiralArcTo( path, circleCenter, angle_d - headAngle, circleRadius - direction * width / 2, angle_o, circleRadius - direction * startWidth / 2, -direction );
592 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * startWidth / 2, angle_o ) );
596 pathArcTo( path, circleCenter, circleRadius, angle_d, angle_o, -direction );
597 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * startWidth / 2, angle_o ) );
605 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_o + headAngle ) );
606 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * width / 2, angle_o + headAngle ) );
608 spiralArcTo( path, circleCenter, angle_o + headAngle, circleRadius + direction * width / 2, angle_d, circleRadius + direction * startWidth / 2, direction );
612 pathArcTo( path, circleCenter, circleRadius, angle_o, angle_d, direction );
616 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * startWidth / 2, angle_d ) );
618 spiralArcTo( path, circleCenter, angle_d, circleRadius - direction * startWidth / 2, angle_o + headAngle, circleRadius - direction * width / 2, - direction );
620 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_o + headAngle ) );
626 pathArcTo( path, circleCenter, circleRadius, angle_d, angle_o, -direction );
630 return path.toSubpathPolygons().at( 0 );
645 const double w = exprVal.toDouble( &ok );
658 const double w = exprVal.toDouble( &ok );
671 const double w = exprVal.toDouble( &ok );
684 const double w = exprVal.toDouble( &ok );
695 const double w = exprVal.toDouble( &ok );
711 mComputedHeadType = h;
725 mComputedArrowType = h;
747 const double prevOpacity = mSymbol->opacity();
748 mSymbol->setOpacity( prevOpacity * context.
opacity() );
753 _resolveDataDefined( context );
757 if ( points.size() >= 3 )
760 const QPointF po( points.at( 0 ) );
762 const QPointF pm( points.at( points.size() / 2 ) );
764 const QPointF pd( points.back() );
766 const QPolygonF poly =
curvedArrow( po, pm, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
767 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
770 else if ( points.size() == 2 )
773 const QPointF po( points.at( 0 ) );
775 const QPointF pd( points.at( 1 ) );
777 const QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
778 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
783 for (
int pIdx = 0; pIdx < points.size() - 1; pIdx += 2 )
789 _resolveDataDefined( context );
791 if ( points.size() - pIdx >= 3 )
794 const QPointF po( points.at( pIdx ) );
796 const QPointF pm( points.at( pIdx + 1 ) );
798 const QPointF pd( points.at( pIdx + 2 ) );
800 const QPolygonF poly =
curvedArrow( po, pm, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
801 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
804 else if ( points.size() - pIdx == 2 )
807 const QPointF po( points.at( pIdx ) );
809 const QPointF pd( points.at( pIdx + 1 ) );
811 const QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
812 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
821 _resolveDataDefined( context );
823 if ( !points.isEmpty() )
826 const QPointF po( points.at( 0 ) );
828 const QPointF pd( points.back() );
830 const QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
831 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
837 for (
int pIdx = 0; pIdx < points.size() - 1; pIdx++ )
843 _resolveDataDefined( context );
846 const QPointF po( points.at( pIdx ) );
848 const QPointF pd( points.at( pIdx + 1 ) );
850 const QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
852 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
859 mSymbol->setOpacity( prevOpacity );
866 mSymbol->setColor(
c );
873 return mSymbol.get() ? mSymbol->color() :
mColor;
RenderUnit
Rendering size units.
@ Millimeters
Millimeters.
@ MetersInMapUnits
Meters value as Map units.
@ RenderingSubSymbol
Set whenever a sub-symbol of a parent symbol is currently being rendered. Can be used during symbol a...
Line symbol layer used for representing lines as arrows.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
bool isCurved() const
Returns whether it is a curved arrow or a straight one.
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.
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.
void setArrowType(ArrowType type)
Sets the arrow type.
void setHeadLengthUnitScale(const QgsMapUnitScale &scale)
Sets the scale for the head length.
~QgsArrowSymbolLayer() override
QgsMapUnitScale headThicknessUnitScale() const
Gets the scale for the head height.
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
Qgis::RenderUnit arrowWidthUnit() const
Gets the unit for the arrow width.
Qgis::RenderUnit headLengthUnit() const
Gets the unit for the head length.
Qgis::RenderUnit headThicknessUnit() const
Gets the unit for the head height.
void setArrowWidthUnit(Qgis::RenderUnit unit)
Sets the unit for the arrow width.
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 setHeadLengthUnit(Qgis::RenderUnit unit)
Sets the unit for the head length.
void setIsRepeated(bool isRepeated)
Sets whether the arrow is repeated along the line.
QColor color() const override
Returns the "representative" color of the symbol layer.
double arrowStartWidth() const
Gets current arrow start width. Only meaningful for single headed arrows.
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
Sets the "representative" color for the symbol layer.
ArrowType
Possible arrow types.
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.
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 setArrowStartWidthUnit(Qgis::RenderUnit unit)
Sets the unit for the arrow start width.
Qgis::RenderUnit arrowStartWidthUnit() const
Gets the unit for the arrow start width.
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.
void setHeadThicknessUnit(Qgis::RenderUnit unit)
Sets the unit for the head height.
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.
Qgis::RenderUnit mOffsetUnit
RenderRingFilter
Options for filtering rings when the line symbol layer is being used to render a polygon's rings.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
Qgis::RenderUnit mWidthUnit
void setOffset(double offset)
Sets the line's offset.
RenderRingFilter mRingFilter
void setOffsetUnit(Qgis::RenderUnit unit)
Sets the unit for the line's offset.
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.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the line's offset.
Qgis::RenderUnit offsetUnit() const
Returns the units for the line's offset.
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.
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.
QgsExpressionContext & expressionContext()
Gets the expression context.
void setFlag(Qgis::RenderContextFlag flag, bool on=true)
Enable or disable a particular flag (other flags are not affected)
bool renderingStopped() const
Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled...
Qgis::RenderContextFlags flags() const
Returns combination of flags used for rendering.
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.
bool shouldRenderUsingSelectionColor(const QgsSymbolRenderContext &context) const
Returns true if the symbol layer should be rendered using the selection color from the render context...
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.
void copyPaintEffect(QgsSymbolLayer *destLayer) const
Copies paint effect of this layer to another symbol layer.
QgsPropertyCollection mDataDefinedProperties
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
virtual bool hasDataDefinedProperties() const
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
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.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
Abstract base class for all rendered symbols.
Qgis::SymbolType type() const
Returns the symbol's type.
static Q_INVOKABLE Qgis::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
static Q_INVOKABLE QString encodeUnit(Qgis::DistanceUnit unit)
Encodes a distance unit to a string.
static bool isNull(const QVariant &variant)
Returns true if the specified variant should be considered a NULL value.
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.