28using namespace Qt::StringLiterals;
56 if ( props.contains( u
"arrow_width"_s ) )
59 if ( props.contains( u
"arrow_width_unit"_s ) )
62 if ( props.contains( u
"arrow_width_unit_scale"_s ) )
65 if ( props.contains( u
"arrow_start_width"_s ) )
68 if ( props.contains( u
"arrow_start_width_unit"_s ) )
71 if ( props.contains( u
"arrow_start_width_unit_scale"_s ) )
74 if ( props.contains( u
"is_curved"_s ) )
75 l->
setIsCurved( props[u
"is_curved"_s].toInt() == 1 );
77 if ( props.contains( u
"is_repeated"_s ) )
80 if ( props.contains( u
"head_length"_s ) )
83 if ( props.contains( u
"head_length_unit"_s ) )
86 if ( props.contains( u
"head_length_unit_scale"_s ) )
89 if ( props.contains( u
"head_thickness"_s ) )
92 if ( props.contains( u
"head_thickness_unit"_s ) )
95 if ( props.contains( u
"head_thickness_unit_scale"_s ) )
98 if ( props.contains( u
"head_type"_s ) )
101 if ( props.contains( u
"arrow_type"_s ) )
104 if ( props.contains( u
"offset"_s ) )
105 l->
setOffset( props[u
"offset"_s].toDouble() );
107 if ( props.contains( u
"offset_unit"_s ) )
110 if ( props.contains( u
"offset_unit_scale"_s ) )
113 if ( props.contains( u
"ring_filter"_s ) )
134 return mSymbol.get();
139 return u
"ArrowLine"_s;
146 map[u
"arrow_width"_s] = QString::number(
arrowWidth() );
154 map[u
"is_curved"_s] = QString::number(
isCurved() ? 1 : 0 );
155 map[u
"is_repeated"_s] = QString::number(
isRepeated() ? 1 : 0 );
157 map[u
"head_length"_s] = QString::number(
headLength() );
161 map[u
"head_thickness"_s] = QString::number(
headThickness() );
165 map[u
"head_type"_s] = QString::number(
headType() );
166 map[u
"arrow_type"_s] = QString::number(
arrowType() );
168 map[u
"offset"_s] = QString::number(
offset() );
172 map[u
"ring_filter"_s] = QString::number(
static_cast< int >(
mRingFilter ) );
181 attributes.unite( mSymbol->usedAttributes( context ) );
190 if ( mSymbol && mSymbol->hasDataDefinedProperties() )
208 mArrowWidthUnit = unit;
209 mArrowStartWidthUnit = unit;
210 mHeadLengthUnit = unit;
211 mHeadThicknessUnit = unit;
216 mExpressionScope = std::make_unique<QgsExpressionContextScope>( );
255 qreal startWidth, qreal width,
256 qreal headWidth, qreal headHeight,
269 po = pd - ( pd - po ) / length * headWidth;
274 pd = po + ( pd - po ) / length * headWidth;
279 const QPointF v = ( pd - po ) / length * headWidth;
280 const QPointF npo = ( po + pd ) / 2.0 - v;
281 const QPointF npd = ( po + pd ) / 2.0 + v;
284 length = 2 * headWidth;
287 const qreal bodyLength = length - headWidth;
290 const QPointF unitVec = ( pd - po ) / length;
292 const QPointF perpVec( -unitVec.y(), unitVec.x() );
295 po += perpVec * offset;
296 pd += perpVec * offset;
304 polygon << po + unitVec *headWidth + perpVec *headHeight;
305 polygon << po + unitVec *headWidth + perpVec * ( width * 0.5 );
307 polygon << po + unitVec *bodyLength + perpVec * ( width * 0.5 );
310 polygon << po + unitVec *bodyLength + perpVec *headHeight;
316 polygon << po + unitVec *bodyLength - perpVec *headHeight;
317 polygon << po + unitVec *bodyLength - perpVec * ( width * 0.5 );
320 polygon << po + unitVec *headWidth - perpVec * ( width * 0.5 );
321 polygon << po + unitVec *headWidth - perpVec *headHeight;
328 polygon << po + perpVec * ( startWidth * 0.5 );
329 polygon << po + unitVec *bodyLength + perpVec * ( width * 0.5 );
330 polygon << po + unitVec *bodyLength + perpVec *headHeight;
339 polygon << po + unitVec *bodyLength - perpVec *headHeight;
340 polygon << po + unitVec *bodyLength - perpVec * ( width * 0.5 );
341 polygon << po - perpVec * ( startWidth * 0.5 );
353 polygon << po + unitVec *headWidth + perpVec *headHeight;
354 polygon << po + unitVec *headWidth + perpVec * ( width * 0.5 );
356 polygon << pd + perpVec * ( startWidth * 0.5 );
364 polygon << pd - perpVec * ( startWidth * 0.5 );
366 polygon << po + unitVec *headWidth - perpVec * ( width * 0.5 );
367 polygon << po + unitVec *headWidth - perpVec *headHeight;
375 polygon << polygon.first();
399 const QPointF ab = b - a;
400 const QPointF bc =
c - b;
403 const QPointF ab2 = ( a + b ) / 2.0;
404 const QPointF bc2 = ( b +
c ) / 2.0;
407 if ( std::fabs( ab.x() * bc.y() - ab.y() * bc.x() ) < 0.001 )
414 cy = bc2.y() - ( cx - bc2.x() ) * bc.x() / bc.y();
417 else if ( bc.y() == 0 )
420 cy = ab2.y() - ( cx - ab2.x() ) * ab.x() / ab.y();
425 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() );
426 cy = bc2.y() - ( cx - bc2.x() ) * bc.x() / bc.y();
439 return QPointF( std::cos( -angle ) * radius + center.x(), std::sin( -angle ) * radius + center.y() );
442void pathArcTo( QPainterPath &path, QPointF circleCenter, qreal circleRadius, qreal angle_o, qreal angle_d,
int direction )
444 const QRectF circleRect( circleCenter - QPointF( circleRadius, circleRadius ), circleCenter + QPointF( circleRadius, circleRadius ) );
445 if ( direction == 1 )
447 if ( angle_o < angle_d )
448 path.arcTo( circleRect, angle_o / M_PI * 180.0, ( angle_d - angle_o ) / M_PI * 180.0 );
450 path.arcTo( circleRect, angle_o / M_PI * 180.0, 360.0 - ( angle_o - angle_d ) / M_PI * 180.0 );
454 if ( angle_o < angle_d )
455 path.arcTo( circleRect, angle_o / M_PI * 180.0, - ( 360.0 - ( angle_d - angle_o ) / M_PI * 180.0 ) );
457 path.arcTo( circleRect, angle_o / M_PI * 180.0, ( angle_d - angle_o ) / M_PI * 180.0 );
462void spiralArcTo( QPainterPath &path, QPointF center, qreal startAngle, qreal startRadius, qreal endAngle, qreal endRadius,
int direction )
465 const QPointF A =
circlePoint( center, startRadius, startAngle );
467 const QPointF B =
circlePoint( center, endRadius, endAngle );
471 deltaAngle = endAngle - startAngle;
472 if ( direction * deltaAngle < 0.0 )
473 deltaAngle = deltaAngle + direction * 2 * M_PI;
475 const QPointF I1 =
circlePoint( center, 0.75 * startRadius + 0.25 * endRadius, startAngle + 0.25 * deltaAngle );
476 const QPointF I2 =
circlePoint( center, 0.50 * startRadius + 0.50 * endRadius, startAngle + 0.50 * deltaAngle );
477 const QPointF I3 =
circlePoint( center, 0.25 * startRadius + 0.75 * endRadius, startAngle + 0.75 * deltaAngle );
490 const qreal a1 = std::atan2( cCenter.y() - A.y(), A.x() - cCenter.x() );
491 const qreal a2 = std::atan2( cCenter.y() - I2.y(), I2.x() - cCenter.x() );
492 pathArcTo( path, cCenter, cRadius, a1, a2, direction );
504 const qreal a1 = std::atan2( cCenter.y() - I2.y(), I2.x() - cCenter.x() );
505 const qreal a2 = std::atan2( cCenter.y() - B.y(), B.x() - cCenter.x() );
506 pathArcTo( path, cCenter, cRadius, a1, a2, direction );
511 qreal startWidth, qreal width,
512 qreal headWidth, qreal headHeight,
517 QPointF circleCenter;
521 return straightArrow( po, pd, startWidth, width, headWidth, headHeight, headType, arrowType, offset );
525 const qreal angle_o =
clampAngle( std::atan2( circleCenter.y() - po.y(), po.x() - circleCenter.x() ) );
526 const qreal angle_m =
clampAngle( std::atan2( circleCenter.y() - pm.y(), pm.x() - circleCenter.x() ) );
527 const qreal angle_d =
clampAngle( std::atan2( circleCenter.y() - pd.y(), pd.x() - circleCenter.x() ) );
530 const int direction =
clampAngle( angle_m - angle_o ) <
clampAngle( angle_m - angle_d ) ? 1 : -1;
539 qreal deltaAngle = angle_d - angle_o;
540 if ( direction * deltaAngle < 0.0 )
541 deltaAngle = deltaAngle + direction * 2 * M_PI;
549 return straightArrow( po, pd, startWidth, width, headWidth, headHeight, headType, arrowType, offset );
553 circleRadius += offset;
554 po =
circlePoint( circleCenter, circleRadius, angle_o );
555 pm =
circlePoint( circleCenter, circleRadius, angle_m );
556 pd =
circlePoint( circleCenter, circleRadius, angle_d );
558 const qreal headAngle = direction * std::atan( headWidth / circleRadius );
568 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_o + headAngle ) );
570 pathArcTo( path, circleCenter, circleRadius + direction * width / 2, angle_o + headAngle, angle_d - headAngle, direction );
573 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_d - headAngle ) );
578 pathArcTo( path, circleCenter, circleRadius, angle_o, angle_d, direction );
582 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_d - headAngle ) );
584 pathArcTo( path, circleCenter, circleRadius - direction * width / 2, angle_d - headAngle, angle_o + headAngle, -direction );
587 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_o + headAngle ) );
592 pathArcTo( path, circleCenter, circleRadius, angle_d, angle_o, -direction );
599 path.moveTo(
circlePoint( circleCenter, circleRadius + direction * startWidth / 2, angle_o ) );
601 spiralArcTo( path, circleCenter, angle_o, circleRadius + direction * startWidth / 2, angle_d - headAngle, circleRadius + direction * width / 2, direction );
604 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_d - headAngle ) );
610 pathArcTo( path, circleCenter, circleRadius, angle_o, angle_d, direction );
614 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_d - headAngle ) );
616 spiralArcTo( path, circleCenter, angle_d - headAngle, circleRadius - direction * width / 2, angle_o, circleRadius - direction * startWidth / 2, -direction );
618 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * startWidth / 2, angle_o ) );
622 pathArcTo( path, circleCenter, circleRadius, angle_d, angle_o, -direction );
623 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * startWidth / 2, angle_o ) );
631 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * headHeight, angle_o + headAngle ) );
632 path.lineTo(
circlePoint( circleCenter, circleRadius + direction * width / 2, angle_o + headAngle ) );
634 spiralArcTo( path, circleCenter, angle_o + headAngle, circleRadius + direction * width / 2, angle_d, circleRadius + direction * startWidth / 2, direction );
638 pathArcTo( path, circleCenter, circleRadius, angle_o, angle_d, direction );
642 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * startWidth / 2, angle_d ) );
644 spiralArcTo( path, circleCenter, angle_d, circleRadius - direction * startWidth / 2, angle_o + headAngle, circleRadius - direction * width / 2, - direction );
646 path.lineTo(
circlePoint( circleCenter, circleRadius - direction * headHeight, angle_o + headAngle ) );
652 pathArcTo( path, circleCenter, circleRadius, angle_d, angle_o, -direction );
656 return path.toSubpathPolygons().at( 0 );
671 const double w = exprVal.toDouble( &ok );
684 const double w = exprVal.toDouble( &ok );
697 const double w = exprVal.toDouble( &ok );
710 const double w = exprVal.toDouble( &ok );
721 const double w = exprVal.toDouble( &ok );
737 mComputedHeadType = h;
751 mComputedArrowType = h;
771 const double prevOpacity = mSymbol->opacity();
772 mSymbol->setOpacity( prevOpacity * context.
opacity() );
777 _resolveDataDefined( context );
781 if ( points.size() >= 3 )
784 const QPointF po( points.at( 0 ) );
786 const QPointF pm( points.at( points.size() / 2 ) );
788 const QPointF pd( points.back() );
790 const QPolygonF poly =
curvedArrow( po, pm, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
791 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
794 else if ( points.size() == 2 )
797 const QPointF po( points.at( 0 ) );
799 const QPointF pd( points.at( 1 ) );
801 const QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
802 if ( !poly.isEmpty() )
803 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
808 for (
int pIdx = 0; pIdx < points.size() - 1; pIdx += 2 )
814 _resolveDataDefined( context );
816 if ( points.size() - pIdx >= 3 )
819 const QPointF po( points.at( pIdx ) );
821 const QPointF pm( points.at( pIdx + 1 ) );
823 const QPointF pd( points.at( pIdx + 2 ) );
825 const QPolygonF poly =
curvedArrow( po, pm, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
826 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
829 else if ( points.size() - pIdx == 2 )
832 const QPointF po( points.at( pIdx ) );
834 const QPointF pd( points.at( pIdx + 1 ) );
836 const QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
837 if ( !poly.isEmpty() )
838 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
847 _resolveDataDefined( context );
849 if ( !points.isEmpty() )
852 const QPointF po( points.at( 0 ) );
854 const QPointF pd( points.back() );
856 const QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
857 if ( !poly.isEmpty() )
858 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
864 for (
int pIdx = 0; pIdx < points.size() - 1; pIdx++ )
870 _resolveDataDefined( context );
873 const QPointF po( points.at( pIdx ) );
875 const QPointF pd( points.at( pIdx + 1 ) );
877 const QPolygonF poly =
straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadLength, mScaledHeadThickness, mComputedHeadType, mComputedArrowType, mScaledOffset );
879 if ( !poly.isEmpty() )
880 mSymbol->renderPolygon( poly,
nullptr, context.
feature(), context.
renderContext(), -1, useSelectedColor );
887 mSymbol->setOpacity( prevOpacity );
894 mSymbol->setColor(
c );
901 return mSymbol.get() ? mSymbol->color() :
mColor;
@ IsSymbolLayerSubSymbol
Symbol is being rendered as a sub-symbol of a QgsSymbolLayer.
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...
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 startFeatureRender(const QgsFeature &feature, QgsRenderContext &context) override
Called before the layer will be rendered for a particular feature.
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.
void stopFeatureRender(const QgsFeature &feature, QgsRenderContext &context) override
Called after the layer has been rendered for a particular feature.
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.
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.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
static std::unique_ptr< QgsFillSymbol > createSimple(const QVariantMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties.
static double distance2D(double x1, double y1, double x2, double y2)
Returns the 2D distance between (x1, y1) and (x2, y2).
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.
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.
bool shouldRenderUsingSelectionColor(const QgsSymbolRenderContext &context) const
Returns true if the symbol layer should be rendered using the selection color from the render context...
bool installMasks(QgsRenderContext &context, bool recursive, const QRectF &rect=QRectF())
When rendering, install masks on context painter.
void removeMasks(QgsRenderContext &context, bool recursive)
When rendering, remove previously installed masks from context painter if recursive is true masks are...
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.
@ ArrowHeadLength
Arrow head length.
@ ArrowWidth
Arrow tail width.
@ ArrowHeadType
Arrow head type.
@ ArrowHeadThickness
Arrow head thickness.
@ ArrowStartWidth
Arrow tail start width.
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.
QgsSymbolLayer(const QgsSymbolLayer &other)
Encapsulates the context in which a symbol is being rendered.
const QgsFeature * feature() const
Returns the current feature being rendered.
QgsFields fields() const
Fields of the layer.
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, bool silenceNullWarnings=false)
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
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference).
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.