QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgssymbollayer.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgssymbollayer.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 "qgssymbollayer.h"
17 #include "qgsclipper.h"
18 #include "qgsexpression.h"
19 #include "qgsrendercontext.h"
20 #include "qgsvectorlayer.h"
21 #include "qgsdxfexport.h"
22 #include "qgsgeometrysimplifier.h"
23 #include "qgspainteffect.h"
24 #include "qgseffectstack.h"
25 #include "qgspainteffectregistry.h"
26 #include "qgsproperty.h"
27 #include "qgsexpressioncontext.h"
28 #include "qgssymbollayerutils.h"
29 #include "qgsapplication.h"
30 #include "qgsmultipoint.h"
31 #include "qgslegendpatchshape.h"
32 #include "qgsstyle.h"
34 #include "qgssymbol.h"
36 
37 #include <QSize>
38 #include <QPainter>
39 #include <QPointF>
40 #include <QPolygonF>
41 
42 QgsPropertiesDefinition QgsSymbolLayer::sPropertyDefinitions;
43 
44 void QgsSymbolLayer::initPropertyDefinitions()
45 {
46  if ( !sPropertyDefinitions.isEmpty() )
47  return;
48 
49  QString origin = QStringLiteral( "symbol" );
50 
51  sPropertyDefinitions = QgsPropertiesDefinition
52  {
53  { QgsSymbolLayer::PropertySize, QgsPropertyDefinition( "size", QObject::tr( "Symbol size" ), QgsPropertyDefinition::Size, origin ) },
54  { QgsSymbolLayer::PropertyAngle, QgsPropertyDefinition( "angle", QObject::tr( "Rotation angle" ), QgsPropertyDefinition::Rotation, origin ) },
55  { QgsSymbolLayer::PropertyName, QgsPropertyDefinition( "name", QObject::tr( "Symbol name" ), QgsPropertyDefinition::String, origin ) },
56  { QgsSymbolLayer::PropertyFillColor, QgsPropertyDefinition( "fillColor", QObject::tr( "Symbol fill color" ), QgsPropertyDefinition::ColorWithAlpha, origin ) },
57  { QgsSymbolLayer::PropertyStrokeColor, QgsPropertyDefinition( "outlineColor", QObject::tr( "Symbol stroke color" ), QgsPropertyDefinition::ColorWithAlpha, origin ) },
58  { QgsSymbolLayer::PropertyStrokeWidth, QgsPropertyDefinition( "outlineWidth", QObject::tr( "Symbol stroke width" ), QgsPropertyDefinition::StrokeWidth, origin ) },
59  { QgsSymbolLayer::PropertyStrokeStyle, QgsPropertyDefinition( "outlineStyle", QObject::tr( "Symbol stroke style" ), QgsPropertyDefinition::LineStyle, origin )},
60  { QgsSymbolLayer::PropertyOffset, QgsPropertyDefinition( "offset", QObject::tr( "Symbol offset" ), QgsPropertyDefinition::Offset, origin )},
61  { QgsSymbolLayer::PropertyCharacter, QgsPropertyDefinition( "char", QObject::tr( "Marker character(s)" ), QgsPropertyDefinition::String, origin )},
62  { QgsSymbolLayer::PropertyFontFamily, QgsPropertyDefinition( "fontFamily", QObject::tr( "Font family" ), QgsPropertyDefinition::String, origin )},
63  { QgsSymbolLayer::PropertyFontStyle, QgsPropertyDefinition( "fontStyle", QObject::tr( "Font style" ), QgsPropertyDefinition::String, origin )},
64  { QgsSymbolLayer::PropertyWidth, QgsPropertyDefinition( "width", QObject::tr( "Symbol width" ), QgsPropertyDefinition::DoublePositive, origin )},
65  { QgsSymbolLayer::PropertyHeight, QgsPropertyDefinition( "height", QObject::tr( "Symbol height" ), QgsPropertyDefinition::DoublePositive, origin )},
66  { QgsSymbolLayer::PropertyPreserveAspectRatio, QgsPropertyDefinition( "preserveAspectRatio", QObject::tr( "Preserve aspect ratio between width and height" ), QgsPropertyDefinition::Boolean, origin )},
67  { QgsSymbolLayer::PropertyFillStyle, QgsPropertyDefinition( "fillStyle", QObject::tr( "Symbol fill style" ), QgsPropertyDefinition::FillStyle, origin )},
68  { QgsSymbolLayer::PropertyJoinStyle, QgsPropertyDefinition( "joinStyle", QObject::tr( "Outline join style" ), QgsPropertyDefinition::PenJoinStyle, origin )},
69  { QgsSymbolLayer::PropertySecondaryColor, QgsPropertyDefinition( "color2", QObject::tr( "Secondary fill color" ), QgsPropertyDefinition::ColorWithAlpha, origin )},
70  { QgsSymbolLayer::PropertyLineAngle, QgsPropertyDefinition( "lineAngle", QObject::tr( "Angle for line fills" ), QgsPropertyDefinition::Rotation, origin )},
71  { QgsSymbolLayer::PropertyGradientType, QgsPropertyDefinition( "gradientType", QgsPropertyDefinition::DataTypeString, QObject::tr( "Gradient type" ), QObject::tr( "string " ) + QLatin1String( "[<b>linear</b>|<b>radial</b>|<b>conical</b>]" ), origin )},
72  { QgsSymbolLayer::PropertyCoordinateMode, QgsPropertyDefinition( "gradientMode", QgsPropertyDefinition::DataTypeString, QObject::tr( "Gradient mode" ), QObject::tr( "string " ) + QLatin1String( "[<b>feature</b>|<b>viewport</b>]" ), origin )},
73  { QgsSymbolLayer::PropertyGradientSpread, QgsPropertyDefinition( "gradientSpread", QgsPropertyDefinition::DataTypeString, QObject::tr( "Gradient spread" ), QObject::tr( "string " ) + QLatin1String( "[<b>pad</b>|<b>repeat</b>|<b>reflect</b>]" ), origin )},
74  { QgsSymbolLayer::PropertyGradientReference1X, QgsPropertyDefinition( "gradientRef1X", QObject::tr( "Reference point 1 (X)" ), QgsPropertyDefinition::Double0To1, origin )},
75  { QgsSymbolLayer::PropertyGradientReference1Y, QgsPropertyDefinition( "gradientRef1Y", QObject::tr( "Reference point 1 (Y)" ), QgsPropertyDefinition::Double0To1, origin )},
76  { QgsSymbolLayer::PropertyGradientReference2X, QgsPropertyDefinition( "gradientRef2X", QObject::tr( "Reference point 2 (X)" ), QgsPropertyDefinition::Double0To1, origin )},
77  { QgsSymbolLayer::PropertyGradientReference2Y, QgsPropertyDefinition( "gradientRef2Y", QObject::tr( "Reference point 2 (Y)" ), QgsPropertyDefinition::Double0To1, origin )},
78  { QgsSymbolLayer::PropertyGradientReference1IsCentroid, QgsPropertyDefinition( "gradientRef1Centroid", QObject::tr( "Reference point 1 follows feature centroid" ), QgsPropertyDefinition::Boolean, origin )},
79  { QgsSymbolLayer::PropertyGradientReference2IsCentroid, QgsPropertyDefinition( "gradientRef2Centroid", QObject::tr( "Reference point 2 follows feature centroid" ), QgsPropertyDefinition::Boolean, origin )},
80  { QgsSymbolLayer::PropertyBlurRadius, QgsPropertyDefinition( "blurRadius", QgsPropertyDefinition::DataTypeNumeric, QObject::tr( "Blur radius" ), QObject::tr( "Integer between 0 and 18" ), origin )},
81  { QgsSymbolLayer::PropertyLineDistance, QgsPropertyDefinition( "lineDistance", QObject::tr( "Distance between lines" ), QgsPropertyDefinition::DoublePositive, origin )},
82  { QgsSymbolLayer::PropertyShapeburstUseWholeShape, QgsPropertyDefinition( "shapeburstWholeShape", QObject::tr( "Shade whole shape" ), QgsPropertyDefinition::Boolean, origin )},
83  { QgsSymbolLayer::PropertyShapeburstMaxDistance, QgsPropertyDefinition( "shapeburstMaxDist", QObject::tr( "Maximum distance for shapeburst fill" ), QgsPropertyDefinition::DoublePositive, origin )},
84  { QgsSymbolLayer::PropertyShapeburstIgnoreRings, QgsPropertyDefinition( "shapeburstIgnoreRings", QObject::tr( "Ignore rings in feature" ), QgsPropertyDefinition::Boolean, origin )},
85  { QgsSymbolLayer::PropertyFile, QgsPropertyDefinition( "file", QObject::tr( "Symbol file path" ), QgsPropertyDefinition::String, origin )},
86  { QgsSymbolLayer::PropertyDistanceX, QgsPropertyDefinition( "distanceX", QObject::tr( "Horizontal distance between markers" ), QgsPropertyDefinition::DoublePositive, origin )},
87  { QgsSymbolLayer::PropertyDistanceY, QgsPropertyDefinition( "distanceY", QObject::tr( "Vertical distance between markers" ), QgsPropertyDefinition::DoublePositive, origin )},
88  { QgsSymbolLayer::PropertyDisplacementX, QgsPropertyDefinition( "displacementX", QObject::tr( "Horizontal displacement between rows" ), QgsPropertyDefinition::DoublePositive, origin )},
89  { QgsSymbolLayer::PropertyDisplacementY, QgsPropertyDefinition( "displacementY", QObject::tr( "Vertical displacement between columns" ), QgsPropertyDefinition::DoublePositive, origin )},
90  { QgsSymbolLayer::PropertyOffsetX, QgsPropertyDefinition( "offsetX", QObject::tr( "Horizontal offset" ), QgsPropertyDefinition::Double, origin )},
91  { QgsSymbolLayer::PropertyOffsetY, QgsPropertyDefinition( "offsetY", QObject::tr( "Vertical offset" ), QgsPropertyDefinition::Double, origin )},
92  { QgsSymbolLayer::PropertyOpacity, QgsPropertyDefinition( "alpha", QObject::tr( "Opacity" ), QgsPropertyDefinition::Opacity, origin )},
93  { QgsSymbolLayer::PropertyCustomDash, QgsPropertyDefinition( "customDash", QgsPropertyDefinition::DataTypeString, QObject::tr( "Custom dash pattern" ), QObject::tr( "[<b><dash>;<space></b>] e.g. '8;2;1;2'" ), origin )},
94  { QgsSymbolLayer::PropertyCapStyle, QgsPropertyDefinition( "capStyle", QObject::tr( "Line cap style" ), QgsPropertyDefinition::CapStyle, origin )},
95  { QgsSymbolLayer::PropertyPlacement, QgsPropertyDefinition( "placement", QgsPropertyDefinition::DataTypeString, QObject::tr( "Marker placement" ), QObject::tr( "string " ) + "[<b>interval</b>|<b>innervertices</b>|<b>vertex</b>|<b>lastvertex</b>|<b>firstvertex</b>|<b>centerpoint</b>|<b>curvepoint</b>|<b>segmentcenter</b>]", origin )},
96  { QgsSymbolLayer::PropertyInterval, QgsPropertyDefinition( "interval", QObject::tr( "Marker interval" ), QgsPropertyDefinition::DoublePositive, origin )},
97  { QgsSymbolLayer::PropertyOffsetAlongLine, QgsPropertyDefinition( "offsetAlongLine", QObject::tr( "Offset along line" ), QgsPropertyDefinition::Double, origin )},
98  { QgsSymbolLayer::PropertyAverageAngleLength, QgsPropertyDefinition( "averageAngleLength", QObject::tr( "Average line angles over" ), QgsPropertyDefinition::DoublePositive, origin )},
99  { QgsSymbolLayer::PropertyHorizontalAnchor, QgsPropertyDefinition( "hAnchor", QObject::tr( "Horizontal anchor point" ), QgsPropertyDefinition::HorizontalAnchor, origin )},
100  { QgsSymbolLayer::PropertyVerticalAnchor, QgsPropertyDefinition( "vAnchor", QObject::tr( "Vertical anchor point" ), QgsPropertyDefinition::VerticalAnchor, origin )},
101  { QgsSymbolLayer::PropertyLayerEnabled, QgsPropertyDefinition( "enabled", QObject::tr( "Layer enabled" ), QgsPropertyDefinition::Boolean, origin )},
102  { QgsSymbolLayer::PropertyArrowWidth, QgsPropertyDefinition( "arrowWidth", QObject::tr( "Arrow line width" ), QgsPropertyDefinition::StrokeWidth, origin )},
103  { QgsSymbolLayer::PropertyArrowStartWidth, QgsPropertyDefinition( "arrowStartWidth", QObject::tr( "Arrow line start width" ), QgsPropertyDefinition::StrokeWidth, origin )},
104  { QgsSymbolLayer::PropertyArrowHeadLength, QgsPropertyDefinition( "arrowHeadLength", QObject::tr( "Arrow head length" ), QgsPropertyDefinition::DoublePositive, origin )},
105  { QgsSymbolLayer::PropertyArrowHeadThickness, QgsPropertyDefinition( "arrowHeadThickness", QObject::tr( "Arrow head thickness" ), QgsPropertyDefinition::DoublePositive, origin )},
106  { QgsSymbolLayer::PropertyArrowHeadType, QgsPropertyDefinition( "arrowHeadType", QgsPropertyDefinition::DataTypeString, QObject::tr( "Arrow head type" ), QObject::tr( "string " ) + QLatin1String( "[<b>single</b>|<b>reversed</b>|<b>double</b>]" ), origin )},
107  { QgsSymbolLayer::PropertyArrowType, QgsPropertyDefinition( "arrowType", QgsPropertyDefinition::DataTypeString, QObject::tr( "Arrow type" ), QObject::tr( "string " ) + QLatin1String( "[<b>plain</b>|<b>lefthalf</b>|<b>righthalf</b>]" ), origin )},
108  { QgsSymbolLayer::PropertyPointCount, QgsPropertyDefinition( "pointCount", QObject::tr( "Point count" ), QgsPropertyDefinition::IntegerPositive, origin )},
109  { QgsSymbolLayer::PropertyRandomSeed, QgsPropertyDefinition( "randomSeed", QgsPropertyDefinition::DataTypeNumeric, QObject::tr( "Random number seed" ), QObject::tr( "integer > 0, or 0 for completely random sequence" ), origin )},
110  { QgsSymbolLayer::PropertyClipPoints, QgsPropertyDefinition( "clipPoints", QObject::tr( "Clip markers" ), QgsPropertyDefinition::Boolean, origin )},
111  { QgsSymbolLayer::PropertyClipPoints, QgsPropertyDefinition( "densityArea", QObject::tr( "Density area" ), QgsPropertyDefinition::DoublePositive, origin )},
112  { QgsSymbolLayer::PropertyDashPatternOffset, QgsPropertyDefinition( "dashPatternOffset", QObject::tr( "Dash pattern offset" ), QgsPropertyDefinition::DoublePositive, origin )},
113  { QgsSymbolLayer::PropertyTrimStart, QgsPropertyDefinition( "trimStart", QObject::tr( "Start trim distance" ), QgsPropertyDefinition::DoublePositive, origin )},
114  { QgsSymbolLayer::PropertyTrimEnd, QgsPropertyDefinition( "trimEnd", QObject::tr( "End trim distance" ), QgsPropertyDefinition::DoublePositive, origin )},
115  { QgsSymbolLayer::PropertyLineStartWidthValue, QgsPropertyDefinition( "lineStartWidthValue", QObject::tr( "Line start width value" ), QgsPropertyDefinition::Double, origin )},
116  { QgsSymbolLayer::PropertyLineEndWidthValue, QgsPropertyDefinition( "lineEndWidthValue", QObject::tr( "Line end width value" ), QgsPropertyDefinition::Double, origin )},
117  { QgsSymbolLayer::PropertyLineStartColorValue, QgsPropertyDefinition( "lineStartColorValue", QObject::tr( "Line start color value" ), QgsPropertyDefinition::Double, origin )},
118  { QgsSymbolLayer::PropertyLineEndColorValue, QgsPropertyDefinition( "lineEndColorValue", QObject::tr( "Line end color value" ), QgsPropertyDefinition::Double, origin )},
119  { QgsSymbolLayer::PropertyMarkerClipping, QgsPropertyDefinition( "markerClipping", QgsPropertyDefinition::DataTypeString, QObject::tr( "Marker clipping mode" ), QObject::tr( "string " ) + QLatin1String( "[<b>no</b>|<b>shape</b>|<b>centroid_within</b>|<b>completely_within</b>]" ), origin )},
120  { QgsSymbolLayer::PropertyRandomOffsetX, QgsPropertyDefinition( "randomOffsetX", QObject::tr( "Horizontal random offset" ), QgsPropertyDefinition::Double, origin )},
121  { QgsSymbolLayer::PropertyRandomOffsetY, QgsPropertyDefinition( "randomOffsetY", QObject::tr( "Vertical random offset" ), QgsPropertyDefinition::Double, origin )},
122  { QgsSymbolLayer::PropertyLineClipping, QgsPropertyDefinition( "lineClipping", QgsPropertyDefinition::DataTypeString, QObject::tr( "Line clipping mode" ), QObject::tr( "string " ) + QLatin1String( "[<b>no</b>|<b>during_render</b>|<b>before_render</b>]" ), origin )},
123  };
124 }
125 
127 {
128  dataDefinedProperties().setProperty( key, property );
129 }
130 
132 {
133  if ( QgsSymbol *lSubSymbol = subSymbol() )
134  lSubSymbol->startFeatureRender( feature, context );
135 
136  if ( !mClipPath.isEmpty() )
137  {
138  context.painter()->save();
139  context.painter()->setClipPath( mClipPath, Qt::IntersectClip );
140  }
141 }
142 
144 {
145  if ( QgsSymbol *lSubSymbol = subSymbol() )
146  lSubSymbol->stopFeatureRender( feature, context );
147 
148  if ( !mClipPath.isEmpty() )
149  {
150  context.painter()->restore();
151  }
152 }
153 
155 {
156  return nullptr;
157 }
158 
160 {
161  delete symbol;
162  return false;
163 }
164 
165 bool QgsSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift ) const
166 {
167  Q_UNUSED( e )
168  Q_UNUSED( mmMapUnitScaleFactor )
169  Q_UNUSED( layerName )
170  Q_UNUSED( context )
171  Q_UNUSED( shift )
172  return false;
173 }
174 
176 {
177  Q_UNUSED( e )
178  Q_UNUSED( context )
179  return 1.0;
180 }
181 
183 {
184  Q_UNUSED( e )
185  Q_UNUSED( context )
186  return 0.0;
187 }
188 
190 {
191  Q_UNUSED( context )
192  return color();
193 }
194 
196 {
197  Q_UNUSED( context )
198  return 0.0;
199 }
200 
202 {
203  Q_UNUSED( unit )
204  return QVector<qreal>();
205 }
206 
207 Qt::PenStyle QgsSymbolLayer::dxfPenStyle() const
208 {
209  return Qt::SolidLine;
210 }
211 
213 {
214  Q_UNUSED( context )
215  return color();
216 }
217 
218 Qt::BrushStyle QgsSymbolLayer::dxfBrushStyle() const
219 {
220  return Qt::NoBrush;
221 }
222 
224 {
225  return mPaintEffect.get();
226 }
227 
229 {
230  if ( effect == mPaintEffect.get() )
231  return;
232 
233  mPaintEffect.reset( effect );
234 }
235 
237  : mType( type )
238  , mLocked( locked )
239 {
240 }
241 
242 Qgis::SymbolLayerFlags QgsSymbolLayer::flags() const
243 {
244  return Qgis::SymbolLayerFlags();
245 }
246 
247 QColor QgsSymbolLayer::color() const
248 {
249  return mColor;
250 }
251 
252 void QgsSymbolLayer::setColor( const QColor &color )
253 {
254  mColor = color;
255 }
256 
257 void QgsSymbolLayer::setStrokeColor( const QColor & )
258 {
259 
260 }
261 
263 {
264  return QColor();
265 }
266 
267 void QgsSymbolLayer::setFillColor( const QColor & )
268 {
269 }
270 
272 {
273  return QColor();
274 }
275 
277 {
279 
280  if ( !context.fields().isEmpty() )
281  {
282  //QgsFields is implicitly shared, so it's cheap to make a copy
283  mFields = context.fields();
284  }
285 }
286 
288 {
290 }
291 
293 {
294  QgsSymbolLayer::initPropertyDefinitions();
295  return sPropertyDefinitions;
296 }
297 
299 
301 {
302  if ( symbol->type() == Qgis::SymbolType::Fill && mType == Qgis::SymbolType::Line )
303  return true;
304 
305  return symbol->type() == mType;
306 }
307 
309 {
310  return false;
311 }
312 
314 {
315  return false;
316 }
317 
318 void QgsSymbolLayer::setRenderingPass( int renderingPass )
319 {
321 }
322 
324 {
325  return mRenderingPass;
326 }
327 
328 QSet<QString> QgsSymbolLayer::usedAttributes( const QgsRenderContext &context ) const
329 {
330  // calling referencedFields() with ignoreContext=true because in our expression context
331  // we do not have valid QgsFields yet - because of that the field names from expressions
332  // wouldn't get reported
333  QSet<QString> columns = mDataDefinedProperties.referencedFields( context.expressionContext(), true );
334  return columns;
335 }
336 
337 QgsProperty propertyFromMap( const QVariantMap &map, const QString &baseName )
338 {
339  QString prefix;
340  if ( !baseName.isEmpty() )
341  {
342  prefix.append( QStringLiteral( "%1_dd_" ).arg( baseName ) );
343  }
344 
345  if ( !map.contains( QStringLiteral( "%1expression" ).arg( prefix ) ) )
346  {
347  //requires at least the expression value
348  return QgsProperty();
349  }
350 
351  bool active = ( map.value( QStringLiteral( "%1active" ).arg( prefix ), QStringLiteral( "1" ) ) != QLatin1String( "0" ) );
352  QString expression = map.value( QStringLiteral( "%1expression" ).arg( prefix ) ).toString();
353  bool useExpression = ( map.value( QStringLiteral( "%1useexpr" ).arg( prefix ), QStringLiteral( "1" ) ) != QLatin1String( "0" ) );
354  QString field = map.value( QStringLiteral( "%1field" ).arg( prefix ), QString() ).toString();
355 
356  if ( useExpression )
357  return QgsProperty::fromExpression( expression, active );
358  else
359  return QgsProperty::fromField( field, active );
360 }
361 
362 void QgsSymbolLayer::restoreOldDataDefinedProperties( const QVariantMap &stringMap )
363 {
364  // property string to type upgrade map
365  static const QMap< QString, QgsSymbolLayer::Property > OLD_PROPS
366  {
368  { "arrow_width", QgsSymbolLayer::PropertyArrowWidth },
369  { "arrow_start_width", QgsSymbolLayer::PropertyArrowStartWidth },
370  { "head_length", QgsSymbolLayer::PropertyArrowHeadLength },
371  { "head_thickness", QgsSymbolLayer::PropertyArrowHeadThickness },
372  { "offset", QgsSymbolLayer::PropertyOffset },
373  { "head_type", QgsSymbolLayer::PropertyArrowHeadType },
374  { "arrow_type", QgsSymbolLayer::PropertyArrowType },
375  { "width_field", QgsSymbolLayer::PropertyWidth },
376  { "height_field", QgsSymbolLayer::PropertyHeight },
377  { "rotation_field", QgsSymbolLayer::PropertyAngle },
378  { "outline_width_field", QgsSymbolLayer::PropertyStrokeWidth },
379  { "fill_color_field", QgsSymbolLayer::PropertyFillColor },
380  { "outline_color_field", QgsSymbolLayer::PropertyStrokeColor },
381  { "symbol_name_field", QgsSymbolLayer::PropertyName },
382  { "outline_width", QgsSymbolLayer::PropertyStrokeWidth },
383  { "outline_style", QgsSymbolLayer::PropertyStrokeStyle },
384  { "join_style", QgsSymbolLayer::PropertyJoinStyle },
385  { "fill_color", QgsSymbolLayer::PropertyFillColor },
386  { "outline_color", QgsSymbolLayer::PropertyStrokeColor },
387  { "width", QgsSymbolLayer::PropertyWidth },
388  { "height", QgsSymbolLayer::PropertyHeight },
389  { "symbol_name", QgsSymbolLayer::PropertyName },
390  { "angle", QgsSymbolLayer::PropertyAngle },
391  { "fill_style", QgsSymbolLayer::PropertyFillStyle },
392  { "color_border", QgsSymbolLayer::PropertyStrokeColor },
393  { "width_border", QgsSymbolLayer::PropertyStrokeWidth },
394  { "border_color", QgsSymbolLayer::PropertyStrokeColor },
395  { "border_style", QgsSymbolLayer::PropertyStrokeStyle },
397  { "gradient_type", QgsSymbolLayer::PropertyGradientType },
398  { "coordinate_mode", QgsSymbolLayer::PropertyCoordinateMode },
404  { "reference1_iscentroid", QgsSymbolLayer::PropertyGradientReference1IsCentroid },
405  { "reference2_iscentroid", QgsSymbolLayer::PropertyGradientReference2IsCentroid },
406  { "blur_radius", QgsSymbolLayer::PropertyBlurRadius },
410  { "svgFillColor", QgsSymbolLayer::PropertyFillColor },
411  { "svgOutlineColor", QgsSymbolLayer::PropertyStrokeColor },
412  { "svgOutlineWidth", QgsSymbolLayer::PropertyStrokeWidth },
413  { "svgFile", QgsSymbolLayer::PropertyFile },
414  { "lineangle", QgsSymbolLayer::PropertyLineAngle },
415  { "distance", QgsSymbolLayer::PropertyLineDistance },
416  { "distance_x", QgsSymbolLayer::PropertyDistanceX },
417  { "distance_y", QgsSymbolLayer::PropertyDistanceY },
418  { "displacement_x", QgsSymbolLayer::PropertyDisplacementX },
419  { "displacement_y", QgsSymbolLayer::PropertyDisplacementY },
420  { "file", QgsSymbolLayer::PropertyFile },
421  { "alpha", QgsSymbolLayer::PropertyOpacity },
422  { "customdash", QgsSymbolLayer::PropertyCustomDash },
423  { "line_style", QgsSymbolLayer::PropertyStrokeStyle },
424  { "joinstyle", QgsSymbolLayer::PropertyJoinStyle },
425  { "capstyle", QgsSymbolLayer::PropertyCapStyle },
426  { "placement", QgsSymbolLayer::PropertyPlacement },
427  { "interval", QgsSymbolLayer::PropertyInterval },
428  { "offset_along_line", QgsSymbolLayer::PropertyOffsetAlongLine },
429  { "name", QgsSymbolLayer::PropertyName },
430  { "size", QgsSymbolLayer::PropertySize },
435  { "rotation", QgsSymbolLayer::PropertyAngle },
436  { "horizontal_anchor_point", QgsSymbolLayer::PropertyHorizontalAnchor },
437  { "vertical_anchor_point", QgsSymbolLayer::PropertyVerticalAnchor },
438  };
439 
440  QVariantMap::const_iterator propIt = stringMap.constBegin();
441  for ( ; propIt != stringMap.constEnd(); ++propIt )
442  {
443  std::unique_ptr<QgsProperty> prop;
444  QString propertyName;
445 
446  if ( propIt.key().endsWith( QLatin1String( "_dd_expression" ) ) )
447  {
448  //found a data defined property
449 
450  //get data defined property name by stripping "_dd_expression" from property key
451  propertyName = propIt.key().left( propIt.key().length() - 14 );
452 
453  prop = std::make_unique<QgsProperty>( propertyFromMap( stringMap, propertyName ) );
454  }
455  else if ( propIt.key().endsWith( QLatin1String( "_expression" ) ) )
456  {
457  //old style data defined property, upgrade
458 
459  //get data defined property name by stripping "_expression" from property key
460  propertyName = propIt.key().left( propIt.key().length() - 11 );
461 
462  prop = std::make_unique<QgsProperty>( QgsProperty::fromExpression( propIt.value().toString() ) );
463  }
464 
465  if ( !prop || !OLD_PROPS.contains( propertyName ) )
466  continue;
467 
468  QgsSymbolLayer::Property key = static_cast< QgsSymbolLayer::Property >( OLD_PROPS.value( propertyName ) );
469 
470  if ( type() == Qgis::SymbolType::Line )
471  {
472  //these keys had different meaning for line symbol layers
473  if ( propertyName == QLatin1String( "width" ) )
475  else if ( propertyName == QLatin1String( "color" ) )
477  }
478 
479  setDataDefinedProperty( key, QgsProperty( *prop.get() ) );
480  }
481 }
482 
484 {
485  if ( !destLayer )
486  return;
487 
489 }
490 
492 {
493  if ( !destLayer || !mPaintEffect )
494  return;
495 
497  destLayer->setPaintEffect( mPaintEffect->clone() );
498  else
499  destLayer->setPaintEffect( nullptr );
500 }
501 
503  : QgsSymbolLayer( Qgis::SymbolType::Marker, locked )
504 {
505 
506 }
507 
509  : QgsSymbolLayer( Qgis::SymbolType::Line, locked )
510 {
511 }
512 
514 {
515  return mRingFilter;
516 }
517 
519 {
521 }
522 
524  : QgsSymbolLayer( Qgis::SymbolType::Fill, locked )
525 {
526 }
527 
529 {
530  Q_UNUSED( context )
531 }
532 
534 {
535  Q_UNUSED( context )
536 }
537 
539 {
540  startRender( context );
541  QgsPaintEffect *effect = paintEffect();
542 
543  QPolygonF points = context.patchShape() ? context.patchShape()->toQPolygonF( Qgis::SymbolType::Marker, size ).value( 0 ).value( 0 )
545 
546  std::unique_ptr< QgsEffectPainter > effectPainter;
547  if ( effect && effect->enabled() )
548  effectPainter = std::make_unique< QgsEffectPainter >( context.renderContext(), effect );
549 
550  for ( QPointF point : std::as_const( points ) )
551  renderPoint( point, context );
552 
553  effectPainter.reset();
554 
555  stopRender( context );
556 }
557 
558 void QgsMarkerSymbolLayer::markerOffset( QgsSymbolRenderContext &context, double &offsetX, double &offsetY ) const
559 {
561 }
562 
563 void QgsMarkerSymbolLayer::markerOffset( QgsSymbolRenderContext &context, double width, double height, double &offsetX, double &offsetY ) const
564 {
565  markerOffset( context, width, height, mSizeUnit, mSizeUnit, offsetX, offsetY, mSizeMapUnitScale, mSizeMapUnitScale );
566 }
567 
568 void QgsMarkerSymbolLayer::markerOffset( QgsSymbolRenderContext &context, double width, double height,
570  double &offsetX, double &offsetY, const QgsMapUnitScale &widthMapUnitScale, const QgsMapUnitScale &heightMapUnitScale ) const
571 {
572  offsetX = mOffset.x();
573  offsetY = mOffset.y();
574 
576  {
579  bool ok = false;
580  const QPointF offset = QgsSymbolLayerUtils::toPoint( exprVal, &ok );
581  if ( ok )
582  {
583  offsetX = offset.x();
584  offsetY = offset.y();
585  }
586  }
587 
588  offsetX = context.renderContext().convertToPainterUnits( offsetX, mOffsetUnit, mOffsetMapUnitScale );
589  offsetY = context.renderContext().convertToPainterUnits( offsetY, mOffsetUnit, mOffsetMapUnitScale );
590 
594  {
596  if ( !exprVal.isNull() )
597  {
598  horizontalAnchorPoint = decodeHorizontalAnchorPoint( exprVal.toString() );
599  }
600  }
602  {
604  if ( !exprVal.isNull() )
605  {
606  verticalAnchorPoint = decodeVerticalAnchorPoint( exprVal.toString() );
607  }
608  }
609 
610  //correct horizontal position according to anchor point
612  {
613  return;
614  }
615 
616  double anchorPointCorrectionX = context.renderContext().convertToPainterUnits( width, widthUnit, widthMapUnitScale ) / 2.0;
618  {
619  // rendering for symbol previews -- an size in meters in map units can't be calculated, so treat the size as millimeters
620  // and clamp it to a reasonable range. It's the best we can do in this situation!
621  anchorPointCorrectionX = std::min( std::max( context.renderContext().convertToPainterUnits( width, QgsUnitTypes::RenderMillimeters ), 3.0 ), 100.0 ) / 2.0;
622  }
623 
624  double anchorPointCorrectionY = context.renderContext().convertToPainterUnits( height, heightUnit, heightMapUnitScale ) / 2.0;
626  {
627  // rendering for symbol previews -- an size in meters in map units can't be calculated, so treat the size as millimeters
628  // and clamp it to a reasonable range. It's the best we can do in this situation!
629  anchorPointCorrectionY = std::min( std::max( context.renderContext().convertToPainterUnits( height, QgsUnitTypes::RenderMillimeters ), 3.0 ), 100.0 ) / 2.0;
630  }
631 
632  if ( horizontalAnchorPoint == Left )
633  {
634  offsetX += anchorPointCorrectionX;
635  }
636  else if ( horizontalAnchorPoint == Right )
637  {
638  offsetX -= anchorPointCorrectionX;
639  }
640 
641  //correct vertical position according to anchor point
642  if ( verticalAnchorPoint == Top )
643  {
644  offsetY += anchorPointCorrectionY;
645  }
646  else if ( verticalAnchorPoint == Bottom )
647  {
648  offsetY -= anchorPointCorrectionY;
649  }
650 }
651 
652 QPointF QgsMarkerSymbolLayer::_rotatedOffset( QPointF offset, double angle )
653 {
654  angle = DEG2RAD( angle );
655  double c = std::cos( angle ), s = std::sin( angle );
656  return QPointF( offset.x() * c - offset.y() * s, offset.x() * s + offset.y() * c );
657 }
658 
659 QgsMarkerSymbolLayer::HorizontalAnchorPoint QgsMarkerSymbolLayer::decodeHorizontalAnchorPoint( const QString &str )
660 {
661  if ( str.compare( QLatin1String( "left" ), Qt::CaseInsensitive ) == 0 )
662  {
664  }
665  else if ( str.compare( QLatin1String( "right" ), Qt::CaseInsensitive ) == 0 )
666  {
668  }
669  else
670  {
672  }
673 }
674 
675 QgsMarkerSymbolLayer::VerticalAnchorPoint QgsMarkerSymbolLayer::decodeVerticalAnchorPoint( const QString &str )
676 {
677  if ( str.compare( QLatin1String( "top" ), Qt::CaseInsensitive ) == 0 )
678  {
680  }
681  else if ( str.compare( QLatin1String( "bottom" ), Qt::CaseInsensitive ) == 0 )
682  {
684  }
685  else
686  {
688  }
689 }
690 
692 {
693  mSizeUnit = unit;
694  mOffsetUnit = unit;
695 }
696 
698 {
699  if ( mOffsetUnit != mSizeUnit )
700  {
702  }
703  return mOffsetUnit;
704 }
705 
707 {
708  mSizeMapUnitScale = scale;
709  mOffsetMapUnitScale = scale;
710 }
711 
713 {
715  {
716  return mSizeMapUnitScale;
717  }
718  return QgsMapUnitScale();
719 }
720 
722 {
723  mWidthUnit = unit;
724  mOffsetUnit = unit;
725 }
726 
728 {
729  return mWidthUnit;
730 }
731 
733 {
734  mWidthMapUnitScale = scale;
735 }
736 
738 {
739  return mWidthMapUnitScale;
740 }
741 
742 
744 {
745  const QList< QList< QPolygonF > > points = context.patchShape() ? context.patchShape()->toQPolygonF( Qgis::SymbolType::Line, size )
747  startRender( context );
748  QgsPaintEffect *effect = paintEffect();
749 
750  std::unique_ptr< QgsEffectPainter > effectPainter;
751  if ( effect && effect->enabled() )
752  effectPainter = std::make_unique< QgsEffectPainter >( context.renderContext(), effect );
753 
754  for ( const QList< QPolygonF > &line : points )
755  renderPolyline( line.value( 0 ), context );
756 
757  effectPainter.reset();
758 
759  stopRender( context );
760 }
761 
762 void QgsLineSymbolLayer::renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context )
763 {
764  QgsExpressionContextScope *scope = nullptr;
765  std::unique_ptr< QgsExpressionContextScopePopper > scopePopper;
766  if ( hasDataDefinedProperties() )
767  {
768  scope = new QgsExpressionContextScope();
769  scopePopper = std::make_unique< QgsExpressionContextScopePopper >( context.renderContext().expressionContext(), scope );
770  }
771 
772  switch ( mRingFilter )
773  {
774  case AllRings:
775  case ExteriorRingOnly:
776  {
777  if ( scope )
779  renderPolyline( points, context );
780  break;
781  }
782  case InteriorRingsOnly:
783  break;
784  }
785 
786  if ( rings )
787  {
788  switch ( mRingFilter )
789  {
790  case AllRings:
791  case InteriorRingsOnly:
792  {
793  int ringIndex = 1;
794  for ( const QPolygonF &ring : std::as_const( *rings ) )
795  {
796  if ( scope )
798 
799  renderPolyline( ring, context );
800  ringIndex++;
801  }
802  }
803  break;
804  case ExteriorRingOnly:
805  break;
806  }
807  }
808 }
809 
810 double QgsLineSymbolLayer::width( const QgsRenderContext &context ) const
811 {
813 }
814 
816 {
817  Q_UNUSED( context )
819 }
820 
821 
823 {
824  const QList< QList< QPolygonF > > polys = context.patchShape() ? context.patchShape()->toQPolygonF( Qgis::SymbolType::Fill, size )
826 
827  startRender( context );
828  QgsPaintEffect *effect = paintEffect();
829 
830  std::unique_ptr< QgsEffectPainter > effectPainter;
831  if ( effect && effect->enabled() )
832  effectPainter = std::make_unique< QgsEffectPainter >( context.renderContext(), effect );
833 
834  for ( const QList< QPolygonF > &poly : polys )
835  {
836  QVector< QPolygonF > rings;
837  for ( int i = 1; i < poly.size(); ++i )
838  rings << poly.at( i );
839  renderPolygon( poly.value( 0 ), &rings, context );
840  }
841 
842  effectPainter.reset();
843 
844  stopRender( context );
845 }
846 
847 void QgsFillSymbolLayer::_renderPolygon( QPainter *p, const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context )
848 {
849  if ( !p )
850  {
851  return;
852  }
853 
854  // Disable 'Antialiasing' if the geometry was generalized in the current RenderContext (We known that it must have least #5 points).
855  if ( points.size() <= 5 &&
858  ( p->renderHints() & QPainter::Antialiasing ) )
859  {
860  p->setRenderHint( QPainter::Antialiasing, false );
861  p->drawRect( points.boundingRect() );
862  p->setRenderHint( QPainter::Antialiasing, true );
863  return;
864  }
865 
866  // polygons outlines are sometimes rendered wrongly with drawPolygon, when
867  // clipped (see #13343), so use drawPath instead.
868  if ( !rings && p->pen().style() == Qt::NoPen )
869  {
870  // simple polygon without holes
871  p->drawPolygon( points );
872  }
873  else
874  {
875  // polygon with holes must be drawn using painter path
876  QPainterPath path;
877  path.addPolygon( points );
878 
879  if ( rings )
880  {
881  for ( auto it = rings->constBegin(); it != rings->constEnd(); ++it )
882  {
883  QPolygonF ring = *it;
884  path.addPolygon( ring );
885  }
886  }
887 
888  p->drawPath( path );
889  }
890 }
891 
892 void QgsMarkerSymbolLayer::toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const
893 {
894  QDomElement symbolizerElem = doc.createElement( QStringLiteral( "se:PointSymbolizer" ) );
895  if ( !props.value( QStringLiteral( "uom" ), QString() ).toString().isEmpty() )
896  symbolizerElem.setAttribute( QStringLiteral( "uom" ), props.value( QStringLiteral( "uom" ), QString() ).toString() );
897  element.appendChild( symbolizerElem );
898 
899  // <Geometry>
900  QgsSymbolLayerUtils::createGeometryElement( doc, symbolizerElem, props.value( QStringLiteral( "geom" ), QString() ).toString() );
901 
902  writeSldMarker( doc, symbolizerElem, props );
903 }
904 
905 QList<QgsSymbolLayerReference> QgsSymbolLayer::masks() const
906 {
907  return {};
908 }
909 
911 {
912 #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
913  mClipPath = QPainterPath();
914 #else
915  mClipPath.clear();
916 #endif
917 
918  const QgsRenderContext &renderContext = context.renderContext();
919  const QList<QPainterPath> clipPaths = renderContext.symbolLayerClipPaths( this );
920  if ( !clipPaths.isEmpty() )
921  {
922  QPainterPath mergedPaths;
923  mergedPaths.setFillRule( Qt::WindingFill );
924  for ( QPainterPath path : clipPaths )
925  {
926  mergedPaths.addPath( path );
927  }
928 
929  if ( !mergedPaths.isEmpty() )
930  {
931  mClipPath.addRect( 0, 0, renderContext.outputSize().width(),
932  renderContext.outputSize().height() );
933  mClipPath = mClipPath.subtracted( mergedPaths );
934  }
935  }
936 }
QgsSymbolLayer::PropertyDashPatternOffset
@ PropertyDashPatternOffset
Dash pattern offset,.
Definition: qgssymbollayer.h:203
QgsSymbolLayer::PropertyArrowHeadType
@ PropertyArrowHeadType
Arrow head type.
Definition: qgssymbollayer.h:193
QgsSymbolRenderContext::setOriginalValueVariable
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for data defined symbology.
Definition: qgssymbolrendercontext.cpp:36
QgsMarkerSymbolLayer::Right
@ Right
Align to right side of symbol.
Definition: qgssymbollayer.h:714
QgsSymbolLayer::PropertyHorizontalAnchor
@ PropertyHorizontalAnchor
Horizontal anchor point.
Definition: qgssymbollayer.h:186
qgsexpressioncontextutils.h
QgsPropertyCollection::prepare
bool prepare(const QgsExpressionContext &context=QgsExpressionContext()) const override
Prepares the collection against a specified expression context.
Definition: qgspropertycollection.cpp:240
Qgis::RenderContextFlag::RenderSymbolPreview
@ RenderSymbolPreview
The render is for a symbol preview only and map based properties may not be available,...
QgsProperty::fromField
static QgsProperty fromField(const QString &fieldName, bool isActive=true)
Returns a new FieldBasedProperty created from the specified field name.
Definition: qgsproperty.cpp:245
QgsSymbolLayer::mClipPath
QPainterPath mClipPath
Definition: qgssymbollayer.h:657
QgsSymbolLayer::strokeColor
virtual QColor strokeColor() const
Returns the stroke color for the symbol layer.
Definition: qgssymbollayer.cpp:262
QgsSymbolLayer::PropertyBlurRadius
@ PropertyBlurRadius
Shapeburst blur radius.
Definition: qgssymbollayer.h:170
QgsPropertyDefinition::Offset
@ Offset
2D offset
Definition: qgsproperty.h:78
QgsMarkerSymbolLayer::VerticalAnchorPoint
VerticalAnchorPoint
Symbol vertical anchor points.
Definition: qgssymbollayer.h:718
QgsSymbolLayer::PropertyArrowHeadThickness
@ PropertyArrowHeadThickness
Arrow head thickness.
Definition: qgssymbollayer.h:192
QgsLineSymbolLayer::RenderRingFilter
RenderRingFilter
Options for filtering rings when the line symbol layer is being used to render a polygon's rings.
Definition: qgssymbollayer.h:1029
QgsSymbolLayer::PropertyLineDistance
@ PropertyLineDistance
Distance between lines, or length of lines for hash line symbols.
Definition: qgssymbollayer.h:160
QgsSymbolLayer::mColor
QColor mColor
Definition: qgssymbollayer.h:648
QgsSymbolLayer::masks
virtual QList< QgsSymbolLayerReference > masks() const
Returns masks defined by this symbol layer.
Definition: qgssymbollayer.cpp:905
QgsSymbolLayer::PropertyShapeburstUseWholeShape
@ PropertyShapeburstUseWholeShape
Shapeburst use whole shape.
Definition: qgssymbollayer.h:171
QgsSymbolLayer::startFeatureRender
virtual void startFeatureRender(const QgsFeature &feature, QgsRenderContext &context)
Called before the layer will be rendered for a particular feature.
Definition: qgssymbollayer.cpp:131
QgsRenderContext::mapToPixel
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
Definition: qgsrendercontext.h:258
QgsSymbolLayer::dxfAngle
virtual double dxfAngle(QgsSymbolRenderContext &context) const
Gets angle.
Definition: qgssymbollayer.cpp:195
QgsMarkerSymbolLayer::size
double size() const
Returns the symbol size.
Definition: qgssymbollayer.h:785
QgsSymbolLayer::setColor
virtual void setColor(const QColor &color)
Sets the "representative" color for the symbol layer.
Definition: qgssymbollayer.cpp:252
QgsSymbolLayer::dataDefinedProperties
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
Definition: qgssymbollayer.h:595
QgsProperty
A store for object properties.
Definition: qgsproperty.h:230
QgsSymbolLayer::PropertyClipPoints
@ PropertyClipPoints
Whether markers should be clipped to polygon boundaries.
Definition: qgssymbollayer.h:199
QgsSymbolLayer::PropertyGradientReference2IsCentroid
@ PropertyGradientReference2IsCentroid
Gradient reference point 2 is centroid.
Definition: qgssymbollayer.h:169
QgsUnitTypes::RenderUnit
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:167
QgsMarkerSymbolLayer::mSizeMapUnitScale
QgsMapUnitScale mSizeMapUnitScale
Marker size map unit scale.
Definition: qgssymbollayer.h:997
QgsDxfExport
Exports QGIS layers to the DXF format.
Definition: qgsdxfexport.h:64
Qgis::SymbolType::Fill
@ Fill
Fill symbol.
QgsLineSymbolLayer::renderPolyline
virtual void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context)=0
Renders the line symbol layer along the line joining points, using the given render context.
Qgis::SymbolType::Line
@ Line
Line symbol.
QgsPropertyDefinition::HorizontalAnchor
@ HorizontalAnchor
Horizontal anchor point.
Definition: qgsproperty.h:75
QgsRenderContext::expressionContext
QgsExpressionContext & expressionContext()
Gets the expression context.
Definition: qgsrendercontext.h:625
QgsVectorSimplifyMethod::AntialiasingSimplification
@ AntialiasingSimplification
The geometries can be rendered with 'AntiAliasing' disabled because of it is '1-pixel size'.
Definition: qgsvectorsimplifymethod.h:54
QgsFillSymbolLayer::drawPreviewIcon
void drawPreviewIcon(QgsSymbolRenderContext &context, QSize size) override
Definition: qgssymbollayer.cpp:822
QgsMapToPixel::mapUnitsPerPixel
double mapUnitsPerPixel() const
Returns the current map units per pixel.
Definition: qgsmaptopixel.h:229
QgsSymbolLayer::PropertyAverageAngleLength
@ PropertyAverageAngleLength
Length to average symbol angles over.
Definition: qgssymbollayer.h:185
QgsLineSymbolLayer::setRingFilter
void setRingFilter(QgsLineSymbolLayer::RenderRingFilter filter)
Sets the line symbol layer's ring filter, which controls which rings are rendered when the line symbo...
Definition: qgssymbollayer.cpp:518
QgsSymbolLayer::dxfPenStyle
virtual Qt::PenStyle dxfPenStyle() const
Gets pen style.
Definition: qgssymbollayer.cpp:207
QgsSymbolLayer::isCompatibleWithSymbol
virtual bool isCompatibleWithSymbol(QgsSymbol *symbol) const
Returns if the layer can be used below the specified symbol.
Definition: qgssymbollayer.cpp:300
QgsLineSymbolLayer::width
virtual double width() const
Returns the estimated width for the line symbol layer.
Definition: qgssymbollayer.h:1089
QgsMarkerSymbolLayer::mapUnitScale
QgsMapUnitScale mapUnitScale() const override
Definition: qgssymbollayer.cpp:712
QgsSymbolLayer::PropertyArrowStartWidth
@ PropertyArrowStartWidth
Arrow tail start width.
Definition: qgssymbollayer.h:190
QgsMarkerSymbolLayer::QgsMarkerSymbolLayer
QgsMarkerSymbolLayer(const QgsMarkerSymbolLayer &other)=delete
QgsMarkerSymbolLayer cannot be copied.
QgsExpressionContextScope::addVariable
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
Definition: qgsexpressioncontext.cpp:97
QgsSymbolLayer::flags
virtual Qgis::SymbolLayerFlags flags() const
Returns flags which control the symbol layer's behavior.
Definition: qgssymbollayer.cpp:242
QgsFields::isEmpty
bool isEmpty() const
Checks whether the container is empty.
Definition: qgsfields.cpp:128
QgsSymbolLayer::dxfCustomDashPattern
virtual QVector< qreal > dxfCustomDashPattern(QgsUnitTypes::RenderUnit &unit) const
Gets dash pattern.
Definition: qgssymbollayer.cpp:201
QgsSymbolLayer::setFillColor
virtual void setFillColor(const QColor &color)
Sets the fill color for the symbol layer.
Definition: qgssymbollayer.cpp:267
qgsexpression.h
QgsSymbolLayer::prepareExpressions
virtual void prepareExpressions(const QgsSymbolRenderContext &context)
Prepares all data defined property expressions for evaluation.
Definition: qgssymbollayer.cpp:276
QgsPropertyDefinition::DataTypeString
@ DataTypeString
Property requires a string value.
Definition: qgsproperty.h:92
QgsSymbolLayer::subSymbol
virtual QgsSymbol * subSymbol()
Returns the symbol's sub symbol, if present.
Definition: qgssymbollayer.cpp:154
QgsSymbolLayer::PropertyFontFamily
@ PropertyFontFamily
Font family.
Definition: qgssymbollayer.h:201
QgsSymbolLayer::PropertyFillStyle
@ PropertyFillStyle
Fill style (eg solid, dots)
Definition: qgssymbollayer.h:156
QgsSymbolLayer::PropertyGradientReference2Y
@ PropertyGradientReference2Y
Gradient reference point 2 y.
Definition: qgssymbollayer.h:167
QgsSymbolLayer::PropertyFillColor
@ PropertyFillColor
Fill color.
Definition: qgssymbollayer.h:147
QgsSymbolLayer::mRenderingPass
int mRenderingPass
Definition: qgssymbollayer.h:649
QgsLineSymbolLayer::mWidthMapUnitScale
QgsMapUnitScale mWidthMapUnitScale
Definition: qgssymbollayer.h:1205
qgssymbollayerutils.h
QgsLineSymbolLayer::mRingFilter
RenderRingFilter mRingFilter
Definition: qgssymbollayer.h:1210
QgsSymbolLayer::mPaintEffect
std::unique_ptr< QgsPaintEffect > mPaintEffect
Definition: qgssymbollayer.h:653
QgsSymbolLayer::PropertyLineEndColorValue
@ PropertyLineEndColorValue
End line color for interpolated line renderer (since QGIS 3.22)
Definition: qgssymbollayer.h:209
QgsSymbolLayer::setRenderingPass
void setRenderingPass(int renderingPass)
Specifies the rendering pass in which this symbol layer should be rendered.
Definition: qgssymbollayer.cpp:318
QgsSymbolLayer::hasDataDefinedProperties
virtual bool hasDataDefinedProperties() const
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
Definition: qgssymbollayer.cpp:287
qgsmultipoint.h
QgsSymbolLayer::PropertyGradientReference1IsCentroid
@ PropertyGradientReference1IsCentroid
Gradient reference point 1 is centroid.
Definition: qgssymbollayer.h:168
QgsFeatureRenderer::type
QString type() const
Definition: qgsrenderer.h:142
QgsRenderContext::flags
Qgis::RenderContextFlags flags() const
Returns combination of flags used for rendering.
Definition: qgsrendercontext.cpp:224
QgsSymbolLayer::QgsSymbolLayer
QgsSymbolLayer(const QgsSymbolLayer &other)=delete
QgsSymbolLayer cannot be copied.
QgsMarkerSymbolLayer::startRender
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
Definition: qgssymbollayer.cpp:528
QgsSymbolLayer::PropertyDisplacementX
@ PropertyDisplacementX
Horizontal displacement.
Definition: qgssymbollayer.h:177
QgsFillSymbolLayer::_renderPolygon
void _renderPolygon(QPainter *p, const QPolygonF &points, const QVector< QPolygonF > *rings, QgsSymbolRenderContext &context)
Default method to render polygon.
Definition: qgssymbollayer.cpp:847
QgsPropertyDefinition::FillStyle
@ FillStyle
Fill style (eg solid, lines)
Definition: qgsproperty.h:73
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:59
QgsPropertyDefinition::DataTypeNumeric
@ DataTypeNumeric
Property requires a numeric value.
Definition: qgsproperty.h:99
QgsPropertyDefinition::Double
@ Double
Double value (including negative values)
Definition: qgsproperty.h:57
QgsUnitTypes::RenderMillimeters
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:169
QgsPropertyDefinition::PenJoinStyle
@ PenJoinStyle
Pen join style.
Definition: qgsproperty.h:66
qgspainteffectregistry.h
QgsSymbolLayer::PropertyInterval
@ PropertyInterval
Line marker interval.
Definition: qgssymbollayer.h:183
propertyFromMap
QgsProperty propertyFromMap(const QVariantMap &map, const QString &baseName)
Definition: qgssymbollayer.cpp:337
QgsSymbolLayer::~QgsSymbolLayer
virtual ~QgsSymbolLayer()
QgsLineSymbolLayer::outputUnit
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
Definition: qgssymbollayer.cpp:727
QgsSymbolLayer::PropertyCapStyle
@ PropertyCapStyle
Line cap style.
Definition: qgssymbollayer.h:181
QgsSymbol
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:92
QgsMarkerSymbolLayer::setMapUnitScale
void setMapUnitScale(const QgsMapUnitScale &scale) override
Definition: qgssymbollayer.cpp:706
QgsProperty::fromExpression
static QgsProperty fromExpression(const QString &expression, bool isActive=true)
Returns a new ExpressionBasedProperty created from the specified expression.
Definition: qgsproperty.cpp:237
field
const QgsField & field
Definition: qgsfield.h:463
QgsMarkerSymbolLayer::mSizeUnit
QgsUnitTypes::RenderUnit mSizeUnit
Marker size unit.
Definition: qgssymbollayer.h:995
qgspainteffect.h
QgsSymbolLayer::PropertyStrokeColor
@ PropertyStrokeColor
Stroke color.
Definition: qgssymbollayer.h:148
QgsMarkerSymbolLayer::drawPreviewIcon
void drawPreviewIcon(QgsSymbolRenderContext &context, QSize size) override
Definition: qgssymbollayer.cpp:538
QgsMarkerSymbolLayer::mVerticalAnchorPoint
VerticalAnchorPoint mVerticalAnchorPoint
Vertical anchor point.
Definition: qgssymbollayer.h:1009
QgsDxfExport::mapUnitScaleFactor
static double mapUnitScaleFactor(double scale, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits, double mapUnitsPerPixel=1.0)
Returns scale factor for conversion to map units.
Definition: qgsdxfexport.cpp:1823
QgsLineSymbolLayer::mapUnitScale
QgsMapUnitScale mapUnitScale() const override
Definition: qgssymbollayer.cpp:737
QgsFillSymbolLayer::renderPolygon
virtual void renderPolygon(const QPolygonF &points, const QVector< QPolygonF > *rings, QgsSymbolRenderContext &context)=0
Renders the fill symbol layer for the polygon whose outer ring is defined by points,...
QgsSymbolRenderContext::patchShape
const QgsLegendPatchShape * patchShape() const
Returns the symbol patch shape, to use if rendering symbol preview icons.
Definition: qgssymbolrendercontext.cpp:72
QgsStyle::defaultPatchAsQPolygonF
QList< QList< QPolygonF > > defaultPatchAsQPolygonF(Qgis::SymbolType type, QSizeF size) const
Returns the default patch geometry for the given symbol type and size as a set of QPolygonF objects (...
Definition: qgsstyle.cpp:1199
QgsSymbolLayerUtils::createGeometryElement
static void createGeometryElement(QDomDocument &doc, QDomElement &element, const QString &geomFunc)
Definition: qgssymbollayerutils.cpp:2923
qgssymbollayerreference.h
qgsgeometrysimplifier.h
QgsSymbolLayer::usesMapUnits
virtual bool usesMapUnits() const
Returns true if the symbol layer has any components which use map unit based sizes.
Definition: qgssymbollayer.cpp:313
QgsPropertyDefinition::String
@ String
Any string value.
Definition: qgsproperty.h:61
QgsSymbolLayer::PropertyFontStyle
@ PropertyFontStyle
Font style.
Definition: qgssymbollayer.h:202
QgsMarkerSymbolLayer::mOffsetUnit
QgsUnitTypes::RenderUnit mOffsetUnit
Offset units.
Definition: qgssymbollayer.h:1001
QgsStyle::defaultStyle
static QgsStyle * defaultStyle()
Returns default application-wide style.
Definition: qgsstyle.cpp:145
QgsSymbolLayer::PropertyArrowHeadLength
@ PropertyArrowHeadLength
Arrow head length.
Definition: qgssymbollayer.h:191
QgsMarkerSymbolLayer::mSize
double mSize
Marker size.
Definition: qgssymbollayer.h:993
QgsFeatureRenderer::filter
virtual QString filter(const QgsFields &fields=QgsFields())
If a renderer does not require all the features this method may be overridden and return an expressio...
Definition: qgsrenderer.h:206
qgsapplication.h
QgsSymbolLayer::PropertyGradientSpread
@ PropertyGradientSpread
Gradient spread mode.
Definition: qgssymbollayer.h:163
QgsLineSymbolLayer::drawPreviewIcon
void drawPreviewIcon(QgsSymbolRenderContext &context, QSize size) override
Definition: qgssymbollayer.cpp:743
QgsSymbolRenderContext
Definition: qgssymbolrendercontext.h:35
QgsMarkerSymbolLayer::HorizontalAnchorPoint
HorizontalAnchorPoint
Symbol horizontal anchor points.
Definition: qgssymbollayer.h:710
QgsPropertyDefinition::Rotation
@ Rotation
Rotation (value between 0-360 degrees)
Definition: qgsproperty.h:60
QgsLineSymbolLayer::mOffsetUnit
QgsUnitTypes::RenderUnit mOffsetUnit
Definition: qgssymbollayer.h:1207
QgsMarkerSymbolLayer::setOutputUnit
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
Definition: qgssymbollayer.cpp:691
QgsSymbolLayerUtils::toPoint
static QPointF toPoint(const QVariant &value, bool *ok=nullptr)
Converts a value to a point.
Definition: qgssymbollayerutils.cpp:551
QgsSymbolLayer::propertyDefinitions
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
Definition: qgssymbollayer.cpp:292
QgsSymbolLayer::writeDxf
virtual bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const
write as DXF
Definition: qgssymbollayer.cpp:165
QgsMarkerSymbolLayer::markerOffset
void markerOffset(QgsSymbolRenderContext &context, double &offsetX, double &offsetY) const
Calculates the required marker offset, including both the symbol offset and any displacement required...
Definition: qgssymbollayer.cpp:558
QgsPropertiesDefinition
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
Definition: qgspropertycollection.h:29
QgsMarkerSymbolLayer::writeSldMarker
virtual void writeSldMarker(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const
Writes the symbol layer definition as a SLD XML element.
Definition: qgssymbollayer.h:929
QgsSymbolLayer::PropertyLineStartWidthValue
@ PropertyLineStartWidthValue
Start line width for interpolated line renderer (since QGIS 3.22)
Definition: qgssymbollayer.h:206
QgsSymbolLayer::PropertyOffset
@ PropertyOffset
Symbol offset.
Definition: qgssymbollayer.h:151
QgsPaintEffectRegistry::isDefaultStack
static bool isDefaultStack(QgsPaintEffect *effect)
Tests whether a paint effect matches the default effects stack.
Definition: qgspainteffectregistry.cpp:134
QgsSymbolLayer::PropertyCharacter
@ PropertyCharacter
Character, eg for font marker symbol layers.
Definition: qgssymbollayer.h:152
qgsexpressioncontext.h
QgsSymbolLayer::mType
Qgis::SymbolType mType
Definition: qgssymbollayer.h:642
QgsSymbolLayer
Definition: qgssymbollayer.h:54
QgsSymbolLayer::PropertyMarkerClipping
@ PropertyMarkerClipping
Marker clipping mode (since QGIS 3.24)
Definition: qgssymbollayer.h:210
QgsSymbolLayer::PropertyGradientType
@ PropertyGradientType
Gradient fill type.
Definition: qgssymbollayer.h:161
QgsDxfExport::mapUnits
QgsUnitTypes::DistanceUnit mapUnits() const
Retrieve map units.
Definition: qgsdxfexport.cpp:262
QgsSymbolLayer::dxfOffset
virtual double dxfOffset(const QgsDxfExport &e, QgsSymbolRenderContext &context) const
Gets offset.
Definition: qgssymbollayer.cpp:182
QgsSymbolLayer::PropertyArrowWidth
@ PropertyArrowWidth
Arrow tail width.
Definition: qgssymbollayer.h:189
QgsFillSymbolLayer::QgsFillSymbolLayer
QgsFillSymbolLayer(const QgsFillSymbolLayer &other)=delete
QgsFillSymbolLayer cannot be copied.
QgsMarkerSymbolLayer::Top
@ Top
Align to top of symbol.
Definition: qgssymbollayer.h:720
QgsSymbolLayer::renderingPass
int renderingPass() const
Specifies the rendering pass in which this symbol layer should be rendered.
Definition: qgssymbollayer.cpp:323
Qgis::SymbolType
SymbolType
Symbol types.
Definition: qgis.h:205
QgsSymbolLayer::PropertyRandomSeed
@ PropertyRandomSeed
Random number seed.
Definition: qgssymbollayer.h:198
QgsMarkerSymbolLayer::toSld
void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const override
Saves the symbol layer as SLD.
Definition: qgssymbollayer.cpp:892
QgsSymbolLayer::setSubSymbol
virtual bool setSubSymbol(QgsSymbol *symbol)
Sets layer's subsymbol. takes ownership of the passed symbol.
Definition: qgssymbollayer.cpp:159
QgsSymbolRenderContext::fields
QgsFields fields() const
Fields of the layer.
Definition: qgssymbolrendercontext.h:168
QgsSymbol::type
Qgis::SymbolType type() const
Returns the symbol's type.
Definition: qgssymbol.h:152
QgsPropertyCollection::hasActiveProperties
bool hasActiveProperties() const override
Returns true if the collection has any active properties, or false if all properties within the colle...
Definition: qgspropertycollection.cpp:304
QgsPropertyDefinition::VerticalAnchor
@ VerticalAnchor
Vertical anchor point.
Definition: qgsproperty.h:76
QgsSymbolLayer::stopFeatureRender
virtual void stopFeatureRender(const QgsFeature &feature, QgsRenderContext &context)
Called after the layer has been rendered for a particular feature.
Definition: qgssymbollayer.cpp:143
QgsMarkerSymbolLayer::HCenter
@ HCenter
Align to horizontal center of symbol.
Definition: qgssymbollayer.h:713
QgsPropertyDefinition::ColorWithAlpha
@ ColorWithAlpha
Color with alpha channel.
Definition: qgsproperty.h:64
QgsSymbolLayer::PropertyVerticalAnchor
@ PropertyVerticalAnchor
Vertical anchor point.
Definition: qgssymbollayer.h:187
QgsSymbolLayer::PropertyGradientReference1Y
@ PropertyGradientReference1Y
Gradient reference point 1 y.
Definition: qgssymbollayer.h:165
QgsSymbolLayer::PropertySize
@ PropertySize
Symbol size.
Definition: qgssymbollayer.h:144
QgsLineSymbolLayer::mWidthUnit
QgsUnitTypes::RenderUnit mWidthUnit
Definition: qgssymbollayer.h:1204
QgsLineSymbolLayer::dxfWidth
double dxfWidth(const QgsDxfExport &e, QgsSymbolRenderContext &context) const override
Gets line width.
Definition: qgssymbollayer.cpp:815
QgsSymbolLayer::copyPaintEffect
void copyPaintEffect(QgsSymbolLayer *destLayer) const
Copies paint effect of this layer to another symbol layer.
Definition: qgssymbollayer.cpp:491
QgsLineSymbolLayer::renderPolygonStroke
virtual void renderPolygonStroke(const QPolygonF &points, const QVector< QPolygonF > *rings, QgsSymbolRenderContext &context)
Renders the line symbol layer along the outline of polygon, using the given render context.
Definition: qgssymbollayer.cpp:762
QgsSymbolLayer::PropertyStrokeStyle
@ PropertyStrokeStyle
Stroke style (eg solid, dashed)
Definition: qgssymbollayer.h:150
QgsRenderContext::outputSize
QSize outputSize() const
Returns the size of the resulting rendered image, in pixels.
Definition: qgsrendercontext.cpp:660
QgsMarkerSymbolLayer::outputUnit
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
Definition: qgssymbollayer.cpp:697
QgsSymbolLayer::PropertyRandomOffsetX
@ PropertyRandomOffsetX
Random offset X (since QGIS 3.24)
Definition: qgssymbollayer.h:211
qgsrendercontext.h
QgsMarkerSymbolLayer::verticalAnchorPoint
VerticalAnchorPoint verticalAnchorPoint() const
Returns the vertical anchor point for positioning the symbol.
Definition: qgssymbollayer.h:919
QgsSymbolLayer::PropertyLineClipping
@ PropertyLineClipping
Line clipping mode (since QGIS 3.24)
Definition: qgssymbollayer.h:213
QgsPropertyDefinition::CapStyle
@ CapStyle
Line cap style (eg round)
Definition: qgsproperty.h:74
QgsLineSymbolLayer::mWidth
double mWidth
Definition: qgssymbollayer.h:1203
QgsPropertyDefinition
Definition for a property.
Definition: qgsproperty.h:46
QgsMarkerSymbolLayer::Bottom
@ Bottom
Align to bottom of symbol.
Definition: qgssymbollayer.h:722
qgssymbollayer.h
QgsVectorSimplifyMethod::threshold
float threshold() const
Gets the simplification threshold of the vector layer managed.
Definition: qgsvectorsimplifymethod.h:89
QgsSymbolLayer::PropertyTrimEnd
@ PropertyTrimEnd
Trim distance from end of line (since QGIS 3.20)
Definition: qgssymbollayer.h:205
QgsSymbolLayer::mFields
QgsFields mFields
Definition: qgssymbollayer.h:654
QgsSymbolLayer::setPaintEffect
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the layer.
Definition: qgssymbollayer.cpp:228
QgsSymbolLayer::restoreOldDataDefinedProperties
void restoreOldDataDefinedProperties(const QVariantMap &stringMap)
Restores older data defined properties from string map.
Definition: qgssymbollayer.cpp:362
QgsMarkerSymbolLayer::Left
@ Left
Align to left side of symbol.
Definition: qgssymbollayer.h:712
QgsSymbolLayer::PropertyName
@ PropertyName
Name, eg shape name for simple markers.
Definition: qgssymbollayer.h:146
qgslegendpatchshape.h
QgsMapUnitScale
Struct for storing maximum and minimum scales for measurements in map units.
Definition: qgsmapunitscale.h:36
QgsRenderContext::symbolLayerClipPaths
QList< QPainterPath > symbolLayerClipPaths(const QgsSymbolLayer *symbolLayer) const
Returns clip paths to be applied to the symbolLayer before rendering.
Definition: qgsrendercontext.cpp:710
QgsSymbolLayer::PropertyPointCount
@ PropertyPointCount
Point count.
Definition: qgssymbollayer.h:197
QgsSymbolLayer::paintEffect
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the layer.
Definition: qgssymbollayer.cpp:223
qgseffectstack.h
QgsPropertyCollection::referencedFields
QSet< QString > referencedFields(const QgsExpressionContext &context=QgsExpressionContext(), bool ignoreContext=false) const override
Returns the set of any fields referenced by the active properties from the collection.
Definition: qgspropertycollection.cpp:254
QgsSymbolLayer::mDataDefinedProperties
QgsPropertyCollection mDataDefinedProperties
Definition: qgssymbollayer.h:651
QgsSymbolLayer::PropertyStrokeWidth
@ PropertyStrokeWidth
Stroke width.
Definition: qgssymbollayer.h:149
QgsSymbolLayer::PropertyShapeburstIgnoreRings
@ PropertyShapeburstIgnoreRings
Shapeburst ignore rings.
Definition: qgssymbollayer.h:173
QgsExpressionContext::EXPR_GEOMETRY_RING_NUM
static const QString EXPR_GEOMETRY_RING_NUM
Inbuilt variable name for geometry ring number variable.
Definition: qgsexpressioncontext.h:819
QgsSymbolLayer::canCauseArtifactsBetweenAdjacentTiles
virtual bool canCauseArtifactsBetweenAdjacentTiles() const
Returns true if the symbol layer rendering can cause visible artifacts across a single feature when t...
Definition: qgssymbollayer.cpp:308
QgsSymbolLayerUtils::encodePoint
static QString encodePoint(QPointF point)
Encodes a QPointF to a string.
Definition: qgssymbollayerutils.cpp:538
QgsMarkerSymbolLayer::VCenter
@ VCenter
Align to vertical center of symbol.
Definition: qgssymbollayer.h:721
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext....
Definition: qgsexpressioncontext.h:113
QgsLineSymbolLayer::InteriorRingsOnly
@ InteriorRingsOnly
Render the interior rings only.
Definition: qgssymbollayer.h:1033
QgsRenderContext::vectorSimplifyMethod
const QgsVectorSimplifyMethod & vectorSimplifyMethod() const
Returns the simplification settings to use when rendering vector layers.
Definition: qgsrendercontext.h:594
QgsSymbolLayer::usedAttributes
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
Definition: qgssymbollayer.cpp:328
qgsclipper.h
QgsPropertyDefinition::Double0To1
@ Double0To1
Double value between 0-1 (inclusive)
Definition: qgsproperty.h:59
qgsstyle.h
DEG2RAD
#define DEG2RAD(x)
Definition: qgsdistancearea.cpp:40
QgsSymbolLayer::PropertyLayerEnabled
@ PropertyLayerEnabled
Whether symbol layer is enabled.
Definition: qgssymbollayer.h:188
QgsSymbolLayer::PropertyOffsetAlongLine
@ PropertyOffsetAlongLine
Offset along line.
Definition: qgssymbollayer.h:184
QgsSymbolLayer::PropertyOffsetY
@ PropertyOffsetY
Vertical offset.
Definition: qgssymbollayer.h:196
qgsvectorlayer.h
QgsRenderContext::convertToPainterUnits
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).
Definition: qgsrendercontext.cpp:367
QgsPropertyDefinition::IntegerPositive
@ IntegerPositive
Positive integer values (including 0)
Definition: qgsproperty.h:55
QgsSymbolLayer::dxfBrushStyle
virtual Qt::BrushStyle dxfBrushStyle() const
Gets brush/fill style.
Definition: qgssymbollayer.cpp:218
QgsPropertyDefinition::Size
@ Size
1D size (eg marker radius, or square marker height/width)
Definition: qgsproperty.h:69
QgsMarkerSymbolLayer::mOffset
QPointF mOffset
Marker offset.
Definition: qgssymbollayer.h:999
QgsSymbolLayer::setDataDefinedProperties
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the symbol layer's property collection, used for data defined overrides.
Definition: qgssymbollayer.h:610
QgsSymbolLayer::PropertyGradientReference2X
@ PropertyGradientReference2X
Gradient reference point 2 x.
Definition: qgssymbollayer.h:166
QgsMarkerSymbolLayer::mHorizontalAnchorPoint
HorizontalAnchorPoint mHorizontalAnchorPoint
Horizontal anchor point.
Definition: qgssymbollayer.h:1007
QgsLegendPatchShape::toQPolygonF
QList< QList< QPolygonF > > toQPolygonF(Qgis::SymbolType type, QSizeF size) const
Converts the patch shape to a set of QPolygonF objects representing how the patch should be drawn for...
Definition: qgslegendpatchshape.cpp:143
QgsLineSymbolLayer::QgsLineSymbolLayer
QgsLineSymbolLayer(const QgsLineSymbolLayer &other)=delete
QgsLineSymbolLayer cannot be copied.
QgsPropertyDefinition::Boolean
@ Boolean
Boolean value.
Definition: qgsproperty.h:53
QgsSymbolLayer::PropertyCoordinateMode
@ PropertyCoordinateMode
Gradient coordinate mode.
Definition: qgssymbollayer.h:162
QgsPropertyCollection::value
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.
Definition: qgspropertycollection.cpp:228
c
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
Definition: porting_processing.dox:1
QgsSymbolLayer::type
Qgis::SymbolType type() const
Definition: qgssymbollayer.h:437
QgsFeatureRenderer::mType
QString mType
Definition: qgsrenderer.h:595
QgsPropertyDefinition::LineStyle
@ LineStyle
Line style (eg solid/dashed)
Definition: qgsproperty.h:71
str
#define str(x)
Definition: qgis.cpp:37
QgsSymbolLayer::PropertyDistanceY
@ PropertyDistanceY
Vertical distance between points.
Definition: qgssymbollayer.h:176
QgsLineSymbolLayer::ringFilter
RenderRingFilter ringFilter() const
Returns the line symbol layer's ring filter, which controls which rings are rendered when the line sy...
Definition: qgssymbollayer.cpp:513
QgsSymbolLayer::PropertyDistanceX
@ PropertyDistanceX
Horizontal distance between points.
Definition: qgssymbollayer.h:175
QgsSymbolLayer::setStrokeColor
virtual void setStrokeColor(const QColor &color)
Sets the stroke color for the symbol layer.
Definition: qgssymbollayer.cpp:257
QgsSymbolLayer::PropertyFile
@ PropertyFile
Filename, eg for svg files.
Definition: qgssymbollayer.h:174
QgsSymbolLayer::PropertyCustomDash
@ PropertyCustomDash
Custom dash pattern.
Definition: qgssymbollayer.h:180
QgsPaintEffect
Base class for visual effects which can be applied to QPicture drawings.
Definition: qgspainteffect.h:52
QgsSymbolLayer::PropertyAngle
@ PropertyAngle
Symbol angle.
Definition: qgssymbollayer.h:145
QgsMarkerSymbolLayer::renderPoint
virtual void renderPoint(QPointF point, QgsSymbolRenderContext &context)=0
Renders a marker at the specified point.
QgsUnitTypes::RenderMetersInMapUnits
@ RenderMetersInMapUnits
Meters value as Map units.
Definition: qgsunittypes.h:176
qgsproperty.h
QgsSymbolLayer::PropertyArrowType
@ PropertyArrowType
Arrow type.
Definition: qgssymbollayer.h:194
QgsUnitTypes::RenderUnknownUnit
@ RenderUnknownUnit
Mixed or unknown units.
Definition: qgsunittypes.h:175
QgsLineSymbolLayer::setOutputUnit
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
Definition: qgssymbollayer.cpp:721
QgsLineSymbolLayer::AllRings
@ AllRings
Render both exterior and interior rings.
Definition: qgssymbollayer.h:1031
QgsSymbolLayer::stopRender
virtual void stopRender(QgsSymbolRenderContext &context)=0
Called after a set of rendering operations has finished on the supplied render context.
QgsSymbolLayer::PropertyShapeburstMaxDistance
@ PropertyShapeburstMaxDistance
Shapeburst fill from edge distance.
Definition: qgssymbollayer.h:172
QgsMarkerSymbolLayer::horizontalAnchorPoint
HorizontalAnchorPoint horizontalAnchorPoint() const
Returns the horizontal anchor point for positioning the symbol.
Definition: qgssymbollayer.h:902
QgsSymbolLayer::Property
Property
Data definable properties.
Definition: qgssymbollayer.h:142
QgsSymbolLayer::PropertyRandomOffsetY
@ PropertyRandomOffsetY
Random offset Y (since QGIS 3.24)
Definition: qgssymbollayer.h:212
QgsSymbolLayer::dxfColor
virtual QColor dxfColor(QgsSymbolRenderContext &context) const
Gets color.
Definition: qgssymbollayer.cpp:189
QgsMarkerSymbolLayer::_rotatedOffset
static QPointF _rotatedOffset(QPointF offset, double angle)
Adjusts a marker offset to account for rotation.
Definition: qgssymbollayer.cpp:652
QgsSymbolLayer::fillColor
virtual QColor fillColor() const
Returns the fill color for the symbol layer.
Definition: qgssymbollayer.cpp:271
QgsMarkerSymbolLayer::offset
QPointF offset() const
Returns the marker's offset, which is the horizontal and vertical displacement which the rendered mar...
Definition: qgssymbollayer.h:851
qgsdxfexport.h
Qgis
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:71
QgsVectorSimplifyMethod::simplifyHints
SimplifyHints simplifyHints() const
Gets the simplification hints of the vector layer managed.
Definition: qgsvectorsimplifymethod.h:64
QgsSymbolLayer::color
virtual QColor color() const
Returns the "representative" color of the symbol layer.
Definition: qgssymbollayer.cpp:247
QgsSymbolLayer::PropertyGradientReference1X
@ PropertyGradientReference1X
Gradient reference point 1 x.
Definition: qgssymbollayer.h:164
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:55
QgsPropertyCollection::setProperty
void setProperty(int key, const QgsProperty &property)
Adds a property to the collection and takes ownership of it.
Definition: qgspropertycollection.cpp:187
QgsSymbolLayer::PropertyOpacity
@ PropertyOpacity
Opacity.
Definition: qgssymbollayer.h:179
QgsSymbolRenderContext::renderContext
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
Definition: qgssymbolrendercontext.h:62
QgsDxfExport::symbologyScale
double symbologyScale() const
Returns the reference scale for output.
Definition: qgsdxfexport.h:229
QgsPropertyDefinition::Opacity
@ Opacity
Opacity (0-100)
Definition: qgsproperty.h:62
QgsSymbolLayer::PropertyTrimStart
@ PropertyTrimStart
Trim distance from start of line (since QGIS 3.20)
Definition: qgssymbollayer.h:204
QgsSymbolLayer::PropertyHeight
@ PropertyHeight
Symbol height.
Definition: qgssymbollayer.h:154
QgsSymbolLayer::startRender
virtual void startRender(QgsSymbolRenderContext &context)=0
Called before a set of rendering operations commences on the supplied render context.
QgsLineSymbolLayer::widthUnit
QgsUnitTypes::RenderUnit widthUnit() const
Returns the units for the line's width.
Definition: qgssymbollayer.h:1171
QgsLineSymbolLayer::ExteriorRingOnly
@ ExteriorRingOnly
Render the exterior ring only.
Definition: qgssymbollayer.h:1032
QgsSymbolLayer::PropertyOffsetX
@ PropertyOffsetX
Horizontal offset.
Definition: qgssymbollayer.h:195
QgsRenderContext::painter
QPainter * painter()
Returns the destination QPainter for the render operation.
Definition: qgsrendercontext.h:112
QgsPaintEffect::enabled
bool enabled() const
Returns whether the effect is enabled.
Definition: qgspainteffect.h:197
QgsExpressionContextScope::StaticVariable
Single variable definition for use within a QgsExpressionContextScope.
Definition: qgsexpressioncontext.h:120
QgsPropertyCollection::isActive
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
Definition: qgspropertycollection.cpp:268
QgsSymbolLayer::PropertyLineEndWidthValue
@ PropertyLineEndWidthValue
End line width for interpolated line renderer (since QGIS 3.22)
Definition: qgssymbollayer.h:207
QgsSymbolLayer::PropertyLineStartColorValue
@ PropertyLineStartColorValue
Start line color for interpolated line renderer (since QGIS 3.22)
Definition: qgssymbollayer.h:208
QgsSymbolLayer::dxfWidth
virtual double dxfWidth(const QgsDxfExport &e, QgsSymbolRenderContext &context) const
Gets line width.
Definition: qgssymbollayer.cpp:175
QgsMarkerSymbolLayer::mOffsetMapUnitScale
QgsMapUnitScale mOffsetMapUnitScale
Offset map unit scale.
Definition: qgssymbollayer.h:1003
QgsSymbolLayer::PropertyDisplacementY
@ PropertyDisplacementY
Vertical displacement.
Definition: qgssymbollayer.h:178
MathUtils::angle
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Definition: MathUtils.cpp:786
QgsMarkerSymbolLayer::stopRender
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
Definition: qgssymbollayer.cpp:533
QgsSymbolLayer::copyDataDefinedProperties
void copyDataDefinedProperties(QgsSymbolLayer *destLayer) const
Copies all data defined properties of this layer to another symbol layer.
Definition: qgssymbollayer.cpp:483
QgsSymbolLayer::PropertyPlacement
@ PropertyPlacement
Line marker placement.
Definition: qgssymbollayer.h:182
QgsSymbolLayer::PropertyPreserveAspectRatio
@ PropertyPreserveAspectRatio
Preserve aspect ratio between width and height.
Definition: qgssymbollayer.h:155
QgsPropertyDefinition::StrokeWidth
@ StrokeWidth
Line stroke width.
Definition: qgsproperty.h:72
qgssymbol.h
QgsSymbolLayer::PropertyLineAngle
@ PropertyLineAngle
Line angle, or angle of hash lines for hash line symbols.
Definition: qgssymbollayer.h:159
QgsLineSymbolLayer::setMapUnitScale
void setMapUnitScale(const QgsMapUnitScale &scale) override
Definition: qgssymbollayer.cpp:732
QgsMarkerSymbolLayer::angle
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
Definition: qgssymbollayer.h:757
QgsSymbolLayer::PropertySecondaryColor
@ PropertySecondaryColor
Secondary color (eg for gradient fills)
Definition: qgssymbollayer.h:158
QgsSymbolLayer::dxfBrushColor
virtual QColor dxfBrushColor(QgsSymbolRenderContext &context) const
Gets brush/fill color.
Definition: qgssymbollayer.cpp:212
Qgis::SymbolType::Marker
@ Marker
Marker symbol.
QgsAbstractGeometrySimplifier::isGeneralizableByDeviceBoundingBox
static bool isGeneralizableByDeviceBoundingBox(const QgsRectangle &envelope, float mapToPixelTol=1.0f)
Returns whether the device-envelope can be replaced by its BBOX when is applied the specified toleran...
Definition: qgsgeometrysimplifier.cpp:23
QgsSymbolLayer::setDataDefinedProperty
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
Definition: qgssymbollayer.cpp:126
QgsSymbolLayer::prepareMasks
virtual void prepareMasks(const QgsSymbolRenderContext &context)
Prepares all mask internal objects according to what is defined in context This should be called prio...
Definition: qgssymbollayer.cpp:910
QgsSymbolLayer::PropertyJoinStyle
@ PropertyJoinStyle
Line join style.
Definition: qgssymbollayer.h:157
QgsSymbolLayer::PropertyWidth
@ PropertyWidth
Symbol width.
Definition: qgssymbollayer.h:153
QgsPropertyDefinition::DoublePositive
@ DoublePositive
Positive double value (including 0)
Definition: qgsproperty.h:58