QGIS API Documentation  3.4.3-Madeira (2f64a3c)
qgsrenderer.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrenderer.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 "qgsrenderer.h"
17 #include "qgssymbol.h"
18 #include "qgssymbollayerutils.h"
19 #include "qgsrulebasedrenderer.h"
20 
21 #include "qgssinglesymbolrenderer.h" // for default renderer
22 
23 #include "qgsrendererregistry.h"
24 
25 #include "qgsrendercontext.h"
26 #include "qgsclipper.h"
27 #include "qgsgeometry.h"
28 #include "qgsgeometrycollection.h"
29 #include "qgsfeature.h"
30 #include "qgslogger.h"
31 #include "qgsvectorlayer.h"
32 #include "qgspainteffect.h"
33 #include "qgseffectstack.h"
34 #include "qgspainteffectregistry.h"
35 #include "qgswkbptr.h"
36 #include "qgspoint.h"
37 #include "qgsproperty.h"
38 
39 #include <QDomElement>
40 #include <QDomDocument>
41 #include <QPolygonF>
42 
43 QPointF QgsFeatureRenderer::_getPoint( QgsRenderContext &context, const QgsPoint &point )
44 {
45  return QgsSymbol::_getPoint( context, point );
46 }
47 
49 {
50  if ( !destRenderer || !mPaintEffect )
51  return;
52 
53  destRenderer->setPaintEffect( mPaintEffect->clone() );
54  destRenderer->mOrderBy = mOrderBy;
55  destRenderer->mOrderByEnabled = mOrderByEnabled;
56 }
57 
59  : mType( type )
60  , mUsingSymbolLevels( false )
63  , mForceRaster( false )
64  , mOrderByEnabled( false )
65 {
67  mPaintEffect->setEnabled( false );
68 }
69 
71 {
72  delete mPaintEffect;
73 }
74 
76 {
77  return new QgsSingleSymbolRenderer( QgsSymbol::defaultSymbol( geomType ) );
78 }
79 
81 {
82  return symbolForFeature( feature, context );
83 }
84 
85 QSet< QString > QgsFeatureRenderer::legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const
86 {
87  Q_UNUSED( feature );
88  Q_UNUSED( context );
89  return QSet< QString >();
90 }
91 
93 {
94 #ifdef QGISDEBUG
95  if ( !mThread )
96  {
97  mThread = QThread::currentThread();
98  }
99  else
100  {
101  Q_ASSERT_X( mThread == QThread::currentThread(), "QgsFeatureRenderer::startRender", "startRender called in a different thread - use a cloned renderer instead" );
102  }
103 #endif
104 }
105 
107 {
108 #ifdef QGISDEBUG
109  Q_ASSERT_X( mThread == QThread::currentThread(), "QgsFeatureRenderer::stopRender", "stopRender called in a different thread - use a cloned renderer instead" );
110 #endif
111 }
112 
114 {
115  return false;
116 }
117 
118 bool QgsFeatureRenderer::renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker )
119 {
120 #ifdef QGISDEBUG
121  Q_ASSERT_X( mThread == QThread::currentThread(), "QgsFeatureRenderer::renderFeature", "renderFeature called in a different thread - use a cloned renderer instead" );
122 #endif
123 
124  QgsSymbol *symbol = symbolForFeature( feature, context );
125  if ( !symbol )
126  return false;
127 
128  renderFeatureWithSymbol( feature, symbol, context, layer, selected, drawVertexMarker );
129  return true;
130 }
131 
132 void QgsFeatureRenderer::renderFeatureWithSymbol( const QgsFeature &feature, QgsSymbol *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker )
133 {
134  symbol->renderFeature( feature, context, layer, selected, drawVertexMarker, mCurrentVertexMarkerType, mCurrentVertexMarkerSize );
135 }
136 
138 {
139  return QStringLiteral( "UNKNOWN RENDERER\n" );
140 }
141 
143 {
144  Q_UNUSED( context );
145  return QgsSymbolList();
146 }
147 
148 QgsFeatureRenderer *QgsFeatureRenderer::load( QDomElement &element, const QgsReadWriteContext &context )
149 {
150  // <renderer-v2 type=""> ... </renderer-v2>
151 
152  if ( element.isNull() )
153  return nullptr;
154 
155  // load renderer
156  QString rendererType = element.attribute( QStringLiteral( "type" ) );
157 
159  if ( !m )
160  return nullptr;
161 
162  QgsFeatureRenderer *r = m->createRenderer( element, context );
163  if ( r )
164  {
165  r->setUsingSymbolLevels( element.attribute( QStringLiteral( "symbollevels" ), QStringLiteral( "0" ) ).toInt() );
166  r->setForceRasterRender( element.attribute( QStringLiteral( "forceraster" ), QStringLiteral( "0" ) ).toInt() );
167 
168  //restore layer effect
169  QDomElement effectElem = element.firstChildElement( QStringLiteral( "effect" ) );
170  if ( !effectElem.isNull() )
171  {
172  r->setPaintEffect( QgsApplication::paintEffectRegistry()->createEffect( effectElem ) );
173  }
174 
175  // restore order by
176  QDomElement orderByElem = element.firstChildElement( QStringLiteral( "orderby" ) );
177  r->mOrderBy.load( orderByElem );
178  r->setOrderByEnabled( element.attribute( QStringLiteral( "enableorderby" ), QStringLiteral( "0" ) ).toInt() );
179  }
180  return r;
181 }
182 
183 QDomElement QgsFeatureRenderer::save( QDomDocument &doc, const QgsReadWriteContext &context )
184 {
185  Q_UNUSED( context );
186  // create empty renderer element
187  QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
188  rendererElem.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );
189 
191  mPaintEffect->saveProperties( doc, rendererElem );
192 
193  if ( !mOrderBy.isEmpty() )
194  {
195  QDomElement orderBy = doc.createElement( QStringLiteral( "orderby" ) );
196  mOrderBy.save( orderBy );
197  rendererElem.appendChild( orderBy );
198  }
199  rendererElem.setAttribute( QStringLiteral( "enableorderby" ), ( mOrderByEnabled ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );
200  return rendererElem;
201 }
202 
203 QgsFeatureRenderer *QgsFeatureRenderer::loadSld( const QDomNode &node, QgsWkbTypes::GeometryType geomType, QString &errorMessage )
204 {
205  QDomElement element = node.toElement();
206  if ( element.isNull() )
207  return nullptr;
208 
209  // get the UserStyle element
210  QDomElement userStyleElem = element.firstChildElement( QStringLiteral( "UserStyle" ) );
211  if ( userStyleElem.isNull() )
212  {
213  // UserStyle element not found, nothing will be rendered
214  errorMessage = QStringLiteral( "Info: UserStyle element not found." );
215  return nullptr;
216  }
217 
218  // get the FeatureTypeStyle element
219  QDomElement featTypeStyleElem = userStyleElem.firstChildElement( QStringLiteral( "FeatureTypeStyle" ) );
220  if ( featTypeStyleElem.isNull() )
221  {
222  errorMessage = QStringLiteral( "Info: FeatureTypeStyle element not found." );
223  return nullptr;
224  }
225 
226  // create empty FeatureTypeStyle element to merge Rule's from all FeatureTypeStyle's
227  QDomElement mergedFeatTypeStyle = featTypeStyleElem.cloneNode( false ).toElement();
228 
229  // use the RuleRenderer when more rules are present or the rule
230  // has filters or min/max scale denominators set,
231  // otherwise use the SingleSymbol renderer
232  bool needRuleRenderer = false;
233  int ruleCount = 0;
234 
235  while ( !featTypeStyleElem.isNull() )
236  {
237  QDomElement ruleElem = featTypeStyleElem.firstChildElement( QStringLiteral( "Rule" ) );
238  while ( !ruleElem.isNull() )
239  {
240  ruleCount++;
241 
242  // append a clone of all Rules to the merged FeatureTypeStyle element
243  mergedFeatTypeStyle.appendChild( ruleElem.cloneNode().toElement() );
244  // more rules present, use the RuleRenderer
245 
246  if ( ruleCount > 1 )
247  {
248  QgsDebugMsg( QStringLiteral( "more Rule elements found: need a RuleRenderer" ) );
249  needRuleRenderer = true;
250  }
251 
252  QDomElement ruleChildElem = ruleElem.firstChildElement();
253  while ( !ruleChildElem.isNull() )
254  {
255  // rule has filter or min/max scale denominator, use the RuleRenderer
256  if ( ruleChildElem.localName() == QLatin1String( "Filter" ) ||
257  ruleChildElem.localName() == QLatin1String( "MinScaleDenominator" ) ||
258  ruleChildElem.localName() == QLatin1String( "MaxScaleDenominator" ) )
259  {
260  QgsDebugMsg( QStringLiteral( "Filter or Min/MaxScaleDenominator element found: need a RuleRenderer" ) );
261  needRuleRenderer = true;
262  break;
263  }
264 
265  ruleChildElem = ruleChildElem.nextSiblingElement();
266  }
267 
268  ruleElem = ruleElem.nextSiblingElement( QStringLiteral( "Rule" ) );
269  }
270  featTypeStyleElem = featTypeStyleElem.nextSiblingElement( QStringLiteral( "FeatureTypeStyle" ) );
271  }
272 
273  QString rendererType;
274  if ( needRuleRenderer )
275  {
276  rendererType = QStringLiteral( "RuleRenderer" );
277  }
278  else
279  {
280  rendererType = QStringLiteral( "singleSymbol" );
281  }
282  QgsDebugMsg( QStringLiteral( "Instantiating a '%1' renderer..." ).arg( rendererType ) );
283 
284  // create the renderer and return it
286  if ( !m )
287  {
288  errorMessage = QStringLiteral( "Error: Unable to get metadata for '%1' renderer." ).arg( rendererType );
289  return nullptr;
290  }
291 
292  QgsFeatureRenderer *r = m->createRendererFromSld( mergedFeatTypeStyle, geomType );
293  return r;
294 }
295 
296 QDomElement QgsFeatureRenderer::writeSld( QDomDocument &doc, const QString &styleName, const QgsStringMap &props ) const
297 {
298  QDomElement userStyleElem = doc.createElement( QStringLiteral( "UserStyle" ) );
299 
300  QDomElement nameElem = doc.createElement( QStringLiteral( "se:Name" ) );
301  nameElem.appendChild( doc.createTextNode( styleName ) );
302  userStyleElem.appendChild( nameElem );
303 
304  QDomElement featureTypeStyleElem = doc.createElement( QStringLiteral( "se:FeatureTypeStyle" ) );
305  toSld( doc, featureTypeStyleElem, props );
306  userStyleElem.appendChild( featureTypeStyleElem );
307 
308  return userStyleElem;
309 }
310 
312 {
313  return false;
314 }
315 
317 {
318  Q_UNUSED( key );
319  return false;
320 }
321 
322 void QgsFeatureRenderer::checkLegendSymbolItem( const QString &key, bool state )
323 {
324  Q_UNUSED( key );
325  Q_UNUSED( state );
326 }
327 
328 void QgsFeatureRenderer::setLegendSymbolItem( const QString &key, QgsSymbol *symbol )
329 {
330  Q_UNUSED( key );
331  delete symbol;
332 }
333 
335 {
336  return QgsLegendSymbolList();
337 }
338 
340 {
343 }
344 
346 {
347  return nullptr != symbolForFeature( feature, context );
348 }
349 
351 {
352  QgsVectorLayer::drawVertexMarker( pt.x(), pt.y(), *context.painter(),
355 }
356 
358 {
359  Q_FOREACH ( QPointF pt, pts )
360  renderVertexMarker( pt, context );
361 }
362 
363 void QgsFeatureRenderer::renderVertexMarkerPolygon( QPolygonF &pts, QList<QPolygonF> *rings, QgsRenderContext &context )
364 {
365  Q_FOREACH ( QPointF pt, pts )
366  renderVertexMarker( pt, context );
367 
368  if ( rings )
369  {
370  Q_FOREACH ( const QPolygonF &ring, *rings )
371  {
372  Q_FOREACH ( QPointF pt, ring )
373  renderVertexMarker( pt, context );
374  }
375  }
376 }
377 
379 {
380  QgsSymbolList lst;
381  QgsSymbol *s = symbolForFeature( feature, context );
382  if ( s ) lst.append( s );
383  return lst;
384 }
385 
387 {
388  Q_UNUSED( extent );
389  Q_UNUSED( context );
390 }
391 
393 {
394  QgsSymbolList lst;
395  QgsSymbol *s = originalSymbolForFeature( feature, context );
396  if ( s ) lst.append( s );
397  return lst;
398 }
399 
401 {
402  return mPaintEffect;
403 }
404 
406 {
407  delete mPaintEffect;
408  mPaintEffect = effect;
409 }
410 
412 {
413  return mOrderBy;
414 }
415 
417 {
418  mOrderBy = orderBy;
419 }
420 
422 {
423  return mOrderByEnabled;
424 }
425 
427 {
428  mOrderByEnabled = enabled;
429 }
430 
432 {
433  delete subRenderer;
434 }
435 
437 {
438  return nullptr;
439 }
440 
442 {
443  if ( symbol->type() == QgsSymbol::Marker )
444  {
445  QgsMarkerSymbol *s = static_cast<QgsMarkerSymbol *>( symbol );
446  if ( QgsSymbol::ScaleArea == QgsSymbol::ScaleMethod( method ) )
447  {
448  s->setDataDefinedSize( QgsProperty::fromExpression( "coalesce(sqrt(" + QString::number( s->size() ) + " * (" + field + ")),0)" ) );
449  }
450  else
451  {
452  s->setDataDefinedSize( QgsProperty::fromExpression( "coalesce(" + QString::number( s->size() ) + " * (" + field + "),0)" ) );
453  }
455  }
456  else if ( symbol->type() == QgsSymbol::Line )
457  {
458  QgsLineSymbol *s = static_cast<QgsLineSymbol *>( symbol );
459  s->setDataDefinedWidth( QgsProperty::fromExpression( "coalesce(" + QString::number( s->width() ) + " * (" + field + "),0)" ) );
460  }
461 }
462 
463 void QgsFeatureRenderer::convertSymbolRotation( QgsSymbol *symbol, const QString &field )
464 {
465  if ( symbol->type() == QgsSymbol::Marker )
466  {
467  QgsMarkerSymbol *s = static_cast<QgsMarkerSymbol *>( symbol );
469  ? QString::number( s->angle() ) + " + "
470  : QString() ) + field );
471  s->setDataDefinedAngle( dd );
472  }
473 }
The class is used as a container of context for various read/write operations on other objects...
virtual QgsLegendSymbolList legendSymbolItems() const
Returns a list of symbology items for the legend.
A rectangle specified with double values.
Definition: qgsrectangle.h:40
void setVertexMarkerAppearance(int type, int size)
Sets type and size of editing vertex markers for subsequent rendering.
QList< QgsLegendSymbolItem > QgsLegendSymbolList
QgsFeatureRequest::OrderBy mOrderBy
Definition: qgsrenderer.h:526
Calculate scale by the diameter.
Definition: qgssymbol.h:97
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:61
virtual void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props=QgsStringMap()) const
used from subclasses to create SLD Rule elements following SLD v1.1 specs
Definition: qgsrenderer.h:300
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
virtual QgsFeatureRenderer * createRendererFromSld(QDomElement &elem, QgsWkbTypes::GeometryType geomType)
QgsFeatureRequest::OrderBy orderBy() const
Gets the order in which features shall be processed by this renderer.
virtual QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context)
store renderer info to XML element
VertexMarkerType
Editing vertex markers.
static bool isDefaultStack(QgsPaintEffect *effect)
Tests whether a paint effect matches the default effects stack.
static QPointF _getPoint(QgsRenderContext &context, const QgsPoint &point)
Creates a point in screen coordinates from a QgsPoint in map coordinates.
Definition: qgssymbol.h:447
Base class for visual effects which can be applied to QPicture drawings.
static QgsProperty fromExpression(const QString &expression, bool isActive=true)
Returns a new ExpressionBasedProperty created from the specified expression.
Container of fields for a vector layer.
Definition: qgsfields.h:42
void renderVertexMarkerPolyline(QPolygonF &pts, QgsRenderContext &context)
render editing vertex marker for a polyline
#define RENDERER_TAG_NAME
Definition: qgsrenderer.h:49
void CORE_EXPORT load(const QDomElement &elem)
Deserialize from XML.
void setUsingSymbolLevels(bool usingSymbolLevels)
Definition: qgsrenderer.h:272
void setDataDefinedAngle(const QgsProperty &property)
Set data defined angle for whole symbol (including all symbol layers).
Definition: qgssymbol.cpp:1211
QgsPaintEffect * mPaintEffect
Definition: qgsrenderer.h:510
Line symbol.
Definition: qgssymbol.h:86
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:55
static QPointF _getPoint(QgsRenderContext &context, const QgsPoint &point)
Creates a point in screen coordinates from a wkb string in map coordinates.
Definition: qgsrenderer.cpp:43
QMap< QString, QString > QgsStringMap
Definition: qgis.h:570
static QgsPaintEffectRegistry * paintEffectRegistry()
Returns the application&#39;s paint effect registry, used for managing paint effects. ...
virtual QgsSymbolList originalSymbolsForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbol...
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
virtual QgsSymbol * symbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const =0
To be overridden.
virtual const QgsFeatureRenderer * embeddedRenderer() const
Returns the current embedded renderer (subrenderer) for this feature renderer.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the renderer.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the renderer.
void setEnabled(bool enabled)
Sets whether the effect is enabled.
QList< QgsSymbol * > QgsSymbolList
Definition: qgsrenderer.h:43
static QgsSymbol * defaultSymbol(QgsWkbTypes::GeometryType geomType)
Returns a new default symbol for the specified geometry type.
Definition: qgssymbol.cpp:275
QString type() const
Definition: qgsrenderer.h:129
static QgsPaintEffect * defaultStack()
Returns a new effect stack consisting of a sensible selection of default effects. ...
virtual bool renderFeature(const QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
Render a feature using this renderer in the given context.
void setForceRasterRender(bool forceRaster)
Sets whether the renderer should be rendered to a raster destination.
Definition: qgsrenderer.h:410
static QgsFeatureRenderer * load(QDomElement &symbologyElem, const QgsReadWriteContext &context)
create a renderer from XML element
virtual void modifyRequestExtent(QgsRectangle &extent, QgsRenderContext &context)
Allows for a renderer to modify the extent of a feature request prior to rendering.
Calculate scale by the area.
Definition: qgssymbol.h:96
double width() const
Definition: qgssymbol.cpp:1627
void renderFeatureWithSymbol(const QgsFeature &feature, QgsSymbol *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker)
Render the feature with the symbol using context.
virtual QgsFeatureRenderer * createRenderer(QDomElement &elem, const QgsReadWriteContext &context)=0
Returns new instance of the renderer given the DOM element.
virtual QgsSymbol * originalSymbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns symbol for feature.
Definition: qgsrenderer.cpp:80
virtual ~QgsFeatureRenderer()
Definition: qgsrenderer.cpp:70
void renderFeature(const QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false, int currentVertexMarkerType=0, int currentVertexMarkerSize=0)
Render a feature.
Definition: qgssymbol.cpp:739
QgsRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
static void convertSymbolSizeScale(QgsSymbol *symbol, QgsSymbol::ScaleMethod method, const QString &field)
virtual bool legendSymbolItemChecked(const QString &key)
items of symbology items in legend is checked
void setScaleMethod(QgsSymbol::ScaleMethod scaleMethod)
Definition: qgssymbol.cpp:1476
ScaleMethod
Scale method.
Definition: qgssymbol.h:94
A store for object properties.
Definition: qgsproperty.h:229
static void drawVertexMarker(double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize)
Draws a vertex symbol at (screen) coordinates x, y. (Useful to assist vertex editing.)
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
bool orderByEnabled() const
Returns whether custom ordering will be applied before features are processed by this renderer...
virtual void checkLegendSymbolItem(const QString &key, bool state=true)
item in symbology was checked
virtual void setLegendSymbolItem(const QString &key, QgsSymbol *symbol)
Sets the symbol to be used for a legend symbol item.
void setDataDefinedWidth(const QgsProperty &property)
Set data defined width for whole symbol (including all symbol layers).
Definition: qgssymbol.cpp:1646
void setOrderBy(const QgsFeatureRequest::OrderBy &orderBy)
Define the order in which features shall be processed by this renderer.
void renderVertexMarkerPolygon(QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context)
render editing vertex marker for a polygon
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:138
static void convertSymbolRotation(QgsSymbol *symbol, const QString &field)
Marker symbol.
Definition: qgssymbol.h:85
Contains information about the context of a rendering operation.
virtual QgsSymbolList symbolsForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns list of symbols used for rendering the feature.
QPainter * painter()
Returns the destination QPainter for the render operation.
SymbolType type() const
Returns the symbol&#39;s type.
Definition: qgssymbol.h:120
virtual QgsSymbolList symbols(QgsRenderContext &context) const
Returns list of symbols used by the renderer.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)
Must be called when a new render cycle is started.
Definition: qgsrenderer.cpp:92
double size() const
Returns the size for the whole symbol, which is the maximum size of all marker symbol layers in the s...
Definition: qgssymbol.cpp:1308
int mCurrentVertexMarkerSize
The current size of editing marker.
Definition: qgsrenderer.h:508
static QgsFeatureRenderer * loadSld(const QDomNode &node, QgsWkbTypes::GeometryType geomType, QString &errorMessage)
Create a new renderer according to the information contained in the UserStyle element of a SLD style ...
Stores metadata about one renderer class.
void CORE_EXPORT save(QDomElement &elem) const
Serialize to XML.
virtual void stopRender(QgsRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
virtual QSet< QString > legendKeysForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns legend keys matching a specified feature.
Definition: qgsrenderer.cpp:85
void copyRendererData(QgsFeatureRenderer *destRenderer) const
Clones generic renderer data to another renderer.
Definition: qgsrenderer.cpp:48
virtual QDomElement writeSld(QDomDocument &doc, const QString &styleName, const QgsStringMap &props=QgsStringMap()) const
create the SLD UserStyle element following the SLD v1.1 specs with the given name ...
virtual void setEmbeddedRenderer(QgsFeatureRenderer *subRenderer)
Sets an embedded renderer (subrenderer) for this feature renderer.
virtual bool willRenderFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns whether the renderer will render a feature or not.
virtual bool legendSymbolItemsCheckable() const
items of symbology items in legend should be checkable
void setDataDefinedSize(const QgsProperty &property)
Set data defined size for whole symbol (including all symbol layers).
Definition: qgssymbol.cpp:1385
int mCurrentVertexMarkerType
The current type of editing marker.
Definition: qgsrenderer.h:506
static QgsFeatureRenderer * defaultRenderer(QgsWkbTypes::GeometryType geomType)
Returns a new renderer - used by default in vector layers.
Definition: qgsrenderer.cpp:75
virtual bool filterNeedsGeometry() const
Returns true if this renderer requires the geometry to apply the filter.
Represents a vector layer which manages a vector based data sets.
QgsFeatureRenderer(const QString &type)
Definition: qgsrenderer.cpp:58
void setOrderByEnabled(bool enabled)
Sets whether custom ordering should be applied before features are processed by this renderer...
static QgsRendererRegistry * rendererRegistry()
Returns the application&#39;s renderer registry, used for managing vector layer renderers.
double angle() const
Returns the marker angle for the whole symbol.
Definition: qgssymbol.cpp:1188
Represents a list of OrderByClauses, with the most important first and the least important last...
void renderVertexMarker(QPointF pt, QgsRenderContext &context)
render editing vertex marker at specified point
virtual QString dump() const
Returns debug information about this renderer.
virtual bool saveProperties(QDomDocument &doc, QDomElement &element) const
Saves the current state of the effect to a DOM element.