QGIS API Documentation  2.99.0-Master (c42dad3)
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
}
 Enumeration of flags that affect rendering operations. More...
 

Public Member Functions

 QgsRenderContext ()
 
 QgsRenderContext (const QgsRenderContext &rh)
 
 ~QgsRenderContext ()
 
const QPainter * constPainter () const
 
QgsCoordinateTransform coordinateTransform () const
 Returns the current coordinate transform for the context, or an invalid transform is no coordinate transformation is required. More...
 
bool drawEditingInformation () const
 
QgsExpressionContextexpressionContext ()
 Gets the expression context. More...
 
const QgsExpressionContextexpressionContext () const
 Gets the expression context (const version). More...
 
const QgsRectangleextent () const
 
const QgsFeatureFilterProviderfeatureFilterProvider () const
 Get the filter feature provider used for additional filtering of rendered features. More...
 
Flags flags () const
 Return combination of flags used for rendering. More...
 
bool forceVectorOutput () const
 
const QgsAbstractGeometrygeometry () const
 Returns pointer to the unsegmentized geometry. More...
 
QgsLabelingEngineInterfacelabelingEngine () const
 
QgsLabelingEnginelabelingEngineV2 () const
 Get access to new labeling engine (may be nullptr) More...
 
const QgsMapToPixelmapToPixel () const
 
QgsRenderContextoperator= (const QgsRenderContext &rh)
 
QPainter * painter ()
 
double rasterScaleFactor () const
 
double rendererScale () const
 
bool renderingStopped () const
 
double scaleFactor () const
 
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
 
void setCoordinateTransform (const QgsCoordinateTransform &t)
 Sets coordinate transformation. More...
 
void setDrawEditingInformation (bool b)
 
void setExpressionContext (const QgsExpressionContext &context)
 Sets the expression context. More...
 
void setExtent (const QgsRectangle &extent)
 
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)
 
void setGeometry (const QgsAbstractGeometry *geometry)
 Sets pointer to original (unsegmentized) geometry. More...
 
void setLabelingEngine (QgsLabelingEngineInterface *iface)
 
void setLabelingEngineV2 (QgsLabelingEngine *engine2)
 Assign new labeling engine. More...
 
void setMapToPixel (const QgsMapToPixel &mtp)
 
void setPainter (QPainter *p)
 
void setRasterScaleFactor (double factor)
 
void setRendererScale (double scale)
 
void setRenderingStopped (bool stopped)
 
void setScaleFactor (double factor)
 
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)
 
void setShowSelection (const bool showSelection)
 Sets whether vector selections should be shown in the rendered map. More...
 
void setUseAdvancedEffects (bool enabled)
 Used to enable or disable advanced effects such as blend modes. More...
 
void setUseRenderingOptimization (bool enabled)
 
void setVectorSimplifyMethod (const QgsVectorSimplifyMethod &simplifyMethod)
 
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...
 
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
 Added in QGIS v2.4. More...
 

Static Public Member Functions

static QgsRenderContext fromMapSettings (const QgsMapSettings &mapSettings)
 create initialized QgsRenderContext instance from given QgsMapSettings 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 / bounding box to be rendered etc.

Definition at line 45 of file qgsrendercontext.h.

Member Enumeration Documentation

§ Flag

Enumeration of flags that affect rendering operations.

Note
added in 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 transparency 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.

Definition at line 58 of file qgsrendercontext.h.

Constructor & Destructor Documentation

§ QgsRenderContext() [1/2]

QgsRenderContext::QgsRenderContext ( )

Definition at line 26 of file qgsrendercontext.cpp.

§ QgsRenderContext() [2/2]

QgsRenderContext::QgsRenderContext ( const QgsRenderContext rh)

Definition at line 43 of file qgsrendercontext.cpp.

§ ~QgsRenderContext()

QgsRenderContext::~QgsRenderContext ( )

Definition at line 88 of file qgsrendercontext.cpp.

Member Function Documentation

§ constPainter()

const QPainter* QgsRenderContext::constPainter ( ) const
inline

Definition at line 99 of file qgsrendercontext.h.

§ coordinateTransform()

QgsCoordinateTransform QgsRenderContext::coordinateTransform ( ) const
inline

Returns the current coordinate transform for the context, or an invalid transform is no coordinate transformation is required.

Definition at line 104 of file qgsrendercontext.h.

§ drawEditingInformation()

bool QgsRenderContext::drawEditingInformation ( ) const

Definition at line 162 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()
Note
added in QGIS 2.12

Definition at line 199 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
added in QGIS 2.12
not available in Python bindings

Definition at line 207 of file qgsrendercontext.h.

§ extent()

const QgsRectangle& QgsRenderContext::extent ( ) const
inline

Definition at line 106 of file qgsrendercontext.h.

§ featureFilterProvider()

const QgsFeatureFilterProvider* QgsRenderContext::featureFilterProvider ( ) const
inline

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

Returns
the filter feature provider
Note
added in QGIS 2.14
See also
setFeatureFilterProvider()

Definition at line 226 of file qgsrendercontext.h.

§ flags()

QgsRenderContext::Flags QgsRenderContext::flags ( ) const

Return combination of flags used for rendering.

Note
added in QGIS 2.14

Definition at line 107 of file qgsrendercontext.cpp.

§ forceVectorOutput()

bool QgsRenderContext::forceVectorOutput ( ) const

Definition at line 147 of file qgsrendercontext.cpp.

§ fromMapSettings()

QgsRenderContext QgsRenderContext::fromMapSettings ( const QgsMapSettings mapSettings)
static

create initialized QgsRenderContext instance from given QgsMapSettings

Note
added in 2.4

Definition at line 117 of file qgsrendercontext.cpp.

§ geometry()

const QgsAbstractGeometry* QgsRenderContext::geometry ( ) const
inline

Returns pointer to the unsegmentized geometry.

Definition at line 210 of file qgsrendercontext.h.

§ labelingEngine()

QgsLabelingEngineInterface* QgsRenderContext::labelingEngine ( ) const
inline

Definition at line 130 of file qgsrendercontext.h.

§ labelingEngineV2()

QgsLabelingEngine* QgsRenderContext::labelingEngineV2 ( ) const
inline

Get access to new labeling engine (may be nullptr)

Note
not available in Python bindings

Definition at line 134 of file qgsrendercontext.h.

§ mapToPixel()

const QgsMapToPixel& QgsRenderContext::mapToPixel ( ) const
inline

Definition at line 108 of file qgsrendercontext.h.

§ operator=()

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

Definition at line 65 of file qgsrendercontext.cpp.

§ painter()

QPainter* QgsRenderContext::painter ( )
inline

Definition at line 98 of file qgsrendercontext.h.

§ rasterScaleFactor()

double QgsRenderContext::rasterScaleFactor ( ) const
inline

Definition at line 112 of file qgsrendercontext.h.

§ rendererScale()

double QgsRenderContext::rendererScale ( ) const
inline

Definition at line 128 of file qgsrendercontext.h.

§ renderingStopped()

bool QgsRenderContext::renderingStopped ( ) const
inline

Definition at line 114 of file qgsrendercontext.h.

§ scaleFactor()

double QgsRenderContext::scaleFactor ( ) const
inline

Definition at line 110 of file qgsrendercontext.h.

§ segmentationTolerance()

double QgsRenderContext::segmentationTolerance ( ) const
inline

Gets the segmentation tolerance applied when rendering curved geometries.

Definition at line 232 of file qgsrendercontext.h.

§ segmentationToleranceType()

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

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

Definition at line 238 of file qgsrendercontext.h.

§ selectionColor()

QColor QgsRenderContext::selectionColor ( ) const
inline

Definition at line 136 of file qgsrendercontext.h.

§ setCoordinateTransform()

void QgsRenderContext::setCoordinateTransform ( const QgsCoordinateTransform t)

Sets coordinate transformation.

Definition at line 172 of file qgsrendercontext.cpp.

§ setDrawEditingInformation()

void QgsRenderContext::setDrawEditingInformation ( bool  b)

Definition at line 177 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()
Note
added in QGIS 2.12

Definition at line 192 of file qgsrendercontext.h.

§ setExtent()

void QgsRenderContext::setExtent ( const QgsRectangle extent)
inline

Definition at line 151 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
Note
added in QGIS 2.14
See also
featureFilterProvider()

Definition at line 202 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)

Note
added in QGIS 2.14

Definition at line 99 of file qgsrendercontext.cpp.

§ setFlags()

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

Set combination of flags that will be used for rendering.

Note
added in QGIS 2.14

Definition at line 94 of file qgsrendercontext.cpp.

§ setForceVectorOutput()

void QgsRenderContext::setForceVectorOutput ( bool  force)

Definition at line 182 of file qgsrendercontext.cpp.

§ setGeometry()

void QgsRenderContext::setGeometry ( const QgsAbstractGeometry geometry)
inline

Sets pointer to original (unsegmentized) geometry.

Definition at line 212 of file qgsrendercontext.h.

§ setLabelingEngine()

void QgsRenderContext::setLabelingEngine ( QgsLabelingEngineInterface iface)
inline

Definition at line 163 of file qgsrendercontext.h.

§ setLabelingEngineV2()

void QgsRenderContext::setLabelingEngineV2 ( QgsLabelingEngine engine2)
inline

Assign new labeling engine.

Note
not available in Python bindings

Definition at line 166 of file qgsrendercontext.h.

§ setMapToPixel()

void QgsRenderContext::setMapToPixel ( const QgsMapToPixel mtp)
inline

Definition at line 150 of file qgsrendercontext.h.

§ setPainter()

void QgsRenderContext::setPainter ( QPainter *  p)
inline

Definition at line 159 of file qgsrendercontext.h.

§ setRasterScaleFactor()

void QgsRenderContext::setRasterScaleFactor ( double  factor)
inline

Definition at line 157 of file qgsrendercontext.h.

§ setRendererScale()

void QgsRenderContext::setRendererScale ( double  scale)
inline

Definition at line 158 of file qgsrendercontext.h.

§ setRenderingStopped()

void QgsRenderContext::setRenderingStopped ( bool  stopped)
inline

Definition at line 155 of file qgsrendercontext.h.

§ setScaleFactor()

void QgsRenderContext::setScaleFactor ( double  factor)
inline

Definition at line 156 of file qgsrendercontext.h.

§ setSegmentationTolerance()

void QgsRenderContext::setSegmentationTolerance ( double  tolerance)
inline

Sets the segmentation tolerance applied when rendering curved geometries.

Parameters
tolerancethe segmentation tolerance

Definition at line 230 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

Definition at line 236 of file qgsrendercontext.h.

§ setSelectionColor()

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

Definition at line 167 of file qgsrendercontext.h.

§ setShowSelection()

void QgsRenderContext::setShowSelection ( const 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
Note
Added in QGIS v2.4

Definition at line 187 of file qgsrendercontext.cpp.

§ setUseAdvancedEffects()

void QgsRenderContext::setUseAdvancedEffects ( bool  enabled)

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

Definition at line 157 of file qgsrendercontext.cpp.

§ setUseRenderingOptimization()

void QgsRenderContext::setUseRenderingOptimization ( bool  enabled)

Definition at line 197 of file qgsrendercontext.cpp.

§ setVectorSimplifyMethod()

void QgsRenderContext::setVectorSimplifyMethod ( const QgsVectorSimplifyMethod simplifyMethod)
inline

Definition at line 185 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
Note
Added in QGIS v2.4

Definition at line 167 of file qgsrendercontext.cpp.

§ testFlag()

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

Check whether a particular flag is enabled.

Note
added in QGIS 2.14

Definition at line 112 of file qgsrendercontext.cpp.

§ useAdvancedEffects()

bool QgsRenderContext::useAdvancedEffects ( ) const

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

Definition at line 152 of file qgsrendercontext.cpp.

§ useRenderingOptimization()

bool QgsRenderContext::useRenderingOptimization ( ) const

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

Definition at line 192 of file qgsrendercontext.cpp.

§ vectorSimplifyMethod()

const QgsVectorSimplifyMethod& QgsRenderContext::vectorSimplifyMethod ( ) const
inline

Added in QGIS v2.4.

Definition at line 184 of file qgsrendercontext.h.


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