1/************************************************************************
2 * This file has been generated automatically from                      *
3 *                                                                      *
4 * src/core/symbology/qgsrenderer.h                                     *
5 *                                                                      *
6 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
7 ************************************************************************/
8
9
10
11
12
13
14typedef QList<QgsSymbol *> QgsSymbolList;
15
16
17
18
19
20class QgsSymbolLevelItem
21{
22
23%TypeHeaderCode
24#include "qgsrenderer.h"
25%End
26  public:
27    QgsSymbolLevelItem( QgsSymbol *symbol, int layer );
28
29    QgsSymbol *symbol() const;
30%Docstring
31The symbol of this symbol level
32%End
33
34    int layer() const;
35%Docstring
36The layer of this symbol level
37%End
38
39  protected:
40};
41
42typedef QList< QgsSymbolLevelItem > QgsSymbolLevel;
43
44typedef QList< QList< QgsSymbolLevelItem > > QgsSymbolLevelOrder;
45
46
47
48class QgsFeatureRenderer
49{
50
51%TypeHeaderCode
52#include "qgsrenderer.h"
53%End
54%ConvertToSubClassCode
55
56    const QString type = sipCpp->type();
57
58    if ( type == QLatin1String( "singleSymbol" ) )
59      sipType = sipType_QgsSingleSymbolRenderer;
60    else if ( type == QLatin1String( "categorizedSymbol" ) )
61      sipType = sipType_QgsCategorizedSymbolRenderer;
62    else if ( type == QLatin1String( "graduatedSymbol" ) )
63      sipType = sipType_QgsGraduatedSymbolRenderer;
64    else if ( type == QLatin1String( "RuleRenderer" ) )
65      sipType = sipType_QgsRuleBasedRenderer;
66    else if ( type == QLatin1String( "heatmapRenderer" ) )
67      sipType = sipType_QgsHeatmapRenderer;
68    else if ( type == QLatin1String( "invertedPolygonRenderer" ) )
69      sipType = sipType_QgsInvertedPolygonRenderer;
70    else if ( type == QLatin1String( "pointCluster" ) )
71      sipType = sipType_QgsPointClusterRenderer;
72    else if ( type == QLatin1String( "pointDisplacement" ) )
73      sipType = sipType_QgsPointDisplacementRenderer;
74    else if ( type == QLatin1String( "25dRenderer" ) )
75      sipType = sipType_Qgs25DRenderer;
76    else if ( type == QLatin1String( "nullSymbol" ) )
77      sipType = sipType_QgsNullSymbolRenderer;
78    else
79      sipType = 0;
80%End
81  public:
82
83    static QgsFeatureRenderer *defaultRenderer( QgsWkbTypes::GeometryType geomType ) /Factory/;
84%Docstring
85Returns a new renderer - used by default in vector layers
86%End
87
88    QString type() const;
89
90    virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const = 0;
91%Docstring
92To be overridden
93
94Must be called between :py:func:`~QgsFeatureRenderer.startRender` and :py:func:`~QgsFeatureRenderer.stopRender` calls.
95
96:param feature: feature
97:param context: render context
98
99:return: returns pointer to symbol or 0 if symbol was not found
100
101.. versionadded:: 2.12
102%End
103
104    virtual QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
105%Docstring
106Returns symbol for feature. The difference compared to :py:func:`~QgsFeatureRenderer.symbolForFeature` is that it returns original
107symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
108of a symbol for use in rendering.
109
110.. versionadded:: 2.12
111%End
112
113    virtual QSet< QString > legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
114%Docstring
115Returns legend keys matching a specified feature.
116
117.. versionadded:: 2.14
118%End
119
120    virtual void startRender( QgsRenderContext &context, const QgsFields &fields );
121%Docstring
122Must be called when a new render cycle is started. A call to :py:func:`~QgsFeatureRenderer.startRender` must always
123be followed by a corresponding call to :py:func:`~QgsFeatureRenderer.stopRender` after all features have been rendered.
124
125:param context: Additional information passed to the renderer about the job which will be rendered
126:param fields: The fields available for rendering
127
128.. seealso:: :py:func:`stopRender`
129
130
131.. warning::
132
133   This method is not thread safe. Before calling :py:func:`~QgsFeatureRenderer.startRender` in a non-main thread,
134   the renderer should instead be cloned and :py:func:`~QgsFeatureRenderer.startRender`/:py:func:`~QgsFeatureRenderer.stopRender` called on the clone.
135%End
136
137    virtual void stopRender( QgsRenderContext &context );
138%Docstring
139Must be called when a render cycle has finished, to allow the renderer to clean up.
140
141Calls to :py:func:`~QgsFeatureRenderer.stopRender` must always be preceded by a call to :py:func:`~QgsFeatureRenderer.startRender`.
142
143.. warning::
144
145   This method is not thread safe. Before calling :py:func:`~QgsFeatureRenderer.startRender` in a non-main thread,
146   the renderer should instead be cloned and :py:func:`~QgsFeatureRenderer.startRender`/:py:func:`~QgsFeatureRenderer.stopRender` called on the clone.
147
148.. seealso:: :py:func:`startRender`
149%End
150
151    virtual QString filter( const QgsFields &fields = QgsFields() );
152%Docstring
153If a renderer does not require all the features this method may be overridden
154and return an expression used as where clause.
155This will be called once after :py:func:`~QgsFeatureRenderer.startRender` and before the first call
156to :py:func:`~QgsFeatureRenderer.renderFeature`.
157By default this returns a null string and all features will be requested.
158You do not need to specify the extent in here, this is taken care of separately and
159will be combined with a filter returned from this method.
160
161:return: An expression used as where clause
162%End
163
164    virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const = 0;
165%Docstring
166Returns a list of attributes required by this renderer. Attributes not listed in here may
167not have been requested from the provider at rendering time.
168
169:return: A set of attributes
170%End
171
172    virtual bool filterNeedsGeometry() const;
173%Docstring
174Returns ``True`` if this renderer requires the geometry to apply the filter.
175%End
176
177    virtual ~QgsFeatureRenderer();
178
179    virtual QgsFeatureRenderer *clone() const = 0 /Factory/;
180%Docstring
181Create a deep copy of this renderer. Should be implemented by all subclasses
182and generate a proper subclass.
183
184:return: A copy of this renderer
185%End
186
187    virtual bool renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false ) throw( QgsCsException );
188%Docstring
189Render a feature using this renderer in the given context.
190Must be called between :py:func:`~QgsFeatureRenderer.startRender` and :py:func:`~QgsFeatureRenderer.stopRender` calls.
191Default implementation renders a symbol as determined by :py:func:`~QgsFeatureRenderer.symbolForFeature` call.
192Returns ``True`` if the feature has been returned (this is used for example
193to determine whether the feature may be labelled).
194
195If layer is not -1, the renderer should draw only a particula layer from symbols
196(in order to support symbol level rendering).
197
198.. seealso:: :py:func:`startRender`
199
200.. seealso:: :py:func:`stopRender`
201%End
202
203    virtual QString dump() const;
204%Docstring
205Returns debug information about this renderer
206%End
207
208    enum Capability
209    {
210      SymbolLevels,
211      MoreSymbolsPerFeature,
212      Filter,
213      ScaleDependent
214    };
215
216    typedef QFlags<QgsFeatureRenderer::Capability> Capabilities;
217
218
219    virtual QgsFeatureRenderer::Capabilities capabilities();
220%Docstring
221Returns details about internals of this renderer.
222
223E.g. if you only want to deal with visible features:
224
225.. code-block:: python
226
227     if not renderer.capabilities().testFlag(QgsFeatureRenderer.Filter) or renderer.willRenderFeature(feature, context):
228         deal_with_my_feature()
229     else:
230         skip_the_curren_feature()
231%End
232
233    virtual QgsSymbolList symbols( QgsRenderContext &context ) const;
234%Docstring
235Returns list of symbols used by the renderer.
236
237:param context: render context
238
239.. versionadded:: 2.12
240%End
241
242    bool usingSymbolLevels() const;
243    void setUsingSymbolLevels( bool usingSymbolLevels );
244
245    static QgsFeatureRenderer *load( QDomElement &symbologyElem, const QgsReadWriteContext &context ) /Factory/;
246%Docstring
247create a renderer from XML element
248%End
249
250    virtual QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context );
251%Docstring
252store renderer info to XML element
253%End
254
255    virtual QDomElement writeSld( QDomDocument &doc, const QString &styleName, const QgsStringMap &props = QgsStringMap() ) const;
256%Docstring
257create the SLD UserStyle element following the SLD v1.1 specs with the given name
258
259.. versionadded:: 2.8
260%End
261
262    static QgsFeatureRenderer *loadSld( const QDomNode &node, QgsWkbTypes::GeometryType geomType, QString &errorMessage ) /Factory/;
263%Docstring
264Create a new renderer according to the information contained in
265the UserStyle element of a SLD style document
266
267:param node: the node in the SLD document whose the UserStyle element
268             is a child
269:param geomType: the geometry type of the features, used to convert
270                 Symbolizer elements
271:param errorMessage: it will contain the error message if something
272                     went wrong
273
274:return: the renderer
275%End
276
277    virtual void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props = QgsStringMap() ) const;
278%Docstring
279used from subclasses to create SLD Rule elements following SLD v1.1 specs
280%End
281
282    virtual bool legendSymbolItemsCheckable() const;
283%Docstring
284items of symbology items in legend should be checkable
285
286.. versionadded:: 2.5
287%End
288
289    virtual bool legendSymbolItemChecked( const QString &key );
290%Docstring
291items of symbology items in legend is checked
292
293.. versionadded:: 2.5
294%End
295
296    virtual void checkLegendSymbolItem( const QString &key, bool state = true );
297%Docstring
298item in symbology was checked
299
300.. versionadded:: 2.5
301%End
302
303    virtual void setLegendSymbolItem( const QString &key, QgsSymbol *symbol /Transfer/ );
304%Docstring
305Sets the symbol to be used for a legend symbol item.
306
307:param key: rule key for legend symbol
308:param symbol: new symbol for legend item. Ownership is transferred to renderer.
309
310.. versionadded:: 2.14
311%End
312
313    virtual QgsLegendSymbolList legendSymbolItems() const;
314%Docstring
315Returns a list of symbology items for the legend
316
317.. versionadded:: 2.6
318%End
319
320    virtual QString legendClassificationAttribute() const;
321%Docstring
322If supported by the renderer, return classification attribute for the use in legend
323
324.. versionadded:: 2.6
325%End
326
327    void setVertexMarkerAppearance( int type, double size );
328%Docstring
329Sets type and size of editing vertex markers for subsequent rendering
330%End
331
332    virtual bool willRenderFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
333%Docstring
334Returns whether the renderer will render a feature or not.
335Must be called between :py:func:`~QgsFeatureRenderer.startRender` and :py:func:`~QgsFeatureRenderer.stopRender` calls.
336Default implementation uses :py:func:`~QgsFeatureRenderer.symbolForFeature`.
337
338.. versionadded:: 2.12
339%End
340
341    virtual QgsSymbolList symbolsForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
342%Docstring
343Returns list of symbols used for rendering the feature.
344For renderers that do not support MoreSymbolsPerFeature it is more efficient
345to use :py:func:`~QgsFeatureRenderer.symbolForFeature`
346
347.. versionadded:: 2.12
348%End
349
350    virtual QgsSymbolList originalSymbolsForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
351%Docstring
352Equivalent of :py:func:`~QgsFeatureRenderer.originalSymbolsForFeature` call
353extended to support renderers that may use more symbols per feature - similar to :py:func:`~QgsFeatureRenderer.symbolsForFeature`
354
355.. versionadded:: 2.12
356%End
357
358    virtual void modifyRequestExtent( QgsRectangle &extent, QgsRenderContext &context );
359%Docstring
360Allows for a renderer to modify the extent of a feature request prior to rendering
361
362:param extent: reference to request's filter extent. Modify extent to change the
363               extent of feature request
364:param context: render context
365
366.. versionadded:: 2.7
367%End
368
369    QgsPaintEffect *paintEffect() const;
370%Docstring
371Returns the current paint effect for the renderer.
372
373:return: paint effect
374
375.. seealso:: :py:func:`setPaintEffect`
376
377.. versionadded:: 2.9
378%End
379
380    void setPaintEffect( QgsPaintEffect *effect /Transfer/ );
381%Docstring
382Sets the current paint effect for the renderer.
383
384:param effect: paint effect. Ownership is transferred to the renderer.
385
386.. seealso:: :py:func:`paintEffect`
387
388.. versionadded:: 2.9
389%End
390
391    bool forceRasterRender() const;
392%Docstring
393Returns whether the renderer must render as a raster.
394
395.. seealso:: :py:func:`setForceRasterRender`
396
397.. versionadded:: 2.12
398%End
399
400    void setForceRasterRender( bool forceRaster );
401%Docstring
402Sets whether the renderer should be rendered to a raster destination.
403
404:param forceRaster: set to ``True`` if renderer must be drawn on a raster surface.
405                    This may be desirable for highly detailed layers where rendering as a vector
406                    would result in a large, complex vector output.
407
408.. seealso:: :py:func:`forceRasterRender`
409
410.. versionadded:: 2.12
411%End
412
413    QgsFeatureRequest::OrderBy orderBy() const;
414%Docstring
415Gets the order in which features shall be processed by this renderer.
416
417.. note::
418
419   this property has no effect if :py:func:`~QgsFeatureRenderer.orderByEnabled` is ``False``
420
421.. seealso:: :py:func:`orderByEnabled`
422
423.. versionadded:: 2.14
424%End
425
426    void setOrderBy( const QgsFeatureRequest::OrderBy &orderBy );
427%Docstring
428Define the order in which features shall be processed by this renderer.
429
430.. note::
431
432   this property has no effect if :py:func:`~QgsFeatureRenderer.orderByEnabled` is ``False``
433
434.. seealso:: :py:func:`setOrderByEnabled`
435
436.. versionadded:: 2.14
437%End
438
439    bool orderByEnabled() const;
440%Docstring
441Returns whether custom ordering will be applied before features are processed by this renderer.
442
443.. seealso:: :py:func:`orderBy`
444
445.. seealso:: :py:func:`setOrderByEnabled`
446
447.. versionadded:: 2.14
448%End
449
450    void setOrderByEnabled( bool enabled );
451%Docstring
452Sets whether custom ordering should be applied before features are processed by this renderer.
453
454:param enabled: set to ``True`` to enable custom feature ordering
455
456.. seealso:: :py:func:`setOrderBy`
457
458.. seealso:: :py:func:`orderByEnabled`
459
460.. versionadded:: 2.14
461%End
462
463    virtual void setEmbeddedRenderer( QgsFeatureRenderer *subRenderer /Transfer/ );
464%Docstring
465Sets an embedded renderer (subrenderer) for this feature renderer. The base class implementation
466does nothing with subrenderers, but individual derived classes can use these to modify their behavior.
467
468:param subRenderer: the embedded renderer. Ownership will be transferred.
469
470.. seealso:: :py:func:`embeddedRenderer`
471
472.. versionadded:: 2.16
473%End
474
475    virtual const QgsFeatureRenderer *embeddedRenderer() const;
476%Docstring
477Returns the current embedded renderer (subrenderer) for this feature renderer. The base class
478implementation does not use subrenderers and will always return ``None``.
479
480.. seealso:: :py:func:`setEmbeddedRenderer`
481
482.. versionadded:: 2.16
483%End
484
485    virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
486%Docstring
487Accepts the specified symbology ``visitor``, causing it to visit all symbols associated
488with the renderer.
489
490Returns ``True`` if the visitor should continue visiting other objects, or ``False`` if visiting
491should be canceled.
492
493.. versionadded:: 3.10
494%End
495
496  protected:
497    QgsFeatureRenderer( const QString &type );
498
499    void renderFeatureWithSymbol( const QgsFeature &feature, QgsSymbol *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker ) throw( QgsCsException );
500%Docstring
501Render the ``feature`` with the ``symbol`` using ``context``.
502Use ``layer`` to specify the symbol layer, ``selected`` to
503specify if it should be rendered as selected and ``drawVertexMarker``
504to specify if vertex markers should be rendered.
505%End
506
507    void renderVertexMarker( QPointF pt, QgsRenderContext &context );
508%Docstring
509render editing vertex marker at specified point
510%End
511    void renderVertexMarkerPolyline( QPolygonF &pts, QgsRenderContext &context );
512%Docstring
513render editing vertex marker for a polyline
514%End
515    void renderVertexMarkerPolygon( QPolygonF &pts, QList<QPolygonF> *rings, QgsRenderContext &context );
516%Docstring
517render editing vertex marker for a polygon
518%End
519
520    static QPointF _getPoint( QgsRenderContext &context, const QgsPoint &point );
521%Docstring
522Creates a point in screen coordinates from a wkb string in map
523coordinates
524%End
525
526    void copyRendererData( QgsFeatureRenderer *destRenderer ) const;
527%Docstring
528Clones generic renderer data to another renderer.
529Currently clones
530
531- Order By
532- Paint Effect
533
534:param destRenderer: destination renderer for copied effect
535%End
536
537
538
539
540
541
542    static void convertSymbolSizeScale( QgsSymbol *symbol, QgsSymbol::ScaleMethod method, const QString &field );
543%Docstring
544
545.. note::
546
547   this function is used to convert old sizeScale expressions to symbol
548   level DataDefined size
549%End
550
551    static void convertSymbolRotation( QgsSymbol *symbol, const QString &field );
552%Docstring
553
554.. note::
555
556   this function is used to convert old rotations expressions to symbol
557   level DataDefined angle
558%End
559
560
561
562  private:
563    QgsFeatureRenderer( const QgsFeatureRenderer & );
564    QgsFeatureRenderer &operator=( const QgsFeatureRenderer & );
565};
566
567QFlags<QgsFeatureRenderer::Capability> operator|(QgsFeatureRenderer::Capability f1, QFlags<QgsFeatureRenderer::Capability> f2);
568
569
570
571/************************************************************************
572 * This file has been generated automatically from                      *
573 *                                                                      *
574 * src/core/symbology/qgsrenderer.h                                     *
575 *                                                                      *
576 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
577 ************************************************************************/
578