QGIS API Documentation
3.6.0-Noosa (5873452)
|
#include <qgsrenderer.h>
Public Types | |
enum | Capability { SymbolLevels = 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3, ScaleDependent = 1 << 4 } |
Used to specify details about a renderer. More... | |
Public Member Functions | |
virtual | ~QgsFeatureRenderer () |
virtual QgsFeatureRenderer::Capabilities | capabilities () |
Returns details about internals of this renderer. More... | |
virtual void | checkLegendSymbolItem (const QString &key, bool state=true) |
item in symbology was checked More... | |
virtual QgsFeatureRenderer * | clone () const =0 |
Create a deep copy of this renderer. More... | |
virtual QString | dump () const |
Returns debug information about this renderer. More... | |
virtual const QgsFeatureRenderer * | embeddedRenderer () const |
Returns the current embedded renderer (subrenderer) for this feature renderer. More... | |
virtual QString | filter (const QgsFields &fields=QgsFields()) |
If a renderer does not require all the features this method may be overridden and return an expression used as where clause. More... | |
virtual bool | filterNeedsGeometry () const |
Returns true if this renderer requires the geometry to apply the filter. More... | |
bool | forceRasterRender () const |
Returns whether the renderer must render as a raster. More... | |
virtual QString | legendClassificationAttribute () const |
If supported by the renderer, return classification attribute for the use in legend. More... | |
virtual QSet< QString > | legendKeysForFeature (const QgsFeature &feature, QgsRenderContext &context) const |
Returns legend keys matching a specified feature. More... | |
virtual bool | legendSymbolItemChecked (const QString &key) |
items of symbology items in legend is checked More... | |
virtual QgsLegendSymbolList | legendSymbolItems () const |
Returns a list of symbology items for the legend. More... | |
virtual bool | legendSymbolItemsCheckable () const |
items of symbology items in legend should be checkable More... | |
virtual void | modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context) |
Allows for a renderer to modify the extent of a feature request prior to rendering. More... | |
QgsFeatureRequest::OrderBy | orderBy () const |
Gets the order in which features shall be processed by this renderer. More... | |
bool | orderByEnabled () const |
Returns whether custom ordering will be applied before features are processed by this renderer. More... | |
virtual QgsSymbol * | originalSymbolForFeature (const QgsFeature &feature, QgsRenderContext &context) const |
Returns symbol for feature. More... | |
virtual QgsSymbolList | originalSymbolsForFeature (const QgsFeature &feature, QgsRenderContext &context) const |
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() More... | |
QgsPaintEffect * | paintEffect () const |
Returns the current paint effect for the renderer. More... | |
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. More... | |
virtual QDomElement | save (QDomDocument &doc, const QgsReadWriteContext &context) |
store renderer info to XML element More... | |
virtual void | setEmbeddedRenderer (QgsFeatureRenderer *subRenderer) |
Sets an embedded renderer (subrenderer) for this feature renderer. More... | |
void | setForceRasterRender (bool forceRaster) |
Sets whether the renderer should be rendered to a raster destination. More... | |
virtual void | setLegendSymbolItem (const QString &key, QgsSymbol *symbol) |
Sets the symbol to be used for a legend symbol item. More... | |
void | setOrderBy (const QgsFeatureRequest::OrderBy &orderBy) |
Define the order in which features shall be processed by this renderer. More... | |
void | setOrderByEnabled (bool enabled) |
Sets whether custom ordering should be applied before features are processed by this renderer. More... | |
void | setPaintEffect (QgsPaintEffect *effect) |
Sets the current paint effect for the renderer. More... | |
void | setUsingSymbolLevels (bool usingSymbolLevels) |
void | setVertexMarkerAppearance (int type, double size) |
Sets type and size of editing vertex markers for subsequent rendering. More... | |
virtual void | startRender (QgsRenderContext &context, const QgsFields &fields) |
Must be called when a new render cycle is started. More... | |
virtual void | stopRender (QgsRenderContext &context) |
Must be called when a render cycle has finished, to allow the renderer to clean up. More... | |
virtual QgsSymbol * | symbolForFeature (const QgsFeature &feature, QgsRenderContext &context) const =0 |
To be overridden. More... | |
virtual QgsSymbolList | symbols (QgsRenderContext &context) const |
Returns list of symbols used by the renderer. More... | |
virtual QgsSymbolList | symbolsForFeature (const QgsFeature &feature, QgsRenderContext &context) const |
Returns list of symbols used for rendering the feature. More... | |
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 More... | |
QString | type () const |
virtual QSet< QString > | usedAttributes (const QgsRenderContext &context) const =0 |
Returns a list of attributes required by this renderer. More... | |
bool | usingSymbolLevels () const |
virtual bool | willRenderFeature (const QgsFeature &feature, QgsRenderContext &context) const |
Returns whether the renderer will render a feature or not. More... | |
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 More... | |
Static Public Member Functions | |
static QgsFeatureRenderer * | defaultRenderer (QgsWkbTypes::GeometryType geomType) |
Returns a new renderer - used by default in vector layers. More... | |
static QgsFeatureRenderer * | load (QDomElement &symbologyElem, const QgsReadWriteContext &context) |
create a renderer from XML element More... | |
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 document. More... | |
Protected Member Functions | |
QgsFeatureRenderer (const QString &type) | |
void | copyRendererData (QgsFeatureRenderer *destRenderer) const |
Clones generic renderer data to another renderer. More... | |
void | renderFeatureWithSymbol (const QgsFeature &feature, QgsSymbol *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker) |
Render the feature with the symbol using context. More... | |
void | renderVertexMarker (QPointF pt, QgsRenderContext &context) |
render editing vertex marker at specified point More... | |
void | renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context) |
render editing vertex marker for a polygon More... | |
void | renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context) |
render editing vertex marker for a polyline More... | |
Static Protected Member Functions | |
static QPointF | _getPoint (QgsRenderContext &context, const QgsPoint &point) |
Creates a point in screen coordinates from a wkb string in map coordinates. More... | |
static void | convertSymbolRotation (QgsSymbol *symbol, const QString &field) |
static void | convertSymbolSizeScale (QgsSymbol *symbol, QgsSymbol::ScaleMethod method, const QString &field) |
Protected Attributes | |
double | mCurrentVertexMarkerSize |
The current size of editing marker. More... | |
int | mCurrentVertexMarkerType |
The current type of editing marker. More... | |
bool | mForceRaster |
QgsFeatureRequest::OrderBy | mOrderBy |
bool | mOrderByEnabled |
QgsPaintEffect * | mPaintEffect = nullptr |
QString | mType |
bool | mUsingSymbolLevels |
Definition at line 90 of file qgsrenderer.h.
Used to specify details about a renderer.
Is returned from the capabilities() method.
Enumerator | |
---|---|
SymbolLevels | Rendering with symbol levels (i.e. implements symbols(), symbolForFeature()) |
MoreSymbolsPerFeature | May use more than one symbol to render a feature: symbolsForFeature() will return them. |
Filter | Features may be filtered, i.e. some features may not be rendered (categorized, rule based ...) |
ScaleDependent | Depends on scale if feature will be rendered (rule based ) |
Definition at line 240 of file qgsrenderer.h.
|
virtual |
Definition at line 71 of file qgsrenderer.cpp.
|
protected |
Definition at line 59 of file qgsrenderer.cpp.
|
staticprotected |
Creates a point in screen coordinates from a wkb string in map coordinates.
Definition at line 44 of file qgsrenderer.cpp.
|
inlinevirtual |
Returns details about internals of this renderer.
E.g. if you only want to deal with visible features:
Reimplemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, and QgsSingleSymbolRenderer.
Definition at line 262 of file qgsrenderer.h.
|
virtual |
item in symbology was checked
Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.
Definition at line 323 of file qgsrenderer.cpp.
|
pure virtual |
Create a deep copy of this renderer.
Should be implemented by all subclasses and generate a proper subclass.
Implemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsSingleSymbolRenderer, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, Qgs25DRenderer, QgsHeatmapRenderer, QgsNullSymbolRenderer, and QgsPointClusterRenderer.
|
staticprotected |
Definition at line 465 of file qgsrenderer.cpp.
|
staticprotected |
Definition at line 443 of file qgsrenderer.cpp.
|
protected |
Clones generic renderer data to another renderer.
Currently clones
destRenderer | destination renderer for copied effect |
Definition at line 49 of file qgsrenderer.cpp.
|
static |
Returns a new renderer - used by default in vector layers.
Definition at line 76 of file qgsrenderer.cpp.
|
virtual |
Returns debug information about this renderer.
Reimplemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsInvertedPolygonRenderer, QgsSingleSymbolRenderer, QgsHeatmapRenderer, and QgsNullSymbolRenderer.
Definition at line 138 of file qgsrenderer.cpp.
|
virtual |
Returns the current embedded renderer (subrenderer) for this feature renderer.
The base class implementation does not use subrenderers and will always return null.
Reimplemented in QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.
Definition at line 438 of file qgsrenderer.cpp.
If a renderer does not require all the features this method may be overridden and return an expression used as where clause.
This will be called once after startRender() and before the first call to renderFeature(). By default this returns a null string and all features will be requested. You do not need to specify the extent in here, this is taken care of separately and will be combined with a filter returned from this method.
Reimplemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, and QgsPointDistanceRenderer.
Definition at line 193 of file qgsrenderer.h.
|
virtual |
Returns true if this renderer requires the geometry to apply the filter.
Reimplemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsPointDistanceRenderer, and QgsInvertedPolygonRenderer.
Definition at line 114 of file qgsrenderer.cpp.
|
inline |
Returns whether the renderer must render as a raster.
Definition at line 400 of file qgsrenderer.h.
|
inlinevirtual |
If supported by the renderer, return classification attribute for the use in legend.
Reimplemented in QgsGraduatedSymbolRenderer, and QgsCategorizedSymbolRenderer.
Definition at line 342 of file qgsrenderer.h.
|
virtual |
Returns legend keys matching a specified feature.
Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsPointDistanceRenderer, and QgsSingleSymbolRenderer.
Definition at line 86 of file qgsrenderer.cpp.
|
virtual |
items of symbology items in legend is checked
Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.
Definition at line 317 of file qgsrenderer.cpp.
|
virtual |
Returns a list of symbology items for the legend.
Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, QgsPointDistanceRenderer, and QgsSingleSymbolRenderer.
Definition at line 335 of file qgsrenderer.cpp.
|
virtual |
items of symbology items in legend should be checkable
Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.
Definition at line 312 of file qgsrenderer.cpp.
|
static |
create a renderer from XML element
Definition at line 149 of file qgsrenderer.cpp.
|
static |
Create a new renderer according to the information contained in the UserStyle element of a SLD style document.
node | the node in the SLD document whose the UserStyle element is a child |
geomType | the geometry type of the features, used to convert Symbolizer elements |
errorMessage | it will contain the error message if something went wrong |
Definition at line 204 of file qgsrenderer.cpp.
|
virtual |
Allows for a renderer to modify the extent of a feature request prior to rendering.
extent | reference to request's filter extent. Modify extent to change the extent of feature request |
context | render context |
Reimplemented in QgsHeatmapRenderer.
Definition at line 388 of file qgsrenderer.cpp.
QgsFeatureRequest::OrderBy QgsFeatureRenderer::orderBy | ( | ) | const |
Gets the order in which features shall be processed by this renderer.
Definition at line 413 of file qgsrenderer.cpp.
bool QgsFeatureRenderer::orderByEnabled | ( | ) | const |
Returns whether custom ordering will be applied before features are processed by this renderer.
Definition at line 423 of file qgsrenderer.cpp.
|
virtual |
Returns symbol for feature.
The difference compared to symbolForFeature() is that it returns original symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement of a symbol for use in rendering.
Reimplemented in QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsInvertedPolygonRenderer, QgsPointDistanceRenderer, QgsSingleSymbolRenderer, and QgsNullSymbolRenderer.
Definition at line 81 of file qgsrenderer.cpp.
|
virtual |
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
Reimplemented in QgsRuleBasedRenderer, QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.
Definition at line 394 of file qgsrenderer.cpp.
QgsPaintEffect * QgsFeatureRenderer::paintEffect | ( | ) | const |
Returns the current paint effect for the renderer.
Definition at line 402 of file qgsrenderer.cpp.
|
virtual |
Render a feature using this renderer in the given context.
Must be called between startRender() and stopRender() calls. Default implementation renders a symbol as determined by symbolForFeature() call. Returns true if the feature has been returned (this is used for example to determine whether the feature may be labelled).
If layer is not -1, the renderer should draw only a particula layer from symbols (in order to support symbol level rendering).
Reimplemented in QgsRuleBasedRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, QgsHeatmapRenderer, and QgsNullSymbolRenderer.
Definition at line 119 of file qgsrenderer.cpp.
|
protected |
Render the feature with the symbol using context.
Use layer to specify the symbol layer, selected to specify if it should be rendered as selected and drawVertexMarker to specify if vertex markers should be rendered.
Definition at line 133 of file qgsrenderer.cpp.
|
protected |
render editing vertex marker at specified point
Definition at line 351 of file qgsrenderer.cpp.
|
protected |
render editing vertex marker for a polygon
Definition at line 365 of file qgsrenderer.cpp.
|
protected |
render editing vertex marker for a polyline
Definition at line 359 of file qgsrenderer.cpp.
|
virtual |
store renderer info to XML element
Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, QgsSingleSymbolRenderer, QgsHeatmapRenderer, QgsNullSymbolRenderer, QgsPointDisplacementRenderer, Qgs25DRenderer, and QgsPointClusterRenderer.
Definition at line 184 of file qgsrenderer.cpp.
|
virtual |
Sets an embedded renderer (subrenderer) for this feature renderer.
The base class implementation does nothing with subrenderers, but individual derived classes can use these to modify their behavior.
subRenderer | the embedded renderer. Ownership will be transferred. |
Reimplemented in QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.
Definition at line 433 of file qgsrenderer.cpp.
|
inline |
Sets whether the renderer should be rendered to a raster destination.
forceRaster | set to true if renderer must be drawn on a raster surface. This may be desirable for highly detailed layers where rendering as a vector would result in a large, complex vector output. |
Definition at line 410 of file qgsrenderer.h.
|
virtual |
Sets the symbol to be used for a legend symbol item.
key | rule key for legend symbol |
symbol | new symbol for legend item. Ownership is transferred to renderer. |
Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, QgsPointDistanceRenderer, and QgsSingleSymbolRenderer.
Definition at line 329 of file qgsrenderer.cpp.
void QgsFeatureRenderer::setOrderBy | ( | const QgsFeatureRequest::OrderBy & | orderBy | ) |
Define the order in which features shall be processed by this renderer.
Definition at line 418 of file qgsrenderer.cpp.
void QgsFeatureRenderer::setOrderByEnabled | ( | bool | enabled | ) |
Sets whether custom ordering should be applied before features are processed by this renderer.
enabled | set to true to enable custom feature ordering |
Definition at line 428 of file qgsrenderer.cpp.
void QgsFeatureRenderer::setPaintEffect | ( | QgsPaintEffect * | effect | ) |
Sets the current paint effect for the renderer.
effect | paint effect. Ownership is transferred to the renderer. |
Definition at line 407 of file qgsrenderer.cpp.
|
inline |
Definition at line 272 of file qgsrenderer.h.
void QgsFeatureRenderer::setVertexMarkerAppearance | ( | int | type, |
double | size | ||
) |
Sets type and size of editing vertex markers for subsequent rendering.
Definition at line 340 of file qgsrenderer.cpp.
|
virtual |
Must be called when a new render cycle is started.
A call to startRender() must always be followed by a corresponding call to stopRender() after all features have been rendered.
context | Additional information passed to the renderer about the job which will be rendered |
fields | The fields available for rendering |
Reimplemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, QgsHeatmapRenderer, QgsSingleSymbolRenderer, Qgs25DRenderer, and QgsPointClusterRenderer.
Definition at line 93 of file qgsrenderer.cpp.
|
virtual |
Must be called when a render cycle has finished, to allow the renderer to clean up.
Calls to stopRender() must always be preceded by a call to startRender().
Reimplemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, QgsHeatmapRenderer, QgsSingleSymbolRenderer, Qgs25DRenderer, QgsNullSymbolRenderer, and QgsPointClusterRenderer.
Definition at line 107 of file qgsrenderer.cpp.
|
pure virtual |
To be overridden.
Must be called between startRender() and stopRender() calls.
feature | feature |
context | render context |
Implemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsInvertedPolygonRenderer, QgsPointDistanceRenderer, QgsHeatmapRenderer, Qgs25DRenderer, QgsSingleSymbolRenderer, and QgsNullSymbolRenderer.
|
virtual |
Returns list of symbols used by the renderer.
context | render context |
Reimplemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, QgsSingleSymbolRenderer, QgsHeatmapRenderer, Qgs25DRenderer, and QgsNullSymbolRenderer.
Definition at line 143 of file qgsrenderer.cpp.
|
virtual |
Returns list of symbols used for rendering the feature.
For renderers that do not support MoreSymbolsPerFeature it is more efficient to use symbolForFeature()
Reimplemented in QgsRuleBasedRenderer, QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.
Definition at line 380 of file qgsrenderer.cpp.
|
inlinevirtual |
used from subclasses to create SLD Rule elements following SLD v1.1 specs
Reimplemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsPointDistanceRenderer, and QgsSingleSymbolRenderer.
Definition at line 300 of file qgsrenderer.h.
|
inline |
Definition at line 129 of file qgsrenderer.h.
|
pure virtual |
Returns a list of attributes required by this renderer.
Attributes not listed in here may not have been requested from the provider at rendering time.
Implemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, QgsHeatmapRenderer, QgsPointDisplacementRenderer, Qgs25DRenderer, QgsSingleSymbolRenderer, QgsNullSymbolRenderer, and QgsPointClusterRenderer.
|
inline |
Definition at line 271 of file qgsrenderer.h.
|
virtual |
Returns whether the renderer will render a feature or not.
Must be called between startRender() and stopRender() calls. Default implementation uses symbolForFeature().
Reimplemented in QgsRuleBasedRenderer, QgsInvertedPolygonRenderer, QgsPointDistanceRenderer, and QgsNullSymbolRenderer.
Definition at line 346 of file qgsrenderer.cpp.
|
virtual |
create the SLD UserStyle element following the SLD v1.1 specs with the given name
Definition at line 297 of file qgsrenderer.cpp.
|
protected |
The current size of editing marker.
Definition at line 508 of file qgsrenderer.h.
|
protected |
The current type of editing marker.
Definition at line 506 of file qgsrenderer.h.
|
protected |
Definition at line 512 of file qgsrenderer.h.
|
protected |
Definition at line 526 of file qgsrenderer.h.
|
protected |
Definition at line 528 of file qgsrenderer.h.
|
protected |
Definition at line 510 of file qgsrenderer.h.
|
protected |
Definition at line 501 of file qgsrenderer.h.
|
protected |
Definition at line 503 of file qgsrenderer.h.