QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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"
17 #include "qgsmarkersymbollayer.h"
18 #include "qgssymbollayerutils.h"
19 #include "qgspainteffect.h"
20 
21 QgsMarkerSymbol *QgsMarkerSymbol::createSimple( const QVariantMap &properties )
22 {
24  if ( !sl )
25  return nullptr;
26 
27  QgsSymbolLayerList layers;
28  layers.append( sl );
29  return new QgsMarkerSymbol( layers );
30 }
31 
33  : QgsSymbol( Qgis::SymbolType::Marker, layers )
34 {
35  if ( mLayers.isEmpty() )
36  mLayers.append( new QgsSimpleMarkerSymbolLayer() );
37 }
38 
39 void QgsMarkerSymbol::setAngle( double symbolAngle )
40 {
41  double origAngle = angle();
42  double angleDiff = symbolAngle - origAngle;
43  const auto constMLayers = mLayers;
44  for ( QgsSymbolLayer *layer : constMLayers )
45  {
46  QgsMarkerSymbolLayer *markerLayer = dynamic_cast<QgsMarkerSymbolLayer *>( layer );
47  if ( markerLayer )
48  markerLayer->setAngle( markerLayer->angle() + angleDiff );
49  }
50 }
51 
52 double QgsMarkerSymbol::angle() const
53 {
54  for ( QgsSymbolLayer *layer : std::as_const( mLayers ) )
55  {
57  continue;
58  const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
59  return markerLayer->angle();
60  }
61  return 0;
62 }
63 
64 void QgsMarkerSymbol::setLineAngle( double lineAng )
65 {
66  const auto constMLayers = mLayers;
67  for ( QgsSymbolLayer *layer : constMLayers )
68  {
70  continue;
71  QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
72  markerLayer->setLineAngle( lineAng );
73  }
74 }
75 
77 {
78  const double symbolRotation = angle();
79 
80 
81  for ( QgsSymbolLayer *layer : std::as_const( mLayers ) )
82  {
84  continue;
85  const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
86  if ( !property )
87  {
88  layer->setDataDefinedProperty( QgsSymbolLayer::PropertyAngle, QgsProperty() );
89  }
90  else
91  {
92  if ( qgsDoubleNear( markerLayer->angle(), symbolRotation ) )
93  {
94  layer->setDataDefinedProperty( QgsSymbolLayer::PropertyAngle, property );
95  }
96  else
97  {
98  QgsProperty rotatedDD = QgsSymbolLayerUtils::rotateWholeSymbol( markerLayer->angle() - symbolRotation, property );
99  layer->setDataDefinedProperty( QgsSymbolLayer::PropertyAngle, rotatedDD );
100  }
101  }
102  }
103 }
104 
106 {
107  const double symbolRotation = angle();
108  QgsProperty symbolDD;
109 
110  // find the base of the "en masse" pattern
111  const auto layers = mLayers;
112  for ( QgsSymbolLayer *layer : layers )
113  {
114  if ( layer->type() != Qgis::SymbolType::Marker )
115  continue;
116  const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
117  if ( qgsDoubleNear( markerLayer->angle(), symbolRotation ) && markerLayer->dataDefinedProperties().isActive( QgsSymbolLayer::PropertyAngle ) )
118  {
119  symbolDD = markerLayer->dataDefinedProperties().property( QgsSymbolLayer::PropertyAngle );
120  break;
121  }
122  }
123 
124  if ( !symbolDD )
125  return QgsProperty();
126 
127  // check that all layer's angle expressions match the "en masse" pattern
128  for ( QgsSymbolLayer *layer : layers )
129  {
130  if ( layer->type() != Qgis::SymbolType::Marker )
131  continue;
132  const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
133 
135 
136  if ( qgsDoubleNear( markerLayer->angle(), symbolRotation ) )
137  {
138  if ( !layerAngleDD || layerAngleDD != symbolDD )
139  return QgsProperty();
140  }
141  else
142  {
143  QgsProperty rotatedDD( QgsSymbolLayerUtils::rotateWholeSymbol( markerLayer->angle() - symbolRotation, symbolDD ) );
144  if ( !layerAngleDD || layerAngleDD != rotatedDD )
145  return QgsProperty();
146  }
147  }
148  return symbolDD;
149 }
150 
151 
152 void QgsMarkerSymbol::setSize( double s )
153 {
154  double origSize = size();
155 
156  const auto constMLayers = mLayers;
157  for ( QgsSymbolLayer *layer : constMLayers )
158  {
159  if ( layer->type() != Qgis::SymbolType::Marker )
160  continue;
161  QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
162  if ( qgsDoubleNear( markerLayer->size(), origSize ) )
163  markerLayer->setSize( s );
164  else if ( !qgsDoubleNear( origSize, 0.0 ) )
165  {
166  // proportionally scale size
167  markerLayer->setSize( markerLayer->size() * s / origSize );
168  }
169  // also scale offset to maintain relative position
170  if ( !qgsDoubleNear( origSize, 0.0 ) && ( !qgsDoubleNear( markerLayer->offset().x(), 0.0 ) || !qgsDoubleNear( markerLayer->offset().y(), 0.0 ) ) )
171  markerLayer->setOffset( QPointF( markerLayer->offset().x() * s / origSize,
172  markerLayer->offset().y() * s / origSize ) );
173  }
174 }
175 
176 double QgsMarkerSymbol::size() const
177 {
178  // return size of the largest symbol
179  double maxSize = 0;
180  const auto constMLayers = mLayers;
181  for ( QgsSymbolLayer *layer : constMLayers )
182  {
183  if ( layer->type() != Qgis::SymbolType::Marker )
184  continue;
185  const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
186  double lsize = markerLayer->size();
187  if ( lsize > maxSize )
188  maxSize = lsize;
189  }
190  return maxSize;
191 }
192 
193 double QgsMarkerSymbol::size( const QgsRenderContext &context ) const
194 {
195  // return size of the largest symbol
196  double maxSize = 0;
197  for ( QgsSymbolLayer *layer : mLayers )
198  {
199  if ( layer->type() != Qgis::SymbolType::Marker )
200  continue;
201  const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
202  const double layerSize = context.convertToPainterUnits( markerLayer->size(), markerLayer->sizeUnit(), markerLayer->sizeMapUnitScale() );
203  maxSize = std::max( maxSize, layerSize );
204  }
205  return maxSize;
206 }
207 
209 {
210  const auto constMLayers = mLayers;
211  for ( QgsSymbolLayer *layer : constMLayers )
212  {
213  if ( layer->type() != Qgis::SymbolType::Marker )
214  continue;
215 
216  QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
217  markerLayer->setSizeUnit( unit );
218  }
219 }
220 
222 {
223  bool first = true;
225 
226  const auto constMLayers = mLayers;
227  for ( QgsSymbolLayer *layer : constMLayers )
228  {
229  if ( layer->type() != Qgis::SymbolType::Marker )
230  continue;
231  const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
232 
233  if ( first )
234  unit = markerLayer->sizeUnit();
235  else
236  {
237  if ( unit != markerLayer->sizeUnit() )
239  }
240 
241  first = false;
242  }
243  return unit;
244 }
245 
247 {
248  const auto constMLayers = mLayers;
249  for ( QgsSymbolLayer *layer : constMLayers )
250  {
251  if ( layer->type() != Qgis::SymbolType::Marker )
252  continue;
253 
254  QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
255  markerLayer->setSizeMapUnitScale( scale );
256  }
257 }
258 
260 {
261  const auto constMLayers = mLayers;
262  for ( QgsSymbolLayer *layer : constMLayers )
263  {
264  if ( layer->type() != Qgis::SymbolType::Marker )
265  continue;
266 
267  QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
268  return markerLayer->sizeMapUnitScale();
269  }
270  return QgsMapUnitScale();
271 }
272 
274 {
275  const double symbolSize = size();
276 
277  const auto constMLayers = mLayers;
278  for ( QgsSymbolLayer *layer : constMLayers )
279  {
280  if ( layer->type() != Qgis::SymbolType::Marker )
281  continue;
282  QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
283 
284  if ( !property )
285  {
288  }
289  else
290  {
291  if ( qgsDoubleNear( symbolSize, 0.0 ) || qgsDoubleNear( markerLayer->size(), symbolSize ) )
292  {
293  markerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertySize, property );
294  }
295  else
296  {
297  markerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertySize, QgsSymbolLayerUtils::scaleWholeSymbol( markerLayer->size() / symbolSize, property ) );
298  }
299 
300  if ( !qgsDoubleNear( markerLayer->offset().x(), 0.0 ) || !qgsDoubleNear( markerLayer->offset().y(), 0.0 ) )
301  {
302  markerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyOffset, QgsSymbolLayerUtils::scaleWholeSymbol(
303  markerLayer->offset().x() / symbolSize,
304  markerLayer->offset().y() / symbolSize, property ) );
305  }
306  }
307  }
308 }
309 
311 {
312  const double symbolSize = size();
313 
314  QgsProperty symbolDD;
315 
316  // find the base of the "en masse" pattern
317  const auto layers = mLayers;
318  for ( QgsSymbolLayer *layer : layers )
319  {
320  if ( layer->type() != Qgis::SymbolType::Marker )
321  continue;
322  const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
323  if ( qgsDoubleNear( markerLayer->size(), symbolSize ) && markerLayer->dataDefinedProperties().isActive( QgsSymbolLayer::PropertySize ) )
324  {
325  symbolDD = markerLayer->dataDefinedProperties().property( QgsSymbolLayer::PropertySize );
326  break;
327  }
328  }
329 
330  if ( !symbolDD )
331  return QgsProperty();
332 
333  // check that all layers size expressions match the "en masse" pattern
334  for ( QgsSymbolLayer *layer : layers )
335  {
336  if ( layer->type() != Qgis::SymbolType::Marker )
337  continue;
338  const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
339 
342 
343  if ( qgsDoubleNear( markerLayer->size(), symbolSize ) )
344  {
345  if ( !layerSizeDD || layerSizeDD != symbolDD )
346  return QgsProperty();
347  }
348  else
349  {
350  if ( qgsDoubleNear( symbolSize, 0.0 ) )
351  return QgsProperty();
352 
353  QgsProperty scaledDD( QgsSymbolLayerUtils::scaleWholeSymbol( markerLayer->size() / symbolSize, symbolDD ) );
354  if ( !layerSizeDD || layerSizeDD != scaledDD )
355  return QgsProperty();
356  }
357 
358  QgsProperty scaledOffsetDD( QgsSymbolLayerUtils::scaleWholeSymbol( markerLayer->offset().x() / symbolSize, markerLayer->offset().y() / symbolSize, symbolDD ) );
359  if ( layerOffsetDD && layerOffsetDD != scaledOffsetDD )
360  return QgsProperty();
361  }
362 
363  return symbolDD;
364 }
365 
367 {
368  const auto constMLayers = mLayers;
369  for ( QgsSymbolLayer *layer : constMLayers )
370  {
371  if ( layer->type() != Qgis::SymbolType::Marker )
372  continue;
373  QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( layer );
374  markerLayer->setScaleMethod( scaleMethod );
375  }
376 }
377 
379 {
380  const auto constMLayers = mLayers;
381  for ( QgsSymbolLayer *layer : constMLayers )
382  {
383  if ( layer->type() != Qgis::SymbolType::Marker )
384  continue;
385  const QgsMarkerSymbolLayer *markerLayer = static_cast<const QgsMarkerSymbolLayer *>( layer );
386  // return scale method of the first symbol layer
387  return markerLayer->scaleMethod();
388  }
389 
390  return DEFAULT_SCALE_METHOD;
391 }
392 
393 void QgsMarkerSymbol::renderPointUsingLayer( QgsMarkerSymbolLayer *layer, QPointF point, QgsSymbolRenderContext &context )
394 {
395  static QPointF nullPoint( 0, 0 );
396 
397  if ( layer->dataDefinedProperties().hasActiveProperties() && !layer->dataDefinedProperties().valueAsBool( QgsSymbolLayer::PropertyLayerEnabled, context.renderContext().expressionContext(), true ) )
398  return;
399 
400  QgsPaintEffect *effect = layer->paintEffect();
401  if ( effect && effect->enabled() )
402  {
403  QgsEffectPainter p( context.renderContext() );
404  p->translate( point );
405  p.setEffect( effect );
406  layer->renderPoint( nullPoint, context );
407  }
408  else
409  {
410  layer->renderPoint( point, context );
411  }
412 }
413 
414 void QgsMarkerSymbol::renderPoint( QPointF point, const QgsFeature *f, QgsRenderContext &context, int layerIdx, bool selected )
415 {
417  : mOpacity;
418 
419  QgsSymbolRenderContext symbolContext( context, QgsUnitTypes::RenderUnknownUnit, opacity, selected, mRenderHints, f );
420  symbolContext.setGeometryPartCount( symbolRenderContext()->geometryPartCount() );
421  symbolContext.setGeometryPartNum( symbolRenderContext()->geometryPartNum() );
422 
423  if ( layerIdx != -1 )
424  {
425  QgsSymbolLayer *symbolLayer = mLayers.value( layerIdx );
427  {
429  {
430  QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( symbolLayer );
431  renderPointUsingLayer( markerLayer, point, symbolContext );
432  }
433  else
434  {
435  QPolygonF points;
436  points.append( point );
437  renderUsingLayer( symbolLayer, symbolContext, QgsWkbTypes::PointGeometry, &points );
438  }
439  }
440  return;
441  }
442 
443 
444  for ( QgsSymbolLayer *symbolLayer : std::as_const( mLayers ) )
445  {
446  if ( context.renderingStopped() )
447  break;
448 
449  if ( !symbolLayer->enabled() || !context.isSymbolLayerEnabled( symbolLayer ) )
450  continue;
451 
453  {
454  QgsMarkerSymbolLayer *markerLayer = static_cast<QgsMarkerSymbolLayer *>( symbolLayer );
455  renderPointUsingLayer( markerLayer, point, symbolContext );
456  }
457  else
458  {
459  QPolygonF points;
460  points.append( point );
461  renderUsingLayer( symbolLayer, symbolContext, QgsWkbTypes::PointGeometry, &points );
462  }
463  }
464 }
465 
466 QRectF QgsMarkerSymbol::bounds( QPointF point, QgsRenderContext &context, const QgsFeature &feature ) const
467 {
468  QgsSymbolRenderContext symbolContext( context, QgsUnitTypes::RenderUnknownUnit, mOpacity, false, mRenderHints, &feature, feature.fields() );
469 
470  QRectF bound;
471  const auto constMLayers = mLayers;
472  for ( QgsSymbolLayer *layer : constMLayers )
473  {
474  if ( layer->type() == Qgis::SymbolType::Marker )
475  {
476  if ( !layer->enabled()
477  || ( layer->dataDefinedProperties().hasActiveProperties() && !layer->dataDefinedProperties().valueAsBool( QgsSymbolLayer::PropertyLayerEnabled, context.expressionContext(), true ) ) )
478  continue;
479 
481  if ( bound.isNull() )
482  bound = symbolLayer->bounds( point, symbolContext );
483  else
484  bound = bound.united( symbolLayer->bounds( point, symbolContext ) );
485  }
486  }
487  return bound;
488 }
489 
491 {
492  QgsMarkerSymbol *cloneSymbol = new QgsMarkerSymbol( cloneLayers() );
493  cloneSymbol->setOpacity( mOpacity );
495  cloneSymbol->setLayer( mLayer );
498  cloneSymbol->setForceRHR( mForceRHR );
500  cloneSymbol->setFlags( mSymbolFlags );
501  return cloneSymbol;
502 }
503 
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:64
ScaleMethod
Scale methods.
Definition: qgis.h:197
@ 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
QgsMapLayerType 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.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the symbol's size.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units 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.
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale 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.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the size units for the whole symbol (including all symbol layers).
static QgsMarkerSymbol * createSimple(const QVariantMap &properties)
Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
void setScaleMethod(Qgis::ScaleMethod scaleMethod)
Sets the method to use for scaling the marker's size.
QgsProperty dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
void setSize(double size)
Sets the size for the whole symbol.
void setLineAngle(double lineAngle)
Sets the line angle modification for the symbol's angle.
QgsMarkerSymbol(const QgsSymbolLayerList &layers=QgsSymbolLayerList())
Constructor for QgsMarkerSymbol, with the specified list of initial symbol layers.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the size units for the whole symbol (including all 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 setDataDefinedSize(const QgsProperty &property)
Set data defined size for whole symbol (including all symbol layers).
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the size map unit scale for the whole symbol (including all symbol layers).
QgsProperty dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
void setAngle(double symbolAngle)
Sets the angle for the whole symbol.
Qgis::ScaleMethod scaleMethod()
Returns the method to use for scaling the marker's size.
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
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.
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...
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:231
Contains information about the context of a rendering operation.
QgsExpressionContext & expressionContext()
Gets the expression context.
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) const
Converts a size from the specified units to painter units (pixels).
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.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
void setGeometryPartCount(int count)
Sets the part count of current geometry.
void setGeometryPartNum(int num)
Sets the part number of current geometry.
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:38
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the symbol's property collection, used for data defined overrides.
Definition: qgssymbol.h:558
Qgis::SymbolFlags mSymbolFlags
Symbol flags.
Definition: qgssymbol.h:719
QgsSymbolLayerList cloneLayers() const
Retrieve a cloned list of all layers that make up this symbol.
Definition: qgssymbol.cpp:790
QgsSymbolRenderContext * symbolRenderContext()
Returns the symbol render context.
Definition: qgssymbol.cpp:1467
QgsSymbolLayer * symbolLayer(int layer)
Returns the symbol layer at the specified index.
Definition: qgssymbol.cpp:420
@ PropertyOpacity
Opacity.
Definition: qgssymbol.h:76
void renderUsingLayer(QgsSymbolLayer *layer, QgsSymbolRenderContext &context, QgsWkbTypes::GeometryType geometryType=QgsWkbTypes::GeometryType::UnknownGeometry, 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:804
qreal mOpacity
Symbol opacity (in the range 0 - 1)
Definition: qgssymbol.h:710
Q_DECL_DEPRECATED const QgsVectorLayer * mLayer
Definition: qgssymbol.h:724
bool mClipFeaturesToExtent
Definition: qgssymbol.h:721
qreal opacity() const
Returns the opacity for the symbol.
Definition: qgssymbol.h:440
void setFlags(Qgis::SymbolFlags flags)
Sets flags for the symbol.
Definition: qgssymbol.h:467
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol's property collection, used for data defined overrides.
Definition: qgssymbol.h:543
void setOpacity(qreal opacity)
Sets the opacity for the symbol.
Definition: qgssymbol.h:447
Qgis::SymbolRenderHints mRenderHints
Definition: qgssymbol.h:712
bool mForceRHR
Definition: qgssymbol.h:722
QgsSymbolLayerList mLayers
Definition: qgssymbol.h:707
Q_DECL_DEPRECATED const QgsVectorLayer * layer() const
Definition: qgssymbol.cpp:877
Q_DECL_DEPRECATED void setLayer(const QgsVectorLayer *layer)
Definition: qgssymbol.cpp:870
void setClipFeaturesToExtent(bool clipFeaturesToExtent)
Sets whether features drawn by the symbol should be clipped to the render context's extent.
Definition: qgssymbol.h:486
void setForceRHR(bool force)
Sets whether polygon features drawn by the symbol should be reoriented to follow the standard right-h...
Definition: qgssymbol.h:508
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:168
@ RenderUnknownUnit
Mixed or unknown units.
Definition: qgsunittypes.h:175
#define Q_NOWARN_DEPRECATED_POP
Definition: qgis.h:2065
#define Q_NOWARN_DEPRECATED_PUSH
Definition: qgis.h:2064
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition: qgis.h:1578
QList< QgsSymbolLayer * > QgsSymbolLayerList
Definition: qgssymbol.h:27
#define DEFAULT_SCALE_METHOD