QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Contains information about the context of a rendering operation. More...
#include <qgsrendercontext.h>
Public Member Functions | |
QgsRenderContext () | |
QgsRenderContext (const QgsRenderContext &rh) | |
~QgsRenderContext () override | |
void | addSymbolLayerClipPath (const QgsSymbolLayer *symbolLayer, QPainterPath path) |
Add a clip path to be applied to the symbolLayer before rendering. More... | |
void | clearCustomRenderingFlag (const QString &flag) |
Clears the specified custom rendering flag. More... | |
QList< QgsMapClippingRegion > | clippingRegions () const |
Returns the list of clipping regions to apply during the render. 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(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) 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... | |
long long | currentFrame () const |
Returns the current frame number of the map (in frames per second), for maps which are part of an animation. More... | |
int | currentMaskId () const |
Returns the current mask id, which can be used with maskPainter() More... | |
QVariantMap | customRenderingFlags () const |
Gets custom rendering flags. More... | |
QSize | deviceOutputSize () const |
Returns the device output size of the render. More... | |
float | devicePixelRatio () const |
Returns the device pixel ratio. 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 QgsDistanceArea & | distanceArea () const |
A general purpose distance and area calculator, capable of performing ellipsoid based calculations. More... | |
double | dpiTarget () const |
Returns the targeted DPI for rendering. More... | |
bool | drawEditingInformation () const |
Returns true if edit markers should be drawn during the render operation. More... | |
QgsExpressionContext & | expressionContext () |
Gets the expression context. More... | |
const QgsExpressionContext & | expressionContext () const |
Gets the expression context (const version). More... | |
const QgsRectangle & | extent () const |
When rendering a map layer, calling this method returns the "clipping" extent for the layer (in the layer's CRS). More... | |
QgsGeometry | featureClipGeometry () const |
Returns the geometry to use to clip features at render time. More... | |
const QgsFeatureFilterProvider * | featureFilterProvider () const |
Gets the filter feature provider used for additional filtering of rendered features. More... | |
QgsFeedback * | feedback () const |
Returns the feedback object that can be queried regularly during rendering to check if rendering should be canceled, if set. More... | |
Qgis::RenderContextFlags | 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... | |
double | frameRate () const |
Returns the frame rate of the map, for maps which are part of an animation. More... | |
const QgsAbstractGeometry * | geometry () const |
Returns pointer to the unsegmentized geometry. More... | |
bool | hasRenderedFeatureHandlers () const |
Returns true if the context has any rendered feature handlers. More... | |
QImage::Format | imageFormat () const |
Returns the QImage format which should be used for QImages created during rendering. 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... | |
QgsLabelingEngine * | labelingEngine () const |
Gets access to new labeling engine (may be nullptr ). More... | |
QgsLabelSink * | labelSink () const |
Returns the associated label sink, or nullptr if not set. More... | |
QgsRectangle | mapExtent () const |
Returns the original extent of the map being rendered. More... | |
const QgsMapToPixel & | mapToPixel () const |
Returns the context's map to pixel transform, which transforms between map coordinates and device coordinates. More... | |
const QgsMaskIdProvider * | maskIdProvider () 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... | |
QgsRenderContext & | operator= (const QgsRenderContext &rh) |
QSize | outputSize () const |
Returns the size of the resulting rendered image, in pixels. More... | |
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 QgsPathResolver & | pathResolver () 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... | |
Qgis::RendererUsage | rendererUsage () const |
Returns the renderer usage. 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 | setCurrentFrame (long long frame) |
Sets the current frame of the map, for maps which are part of an animation. 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 | setDevicePixelRatio (float ratio) |
Sets the device pixel ratio. 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 | setDpiTarget (double dpi) |
Sets the targeted dpi for rendering. 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 | setFeatureClipGeometry (const QgsGeometry &geometry) |
Sets a geometry to use to clip features at render time. More... | |
void | setFeatureFilterProvider (const QgsFeatureFilterProvider *ffp) |
Set a filter feature provider used for additional filtering of rendered features. More... | |
void | setFeedback (QgsFeedback *feedback) |
Attach a feedback object that can be queried regularly during rendering to check if rendering should be canceled. More... | |
void | setFlag (Qgis::RenderContextFlag flag, bool on=true) |
Enable or disable a particular flag (other flags are not affected) More... | |
void | setFlags (Qgis::RenderContextFlags 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 | setFrameRate (double rate) |
Sets the frame rate of the map (in frames per second), for maps which are part of an animation. More... | |
void | setGeometry (const QgsAbstractGeometry *geometry) |
Sets pointer to original (unsegmentized) geometry. More... | |
void | setImageFormat (QImage::Format format) |
Sets QImage format which should be used for QImages created during rendering. More... | |
void | setIsGuiPreview (bool preview) |
Sets GUI preview mode. More... | |
void | setLabelingEngine (QgsLabelingEngine *engine) |
Assigns the labeling engine. More... | |
void | setLabelSink (QgsLabelSink *sink) |
Assigns the label sink which will take over responsibility for handling labels. 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 | setOutputSize (QSize size) |
Sets the size of the resulting rendered image, in pixels. More... | |
void | setPainter (QPainter *p) |
Sets the destination QPainter for the render operation. More... | |
void | setPainterFlagsUsingContext (QPainter *painter=nullptr) const |
Sets relevant flags on a destination painter, using the flags and settings currently defined for the render context. 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 | setRendererUsage (Qgis::RendererUsage usage) |
Sets the renderer usage. 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 | setSymbologyReferenceScale (double scale) |
Sets the symbology reference scale. More... | |
void | setTextRenderFormat (Qgis::TextRenderFormat format) |
Sets the text render format, which dictates how text is rendered (e.g. More... | |
void | setTextureOrigin (const QPointF &origin) |
Sets the texture origin, which should be used as a brush transform when rendering using QBrush objects. 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... | |
void | setZRange (const QgsDoubleRange &range) |
Sets the range of z-values which should be rendered. More... | |
bool | showSelection () const |
Returns true if vector selections should be shown in the rendered map. More... | |
QList< QPainterPath > | symbolLayerClipPaths (const QgsSymbolLayer *symbolLayer) const |
Returns clip paths to be applied to the symbolLayer before rendering. More... | |
double | symbologyReferenceScale () const |
Returns the symbology reference scale. More... | |
bool | testFlag (Qgis::RenderContextFlag flag) const |
Check whether a particular flag is enabled. More... | |
Qgis::TextRenderFormat | textRenderFormat () const |
Returns the text render format, which dictates how text is rendered (e.g. More... | |
QPointF | textureOrigin () const |
Returns the texture origin, which should be used as a brush transform when rendering using QBrush objects. 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 QgsVectorSimplifyMethod & | vectorSimplifyMethod () const |
Returns the simplification settings to use when rendering vector layers. More... | |
QgsDoubleRange | zRange () const |
Returns the range of z-values which should be rendered. More... | |
![]() | |
QgsTemporalRangeObject (bool enabled=false) | |
Constructor QgsTemporalRangeObject. More... | |
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. More... | |
void | setIsTemporal (bool enabled) |
Sets whether the temporal range is enabled (i.e. More... | |
void | setTemporalRange (const QgsDateTimeRange &range) |
Sets the temporal range for the object. More... | |
const QgsDateTimeRange & | temporalRange () const |
Returns the datetime range for the object. 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... | |
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 59 of file qgsrendercontext.h.
QgsRenderContext::QgsRenderContext | ( | ) |
Definition at line 31 of file qgsrendercontext.cpp.
|
overridedefault |
QgsRenderContext::QgsRenderContext | ( | const QgsRenderContext & | rh | ) |
Definition at line 42 of file qgsrendercontext.cpp.
void QgsRenderContext::addSymbolLayerClipPath | ( | const QgsSymbolLayer * | symbolLayer, |
QPainterPath | path | ||
) |
Add a clip path to be applied to the symbolLayer before rendering.
Definition at line 705 of file qgsrendercontext.cpp.
|
inline |
Clears the specified custom rendering flag.
flag | the flag name |
Definition at line 837 of file qgsrendercontext.h.
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.
Definition at line 625 of file qgsrendercontext.cpp.
double QgsRenderContext::convertFromMapUnits | ( | double | sizeInMapUnits, |
QgsUnitTypes::RenderUnit | outputUnit | ||
) | const |
Converts a size from map units to the specified units.
Definition at line 541 of file qgsrendercontext.cpp.
double QgsRenderContext::convertMetersToMapUnits | ( | double | meters | ) | const |
Convert meter distances to active MapUnit values for QgsUnitTypes::RenderMetersInMapUnits.
Definition at line 581 of file qgsrendercontext.cpp.
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.
Definition at line 475 of file qgsrendercontext.cpp.
double QgsRenderContext::convertToPainterUnits | ( | double | size, |
QgsUnitTypes::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.
Definition at line 367 of file qgsrendercontext.cpp.
|
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.
Definition at line 178 of file qgsrendercontext.h.
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.
Definition at line 695 of file qgsrendercontext.cpp.
|
inline |
Returns the current mask id, which can be used with maskPainter()
Definition at line 789 of file qgsrendercontext.h.
|
inline |
Gets custom rendering flags.
Layers might honour these to alter their rendering.
Definition at line 820 of file qgsrendercontext.h.
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.
Definition at line 680 of file qgsrendercontext.cpp.
float QgsRenderContext::devicePixelRatio | ( | ) | const |
Returns the device pixel ratio.
Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays.
Definition at line 670 of file qgsrendercontext.cpp.
|
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.
Definition at line 155 of file qgsrendercontext.h.
|
inline |
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
Definition at line 184 of file qgsrendercontext.h.
|
inline |
Returns the targeted DPI for rendering.
Definition at line 274 of file qgsrendercontext.h.
bool QgsRenderContext::drawEditingInformation | ( | ) | const |
Returns true
if edit markers should be drawn during the render operation.
Definition at line 310 of file qgsrendercontext.cpp.
|
inline |
Gets the expression context.
This context should be used for all expression evaluation associated with this render context.
Definition at line 625 of file qgsrendercontext.h.
|
inline |
Gets the expression context (const version).
This context should be used for all expression evaluation associated with this render context.
Definition at line 634 of file qgsrendercontext.h.
|
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.
Definition at line 239 of file qgsrendercontext.h.
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.
Definition at line 630 of file qgsrendercontext.cpp.
const QgsFeatureFilterProvider * QgsRenderContext::featureFilterProvider | ( | ) | const |
Gets the filter feature provider used for additional filtering of rendered features.
Definition at line 362 of file qgsrendercontext.cpp.
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
.
Definition at line 206 of file qgsrendercontext.cpp.
Qgis::RenderContextFlags QgsRenderContext::flags | ( | ) | const |
Returns combination of flags used for rendering.
Definition at line 224 of file qgsrendercontext.cpp.
bool QgsRenderContext::forceVectorOutput | ( | ) | const |
Returns true
if rendering operations should use vector operations instead of any faster raster shortcuts.
Definition at line 295 of file qgsrendercontext.cpp.
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.
Definition at line 685 of file qgsrendercontext.cpp.
|
static |
create initialized QgsRenderContext instance from given QgsMapSettings
Definition at line 234 of file qgsrendercontext.cpp.
|
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 143 of file qgsrendercontext.cpp.
|
inline |
Returns pointer to the unsegmentized geometry.
Definition at line 637 of file qgsrendercontext.h.
|
inline |
Returns true
if the context has any rendered feature handlers.
Definition at line 757 of file qgsrendercontext.h.
|
inline |
Returns the QImage format which should be used for QImages created during rendering.
Definition at line 992 of file qgsrendercontext.h.
|
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.
Definition at line 812 of file qgsrendercontext.h.
|
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.
Definition at line 166 of file qgsrendercontext.h.
|
inline |
Gets access to new labeling engine (may be nullptr
).
Definition at line 368 of file qgsrendercontext.h.
|
inline |
Returns the associated label sink, or nullptr
if not set.
Definition at line 375 of file qgsrendercontext.h.
|
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.
Definition at line 251 of file qgsrendercontext.h.
|
inline |
Returns the context's map to pixel transform, which transforms between map coordinates and device coordinates.
Definition at line 258 of file qgsrendercontext.h.
|
inline |
Returns the mask id provider attached to the context.
Definition at line 774 of file qgsrendercontext.h.
|
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.
Definition at line 144 of file qgsrendercontext.h.
QgsRenderContext & QgsRenderContext::operator= | ( | const QgsRenderContext & | rh | ) |
Definition at line 91 of file qgsrendercontext.cpp.
QSize QgsRenderContext::outputSize | ( | ) | const |
Returns the size of the resulting rendered image, in pixels.
Definition at line 660 of file qgsrendercontext.cpp.
|
inline |
Returns the destination QPainter for the render operation.
Definition at line 112 of file qgsrendercontext.h.
|
inline |
Returns the const destination QPainter for the render operation.
Definition at line 121 of file qgsrendercontext.h.
|
inline |
Returns the path resolver for conversion between relative and absolute paths during rendering operations, e.g.
for resolving relative symbol paths.
Definition at line 213 of file qgsrendercontext.h.
QList< QgsRenderedFeatureHandlerInterface * > QgsRenderContext::renderedFeatureHandlers | ( | ) | const |
Returns the list of rendered feature handlers to use while rendering map layers.
Definition at line 620 of file qgsrendercontext.cpp.
|
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.
Definition at line 344 of file qgsrendercontext.h.
|
inline |
Returns the renderer usage.
Definition at line 1000 of file qgsrendercontext.h.
|
inline |
Returns true
if the rendering operation has been stopped and any ongoing rendering should be canceled immediately.
Definition at line 285 of file qgsrendercontext.h.
|
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.
Definition at line 266 of file qgsrendercontext.h.
|
inline |
Gets the segmentation tolerance applied when rendering curved geometries.
Definition at line 669 of file qgsrendercontext.h.
|
inline |
Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)
Definition at line 683 of file qgsrendercontext.h.
|
inline |
Returns the color to use when rendering selected features.
Definition at line 382 of file qgsrendercontext.h.
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.
Definition at line 320 of file qgsrendercontext.cpp.
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.
Definition at line 700 of file qgsrendercontext.cpp.
|
inline |
Stores a mask id as the "current" one.
Definition at line 781 of file qgsrendercontext.h.
|
inline |
Sets a custom rendering flag.
Layers might honour these to alter their rendering.
flag | the flag name |
value | the flag value |
Definition at line 829 of file qgsrendercontext.h.
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.
Definition at line 675 of file qgsrendercontext.cpp.
|
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.
Definition at line 532 of file qgsrendercontext.h.
|
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 464 of file qgsrendercontext.h.
|
inline |
Sets the targeted dpi for rendering.
Definition at line 480 of file qgsrendercontext.h.
void QgsRenderContext::setDrawEditingInformation | ( | bool | b | ) |
Sets whether edit markers should be drawn during the render operation.
Definition at line 325 of file qgsrendercontext.cpp.
|
inline |
Sets the expression context.
This context is used for all expression evaluation associated with this render context.
Definition at line 617 of file qgsrendercontext.h.
|
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.
Definition at line 426 of file qgsrendercontext.h.
void QgsRenderContext::setFeatureClipGeometry | ( | const QgsGeometry & | geometry | ) |
Sets a geometry to use to clip features at render time.
Definition at line 635 of file qgsrendercontext.cpp.
void QgsRenderContext::setFeatureFilterProvider | ( | const QgsFeatureFilterProvider * | ffp | ) |
Set a filter feature provider used for additional filtering of rendered features.
ffp | the filter feature provider |
Definition at line 350 of file qgsrendercontext.cpp.
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.
Definition at line 201 of file qgsrendercontext.cpp.
void QgsRenderContext::setFlag | ( | Qgis::RenderContextFlag | flag, |
bool | on = true |
||
) |
Enable or disable a particular flag (other flags are not affected)
Definition at line 216 of file qgsrendercontext.cpp.
void QgsRenderContext::setFlags | ( | Qgis::RenderContextFlags | flags | ) |
Set combination of flags that will be used for rendering.
Definition at line 211 of file qgsrendercontext.cpp.
void QgsRenderContext::setForceVectorOutput | ( | bool | force | ) |
Sets whether rendering operations should use vector operations instead of any faster raster shortcuts.
Definition at line 330 of file qgsrendercontext.cpp.
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.
Definition at line 690 of file qgsrendercontext.cpp.
|
inline |
Sets pointer to original (unsegmentized) geometry.
Definition at line 639 of file qgsrendercontext.h.
|
inline |
Sets QImage format which should be used for QImages created during rendering.
Definition at line 983 of file qgsrendercontext.h.
|
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.
Definition at line 800 of file qgsrendercontext.h.
|
inline |
Assigns the labeling engine.
Definition at line 546 of file qgsrendercontext.h.
|
inline |
Assigns the label sink which will take over responsibility for handling labels.
Definition at line 554 of file qgsrendercontext.h.
|
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.
Definition at line 438 of file qgsrendercontext.h.
|
inline |
Sets the context's map to pixel transform, which transforms between map coordinates and device coordinates.
Definition at line 412 of file qgsrendercontext.h.
|
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).
Definition at line 767 of file qgsrendercontext.h.
|
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.
Definition at line 521 of file qgsrendercontext.h.
void QgsRenderContext::setOutputSize | ( | QSize | size | ) |
Sets the size of the resulting rendered image, in pixels.
Definition at line 665 of file qgsrendercontext.cpp.
|
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.
Definition at line 512 of file qgsrendercontext.h.
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().
Definition at line 169 of file qgsrendercontext.cpp.
|
inline |
Sets the path resolver for conversion between relative and absolute paths during rendering operations, e.g.
for resolving relative symbol paths.
Definition at line 222 of file qgsrendercontext.h.
|
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.
Definition at line 487 of file qgsrendercontext.h.
|
inline |
Sets the renderer usage.
Definition at line 1011 of file qgsrendercontext.h.
|
inline |
Sets whether the rendering operation has been stopped and any ongoing rendering should be canceled immediately.
Definition at line 457 of file qgsrendercontext.h.
|
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.
Definition at line 472 of file qgsrendercontext.h.
|
inline |
Sets the segmentation tolerance applied when rendering curved geometries.
tolerance | the segmentation tolerance |
Definition at line 663 of file qgsrendercontext.h.
|
inline |
Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)
type | the segmentation tolerance typename |
Definition at line 677 of file qgsrendercontext.h.
|
inline |
Sets the color to use when rendering selected features.
Definition at line 561 of file qgsrendercontext.h.
void QgsRenderContext::setShowSelection | ( | bool | showSelection | ) |
Sets whether vector selections should be shown in the rendered map.
showSelection | set to true if selections should be shown |
Definition at line 335 of file qgsrendercontext.cpp.
|
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.
Definition at line 504 of file qgsrendercontext.h.
|
inline |
Sets the text render format, which dictates how text is rendered (e.g.
as paths or real text objects).
Definition at line 740 of file qgsrendercontext.h.
void QgsRenderContext::setTextureOrigin | ( | const QPointF & | origin | ) |
Sets the texture origin, which should be used as a brush transform when rendering using QBrush objects.
Definition at line 645 of file qgsrendercontext.cpp.
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.
Definition at line 193 of file qgsrendercontext.cpp.
void QgsRenderContext::setUseAdvancedEffects | ( | bool | enabled | ) |
Used to enable or disable advanced effects such as blend modes.
Definition at line 305 of file qgsrendercontext.cpp.
void QgsRenderContext::setUseRenderingOptimization | ( | bool | enabled | ) |
Sets whether the rendering optimization (geometry simplification) should be executed.
Definition at line 345 of file qgsrendercontext.cpp.
|
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.
Definition at line 609 of file qgsrendercontext.h.
void QgsRenderContext::setZRange | ( | const QgsDoubleRange & | range | ) |
Sets the range of z-values which should be rendered.
Definition at line 655 of file qgsrendercontext.cpp.
bool QgsRenderContext::showSelection | ( | ) | const |
Returns true
if vector selections should be shown in the rendered map.
true
if selections should be shown Definition at line 315 of file qgsrendercontext.cpp.
QList< QPainterPath > QgsRenderContext::symbolLayerClipPaths | ( | const QgsSymbolLayer * | symbolLayer | ) | const |
Returns clip paths to be applied to the symbolLayer before rendering.
Definition at line 710 of file qgsrendercontext.cpp.
|
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.
Definition at line 362 of file qgsrendercontext.h.
bool QgsRenderContext::testFlag | ( | Qgis::RenderContextFlag | flag | ) | const |
Check whether a particular flag is enabled.
Definition at line 229 of file qgsrendercontext.cpp.
|
inline |
Returns the text render format, which dictates how text is rendered (e.g.
as paths or real text objects).
Definition at line 729 of file qgsrendercontext.h.
QPointF QgsRenderContext::textureOrigin | ( | ) | const |
Returns the texture origin, which should be used as a brush transform when rendering using QBrush objects.
Definition at line 640 of file qgsrendercontext.cpp.
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.
Definition at line 184 of file qgsrendercontext.cpp.
bool QgsRenderContext::useAdvancedEffects | ( | ) | const |
Returns true
if advanced effects such as blend modes such be used.
Definition at line 300 of file qgsrendercontext.cpp.
bool QgsRenderContext::useRenderingOptimization | ( | ) | const |
Returns true
if the rendering optimization (geometry simplification) can be executed.
Definition at line 340 of file qgsrendercontext.cpp.
|
inline |
Returns the simplification settings to use when rendering vector layers.
The default is to use no simplification.
Definition at line 594 of file qgsrendercontext.h.
QgsDoubleRange QgsRenderContext::zRange | ( | ) | const |
Returns the range of z-values which should be rendered.
Definition at line 650 of file qgsrendercontext.cpp.