QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
qgsmarkersymbol.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsmarkersymbol.cpp
3 ---------------------
4 begin : November 2009
5 copyright : (C) 2009 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include "qgsmarkersymbol.h"
19#include "qgssymbollayerutils.h"
20#include "qgspainteffect.h"
21
22QgsMarkerSymbol *QgsMarkerSymbol::createSimple( const QVariantMap &properties )
23{
25 if ( !sl )
26 return nullptr;
27
28 QgsSymbolLayerList layers;
29 layers.append( sl );
30 return new QgsMarkerSymbol( layers );
31}
32
34 : QgsSymbol( Qgis::SymbolType::Marker, layers )
35{
36 if ( mLayers.isEmpty() )
37 mLayers.append( new QgsSimpleMarkerSymbolLayer() );
38}
39
40void QgsMarkerSymbol::setAngle( double symbolAngle ) const
41{
42 double origAngle = angle();
43 double angleDiff = symbolAngle - origAngle;
44 const auto constMLayers = mLayers;
45 for ( QgsSymbolLayer *layer : constMLayers )
46 {
47 QgsMarkerSymbolLayer *markerLayer = dynamic_cast<QgsMarkerSymbolLayer *>( layer );
48 if ( markerLayer )
49 markerLayer->setAngle( markerLayer->angle() + angleDiff );
50 }
51}
52
54{
55 for ( QgsSymbolLayer *layer : std::as_const( mLayers ) )
56 {
58 continue;
59 const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
60 return markerLayer->angle();
61 }
62 return 0;
63}
64
65void QgsMarkerSymbol::setLineAngle( double lineAng ) const
66{
67 const auto constMLayers = mLayers;
68 for ( QgsSymbolLayer *layer : constMLayers )
69 {
71 continue;
72 QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
73 markerLayer->setLineAngle( lineAng );
74 }
75}
76
78{
79 const double symbolRotation = angle();
80
81
82 for ( QgsSymbolLayer *layer : std::as_const( mLayers ) )
83 {
85 continue;
86 const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
87 if ( !property )
88 {
89 layer->setDataDefinedProperty( QgsSymbolLayer::PropertyAngle, QgsProperty() );
90 }
91 else
92 {
93 if ( qgsDoubleNear( markerLayer->angle(), symbolRotation ) )
94 {
95 layer->setDataDefinedProperty( QgsSymbolLayer::PropertyAngle, property );
96 }
97 else
98 {
99 QgsProperty rotatedDD = QgsSymbolLayerUtils::rotateWholeSymbol( markerLayer->angle() - symbolRotation, property );
100 layer->setDataDefinedProperty( QgsSymbolLayer::PropertyAngle, rotatedDD );
101 }
102 }
103 }
104}
105
107{
108 const double symbolRotation = angle();
109 QgsProperty symbolDD;
110
111 // find the base of the "en masse" pattern
112 const auto layers = mLayers;
113 for ( QgsSymbolLayer *layer : layers )
114 {
116 continue;
117 const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
118 if ( qgsDoubleNear( markerLayer->angle(), symbolRotation ) && markerLayer->dataDefinedProperties().isActive( QgsSymbolLayer::PropertyAngle ) )
119 {
121 break;
122 }
123 }
124
125 if ( !symbolDD )
126 return QgsProperty();
127
128 // check that all layer's angle expressions match the "en masse" pattern
129 for ( QgsSymbolLayer *layer : layers )
130 {
132 continue;
133 const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
134
136
137 if ( qgsDoubleNear( markerLayer->angle(), symbolRotation ) )
138 {
139 if ( !layerAngleDD || layerAngleDD != symbolDD )
140 return QgsProperty();
141 }
142 else
143 {
144 QgsProperty rotatedDD( QgsSymbolLayerUtils::rotateWholeSymbol( markerLayer->angle() - symbolRotation, symbolDD ) );
145 if ( !layerAngleDD || layerAngleDD != rotatedDD )
146 return QgsProperty();
147 }
148 }
149 return symbolDD;
150}
151
152
153void QgsMarkerSymbol::setSize( double s ) const
154{
155 double origSize = size();
156
157 const auto constMLayers = mLayers;
158 for ( QgsSymbolLayer *layer : constMLayers )
159 {
160 QgsMarkerSymbolLayer *markerLayer = dynamic_cast<QgsMarkerSymbolLayer *>( layer );
161 if ( markerLayer )
162 {
163 if ( qgsDoubleNear( markerLayer->size(), origSize ) )
164 {
165 markerLayer->setSize( s );
166 }
167 else if ( !qgsDoubleNear( origSize, 0.0 ) )
168 {
169 // proportionally scale size
170 markerLayer->setSize( markerLayer->size() * s / origSize );
171 }
172 // also scale offset to maintain relative position
173 if ( !qgsDoubleNear( origSize, 0.0 ) && ( !qgsDoubleNear( markerLayer->offset().x(), 0.0 ) || !qgsDoubleNear( markerLayer->offset().y(), 0.0 ) ) )
174 markerLayer->setOffset( QPointF( markerLayer->offset().x() * s / origSize,
175 markerLayer->offset().y() * s / origSize ) );
176 }
177 else
178 {
179 QgsGeometryGeneratorSymbolLayer *geomGeneratorLayer = dynamic_cast<QgsGeometryGeneratorSymbolLayer *>( layer );
180 if ( geomGeneratorLayer && geomGeneratorLayer->symbolType() == Qgis::SymbolType::Marker )
181 {
182 QgsMarkerSymbol *markerSymbol = qgis::down_cast<QgsMarkerSymbol *>( geomGeneratorLayer->subSymbol() );
183 if ( qgsDoubleNear( markerSymbol->size(), origSize ) )
184 {
185 markerSymbol->setSize( s );
186 }
187 else if ( !qgsDoubleNear( origSize, 0.0 ) )
188 {
189 // proportionally scale the width
190 markerSymbol->setSize( markerSymbol->size() * s / origSize );
191 }
192 }
193 }
194 }
195}
196
198{
199 // return size of the largest symbol
200 double maxSize = 0;
201 const auto constMLayers = mLayers;
202 for ( QgsSymbolLayer *layer : constMLayers )
203 {
204 const QgsMarkerSymbolLayer *markerLayer = dynamic_cast<QgsMarkerSymbolLayer *>( layer );
205 if ( markerLayer )
206 {
207 const double lsize = markerLayer->size();
208 if ( lsize > maxSize )
209 maxSize = lsize;
210 }
211 else
212 {
213 QgsGeometryGeneratorSymbolLayer *geomGeneratorLayer = dynamic_cast<QgsGeometryGeneratorSymbolLayer *>( layer );
214 if ( geomGeneratorLayer && geomGeneratorLayer->symbolType() == Qgis::SymbolType::Marker )
215 {
216 QgsMarkerSymbol *markerSymbol = qgis::down_cast<QgsMarkerSymbol *>( geomGeneratorLayer->subSymbol() );
217 const double lsize = markerSymbol->size();
218 if ( lsize > maxSize )
219 maxSize = lsize;
220 }
221 }
222 }
223 return maxSize;
224}
225
226double QgsMarkerSymbol::size( const QgsRenderContext &context ) const
227{
228 // return size of the largest symbol
229 double maxSize = 0;
230 for ( QgsSymbolLayer *layer : mLayers )
231 {
233 continue;
234 const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
235 const double layerSize = context.convertToPainterUnits( markerLayer->size(), markerLayer->sizeUnit(), markerLayer->sizeMapUnitScale() );
236 maxSize = std::max( maxSize, layerSize );
237 }
238 return maxSize;
239}
240
242{
243 const auto constMLayers = mLayers;
244 for ( QgsSymbolLayer *layer : constMLayers )
245 {
247 continue;
248
249 QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
250 markerLayer->setSizeUnit( unit );
251 }
252}
253
255{
256 bool first = true;
257 Qgis::RenderUnit unit = Qgis::RenderUnit::Unknown;
258
259 const auto constMLayers = mLayers;
260 for ( QgsSymbolLayer *layer : constMLayers )
261 {
263 continue;
264 const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
265
266 if ( first )
267 unit = markerLayer->sizeUnit();
268 else
269 {
270 if ( unit != markerLayer->sizeUnit() )
271 return Qgis::RenderUnit::Unknown;
272 }
273
274 first = false;
275 }
276 return unit;
277}
278
280{
281 const auto constMLayers = mLayers;
282 for ( QgsSymbolLayer *layer : constMLayers )
283 {
285 continue;
286
287 QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
288 markerLayer->setSizeMapUnitScale( scale );
289 }
290}
291
293{
294 const auto constMLayers = mLayers;
295 for ( QgsSymbolLayer *layer : constMLayers )
296 {
298 continue;
299
300 QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
301 return markerLayer->sizeMapUnitScale();
302 }
303 return QgsMapUnitScale();
304}
305
307{
308 const double symbolSize = size();
309
310 const auto constMLayers = mLayers;
311 for ( QgsSymbolLayer *layer : constMLayers )
312 {
314 continue;
315 QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
316
317 if ( !property )
318 {
321 }
322 else
323 {
324 if ( qgsDoubleNear( symbolSize, 0.0 ) || qgsDoubleNear( markerLayer->size(), symbolSize ) )
325 {
327 }
328 else
329 {
330 markerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertySize, QgsSymbolLayerUtils::scaleWholeSymbol( markerLayer->size() / symbolSize, property ) );
331 }
332
333 if ( !qgsDoubleNear( markerLayer->offset().x(), 0.0 ) || !qgsDoubleNear( markerLayer->offset().y(), 0.0 ) )
334 {
335 markerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyOffset, QgsSymbolLayerUtils::scaleWholeSymbol(
336 markerLayer->offset().x() / symbolSize,
337 markerLayer->offset().y() / symbolSize, property ) );
338 }
339 }
340 }
341}
342
344{
345 const double symbolSize = size();
346
347 QgsProperty symbolDD;
348
349 // find the base of the "en masse" pattern
350 const auto layers = mLayers;
351 for ( QgsSymbolLayer *layer : layers )
352 {
354 continue;
355 const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
356 if ( qgsDoubleNear( markerLayer->size(), symbolSize ) && markerLayer->dataDefinedProperties().isActive( QgsSymbolLayer::PropertySize ) )
357 {
359 break;
360 }
361 }
362
363 if ( !symbolDD )
364 return QgsProperty();
365
366 // check that all layers size expressions match the "en masse" pattern
367 for ( QgsSymbolLayer *layer : layers )
368 {
370 continue;
371 const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
372
375
376 if ( qgsDoubleNear( markerLayer->size(), symbolSize ) )
377 {
378 if ( !layerSizeDD || layerSizeDD != symbolDD )
379 return QgsProperty();
380 }
381 else
382 {
383 if ( qgsDoubleNear( symbolSize, 0.0 ) )
384 return QgsProperty();
385
386 QgsProperty scaledDD( QgsSymbolLayerUtils::scaleWholeSymbol( markerLayer->size() / symbolSize, symbolDD ) );
387 if ( !layerSizeDD || layerSizeDD != scaledDD )
388 return QgsProperty();
389 }
390
391 QgsProperty scaledOffsetDD( QgsSymbolLayerUtils::scaleWholeSymbol( markerLayer->offset().x() / symbolSize, markerLayer->offset().y() / symbolSize, symbolDD ) );
392 if ( layerOffsetDD && layerOffsetDD != scaledOffsetDD )
393 return QgsProperty();
394 }
395
396 return symbolDD;
397}
398
400{
401 const auto constMLayers = mLayers;
402 for ( QgsSymbolLayer *layer : constMLayers )
403 {
405 continue;
406 QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
407 markerLayer->setScaleMethod( scaleMethod );
408 }
409}
410
412{
413 const auto constMLayers = mLayers;
414 for ( QgsSymbolLayer *layer : constMLayers )
415 {
417 continue;
418 const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
419 // return scale method of the first symbol layer
420 return markerLayer->scaleMethod();
421 }
422
424}
425
426void QgsMarkerSymbol::renderPointUsingLayer( QgsMarkerSymbolLayer *layer, QPointF point, QgsSymbolRenderContext &context )
427{
428 static QPointF nullPoint( 0, 0 );
429
430 if ( layer->dataDefinedProperties().hasActiveProperties() && !layer->dataDefinedProperties().valueAsBool( QgsSymbolLayer::PropertyLayerEnabled, context.renderContext().expressionContext(), true ) )
431 return;
432
433 QgsPaintEffect *effect = layer->paintEffect();
434 if ( effect && effect->enabled() )
435 {
436 QgsEffectPainter p( context.renderContext() );
437 p->translate( point );
438 p.setEffect( effect );
439 layer->renderPoint( nullPoint, context );
440 }
441 else
442 {
443 layer->renderPoint( point, context );
444 }
445}
446
447void QgsMarkerSymbol::renderPoint( QPointF point, const QgsFeature *f, QgsRenderContext &context, int layerIdx, bool selected )
448{
450 : mOpacity;
451
452 QgsSymbolRenderContext symbolContext( context, Qgis::RenderUnit::Unknown, opacity, selected, mRenderHints, f );
453 symbolContext.setGeometryPartCount( symbolRenderContext()->geometryPartCount() );
454 symbolContext.setGeometryPartNum( symbolRenderContext()->geometryPartNum() );
455
456 if ( layerIdx != -1 )
457 {
458 QgsSymbolLayer *symbolLayer = mLayers.value( layerIdx );
460 {
462 {
463 QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( symbolLayer );
464 renderPointUsingLayer( markerLayer, point, symbolContext );
465 }
466 else
467 {
468 QPolygonF points;
469 points.append( point );
470 renderUsingLayer( symbolLayer, symbolContext, Qgis::GeometryType::Point, &points );
471 }
472 }
473 return;
474 }
475
476
477 for ( QgsSymbolLayer *symbolLayer : std::as_const( mLayers ) )
478 {
479 if ( context.renderingStopped() )
480 break;
481
482 if ( !symbolLayer->enabled() || !context.isSymbolLayerEnabled( symbolLayer ) )
483 continue;
484
486 {
487 QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( symbolLayer );
488 renderPointUsingLayer( markerLayer, point, symbolContext );
489 }
490 else
491 {
492 QPolygonF points;
493 points.append( point );
494 renderUsingLayer( symbolLayer, symbolContext, Qgis::GeometryType::Point, &points );
495 }
496 }
497}
498
499QRectF QgsMarkerSymbol::bounds( QPointF point, QgsRenderContext &context, const QgsFeature &feature ) const
500{
501 QgsSymbolRenderContext symbolContext( context, Qgis::RenderUnit::Unknown, mOpacity, false, mRenderHints, &feature, feature.fields() );
502
503 QRectF bound;
504 const auto constMLayers = mLayers;
505 for ( QgsSymbolLayer *layer : constMLayers )
506 {
508 {
509 if ( !layer->enabled()
510 || ( layer->dataDefinedProperties().hasActiveProperties() && !layer->dataDefinedProperties().valueAsBool( QgsSymbolLayer::PropertyLayerEnabled, context.expressionContext(), true ) ) )
511 continue;
512
514 if ( bound.isNull() )
515 bound = symbolLayer->bounds( point, symbolContext );
516 else
517 bound = bound.united( symbolLayer->bounds( point, symbolContext ) );
518 }
519 }
520 return bound;
521}
522
524{
525 QgsMarkerSymbol *cloneSymbol = new QgsMarkerSymbol( cloneLayers() );
526 cloneSymbol->setOpacity( mOpacity );
528 cloneSymbol->setLayer( mLayer );
531 cloneSymbol->setForceRHR( mForceRHR );
533 cloneSymbol->setFlags( mSymbolFlags );
535 return cloneSymbol;
536}
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:55
ScaleMethod
Scale methods.
Definition: qgis.h:334
RenderUnit
Rendering size units.
Definition: qgis.h:3176
@ Marker
Marker symbol.
double valueAsDouble(int key, const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a double.
A class to manager painter saving and restoring required for effect drawing.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
QgsFields fields
Definition: qgsfeature.h:66
Qgis::SymbolType symbolType() const
Access the symbol type.
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
Qgis::LayerType type
Definition: qgsmaplayer.h:80
Struct for storing maximum and minimum scales for measurements in map units.
Abstract base class for marker symbol layers.
virtual void setSize(double size)
Sets the symbol size.
QPointF offset() const
Returns the marker's offset, which is the horizontal and vertical displacement which the rendered mar...
void setAngle(double angle)
Sets the rotation angle for the marker.
Qgis::ScaleMethod scaleMethod() const
Returns the method to use for scaling the marker's size.
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale for the symbol's size.
void setOffset(QPointF offset)
Sets the marker's offset, which is the horizontal and vertical displacement which the rendered marker...
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's size.
void setLineAngle(double lineAngle)
Sets the line angle modification for the symbol's angle.
double size() const
Returns the symbol size.
void setScaleMethod(Qgis::ScaleMethod scaleMethod)
Sets the method to use for scaling the marker's size.
Qgis::RenderUnit sizeUnit() const
Returns the units for the symbol's size.
void setSizeUnit(Qgis::RenderUnit unit)
Sets the units for the symbol's size.
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
A marker symbol type, for rendering Point and MultiPoint geometries.
void setScaleMethod(Qgis::ScaleMethod scaleMethod) const
Sets the method to use for scaling the marker's size.
void setAngle(double symbolAngle) const
Sets the angle for the whole symbol.
void setSize(double size) const
Sets the size for the whole symbol.
static QgsMarkerSymbol * createSimple(const QVariantMap &properties)
Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
QgsProperty dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
QgsMarkerSymbol(const QgsSymbolLayerList &layers=QgsSymbolLayerList())
Constructor for QgsMarkerSymbol, with the specified list of initial symbol layers.
double size() const
Returns the estimated size for the whole symbol, which is the maximum size of all marker symbol layer...
double angle() const
Returns the marker angle for the whole symbol.
QgsMapUnitScale sizeMapUnitScale() const
Returns the size map unit scale for the whole symbol.
void setLineAngle(double lineAngle) const
Sets the line angle modification for the symbol's angle.
QgsProperty dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
void setDataDefinedSize(const QgsProperty &property) const
Set data defined size for whole symbol (including all symbol layers).
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
void setSizeMapUnitScale(const QgsMapUnitScale &scale) const
Sets the size map unit scale for the whole symbol (including all symbol layers).
Qgis::ScaleMethod scaleMethod() const
Returns the method to use for scaling the marker's size.
void renderPoint(QPointF point, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
Renders the symbol at the specified point, using the given render context.
Qgis::RenderUnit sizeUnit() const
Returns the size units for the whole symbol (including all symbol layers).
void setDataDefinedAngle(const QgsProperty &property)
Set data defined angle for whole symbol (including all symbol layers).
QRectF bounds(QPointF point, QgsRenderContext &context, const QgsFeature &feature=QgsFeature()) const
Returns the approximate bounding box of the marker symbol, which includes the bounding box of all sym...
void setSizeUnit(Qgis::RenderUnit unit) const
Sets the size units for the whole symbol (including all symbol layers).
Base class for visual effects which can be applied to QPicture drawings.
bool enabled() const
Returns whether the effect is enabled.
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
bool hasActiveProperties() const override
Returns true if the collection has any active properties, or false if all properties within the colle...
A store for object properties.
Definition: qgsproperty.h:230
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).
QgsExpressionContext & expressionContext()
Gets the expression context.
bool isSymbolLayerEnabled(const QgsSymbolLayer *layer) const
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
bool renderingStopped() const
Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled...
Simple marker symbol layer, consisting of a rendered shape with solid fill color and an stroke.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleMarkerSymbolLayer.
@ PropertyAngle
Symbol angle.
@ PropertySize
Symbol size.
@ PropertyOffset
Symbol offset.
@ PropertyLayerEnabled
Whether symbol layer is enabled.
Qgis::SymbolType type() const
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
void setGeometryPartCount(int count)
Sets the part count of current geometry.
void setGeometryPartNum(int num)
Sets the part number of current geometry.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:93
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the symbol's property collection, used for data defined overrides.
Definition: qgssymbol.h:637
void renderUsingLayer(QgsSymbolLayer *layer, QgsSymbolRenderContext &context, Qgis::GeometryType geometryType=Qgis::GeometryType::Unknown, const QPolygonF *points=nullptr, const QVector< QPolygonF > *rings=nullptr)
Renders a context using a particular symbol layer without passing in a geometry.
Definition: qgssymbol.cpp:1162
Qgis::SymbolFlags mSymbolFlags
Symbol flags.
Definition: qgssymbol.h:798
QgsSymbolLayerList cloneLayers() const
Retrieve a cloned list of all layers that make up this symbol.
Definition: qgssymbol.cpp:1147
QgsSymbolRenderContext * symbolRenderContext()
Returns the symbol render context.
Definition: qgssymbol.cpp:1823
QgsSymbolLayer * symbolLayer(int layer)
Returns the symbol layer at the specified index.
Definition: qgssymbol.cpp:756
@ PropertyOpacity
Opacity.
Definition: qgssymbol.h:131
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol's property collection, used for data defined overrides.
Definition: qgssymbol.h:622
qreal mOpacity
Symbol opacity (in the range 0 - 1)
Definition: qgssymbol.h:789
Q_DECL_DEPRECATED const QgsVectorLayer * mLayer
Definition: qgssymbol.h:805
bool mClipFeaturesToExtent
Definition: qgssymbol.h:800
qreal opacity() const
Returns the opacity for the symbol.
Definition: qgssymbol.h:495
void setFlags(Qgis::SymbolFlags flags)
Sets flags for the symbol.
Definition: qgssymbol.h:522
void setOpacity(qreal opacity)
Sets the opacity for the symbol.
Definition: qgssymbol.h:502
Qgis::SymbolRenderHints mRenderHints
Definition: qgssymbol.h:791
bool mForceRHR
Definition: qgssymbol.h:801
QgsSymbolLayerList mLayers
Definition: qgssymbol.h:786
Q_DECL_DEPRECATED const QgsVectorLayer * layer() const
Definition: qgssymbol.cpp:1235
QgsSymbolAnimationSettings mAnimationSettings
Definition: qgssymbol.h:803
void setAnimationSettings(const QgsSymbolAnimationSettings &settings)
Sets a the symbol animation settings.
Definition: qgssymbol.cpp:699
Q_DECL_DEPRECATED void setLayer(const QgsVectorLayer *layer)
Definition: qgssymbol.cpp:1228
void setClipFeaturesToExtent(bool clipFeaturesToExtent)
Sets whether features drawn by the symbol should be clipped to the render context's extent.
Definition: qgssymbol.h:541
void setForceRHR(bool force)
Sets whether polygon features drawn by the symbol should be reoriented to follow the standard right-h...
Definition: qgssymbol.h:563
#define Q_NOWARN_DEPRECATED_POP
Definition: qgis.h:4093
#define Q_NOWARN_DEPRECATED_PUSH
Definition: qgis.h:4092
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition: qgis.h:3509
QList< QgsSymbolLayer * > QgsSymbolLayerList
Definition: qgssymbol.h:29
#define DEFAULT_SCALE_METHOD