QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
Public Types | 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>

Public Types

enum  Flag {
  DrawEditingInfo = 0x01, ForceVectorOutput = 0x02, UseAdvancedEffects = 0x04, UseRenderingOptimization = 0x08,
  DrawSelection = 0x10, DrawSymbolBounds = 0x20, RenderMapTile = 0x40, Antialiasing = 0x80,
  RenderPartialOutput = 0x100, RenderPreviewJob = 0x200, RenderBlocking = 0x400
}
 Enumeration of flags that affect rendering operations. More...
 
enum  TextRenderFormat { TextFormatAlwaysOutlines, TextFormatAlwaysText }
 Options for rendering text. More...
 

Public Member Functions

 QgsRenderContext ()
 
 QgsRenderContext (const QgsRenderContext &rh)
 
void clearCustomRenderingFlag (const QString &flag)
 Clears the specified custom rendering flag. More...
 
double convertFromMapUnits (double sizeInMapUnits, QgsUnitTypes::RenderUnit outputUnit) const
 Converts a size from map units to the specified units. More...
 
double convertMetersToMapUnits (double meters) const
 Convert meter distances to active MapUnit values for QgsUnitTypes::RenderMetersInMapUnits. More...
 
double convertToMapUnits (double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
 Converts a size from the specified units to map units. More...
 
double convertToPainterUnits (double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
 Converts a size from the specified units to painter units (pixels). More...
 
QgsCoordinateTransform coordinateTransform () const
 Returns the current coordinate transform for the context. More...
 
int currentMaskId () const
 Returns the current mask id, which can be used with maskPainter() More...
 
QVariantMap customRenderingFlags () const
 Gets custom rendering flags. More...
 
QSet< const QgsSymbolLayer * > disabledSymbolLayers () const
 When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled. More...
 
const QgsDistanceAreadistanceArea () const
 A general purpose distance and area calculator, capable of performing ellipsoid based calculations. More...
 
bool drawEditingInformation () const
 Returns true if edit markers should be drawn during the render operation. More...
 
QgsExpressionContextexpressionContext ()
 Gets the expression context. More...
 
const QgsExpressionContextexpressionContext () const
 Gets the expression context (const version). More...
 
const QgsRectangleextent () const
 When rendering a map layer, calling this method returns the "clipping" extent for the layer (in the layer's CRS). More...
 
const QgsFeatureFilterProviderfeatureFilterProvider () const
 Gets the filter feature provider used for additional filtering of rendered features. More...
 
Flags flags () const
 Returns combination of flags used for rendering. More...
 
bool forceVectorOutput () const
 Returns true if rendering operations should use vector operations instead of any faster raster shortcuts. More...
 
const QgsAbstractGeometrygeometry () const
 Returns pointer to the unsegmentized geometry. More...
 
bool hasRenderedFeatureHandlers () const
 Returns true if the context has any rendered feature handlers. More...
 
bool isGuiPreview () const
 Returns the Gui preview mode. More...
 
bool isSymbolLayerEnabled (const QgsSymbolLayer *layer) const
 When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabled. More...
 
QgsLabelingEnginelabelingEngine () const
 Gets access to new labeling engine (may be nullptr) More...
 
QgsRectangle mapExtent () const
 Returns the original extent of the map being rendered. More...
 
const QgsMapToPixelmapToPixel () const
 Returns the context's map to pixel transform, which transforms between map coordinates and device coordinates. More...
 
const QgsMaskIdProvidermaskIdProvider () const
 Returns the mask id provider attached to the context. More...
 
QPainter * maskPainter (int id=0)
 Returns a mask QPainter for the render operation. More...
 
QgsRenderContextoperator= (const QgsRenderContext &rh)
 
QPainter * painter ()
 Returns the destination QPainter for the render operation. More...
 
const QPainter * painter () const
 Returns the const destination QPainter for the render operation. More...
 
const QgsPathResolverpathResolver () const
 Returns the path resolver for conversion between relative and absolute paths during rendering operations, e.g. More...
 
QList< QgsRenderedFeatureHandlerInterface * > renderedFeatureHandlers () const
 Returns the list of rendered feature handlers to use while rendering map layers. More...
 
double rendererScale () const
 Returns the renderer map scale. More...
 
bool renderingStopped () const
 Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled immediately. More...
 
double scaleFactor () const
 Returns the scaling factor for the render to convert painter units to physical sizes. More...
 
double segmentationTolerance () const
 Gets the segmentation tolerance applied when rendering curved geometries. More...
 
QgsAbstractGeometry::SegmentationToleranceType segmentationToleranceType () const
 Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation) More...
 
QColor selectionColor () const
 Returns the color to use when rendering selected features. More...
 
void setCoordinateTransform (const QgsCoordinateTransform &t)
 Sets the current coordinate transform for the context. More...
 
void setCurrentMaskId (int id)
 Stores a mask id as the "current" one. More...
 
void setCustomRenderingFlag (const QString &flag, const QVariant &value)
 Sets a custom rendering flag. More...
 
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. More...
 
void setDistanceArea (const QgsDistanceArea &distanceArea)
 A general purpose distance and area calculator, capable of performing ellipsoid based calculations. More...
 
void setDrawEditingInformation (bool b)
 Sets whether edit markers should be drawn during the render operation. More...
 
void setExpressionContext (const QgsExpressionContext &context)
 Sets the expression context. More...
 
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). More...
 
void setFeatureFilterProvider (const QgsFeatureFilterProvider *ffp)
 Set a filter feature provider used for additional filtering of rendered features. More...
 
void setFlag (Flag flag, bool on=true)
 Enable or disable a particular flag (other flags are not affected) More...
 
void setFlags (QgsRenderContext::Flags flags)
 Set combination of flags that will be used for rendering. More...
 
void setForceVectorOutput (bool force)
 Sets whether rendering operations should use vector operations instead of any faster raster shortcuts. More...
 
void setGeometry (const QgsAbstractGeometry *geometry)
 Sets pointer to original (unsegmentized) geometry. More...
 
void setIsGuiPreview (bool preview)
 Sets GUI preview mode. More...
 
void setLabelingEngine (QgsLabelingEngine *engine)
 Assign new labeling engine. More...
 
void setMapExtent (const QgsRectangle &extent)
 Sets the original extent of the map being rendered. More...
 
void setMapToPixel (const QgsMapToPixel &mtp)
 Sets the context's map to pixel transform, which transforms between map coordinates and device coordinates. More...
 
void setMaskIdProvider (QgsMaskIdProvider *provider)
 Attaches a mask id provider to the context. More...
 
void setMaskPainter (QPainter *p, int id=0)
 Sets a mask QPainter for the render operation. More...
 
void setPainter (QPainter *p)
 Sets the destination QPainter for the render operation. More...
 
void setPathResolver (const QgsPathResolver &resolver)
 Sets the path resolver for conversion between relative and absolute paths during rendering operations, e.g. More...
 
void setRendererScale (double scale)
 Sets the renderer map scale. More...
 
void setRenderingStopped (bool stopped)
 Sets whether the rendering operation has been stopped and any ongoing rendering should be canceled immediately. More...
 
void setScaleFactor (double factor)
 Sets the scaling factor for the render to convert painter units to physical sizes. More...
 
void setSegmentationTolerance (double tolerance)
 Sets the segmentation tolerance applied when rendering curved geometries. More...
 
void setSegmentationToleranceType (QgsAbstractGeometry::SegmentationToleranceType type)
 Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation) More...
 
void setSelectionColor (const QColor &color)
 Sets the color to use when rendering selected features. More...
 
void setShowSelection (bool showSelection)
 Sets whether vector selections should be shown in the rendered map. More...
 
void setTextRenderFormat (TextRenderFormat format)
 Sets the text render format, which dictates how text is rendered (e.g. More...
 
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. More...
 
void setUseAdvancedEffects (bool enabled)
 Used to enable or disable advanced effects such as blend modes. More...
 
void setUseRenderingOptimization (bool enabled)
 Sets whether the rendering optimization (geometry simplification) should be executed. More...
 
void setVectorSimplifyMethod (const QgsVectorSimplifyMethod &simplifyMethod)
 Sets the simplification setting to use when rendering vector layers. More...
 
bool showSelection () const
 Returns true if vector selections should be shown in the rendered map. More...
 
bool testFlag (Flag flag) const
 Check whether a particular flag is enabled. More...
 
TextRenderFormat textRenderFormat () const
 Returns the text render format, which dictates how text is rendered (e.g. More...
 
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. More...
 
bool useAdvancedEffects () const
 Returns true if advanced effects such as blend modes such be used. More...
 
bool useRenderingOptimization () const
 Returns true if the rendering optimization (geometry simplification) can be executed. More...
 
const QgsVectorSimplifyMethodvectorSimplifyMethod () const
 Returns the simplification settings to use when rendering vector layers. More...
 

Static Public Member Functions

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

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 55 of file qgsrendercontext.h.

Member Enumeration Documentation

◆ Flag

Enumeration of flags that affect rendering operations.

Since
QGIS 2.14
Enumerator
DrawEditingInfo 

Enable drawing of vertex markers for layers in editing mode.

ForceVectorOutput 

Vector graphics should not be cached and drawn as raster images.

UseAdvancedEffects 

Enable layer opacity and blending effects.

UseRenderingOptimization 

Enable vector simplification and other rendering optimizations.

DrawSelection 

Whether vector selections should be shown in the rendered map.

DrawSymbolBounds 

Draw bounds of symbols (for debugging/testing)

RenderMapTile 

Draw map such that there are no problems between adjacent tiles.

Antialiasing 

Use antialiasing while drawing.

RenderPartialOutput 

Whether to make extra effort to update map image with partially rendered layers (better for interactive map canvas). Added in QGIS 3.0.

RenderPreviewJob 

Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering.

RenderBlocking 

Render and load remote sources in the same thread to ensure rendering remote sources (svg and images). WARNING: this flag must NEVER be used from GUI based applications (like the main QGIS application) or crashes will result. Only for use in external scripts or QGIS server.

Definition at line 67 of file qgsrendercontext.h.

◆ TextRenderFormat

Options for rendering text.

Since
QGIS 3.4.3
Enumerator
TextFormatAlwaysOutlines 

Always render text using path objects (AKA outlines/curves).

This setting guarantees the best quality rendering, even when using a raster paint surface (where sub-pixel path based text rendering is superior to sub-pixel text-based rendering). The downside is that text is converted to paths only, so users cannot open created vector outputs for post-processing in other applications and retain text editability.

This setting also guarantees complete compatibility with the full range of formatting options available through QgsTextRenderer and QgsTextFormat, some of which may not be possible to reproduce when using a vector-based paint surface and TextFormatAlwaysText mode.

A final benefit to this setting is that vector exports created using text as outlines do not require all users to have the original fonts installed in order to display the text in its original style.

TextFormatAlwaysText 

Always render text as text objects.

While this mode preserves text objects as text for post-processing in external vector editing applications, it can result in rendering artifacts or poor quality rendering, depending on the text format settings.

Even with raster based paint devices, TextFormatAlwaysText can result in inferior rendering quality to TextFormatAlwaysOutlines.

When rendering using TextFormatAlwaysText to a vector based device (e.g. PDF or SVG), care must be taken to ensure that the required fonts are available to users when opening the created files, or default fallback fonts will be used to display the output instead. (Although PDF exports MAY automatically embed some fonts when possible, depending on the user's platform).

Definition at line 87 of file qgsrendercontext.h.

Constructor & Destructor Documentation

◆ QgsRenderContext() [1/2]

QgsRenderContext::QgsRenderContext ( )

Definition at line 31 of file qgsrendercontext.cpp.

◆ QgsRenderContext() [2/2]

QgsRenderContext::QgsRenderContext ( const QgsRenderContext rh)

Definition at line 40 of file qgsrendercontext.cpp.

Member Function Documentation

◆ clearCustomRenderingFlag()

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

Clears the specified custom rendering flag.

Parameters
flagthe flag name
See also
setCustomRenderingFlag()
Since
QGIS 3.12

Definition at line 784 of file qgsrendercontext.h.

◆ convertFromMapUnits()

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

Converts a size from map units to the specified units.

See also
convertToMapUnits()
Since
QGIS 3.0

Definition at line 405 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
Since
QGIS 3.0

Definition at line 444 of file qgsrendercontext.cpp.

◆ convertToMapUnits()

double QgsRenderContext::convertToMapUnits ( double  size,
QgsUnitTypes::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()
Since
QGIS 3.0

Definition at line 341 of file qgsrendercontext.cpp.

◆ convertToPainterUnits()

double QgsRenderContext::convertToPainterUnits ( double  size,
QgsUnitTypes::RenderUnit  unit,
const QgsMapUnitScale scale = QgsMapUnitScale() 
) const

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

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

See also
convertToMapUnits()
Since
QGIS 3.0

Definition at line 279 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 226 of file qgsrendercontext.h.

◆ 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 736 of file qgsrendercontext.h.

◆ customRenderingFlags()

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()
Since
QGIS 3.12

Definition at line 767 of file qgsrendercontext.h.

◆ disabledSymbolLayers()

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

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

Definition at line 203 of file qgsrendercontext.h.

◆ distanceArea()

const QgsDistanceArea& QgsRenderContext::distanceArea ( ) const
inline

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

Since
QGIS 3.0

Definition at line 232 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 222 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()
Since
QGIS 2.12

Definition at line 577 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
Since
QGIS 2.12

Definition at line 586 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 287 of file qgsrendercontext.h.

◆ 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()
Since
QGIS 2.14

Definition at line 274 of file qgsrendercontext.cpp.

◆ flags()

QgsRenderContext::Flags QgsRenderContext::flags ( ) const

Returns combination of flags used for rendering.

Since
QGIS 2.14

Definition at line 155 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 207 of file qgsrendercontext.cpp.

◆ fromMapSettings()

QgsRenderContext QgsRenderContext::fromMapSettings ( const QgsMapSettings mapSettings)
static

create initialized QgsRenderContext instance from given QgsMapSettings

Since
QGIS 2.4

Definition at line 165 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.

Since
QGIS 3.0

Definition at line 106 of file qgsrendercontext.cpp.

◆ geometry()

const QgsAbstractGeometry* QgsRenderContext::geometry ( ) const
inline

Returns pointer to the unsegmentized geometry.

Definition at line 589 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 704 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 759 of file qgsrendercontext.h.

◆ isSymbolLayerEnabled()

bool QgsRenderContext::isSymbolLayerEnabled ( const QgsSymbolLayer layer) const
inline

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 214 of file qgsrendercontext.h.

◆ labelingEngine()

QgsLabelingEngine* QgsRenderContext::labelingEngine ( ) const
inline

Gets access to new labeling engine (may be nullptr)

Note
not available in Python bindings

Definition at line 364 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 299 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 306 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 721 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 192 of file qgsrendercontext.h.

◆ operator=()

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

Definition at line 72 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 171 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 180 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()
Since
QGIS 3.0

Definition at line 261 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 475 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 358 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.

See also
setRenderingStopped()

Definition at line 322 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 314 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 621 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 635 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 371 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 232 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 728 of file qgsrendercontext.h.

◆ setCustomRenderingFlag()

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()
Since
QGIS 3.12

Definition at line 776 of file qgsrendercontext.h.

◆ setDisabledSymbolLayers()

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

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

Definition at line 492 of file qgsrendercontext.h.

◆ 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

Since
QGIS 3.0

Definition at line 449 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 237 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()
Since
QGIS 2.12

Definition at line 569 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 415 of file qgsrendercontext.h.

◆ 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()
Since
QGIS 2.14

Definition at line 262 of file qgsrendercontext.cpp.

◆ setFlag()

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

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

Since
QGIS 2.14

Definition at line 147 of file qgsrendercontext.cpp.

◆ setFlags()

void QgsRenderContext::setFlags ( QgsRenderContext::Flags  flags)

Set combination of flags that will be used for rendering.

Since
QGIS 2.14

Definition at line 142 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 242 of file qgsrendercontext.cpp.

◆ setGeometry()

void QgsRenderContext::setGeometry ( const QgsAbstractGeometry geometry)
inline

Sets pointer to original (unsegmentized) geometry.

Definition at line 591 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 747 of file qgsrendercontext.h.

◆ setLabelingEngine()

void QgsRenderContext::setLabelingEngine ( QgsLabelingEngine engine)
inline

Assign new labeling engine.

Note
not available in Python bindings

Definition at line 506 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 427 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 401 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 714 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 481 of file qgsrendercontext.h.

◆ 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 472 of file qgsrendercontext.h.

◆ 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()
Since
QGIS 3.0

Definition at line 270 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 464 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.

See also
renderingStopped()

Definition at line 442 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 457 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 615 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 629 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 513 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 247 of file qgsrendercontext.cpp.

◆ setTextRenderFormat()

void QgsRenderContext::setTextRenderFormat ( 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 687 of file qgsrendercontext.h.

◆ 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()
Since
QGIS 3.0

Definition at line 134 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 217 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 257 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()
Since
QGIS 2.4

Definition at line 561 of file qgsrendercontext.h.

◆ 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 227 of file qgsrendercontext.cpp.

◆ testFlag()

bool QgsRenderContext::testFlag ( QgsRenderContext::Flag  flag) const

Check whether a particular flag is enabled.

Since
QGIS 2.14

Definition at line 160 of file qgsrendercontext.cpp.

◆ textRenderFormat()

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 676 of file qgsrendercontext.h.

◆ 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()
Since
QGIS 3.0

Definition at line 125 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 212 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 252 of file qgsrendercontext.cpp.

◆ vectorSimplifyMethod()

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()
Since
QGIS 2.4

Definition at line 546 of file qgsrendercontext.h.


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