Subgroup: other

Class: QgsInvertedPolygonRenderer

class qgis.core.QgsInvertedPolygonRenderer

Bases: qgis._core.QgsFeatureRenderer

QgsInvertedPolygonRenderer is a polygon-only feature renderer used to display features inverted, where the exterior is turned to an interior and where the exterior theoretically spans the entire plane, allowing to mask the surroundings of some features.

It is designed on top of another feature renderer, which is called “embedded” Most of the methods are then only proxies to the embedded renderer.

Features are collected to form one “inverted” polygon during renderFeature() and rendered on stopRender().

New in version 2.4: Methods

capabilities Proxy that will call this method on the embedded renderer.
checkLegendSymbolItem
clone Direct copies are forbidden.
convertFromRenderer Creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer.
convertSymbolRotation
convertSymbolSizeScale
copyRendererData
create Creates a renderer out of an XML, for loading
defaultRenderer return a new renderer - used by default in vector layers
dump
embeddedRenderer
filter If a renderer does not require all the features this method may be overridden and return an expression used as where clause.
filterNeedsGeometry Returns true if this renderer requires the geometry to apply the filter.
forceRasterRender Returns whether the renderer must render as a raster.
legendClassificationAttribute If supported by the renderer, return classification attribute for the use in legend
legendKeysForFeature Return legend keys matching a specified feature.
legendSymbolItemChecked
legendSymbolItems Proxy that will call this method on the embedded renderer.
legendSymbolItemsCheckable
load create a renderer from XML element
loadSld Create a new renderer according to the information contained in
modifyRequestExtent Allows for a renderer to modify the extent of a feature request prior to rendering
orderBy Get the order in which features shall be processed by this renderer.
orderByEnabled Returns whether custom ordering will be applied before features are processed by this renderer.
originalSymbolForFeature Proxy that will call this method on the embedded renderer.
originalSymbolsForFeature Proxy that will call this method on the embedded renderer.
paintEffect Returns the current paint effect for the renderer.
preprocessingEnabled
return:true if the geometries are to be preprocessed (merged with an union) before rendering.
renderFeature Renders a given feature.
renderFeatureWithSymbol
renderVertexMarker
renderVertexMarkerPolygon
renderVertexMarkerPolyline
save
setEmbeddedRenderer
setForceRasterRender Sets whether the renderer should be rendered to a raster destination.
setLegendSymbolItem
setOrderBy Define the order in which features shall be processed by this renderer.
setOrderByEnabled Sets whether custom ordering should be applied before features are processed by this renderer.
setPaintEffect Sets the current paint effect for the renderer.
setPreprocessingEnabled
param enabled:enables or disables the preprocessing.
setUsingSymbolLevels
setVertexMarkerAppearance set type and size of editing vertex markers for subsequent rendering
startRender
stopRender The actual rendering will take place here.
symbolForFeature Proxy that will call this method on the embedded renderer.
symbols Proxy that will call this method on the embedded renderer.
symbolsForFeature Proxy that will call this method on the embedded renderer.
toSld used from subclasses to create SLD Rule elements following SLD v1.1 specs
type
usedAttributes Proxy that will call this method on the embedded renderer.
usingSymbolLevels
willRenderFeature Proxy that will call this method on the embedded renderer.
writeSld create the SLD UserStyle element following the SLD v1.1 specs with the given name

Attributes

Filter
MoreSymbolsPerFeature
ScaleDependent
SymbolLevels
capabilities(self) → QgsFeatureRenderer.Capabilities

Proxy that will call this method on the embedded renderer.

checkLegendSymbolItem(self, key: str, state: bool = True)
clone(self) → QgsInvertedPolygonRenderer

Direct copies are forbidden. Use clone() instead.

convertFromRenderer(renderer: QgsFeatureRenderer) → QgsInvertedPolygonRenderer

Creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer.

Returns:a new renderer if the conversion was possible, otherwise 0.

New in version 2.5.

convertSymbolRotation()
convertSymbolSizeScale()
copyRendererData()
create(element: QDomElement, context: QgsReadWriteContext) → QgsFeatureRenderer

Creates a renderer out of an XML, for loading

dump(self) → str
embeddedRenderer(self) → QgsFeatureRenderer
legendSymbolItemChecked(self, key: str) → bool
legendSymbolItems(self) → object

Proxy that will call this method on the embedded renderer.

legendSymbolItemsCheckable(self) → bool
originalSymbolForFeature(self, feat: QgsFeature, context: QgsRenderContext) → QgsSymbol

Proxy that will call this method on the embedded renderer.

originalSymbolsForFeature(self, feat: QgsFeature, context: QgsRenderContext) → object

Proxy that will call this method on the embedded renderer.

preprocessingEnabled(self) → bool
Returns:true if the geometries are to be preprocessed (merged with an union) before rendering.
renderFeature(self, feature: QgsFeature, context: QgsRenderContext, layer: int = -1, selected: bool = False, drawVertexMarker: bool = False) → bool

Renders a given feature. This will here collect features. The actual rendering will be postponed to stopRender()

Parameters:
  • feature – the feature to render
  • context – the rendering context
  • layer – the symbol layer to render, if that makes sense
  • selected – whether this feature has been selected (this will add decorations)
  • drawVertexMarker – whether this feature has vertex markers (in edit mode usually)
Returns:

true if the rendering was OK

renderFeatureWithSymbol()
renderVertexMarker()
renderVertexMarkerPolygon()
renderVertexMarkerPolyline()
save(self, doc: QDomDocument, context: QgsReadWriteContext) → QDomElement
setEmbeddedRenderer(self, subRenderer: QgsFeatureRenderer)
setLegendSymbolItem(self, key: str, symbol: QgsSymbol)
setPreprocessingEnabled(self, enabled: bool)
Parameters:enabled – enables or disables the preprocessing.

When enabled, geometries will be merged with an union before being rendered. It allows fixing some rendering artifacts (when rendering overlapping polygons for instance). This will involve some CPU-demanding computations and is thus disabled by default.

startRender(self, context: QgsRenderContext, fields: QgsFields)
stopRender(self, context: QgsRenderContext)

The actual rendering will take place here. Features collected during renderFeature() are rendered using the embedded feature renderer

symbolForFeature(self, feature: QgsFeature, context: QgsRenderContext) → QgsSymbol

Proxy that will call this method on the embedded renderer.

symbols(self, context: QgsRenderContext) → object

Proxy that will call this method on the embedded renderer.

symbolsForFeature(self, feat: QgsFeature, context: QgsRenderContext) → object

Proxy that will call this method on the embedded renderer.

usedAttributes(self, context: QgsRenderContext) → Set[str]

Proxy that will call this method on the embedded renderer.

willRenderFeature(self, feat: QgsFeature, context: QgsRenderContext) → bool

Proxy that will call this method on the embedded renderer.