QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsRenderContext Class Reference

Contains information about the context of a rendering operation. More...

#include <qgsrendercontext.h>

Inheritance diagram for QgsRenderContext:
Inheritance graph
[legend]

Public Member Functions

 QgsRenderContext ()
 
 QgsRenderContext (const QgsRenderContext &rh)
 
 ~QgsRenderContext () override
 
void addSymbolLayerClipGeometry (const QString &symbolLayerId, const QgsGeometry &geometry)
 Add a clip geometry to be applied to the symbolLayer before rendering.
 
Q_DECL_DEPRECATED void addSymbolLayerClipPath (const QString &symbolLayerId, QPainterPath path)
 Add a clip path to be applied to the symbolLayer before rendering.
 
void clearCustomProperty (const QString &property)
 Clears the specified custom rendering property.
 
Q_DECL_DEPRECATED void clearCustomRenderingFlag (const QString &flag)
 Clears the specified custom rendering flag.
 
QList< QgsMapClippingRegionclippingRegions () const
 Returns the list of clipping regions to apply during the render.
 
double convertFromMapUnits (double sizeInMapUnits, Qgis::RenderUnit outputUnit) const
 Converts a size from map units to the specified units.
 
double convertFromPainterUnits (double size, Qgis::RenderUnit unit) const
 Converts a size from painter units (pixels) to the specified render unit.
 
double convertMetersToMapUnits (double meters) const
 Convert meter distances to active MapUnit values for QgsUnitTypes::RenderMetersInMapUnits.
 
double convertToMapUnits (double size, Qgis::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
 Converts a size from the specified units to map units.
 
double convertToPainterUnits (double size, Qgis::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) const
 Converts a size from the specified units to painter units (pixels).
 
QgsCoordinateTransform coordinateTransform () const
 Returns the current coordinate transform for the context.
 
long long currentFrame () const
 Returns the current frame number of the map (in frames per second), for maps which are part of an animation.
 
int currentMaskId () const
 Returns the current mask id, which can be used with maskPainter()
 
QVariantMap customProperties () const
 Returns custom rendering properties.
 
Q_DECL_DEPRECATED QVariantMap customRenderingFlags () const
 Gets custom rendering flags.
 
QSize deviceOutputSize () const
 Returns the device output size of the render.
 
float devicePixelRatio () const
 Returns the device pixel ratio.
 
Q_DECL_DEPRECATED QSet< const QgsSymbolLayer * > disabledSymbolLayers () const
 When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled.
 
QSet< QString > disabledSymbolLayersV2 () const
 When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled.
 
const QgsDistanceAreadistanceArea () const
 A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
 
double dpiTarget () const
 Returns the targeted DPI for rendering.
 
bool drawEditingInformation () const
 Returns true if edit markers should be drawn during the render operation.
 
QgsElevationMapelevationMap () const
 Returns the destination elevation map for the render operation.
 
QgsExpressionContextexpressionContext ()
 Gets the expression context.
 
const QgsExpressionContextexpressionContext () const
 Gets the expression context (const version).
 
const QgsRectangleextent () const
 When rendering a map layer, calling this method returns the "clipping" extent for the layer (in the layer's CRS).
 
QgsGeometry featureClipGeometry () const
 Returns the geometry to use to clip features at render time.
 
const QgsFeatureFilterProviderfeatureFilterProvider () const
 Gets the filter feature provider used for additional filtering of rendered features.
 
QgsFeedbackfeedback () const
 Returns the feedback object that can be queried regularly during rendering to check if rendering should be canceled, if set.
 
Qgis::RenderContextFlags flags () const
 Returns combination of flags used for rendering.
 
bool forceVectorOutput () const
 Returns true if rendering operations should use vector operations instead of any faster raster shortcuts.
 
double frameRate () const
 Returns the frame rate of the map, for maps which are part of an animation.
 
const QgsAbstractGeometrygeometry () const
 Returns pointer to the unsegmentized geometry.
 
bool hasRenderedFeatureHandlers () const
 Returns true if the context has any rendered feature handlers.
 
QImage::Format imageFormat () const
 Returns the QImage format which should be used for QImages created during rendering.
 
bool isGuiPreview () const
 Returns the Gui preview mode.
 
bool isSymbolLayerEnabled (const QgsSymbolLayer *layer) const
 When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled.
 
QgsLabelingEnginelabelingEngine () const
 Gets access to new labeling engine (may be nullptr).
 
QgsLabelSinklabelSink () const
 Returns the associated label sink, or nullptr if not set.
 
QgsRectangle mapExtent () const
 Returns the original extent of the map being rendered.
 
const QgsMapToPixelmapToPixel () const
 Returns the context's map to pixel transform, which transforms between map coordinates and device coordinates.
 
const QgsMaskIdProvidermaskIdProvider () const
 Returns the mask id provider attached to the context.
 
QPainter * maskPainter (int id=0)
 Returns a mask QPainter for the render operation.
 
QgsMaskRenderSettingsmaskSettings ()
 Returns a reference to the mask render settings, which control how masks are drawn and behave during render operations.
 
const QgsMaskRenderSettingsmaskSettings () const
 Returns a reference to the mask render settings, which control how masks are drawn and behave during render operations.
 
QgsRenderContextoperator= (const QgsRenderContext &rh)
 
QSize outputSize () const
 Returns the size of the resulting rendered image, in pixels.
 
QPainter * painter ()
 Returns the destination QPainter for the render operation.
 
const QPainter * painter () const
 Returns the const destination QPainter for the render operation.
 
const QgsPathResolverpathResolver () const
 Returns the path resolver for conversion between relative and absolute paths during rendering operations, e.g.
 
QPainter * previewRenderPainter ()
 Returns the const destination QPainter for temporary in-progress preview renders.
 
const QPainter * previewRenderPainter () const
 Returns the const destination QPainter for temporary in-progress preview renders.
 
QList< QgsRenderedFeatureHandlerInterface * > renderedFeatureHandlers () const
 Returns the list of rendered feature handlers to use while rendering map layers.
 
double rendererScale () const
 Returns the renderer map scale.
 
Qgis::RendererUsage rendererUsage () const
 Returns the renderer usage.
 
bool renderingStopped () const
 Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled immediately.
 
double scaleFactor () const
 Returns the scaling factor for the render to convert painter units to physical sizes.
 
double segmentationTolerance () const
 Gets the segmentation tolerance applied when rendering curved geometries.
 
QgsAbstractGeometry::SegmentationToleranceType segmentationToleranceType () const
 Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)
 
QColor selectionColor () const
 Returns the color to use when rendering selected features.
 
void setCoordinateTransform (const QgsCoordinateTransform &t)
 Sets the current coordinate transform for the context.
 
void setCurrentFrame (long long frame)
 Sets the current frame of the map, for maps which are part of an animation.
 
void setCurrentMaskId (int id)
 Stores a mask id as the "current" one.
 
void setCustomProperty (const QString &property, const QVariant &value)
 Sets a custom rendering property.
 
Q_DECL_DEPRECATED void setCustomRenderingFlag (const QString &flag, const QVariant &value)
 Sets a custom rendering flag.
 
void setDevicePixelRatio (float ratio)
 Sets the device pixel ratio.
 
Q_DECL_DEPRECATED void setDisabledSymbolLayers (const QSet< const QgsSymbolLayer * > &symbolLayers)
 When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled.
 
void setDisabledSymbolLayersV2 (const QSet< QString > &symbolLayers)
 When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled.
 
void setDistanceArea (const QgsDistanceArea &distanceArea)
 A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
 
void setDpiTarget (double dpi)
 Sets the targeted dpi for rendering.
 
void setDrawEditingInformation (bool b)
 Sets whether edit markers should be drawn during the render operation.
 
void setElevationMap (QgsElevationMap *map)
 Sets the destination elevation map for the render operation.
 
void setExpressionContext (const QgsExpressionContext &context)
 Sets the expression context.
 
void setExtent (const QgsRectangle &extent)
 When rendering a map layer, calling this method sets the "clipping" extent for the layer (in the layer's CRS).
 
void setFeatureClipGeometry (const QgsGeometry &geometry)
 Sets a geometry to use to clip features at render time.
 
void setFeatureFilterProvider (const QgsFeatureFilterProvider *ffp)
 Set a filter feature provider used for additional filtering of rendered features.
 
void setFeedback (QgsFeedback *feedback)
 Attach a feedback object that can be queried regularly during rendering to check if rendering should be canceled.
 
void setFlag (Qgis::RenderContextFlag flag, bool on=true)
 Enable or disable a particular flag (other flags are not affected)
 
void setFlags (Qgis::RenderContextFlags flags)
 Set combination of flags that will be used for rendering.
 
void setForceVectorOutput (bool force)
 Sets whether rendering operations should use vector operations instead of any faster raster shortcuts.
 
void setFrameRate (double rate)
 Sets the frame rate of the map (in frames per second), for maps which are part of an animation.
 
void setGeometry (const QgsAbstractGeometry *geometry)
 Sets pointer to original (unsegmentized) geometry.
 
void setImageFormat (QImage::Format format)
 Sets QImage format which should be used for QImages created during rendering.
 
void setIsGuiPreview (bool preview)
 Sets GUI preview mode.
 
void setLabelingEngine (QgsLabelingEngine *engine)
 Assigns the labeling engine.
 
void setLabelSink (QgsLabelSink *sink)
 Assigns the label sink which will take over responsibility for handling labels.
 
void setMapExtent (const QgsRectangle &extent)
 Sets the original extent of the map being rendered.
 
void setMapToPixel (const QgsMapToPixel &mtp)
 Sets the context's map to pixel transform, which transforms between map coordinates and device coordinates.
 
void setMaskIdProvider (QgsMaskIdProvider *provider)
 Attaches a mask id provider to the context.
 
void setMaskPainter (QPainter *p, int id=0)
 Sets a mask QPainter for the render operation.
 
void setMaskSettings (const QgsMaskRenderSettings &settings)
 Sets the mask render settings, which control how masks are drawn and behave during render operations.
 
void setOutputSize (QSize size)
 Sets the size of the resulting rendered image, in pixels.
 
void setPainter (QPainter *p)
 Sets the destination QPainter for the render operation.
 
void setPainterFlagsUsingContext (QPainter *painter=nullptr) const
 Sets relevant flags on a destination painter, using the flags and settings currently defined for the render context.
 
void setPathResolver (const QgsPathResolver &resolver)
 Sets the path resolver for conversion between relative and absolute paths during rendering operations, e.g.
 
void setPreviewRenderPainter (QPainter *painter)
 Sets the destination painter for temporary in-progress preview renders.
 
void setRendererScale (double scale)
 Sets the renderer map scale.
 
void setRendererUsage (Qgis::RendererUsage usage)
 Sets the renderer usage.
 
void setRenderingStopped (bool stopped)
 Sets whether the rendering operation has been stopped and any ongoing rendering should be canceled immediately.
 
void setScaleFactor (double factor)
 Sets the scaling factor for the render to convert painter units to physical sizes.
 
void setSegmentationTolerance (double tolerance)
 Sets the segmentation tolerance applied when rendering curved geometries.
 
void setSegmentationToleranceType (QgsAbstractGeometry::SegmentationToleranceType type)
 Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)
 
void setSelectionColor (const QColor &color)
 Sets the color to use when rendering selected features.
 
void setShowSelection (bool showSelection)
 Sets whether vector selections should be shown in the rendered map.
 
void setSymbologyReferenceScale (double scale)
 Sets the symbology reference scale.
 
void setTextRenderFormat (Qgis::TextRenderFormat format)
 Sets the text render format, which dictates how text is rendered (e.g.
 
void setTextureOrigin (const QPointF &origin)
 Sets the texture origin, which should be used as a brush transform when rendering using QBrush objects.
 
void setTransformContext (const QgsCoordinateTransformContext &context)
 Sets the context's coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system.
 
void setUseAdvancedEffects (bool enabled)
 Used to enable or disable advanced effects such as blend modes.
 
void setUseRenderingOptimization (bool enabled)
 Sets whether the rendering optimization (geometry simplification) should be executed.
 
void setVectorSimplifyMethod (const QgsVectorSimplifyMethod &simplifyMethod)
 Sets the simplification setting to use when rendering vector layers.
 
void setZRange (const QgsDoubleRange &range)
 Sets the range of z-values which should be rendered.
 
bool showSelection () const
 Returns true if vector selections should be shown in the rendered map.
 
QVector< QgsGeometrysymbolLayerClipGeometries (const QString &symbolLayerId) const
 Returns clipping geometries to be applied to the symbolLayer before rendering.
 
Q_DECL_DEPRECATED QList< QPainterPath > symbolLayerClipPaths (const QString &symbolLayerId) const
 Returns clip paths to be applied to the symbolLayer before rendering.
 
bool symbolLayerHasClipGeometries (const QString &symbolLayerId) const
 Returns true if the symbol layer with matching ID has any associated clip geometries.
 
double symbologyReferenceScale () const
 Returns the symbology reference scale.
 
bool testFlag (Qgis::RenderContextFlag flag) const
 Check whether a particular flag is enabled.
 
Qgis::TextRenderFormat textRenderFormat () const
 Returns the text render format, which dictates how text is rendered (e.g.
 
QPointF textureOrigin () const
 Returns the texture origin, which should be used as a brush transform when rendering using QBrush objects.
 
QgsCoordinateTransformContext transformContext () const
 Returns the context's coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system.
 
bool useAdvancedEffects () const
 Returns true if advanced effects such as blend modes such be used.
 
bool useRenderingOptimization () const
 Returns true if the rendering optimization (geometry simplification) can be executed.
 
QgsVectorSimplifyMethodvectorSimplifyMethod ()
 Returns the simplification settings to use when rendering vector layers.
 
const QgsVectorSimplifyMethodvectorSimplifyMethod () const
 Returns the simplification settings to use when rendering vector layers.
 
QgsDoubleRange zRange () const
 Returns the range of z-values which should be rendered.
 
- Public Member Functions inherited from QgsTemporalRangeObject
 QgsTemporalRangeObject (bool enabled=false)
 Constructor QgsTemporalRangeObject.
 
virtual ~QgsTemporalRangeObject ()=default
 
bool isTemporal () const
 Returns true if the object's temporal range is enabled, and the object will be filtered when rendering maps with a specific time range set.
 
void setIsTemporal (bool enabled)
 Sets whether the temporal range is enabled (i.e.
 
void setTemporalRange (const QgsDateTimeRange &range)
 Sets the temporal range for the object.
 
const QgsDateTimeRangetemporalRange () const
 Returns the datetime range for the object.
 

Static Public Member Functions

static QgsRenderContext fromMapSettings (const QgsMapSettings &mapSettings)
 create initialized QgsRenderContext instance from given QgsMapSettings
 
static QgsRenderContext fromQPainter (QPainter *painter)
 Creates a default render context given a pixel based QPainter destination.
 

Detailed Description

Contains information about the context of a rendering operation.

The context of a rendering operation defines properties such as the conversion ratio between screen and map units, the extents to be rendered etc.

Definition at line 61 of file qgsrendercontext.h.

Constructor & Destructor Documentation

◆ QgsRenderContext() [1/2]

QgsRenderContext::QgsRenderContext ( )

Definition at line 32 of file qgsrendercontext.cpp.

◆ ~QgsRenderContext()

QgsRenderContext::~QgsRenderContext ( )
overridedefault

◆ QgsRenderContext() [2/2]

QgsRenderContext::QgsRenderContext ( const QgsRenderContext rh)

Definition at line 43 of file qgsrendercontext.cpp.

Member Function Documentation

◆ addSymbolLayerClipGeometry()

void QgsRenderContext::addSymbolLayerClipGeometry ( const QString &  symbolLayerId,
const QgsGeometry geometry 
)

Add a clip geometry to be applied to the symbolLayer before rendering.

See also
symbolLayerClipGeometries()
Since
QGIS 3.38

Definition at line 870 of file qgsrendercontext.cpp.

◆ addSymbolLayerClipPath()

void QgsRenderContext::addSymbolLayerClipPath ( const QString &  symbolLayerId,
QPainterPath  path 
)

Add a clip path to be applied to the symbolLayer before rendering.

See also
addSymbolLayerClipGeometry()
Deprecated:
QGIS 3.38. Use addSymbolLayerClipGeometry() instead.

Definition at line 851 of file qgsrendercontext.cpp.

◆ clearCustomProperty()

void QgsRenderContext::clearCustomProperty ( const QString &  property)
inline

Clears the specified custom rendering property.

See also
setCustomProperty()
Since
QGIS 3.40

Definition at line 923 of file qgsrendercontext.h.

◆ clearCustomRenderingFlag()

Q_DECL_DEPRECATED void QgsRenderContext::clearCustomRenderingFlag ( const QString &  flag)
inline

Clears the specified custom rendering flag.

Parameters
flagthe flag name
See also
setCustomRenderingFlag()
Deprecated:
QGIS 3.40. Use clearCustomProperty() instead.

Definition at line 915 of file qgsrendercontext.h.

◆ clippingRegions()

QList< QgsMapClippingRegion > QgsRenderContext::clippingRegions ( ) const

Returns the list of clipping regions to apply during the render.

These regions are always in the final destination CRS for the map.

Since
QGIS 3.16

Definition at line 756 of file qgsrendercontext.cpp.

◆ convertFromMapUnits()

double QgsRenderContext::convertFromMapUnits ( double  sizeInMapUnits,
Qgis::RenderUnit  outputUnit 
) const

Converts a size from map units to the specified units.

See also
convertToMapUnits()

Definition at line 623 of file qgsrendercontext.cpp.

◆ convertFromPainterUnits()

double QgsRenderContext::convertFromPainterUnits ( double  size,
Qgis::RenderUnit  unit 
) const

Converts a size from painter units (pixels) to the specified render unit.

See also
convertToPainterUnits()
convertToMapUnits()
Since
QGIS 3.40

Definition at line 495 of file qgsrendercontext.cpp.

◆ convertMetersToMapUnits()

double QgsRenderContext::convertMetersToMapUnits ( double  meters) const

Convert meter distances to active MapUnit values for QgsUnitTypes::RenderMetersInMapUnits.

Note
When the sourceCrs() is geographic, the center of the Extent will be used

Definition at line 663 of file qgsrendercontext.cpp.

◆ convertToMapUnits()

double QgsRenderContext::convertToMapUnits ( double  size,
Qgis::RenderUnit  unit,
const QgsMapUnitScale scale = QgsMapUnitScale() 
) const

Converts a size from the specified units to map units.

The conversion respects the limits specified by the optional scale parameter.

See also
convertToPainterUnits()

Definition at line 557 of file qgsrendercontext.cpp.

◆ convertToPainterUnits()

double QgsRenderContext::convertToPainterUnits ( double  size,
Qgis::RenderUnit  unit,
const QgsMapUnitScale scale = QgsMapUnitScale(),
Qgis::RenderSubcomponentProperty  property = Qgis::RenderSubcomponentProperty::Generic 
) const

Converts a size from the specified units to painter units (pixels).

The conversion respects the limits specified by the optional scale parameter.

Since QGIS 3.22 the optional property argument can be used to specify the associated property. This is used in some contexts to refine the converted size. For example, a Qgis::RenderSubcomponentProperty::BlurSize property will be limited to a suitably fast range when the render context has the Qgis::RenderContextFlag::RenderSymbolPreview set.

See also
convertFromPainterUnits()
convertToMapUnits()

Definition at line 387 of file qgsrendercontext.cpp.

◆ coordinateTransform()

QgsCoordinateTransform QgsRenderContext::coordinateTransform ( ) const
inline

Returns the current coordinate transform for the context.

This represents the coordinate transform required to transform a layer which is being rendered back to the CRS of the rendered map. If no coordinate transformation is required, or the render context is not associated with a map layer render, then an invalid coordinate transformation is returned.

See also
setCoordinateTransform()

Definition at line 234 of file qgsrendercontext.h.

◆ currentFrame()

long long QgsRenderContext::currentFrame ( ) const

Returns the current frame number of the map (in frames per second), for maps which are part of an animation.

Returns -1 if the map is not associated with an animation.

See also
setCurrentFrame()
Since
QGIS 3.26

Definition at line 831 of file qgsrendercontext.cpp.

◆ currentMaskId()

int QgsRenderContext::currentMaskId ( ) const
inline

Returns the current mask id, which can be used with maskPainter()

See also
setCurrentMaskId()
maskPainter()
Since
QGIS 3.12

Definition at line 847 of file qgsrendercontext.h.

◆ customProperties()

QVariantMap QgsRenderContext::customProperties ( ) const
inline

Returns custom rendering properties.

Objects might honour these to alter their rendering.

See also
setCustomProperty()
Since
QGIS 3.40

Definition at line 888 of file qgsrendercontext.h.

◆ customRenderingFlags()

Q_DECL_DEPRECATED QVariantMap QgsRenderContext::customRenderingFlags ( ) const
inline

Gets custom rendering flags.

Layers might honour these to alter their rendering.

Returns
a map of custom flags
See also
setCustomRenderingFlag()
Deprecated:
QGIS 3.40. Use customProperties() instead.

Definition at line 878 of file qgsrendercontext.h.

◆ deviceOutputSize()

QSize QgsRenderContext::deviceOutputSize ( ) const

Returns the device output size of the render.

This is equivalent to the output size multiplicated by the device pixel ratio.

See also
outputSize()
devicePixelRatio()
setOutputSize()
Since
QGIS 3.22

Definition at line 816 of file qgsrendercontext.cpp.

◆ devicePixelRatio()

float QgsRenderContext::devicePixelRatio ( ) const

Returns the device pixel ratio.

Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays.

See also
setDevicePixelRatio()
Since
QGIS 3.22

Definition at line 806 of file qgsrendercontext.cpp.

◆ disabledSymbolLayers()

QSet< const QgsSymbolLayer * > QgsRenderContext::disabledSymbolLayers ( ) const

When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled.

Returns the list of disabled symbol layers.

See also
setDisabledSymbolLayers()
isSymbolLayerEnabled()
Since
QGIS 3.12
Deprecated:
QGIS 3.30. And replaced with disabledSymbolLayersV2.

Definition at line 907 of file qgsrendercontext.cpp.

◆ disabledSymbolLayersV2()

QSet< QString > QgsRenderContext::disabledSymbolLayersV2 ( ) const

When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled.

Returns the list of disabled symbol layer ids.

See also
setDisabledSymbolLayers()
isSymbolLayerEnabled()
Since
QGIS 3.30

Definition at line 912 of file qgsrendercontext.cpp.

◆ distanceArea()

const QgsDistanceArea & QgsRenderContext::distanceArea ( ) const
inline

A general purpose distance and area calculator, capable of performing ellipsoid based calculations.

Definition at line 239 of file qgsrendercontext.h.

◆ dpiTarget()

double QgsRenderContext::dpiTarget ( ) const
inline

Returns the targeted DPI for rendering.

See also
setDpiTarget()
Since
QGIS 3.20

Definition at line 325 of file qgsrendercontext.h.

◆ drawEditingInformation()

bool QgsRenderContext::drawEditingInformation ( ) const

Returns true if edit markers should be drawn during the render operation.

See also
setDrawEditingInformation()

Definition at line 330 of file qgsrendercontext.cpp.

◆ elevationMap()

QgsElevationMap * QgsRenderContext::elevationMap ( ) const

Returns the destination elevation map for the render operation.

See also
setElevationMap()
Since
QGIS 3.30

Definition at line 841 of file qgsrendercontext.cpp.

◆ expressionContext() [1/2]

QgsExpressionContext & QgsRenderContext::expressionContext ( )
inline

Gets the expression context.

This context should be used for all expression evaluation associated with this render context.

See also
setExpressionContext()

Definition at line 681 of file qgsrendercontext.h.

◆ expressionContext() [2/2]

const QgsExpressionContext & QgsRenderContext::expressionContext ( ) const
inline

Gets the expression context (const version).

This context should be used for all expression evaluation associated with this render context.

See also
setExpressionContext()
Note
not available in Python bindings

Definition at line 689 of file qgsrendercontext.h.

◆ extent()

const QgsRectangle & QgsRenderContext::extent ( ) const
inline

When rendering a map layer, calling this method returns the "clipping" extent for the layer (in the layer's CRS).

This extent is a "worst-case" scenario, which is guaranteed to cover the complete visible portion of the layer when it is rendered to a map. It is often larger than the actual visible portion of that layer.

Warning
For some layers, depending on the visible extent and the coordinate transforms involved, this extent will represent the entire globe. This method should never be used to determine the actual visible extent of a map render.
See also
setExtent()
mapExtent()

Definition at line 290 of file qgsrendercontext.h.

◆ featureClipGeometry()

QgsGeometry QgsRenderContext::featureClipGeometry ( ) const

Returns the geometry to use to clip features at render time.

When vector features are rendered, they should be clipped to this geometry.

Warning
The clipping must take effect for rendering the feature's symbol only, and should never be applied directly to the feature being rendered. Doing so would impact the results of rendering rules which rely on feature geometry, such as a rule-based renderer using the feature's area.
See also
setFeatureClipGeometry()
Since
QGIS 3.16

Definition at line 761 of file qgsrendercontext.cpp.

◆ featureFilterProvider()

const QgsFeatureFilterProvider * QgsRenderContext::featureFilterProvider ( ) const

Gets the filter feature provider used for additional filtering of rendered features.

Returns
the filter feature provider
See also
setFeatureFilterProvider()

Definition at line 382 of file qgsrendercontext.cpp.

◆ feedback()

QgsFeedback * QgsRenderContext::feedback ( ) const

Returns the feedback object that can be queried regularly during rendering to check if rendering should be canceled, if set.

Maybe be nullptr.

See also
setFeedback()
Since
QGIS 3.22

Definition at line 218 of file qgsrendercontext.cpp.

◆ flags()

Qgis::RenderContextFlags QgsRenderContext::flags ( ) const

Returns combination of flags used for rendering.

Definition at line 236 of file qgsrendercontext.cpp.

◆ forceVectorOutput()

bool QgsRenderContext::forceVectorOutput ( ) const

Returns true if rendering operations should use vector operations instead of any faster raster shortcuts.

See also
setForceVectorOutput()

Definition at line 315 of file qgsrendercontext.cpp.

◆ frameRate()

double QgsRenderContext::frameRate ( ) const

Returns the frame rate of the map, for maps which are part of an animation.

Returns -1 if the map is not associated with an animation.

See also
setFrameRate()
Since
QGIS 3.26

Definition at line 821 of file qgsrendercontext.cpp.

◆ fromMapSettings()

QgsRenderContext QgsRenderContext::fromMapSettings ( const QgsMapSettings mapSettings)
static

create initialized QgsRenderContext instance from given QgsMapSettings

Definition at line 246 of file qgsrendercontext.cpp.

◆ fromQPainter()

QgsRenderContext QgsRenderContext::fromQPainter ( QPainter *  painter)
static

Creates a default render context given a pixel based QPainter destination.

If no painter is specified or the painter has no device, then a default DPI of 88 will be assumed.

Definition at line 160 of file qgsrendercontext.cpp.

◆ geometry()

const QgsAbstractGeometry * QgsRenderContext::geometry ( ) const
inline

Returns pointer to the unsegmentized geometry.

Definition at line 692 of file qgsrendercontext.h.

◆ hasRenderedFeatureHandlers()

bool QgsRenderContext::hasRenderedFeatureHandlers ( ) const
inline

Returns true if the context has any rendered feature handlers.

See also
renderedFeatureHandlers()
Since
QGIS 3.10

Definition at line 815 of file qgsrendercontext.h.

◆ imageFormat()

QImage::Format QgsRenderContext::imageFormat ( ) const
inline

Returns the QImage format which should be used for QImages created during rendering.

See also
setImageFormat
Since
QGIS 3.22

Definition at line 1130 of file qgsrendercontext.h.

◆ isGuiPreview()

bool QgsRenderContext::isGuiPreview ( ) const
inline

Returns the Gui preview mode.

GUI preview mode is used to change the behavior of some renderings when they are done to preview of symbology in the GUI. This is especially used to display mask symbol layers rather than painting them in a mask painter, which is not meant to be visible, by definition.

See also
isGuiPreview
setIsGuiPreview
Since
QGIS 3.12

Definition at line 870 of file qgsrendercontext.h.

◆ isSymbolLayerEnabled()

bool QgsRenderContext::isSymbolLayerEnabled ( const QgsSymbolLayer layer) const

When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled.

Checks whether a given symbol layer has been disabled for the current pass.

See also
setDisabledSymbolLayers()
disabledSymbolLayers()
Since
QGIS 3.12

Definition at line 917 of file qgsrendercontext.cpp.

◆ labelingEngine()

QgsLabelingEngine * QgsRenderContext::labelingEngine ( ) const
inline

Gets access to new labeling engine (may be nullptr).

Note
Not available in Python bindings.

Definition at line 419 of file qgsrendercontext.h.

◆ labelSink()

QgsLabelSink * QgsRenderContext::labelSink ( ) const
inline

Returns the associated label sink, or nullptr if not set.

Note
Not available in Python bindings.
Since
QGIS 3.24

Definition at line 426 of file qgsrendercontext.h.

◆ mapExtent()

QgsRectangle QgsRenderContext::mapExtent ( ) const
inline

Returns the original extent of the map being rendered.

Unlike extent(), this extent is always in the final destination CRS for the map render and represents the exact bounds of the map being rendered.

See also
extent()
setMapExtent()
Since
QGIS 3.4.8

Definition at line 302 of file qgsrendercontext.h.

◆ mapToPixel()

const QgsMapToPixel & QgsRenderContext::mapToPixel ( ) const
inline

Returns the context's map to pixel transform, which transforms between map coordinates and device coordinates.

See also
setMapToPixel()

Definition at line 309 of file qgsrendercontext.h.

◆ maskIdProvider()

const QgsMaskIdProvider * QgsRenderContext::maskIdProvider ( ) const
inline

Returns the mask id provider attached to the context.

See also
setMaskIdProvider()
Since
QGIS 3.12

Definition at line 832 of file qgsrendercontext.h.

◆ maskPainter()

QPainter * QgsRenderContext::maskPainter ( int  id = 0)
inline

Returns a mask QPainter for the render operation.

Multiple mask painters can be defined, each with a unique identifier. nullptr is returned if a mask painter with the given identifier does not exist. This is currently used to implement selective masking.

See also
setMaskPainter()
currentMaskId()
Since
QGIS 3.12

Definition at line 163 of file qgsrendercontext.h.

◆ maskSettings() [1/2]

QgsMaskRenderSettings & QgsRenderContext::maskSettings ( )
inline

Returns a reference to the mask render settings, which control how masks are drawn and behave during render operations.

See also
setMaskSettings()
Since
QGIS 3.38

Definition at line 995 of file qgsrendercontext.h.

◆ maskSettings() [2/2]

const QgsMaskRenderSettings & QgsRenderContext::maskSettings ( ) const
inline

Returns a reference to the mask render settings, which control how masks are drawn and behave during render operations.

See also
setMaskSettings()
Since
QGIS 3.38

Definition at line 986 of file qgsrendercontext.h.

◆ operator=()

QgsRenderContext & QgsRenderContext::operator= ( const QgsRenderContext rh)

Definition at line 101 of file qgsrendercontext.cpp.

◆ outputSize()

QSize QgsRenderContext::outputSize ( ) const

Returns the size of the resulting rendered image, in pixels.

See also
deviceOutputSize()
setOutputSize()
Since
QGIS 3.22

Definition at line 796 of file qgsrendercontext.cpp.

◆ painter() [1/2]

QPainter * QgsRenderContext::painter ( )
inline

Returns the destination QPainter for the render operation.

See also
setPainter()

Definition at line 108 of file qgsrendercontext.h.

◆ painter() [2/2]

const QPainter * QgsRenderContext::painter ( ) const
inline

Returns the const destination QPainter for the render operation.

See also
setPainter()
Since
QGIS 3.12

Definition at line 117 of file qgsrendercontext.h.

◆ pathResolver()

const QgsPathResolver & QgsRenderContext::pathResolver ( ) const
inline

Returns the path resolver for conversion between relative and absolute paths during rendering operations, e.g.

for resolving relative symbol paths.

See also
setPathResolver()

Definition at line 265 of file qgsrendercontext.h.

◆ previewRenderPainter() [1/2]

QPainter * QgsRenderContext::previewRenderPainter ( )
inline

Returns the const destination QPainter for temporary in-progress preview renders.

May be nullptr if temporary in-progress preview renders are not required.

See also
setPreviewRenderPainter()
Since
QGIS 3.34

Definition at line 128 of file qgsrendercontext.h.

◆ previewRenderPainter() [2/2]

const QPainter * QgsRenderContext::previewRenderPainter ( ) const
inline

Returns the const destination QPainter for temporary in-progress preview renders.

May be nullptr if temporary in-progress preview renders are not required.

See also
setPreviewRenderPainter()
Since
QGIS 3.34

Definition at line 140 of file qgsrendercontext.h.

◆ renderedFeatureHandlers()

QList< QgsRenderedFeatureHandlerInterface * > QgsRenderContext::renderedFeatureHandlers ( ) const

Returns the list of rendered feature handlers to use while rendering map layers.

See also
hasRenderedFeatureHandlers()
Since
QGIS 3.10

Definition at line 751 of file qgsrendercontext.cpp.

◆ rendererScale()

double QgsRenderContext::rendererScale ( ) const
inline

Returns the renderer map scale.

This will match the desired scale denominator for the rendered map, eg 1000.0 for a 1:1000 map render.

See also
setRendererScale()

Definition at line 395 of file qgsrendercontext.h.

◆ rendererUsage()

Qgis::RendererUsage QgsRenderContext::rendererUsage ( ) const
inline

Returns the renderer usage.

See also
setRendererUsage()
Since
QGIS 3.24

Definition at line 1138 of file qgsrendercontext.h.

◆ renderingStopped()

bool QgsRenderContext::renderingStopped ( ) const
inline

Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled immediately.

Note
Since QGIS 3.22 the feedback() member exists as an alternative means of cancellation support.
See also
setRenderingStopped()
feedback()

Definition at line 336 of file qgsrendercontext.h.

◆ scaleFactor()

double QgsRenderContext::scaleFactor ( ) const
inline

Returns the scaling factor for the render to convert painter units to physical sizes.

This is usually equal to the number of pixels per millimeter.

See also
setScaleFactor()

Definition at line 317 of file qgsrendercontext.h.

◆ segmentationTolerance()

double QgsRenderContext::segmentationTolerance ( ) const
inline

Gets the segmentation tolerance applied when rendering curved geometries.

See also
setSegmentationTolerance()

Definition at line 722 of file qgsrendercontext.h.

◆ segmentationToleranceType()

QgsAbstractGeometry::SegmentationToleranceType QgsRenderContext::segmentationToleranceType ( ) const
inline

Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)

See also
setSegmentationToleranceType()

Definition at line 736 of file qgsrendercontext.h.

◆ selectionColor()

QColor QgsRenderContext::selectionColor ( ) const
inline

Returns the color to use when rendering selected features.

See also
setSelectionColor()

Definition at line 433 of file qgsrendercontext.h.

◆ setCoordinateTransform()

void QgsRenderContext::setCoordinateTransform ( const QgsCoordinateTransform t)

Sets the current coordinate transform for the context.

This represents the coordinate transform required to transform the layer which is being rendered back to the CRS of the rendered map.

Set to an invalid QgsCoordinateTransform to indicate that no transformation is required.

See also
coordinateTransform()

Definition at line 340 of file qgsrendercontext.cpp.

◆ setCurrentFrame()

void QgsRenderContext::setCurrentFrame ( long long  frame)

Sets the current frame of the map, for maps which are part of an animation.

Defaults to -1 if the map is not associated with an animation.

See also
currentFrame()
Since
QGIS 3.26

Definition at line 836 of file qgsrendercontext.cpp.

◆ setCurrentMaskId()

void QgsRenderContext::setCurrentMaskId ( int  id)
inline

Stores a mask id as the "current" one.

See also
currentMaskId()
Since
QGIS 3.12

Definition at line 839 of file qgsrendercontext.h.

◆ setCustomProperty()

void QgsRenderContext::setCustomProperty ( const QString &  property,
const QVariant &  value 
)
inline

Sets a custom rendering property.

Objects might honour these to alter their rendering.

See also
customProperties()
Since
QGIS 3.40

Definition at line 907 of file qgsrendercontext.h.

◆ setCustomRenderingFlag()

Q_DECL_DEPRECATED void QgsRenderContext::setCustomRenderingFlag ( const QString &  flag,
const QVariant &  value 
)
inline

Sets a custom rendering flag.

Layers might honour these to alter their rendering.

Parameters
flagthe flag name
valuethe flag value
See also
customRenderingFlags()
Deprecated:
QGIS 3.40. Use setCustomProperty() instead.

Definition at line 897 of file qgsrendercontext.h.

◆ setDevicePixelRatio()

void QgsRenderContext::setDevicePixelRatio ( float  ratio)

Sets the device pixel ratio.

Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays.

See also
devicePixelRatio()
Since
QGIS 3.22

Definition at line 811 of file qgsrendercontext.cpp.

◆ setDisabledSymbolLayers()

void QgsRenderContext::setDisabledSymbolLayers ( const QSet< const QgsSymbolLayer * > &  symbolLayers)

When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled.

Sets the list of disabled symbol layers.

See also
disabledSymbolLayers()
isSymbolLayerEnabled()
Since
QGIS 3.12
Deprecated:
QGIS 3.30. And replaced with setDisabledSymbolLayersV2.

Definition at line 895 of file qgsrendercontext.cpp.

◆ setDisabledSymbolLayersV2()

void QgsRenderContext::setDisabledSymbolLayersV2 ( const QSet< QString > &  symbolLayers)

When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled.

Sets the list of disabled symbol layer ids.

See also
disabledSymbolLayersV2()
isSymbolLayerEnabled()
Since
QGIS 3.30

Definition at line 902 of file qgsrendercontext.cpp.

◆ setDistanceArea()

void QgsRenderContext::setDistanceArea ( const QgsDistanceArea distanceArea)
inline

A general purpose distance and area calculator, capable of performing ellipsoid based calculations.

Will be used to convert meter distances to active MapUnit values for QgsUnitTypes::RenderMetersInMapUnits

Definition at line 514 of file qgsrendercontext.h.

◆ setDpiTarget()

void QgsRenderContext::setDpiTarget ( double  dpi)
inline

Sets the targeted dpi for rendering.

See also
dpiTarget()
Since
QGIS 3.20

Definition at line 530 of file qgsrendercontext.h.

◆ setDrawEditingInformation()

void QgsRenderContext::setDrawEditingInformation ( bool  b)

Sets whether edit markers should be drawn during the render operation.

See also
drawEditingInformation()

Definition at line 345 of file qgsrendercontext.cpp.

◆ setElevationMap()

void QgsRenderContext::setElevationMap ( QgsElevationMap map)

Sets the destination elevation map for the render operation.

Ownership of the elevation map is not transferred and the QgsElevationMap destination must stay alive for the duration of any rendering operations.

See also
elevationMap()
Since
QGIS 3.30

Definition at line 846 of file qgsrendercontext.cpp.

◆ setExpressionContext()

void QgsRenderContext::setExpressionContext ( const QgsExpressionContext context)
inline

Sets the expression context.

This context is used for all expression evaluation associated with this render context.

See also
expressionContext()

Definition at line 674 of file qgsrendercontext.h.

◆ setExtent()

void QgsRenderContext::setExtent ( const QgsRectangle extent)
inline

When rendering a map layer, calling this method sets the "clipping" extent for the layer (in the layer's CRS).

This extent should be a "worst-case" scenario, which is guaranteed to completely cover the entire visible portion of the layer when it is rendered to the map. It may be larger than the actual visible area, but MUST contain at least the entire visible area.

See also
setExtent()
setMapExtent()

Definition at line 477 of file qgsrendercontext.h.

◆ setFeatureClipGeometry()

void QgsRenderContext::setFeatureClipGeometry ( const QgsGeometry geometry)

Sets a geometry to use to clip features at render time.

Note
This is not usually set directly, but rather specified by calling QgsMapSettings:addClippingRegion() prior to constructing a QgsRenderContext.
See also
featureClipGeometry()
Since
QGIS 3.16

Definition at line 766 of file qgsrendercontext.cpp.

◆ setFeatureFilterProvider()

void QgsRenderContext::setFeatureFilterProvider ( const QgsFeatureFilterProvider ffp)

Set a filter feature provider used for additional filtering of rendered features.

Parameters
ffpthe filter feature provider
See also
featureFilterProvider()

Definition at line 370 of file qgsrendercontext.cpp.

◆ setFeedback()

void QgsRenderContext::setFeedback ( QgsFeedback feedback)

Attach a feedback object that can be queried regularly during rendering to check if rendering should be canceled.

Ownership of feedback is NOT transferred, and the caller must take care that it exists for the lifetime of the render context.

See also
feedback()
Since
QGIS 3.22

Definition at line 213 of file qgsrendercontext.cpp.

◆ setFlag()

void QgsRenderContext::setFlag ( Qgis::RenderContextFlag  flag,
bool  on = true 
)

Enable or disable a particular flag (other flags are not affected)

Definition at line 228 of file qgsrendercontext.cpp.

◆ setFlags()

void QgsRenderContext::setFlags ( Qgis::RenderContextFlags  flags)

Set combination of flags that will be used for rendering.

Definition at line 223 of file qgsrendercontext.cpp.

◆ setForceVectorOutput()

void QgsRenderContext::setForceVectorOutput ( bool  force)

Sets whether rendering operations should use vector operations instead of any faster raster shortcuts.

See also
forceVectorOutput()

Definition at line 350 of file qgsrendercontext.cpp.

◆ setFrameRate()

void QgsRenderContext::setFrameRate ( double  rate)

Sets the frame rate of the map (in frames per second), for maps which are part of an animation.

Defaults to -1 if the map is not associated with an animation.

See also
frameRate()
Since
QGIS 3.26

Definition at line 826 of file qgsrendercontext.cpp.

◆ setGeometry()

void QgsRenderContext::setGeometry ( const QgsAbstractGeometry geometry)
inline

Sets pointer to original (unsegmentized) geometry.

Definition at line 694 of file qgsrendercontext.h.

◆ setImageFormat()

void QgsRenderContext::setImageFormat ( QImage::Format  format)
inline

Sets QImage format which should be used for QImages created during rendering.

See also
imageFormat()
Since
QGIS 3.22

Definition at line 1121 of file qgsrendercontext.h.

◆ setIsGuiPreview()

void QgsRenderContext::setIsGuiPreview ( bool  preview)
inline

Sets GUI preview mode.

GUI preview mode is used to change the behavior of some renderings when they are done to preview of symbology in the GUI. This is especially used to display mask symbol layers rather than painting them in a mask painter, which is not meant to be visible, by definition.

See also
isGuiPreview
Since
QGIS 3.12

Definition at line 858 of file qgsrendercontext.h.

◆ setLabelingEngine()

void QgsRenderContext::setLabelingEngine ( QgsLabelingEngine engine)
inline

Assigns the labeling engine.

Note
Not available in Python bindings.

Definition at line 597 of file qgsrendercontext.h.

◆ setLabelSink()

void QgsRenderContext::setLabelSink ( QgsLabelSink sink)
inline

Assigns the label sink which will take over responsibility for handling labels.

Note
Ownership is not transferred and the sink must exist for the lifetime of the map rendering job.
Not available in Python bindings.
Since
QGIS 3.24

Definition at line 605 of file qgsrendercontext.h.

◆ setMapExtent()

void QgsRenderContext::setMapExtent ( const QgsRectangle extent)
inline

Sets the original extent of the map being rendered.

Unlike setExtent(), this extent is always in the final destination CRS for the map render and represents the exact bounds of the map being rendered.

See also
mapExtent()
setExtent()
Since
QGIS 3.4.8

Definition at line 489 of file qgsrendercontext.h.

◆ setMapToPixel()

void QgsRenderContext::setMapToPixel ( const QgsMapToPixel mtp)
inline

Sets the context's map to pixel transform, which transforms between map coordinates and device coordinates.

See also
mapToPixel()

Definition at line 463 of file qgsrendercontext.h.

◆ setMaskIdProvider()

void QgsRenderContext::setMaskIdProvider ( QgsMaskIdProvider provider)
inline

Attaches a mask id provider to the context.

It will allow some rendering operations to set the current mask id based on the context (label layer names and label rules for instance).

See also
QgsMaskIdProvider
setCurrentMaskId()
maskIdProvider()
Since
QGIS 3.12

Definition at line 825 of file qgsrendercontext.h.

◆ setMaskPainter()

void QgsRenderContext::setMaskPainter ( QPainter *  p,
int  id = 0 
)
inline

Sets a mask QPainter for the render operation.

Ownership of the painter is not transferred and the QPainter must stay alive for the duration of any rendering operations. Multiple mask painters can be defined and the second parameter gives a unique identifier to each one.

See also
maskPainter()

Definition at line 583 of file qgsrendercontext.h.

◆ setMaskSettings()

void QgsRenderContext::setMaskSettings ( const QgsMaskRenderSettings settings)

Sets the mask render settings, which control how masks are drawn and behave during render operations.

See also
maskSettings()
Since
QGIS 3.38

Definition at line 781 of file qgsrendercontext.cpp.

◆ setOutputSize()

void QgsRenderContext::setOutputSize ( QSize  size)

Sets the size of the resulting rendered image, in pixels.

See also
outputSize()
Since
QGIS 3.22

Definition at line 801 of file qgsrendercontext.cpp.

◆ setPainter()

void QgsRenderContext::setPainter ( QPainter *  p)
inline

Sets the destination QPainter for the render operation.

Ownership of the painter is not transferred and the QPainter destination must stay alive for the duration of any rendering operations.

See also
painter()

Definition at line 562 of file qgsrendercontext.h.

◆ setPainterFlagsUsingContext()

void QgsRenderContext::setPainterFlagsUsingContext ( QPainter *  painter = nullptr) const

Sets relevant flags on a destination painter, using the flags and settings currently defined for the render context.

If no painter is specified, then the flags will be applied to the render context's painter().

Since
QGIS 3.16

Definition at line 183 of file qgsrendercontext.cpp.

◆ setPathResolver()

void QgsRenderContext::setPathResolver ( const QgsPathResolver resolver)
inline

Sets the path resolver for conversion between relative and absolute paths during rendering operations, e.g.

for resolving relative symbol paths.

See also
pathResolver()

Definition at line 273 of file qgsrendercontext.h.

◆ setPreviewRenderPainter()

void QgsRenderContext::setPreviewRenderPainter ( QPainter *  painter)
inline

Sets the destination painter for temporary in-progress preview renders.

Ownership of painter is not transferred and the QPainter destination must stay alive for the duration of any rendering operations.

painter may be nullptr if temporary in-progress preview renders are not required.

See also
previewRenderPainter()
Since
QGIS 3.34

Definition at line 574 of file qgsrendercontext.h.

◆ setRendererScale()

void QgsRenderContext::setRendererScale ( double  scale)
inline

Sets the renderer map scale.

This should match the desired scale denominator for the rendered map, eg 1000.0 for a 1:1000 map render.

See also
rendererScale()

Definition at line 537 of file qgsrendercontext.h.

◆ setRendererUsage()

void QgsRenderContext::setRendererUsage ( Qgis::RendererUsage  usage)
inline

Sets the renderer usage.

Note
This usage not alter how the map gets rendered but the intention is that data provider knows the context of rendering and may report that to the backend.
See also
rendererUsage()
Since
QGIS 3.24

Definition at line 1149 of file qgsrendercontext.h.

◆ setRenderingStopped()

void QgsRenderContext::setRenderingStopped ( bool  stopped)
inline

Sets whether the rendering operation has been stopped and any ongoing rendering should be canceled immediately.

Note
Since QGIS 3.22 the feedback() member exists as an alternative means of cancellation support.
See also
renderingStopped()
feedback()
setFeedback()

Definition at line 508 of file qgsrendercontext.h.

◆ setScaleFactor()

void QgsRenderContext::setScaleFactor ( double  factor)
inline

Sets the scaling factor for the render to convert painter units to physical sizes.

This should usually be equal to the number of pixels per millimeter.

See also
scaleFactor()

Definition at line 522 of file qgsrendercontext.h.

◆ setSegmentationTolerance()

void QgsRenderContext::setSegmentationTolerance ( double  tolerance)
inline

Sets the segmentation tolerance applied when rendering curved geometries.

Parameters
tolerancethe segmentation tolerance
See also
segmentationTolerance()
segmentationToleranceType()

Definition at line 716 of file qgsrendercontext.h.

◆ setSegmentationToleranceType()

void QgsRenderContext::setSegmentationToleranceType ( QgsAbstractGeometry::SegmentationToleranceType  type)
inline

Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)

Parameters
typethe segmentation tolerance typename
See also
segmentationToleranceType()
segmentationTolerance()

Definition at line 730 of file qgsrendercontext.h.

◆ setSelectionColor()

void QgsRenderContext::setSelectionColor ( const QColor &  color)
inline

Sets the color to use when rendering selected features.

See also
selectionColor()

Definition at line 612 of file qgsrendercontext.h.

◆ setShowSelection()

void QgsRenderContext::setShowSelection ( bool  showSelection)

Sets whether vector selections should be shown in the rendered map.

Parameters
showSelectionset to true if selections should be shown
See also
showSelection
setSelectionColor
Since
QGIS v2.4

Definition at line 355 of file qgsrendercontext.cpp.

◆ setSymbologyReferenceScale()

void QgsRenderContext::setSymbologyReferenceScale ( double  scale)
inline

Sets the symbology reference scale.

This should match the desired scale denominator for the rendered map, eg 1000.0 for a 1:1000 map render. Set to -1 to disable symbology scaling by reference scale.

The symbology reference scale is an optional property which specifies the reference scale at which symbology in paper units (such a millimeters or points) is fixed to. For instance, if scale is set to 1000 then a 2mm thick line will be rendered at exactly 2mm thick when a map is rendered at 1:1000, or 1mm thick when rendered at 1:2000, or 4mm thick at 1:500.

See also
symbologyReferenceScale()
rendererScale()
Since
QGIS 3.22

Definition at line 554 of file qgsrendercontext.h.

◆ setTextRenderFormat()

void QgsRenderContext::setTextRenderFormat ( Qgis::TextRenderFormat  format)
inline

Sets the text render format, which dictates how text is rendered (e.g.

as paths or real text objects).

See also
textRenderFormat()
Since
QGIS 3.4.3

Definition at line 798 of file qgsrendercontext.h.

◆ setTextureOrigin()

void QgsRenderContext::setTextureOrigin ( const QPointF &  origin)

Sets the texture origin, which should be used as a brush transform when rendering using QBrush objects.

See also
textureOrigin()
Since
QGIS 3.16

Definition at line 776 of file qgsrendercontext.cpp.

◆ setTransformContext()

void QgsRenderContext::setTransformContext ( const QgsCoordinateTransformContext context)

Sets the context's coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system.

See also
transformContext()

Definition at line 205 of file qgsrendercontext.cpp.

◆ setUseAdvancedEffects()

void QgsRenderContext::setUseAdvancedEffects ( bool  enabled)

Used to enable or disable advanced effects such as blend modes.

See also
useAdvancedEffects()

Definition at line 325 of file qgsrendercontext.cpp.

◆ setUseRenderingOptimization()

void QgsRenderContext::setUseRenderingOptimization ( bool  enabled)

Sets whether the rendering optimization (geometry simplification) should be executed.

See also
useRenderingOptimization()

Definition at line 365 of file qgsrendercontext.cpp.

◆ setVectorSimplifyMethod()

void QgsRenderContext::setVectorSimplifyMethod ( const QgsVectorSimplifyMethod simplifyMethod)
inline

Sets the simplification setting to use when rendering vector layers.

This can be used to specify simplification methods to apply during map exports and renders, e.g. to allow vector layers to be simplified to an appropriate maximum level of detail during PDF exports or to speed up layer rendering

The default is to use no simplification.

See also
vectorSimplifyMethod()

Definition at line 667 of file qgsrendercontext.h.

◆ setZRange()

void QgsRenderContext::setZRange ( const QgsDoubleRange range)

Sets the range of z-values which should be rendered.

See also
zRange()
Since
QGIS 3.18

Definition at line 791 of file qgsrendercontext.cpp.

◆ showSelection()

bool QgsRenderContext::showSelection ( ) const

Returns true if vector selections should be shown in the rendered map.

Returns
true if selections should be shown
See also
setShowSelection
selectionColor
Since
QGIS v2.4

Definition at line 335 of file qgsrendercontext.cpp.

◆ symbolLayerClipGeometries()

QVector< QgsGeometry > QgsRenderContext::symbolLayerClipGeometries ( const QString &  symbolLayerId) const

Returns clipping geometries to be applied to the symbolLayer before rendering.

See also
symbolLayerHasClipGeometries()
addSymbolLayerClipGeometry()
Since
QGIS 3.38

Definition at line 890 of file qgsrendercontext.cpp.

◆ symbolLayerClipPaths()

QList< QPainterPath > QgsRenderContext::symbolLayerClipPaths ( const QString &  symbolLayerId) const

Returns clip paths to be applied to the symbolLayer before rendering.

See also
symbolLayerClipGeometries()
Deprecated:
QGIS 3.38. Use symbolLayerClipGeometries() instead.

Definition at line 858 of file qgsrendercontext.cpp.

◆ symbolLayerHasClipGeometries()

bool QgsRenderContext::symbolLayerHasClipGeometries ( const QString &  symbolLayerId) const

Returns true if the symbol layer with matching ID has any associated clip geometries.

See also
symbolLayerClipGeometries()
Since
QGIS 3.38

Definition at line 882 of file qgsrendercontext.cpp.

◆ symbologyReferenceScale()

double QgsRenderContext::symbologyReferenceScale ( ) const
inline

Returns the symbology reference scale.

This represents the desired scale denominator for the rendered map, eg 1000.0 for a 1:1000 map render. A value of -1 indicates that symbology scaling by reference scale is disabled.

The symbology reference scale is an optional property which specifies the reference scale at which symbology in paper units (such a millimeters or points) is fixed to. For instance, if the scale is 1000 then a 2mm thick line will be rendered at exactly 2mm thick when a map is rendered at 1:1000, or 1mm thick when rendered at 1:2000, or 4mm thick at 1:500.

See also
setSymbologyReferenceScale()
rendererScale()
Since
QGIS 3.22

Definition at line 413 of file qgsrendercontext.h.

◆ testFlag()

bool QgsRenderContext::testFlag ( Qgis::RenderContextFlag  flag) const

Check whether a particular flag is enabled.

Definition at line 241 of file qgsrendercontext.cpp.

◆ textRenderFormat()

Qgis::TextRenderFormat QgsRenderContext::textRenderFormat ( ) const
inline

Returns the text render format, which dictates how text is rendered (e.g.

as paths or real text objects).

See also
setTextRenderFormat()
Since
QGIS 3.4.3

Definition at line 787 of file qgsrendercontext.h.

◆ textureOrigin()

QPointF QgsRenderContext::textureOrigin ( ) const

Returns the texture origin, which should be used as a brush transform when rendering using QBrush objects.

See also
setTextureOrigin()
Since
QGIS 3.16

Definition at line 771 of file qgsrendercontext.cpp.

◆ transformContext()

QgsCoordinateTransformContext QgsRenderContext::transformContext ( ) const

Returns the context's coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system.

See also
setTransformContext()

Definition at line 196 of file qgsrendercontext.cpp.

◆ useAdvancedEffects()

bool QgsRenderContext::useAdvancedEffects ( ) const

Returns true if advanced effects such as blend modes such be used.

See also
setUseAdvancedEffects()

Definition at line 320 of file qgsrendercontext.cpp.

◆ useRenderingOptimization()

bool QgsRenderContext::useRenderingOptimization ( ) const

Returns true if the rendering optimization (geometry simplification) can be executed.

See also
setUseRenderingOptimization()

Definition at line 360 of file qgsrendercontext.cpp.

◆ vectorSimplifyMethod() [1/2]

QgsVectorSimplifyMethod & QgsRenderContext::vectorSimplifyMethod ( )
inline

Returns the simplification settings to use when rendering vector layers.

The default is to use no simplification.

See also
setVectorSimplifyMethod()

Definition at line 644 of file qgsrendercontext.h.

◆ vectorSimplifyMethod() [2/2]

const QgsVectorSimplifyMethod & QgsRenderContext::vectorSimplifyMethod ( ) const
inline

Returns the simplification settings to use when rendering vector layers.

The default is to use no simplification.

See also
setVectorSimplifyMethod()

Definition at line 653 of file qgsrendercontext.h.

◆ zRange()

QgsDoubleRange QgsRenderContext::zRange ( ) const

Returns the range of z-values which should be rendered.

See also
setZRange()
Since
QGIS 3.18

Definition at line 786 of file qgsrendercontext.cpp.


The documentation for this class was generated from the following files: