29#define POINTS_TO_MM 2.83464567 
   30#define INCH_TO_MM 25.4 
   33  : mFlags( 
Qgis::RenderContextFlag::DrawEditingInfo | 
Qgis::RenderContextFlag::UseAdvancedEffects | 
Qgis::RenderContextFlag::DrawSelection | 
Qgis::RenderContextFlag::UseRenderingOptimization )
 
 
   46  , mRasterizedRenderingPolicy( rh.mRasterizedRenderingPolicy )
 
   47  , mPainter( rh.mPainter )
 
   48  , mPreviewRenderPainter( rh.mPreviewRenderPainter )
 
   49  , mMaskPainter( rh.mMaskPainter )
 
   52  , mMaskIdProvider( nullptr )
 
   53  , mCurrentMaskId( -1 )
 
   55  , mIsGuiPreview( rh.mIsGuiPreview )
 
   56  , mCoordTransform( rh.mCoordTransform )
 
   57  , mDistanceArea( rh.mDistanceArea )
 
   58  , mExtent( rh.mExtent )
 
   59  , mOriginalMapExtent( rh.mOriginalMapExtent )
 
   60  , mMapToPixel( rh.mMapToPixel )
 
   61  , mRenderingStopped( rh.mRenderingStopped )
 
   62  , mFeedback( rh.mFeedback )
 
   63  , mScaleFactor( rh.mScaleFactor )
 
   64  , mDpiTarget( rh.mDpiTarget )
 
   65  , mRendererScale( rh.mRendererScale )
 
   66  , mSymbologyReferenceScale( rh.mSymbologyReferenceScale )
 
   67  , mLabelingEngine( rh.mLabelingEngine )
 
   68  , mLabelSink( rh.mLabelSink )
 
   69  , mSelectionColor( rh.mSelectionColor )
 
   70  , mVectorSimplifyMethod( rh.mVectorSimplifyMethod )
 
   71  , mExpressionContext( rh.mExpressionContext )
 
   72  , mGeometry( rh.mGeometry )
 
   73  , mFeatureFilterProvider( rh.mFeatureFilterProvider ? rh.mFeatureFilterProvider->clone() : nullptr )
 
   74  , mSegmentationTolerance( rh.mSegmentationTolerance )
 
   75  , mSegmentationToleranceType( rh.mSegmentationToleranceType )
 
   76  , mTransformContext( rh.mTransformContext )
 
   77  , mPathResolver( rh.mPathResolver )
 
   78  , mTextRenderFormat( rh.mTextRenderFormat )
 
   79  , mRenderedFeatureHandlers( rh.mRenderedFeatureHandlers )
 
   80  , mHasRenderedFeatureHandlers( rh.mHasRenderedFeatureHandlers )
 
   81  , mCustomProperties( rh.mCustomProperties )
 
   82  , mDisabledSymbolLayers()
 
   83  , mClippingRegions( rh.mClippingRegions )
 
   84  , mFeatureClipGeometry( rh.mFeatureClipGeometry )
 
   85  , mTextureOrigin( rh.mTextureOrigin )
 
   86  , mZRange( rh.mZRange )
 
   88  , mDevicePixelRatio( rh.mDevicePixelRatio )
 
   89  , mImageFormat( rh.mImageFormat )
 
   90  , mRendererUsage( rh.mRendererUsage )
 
   91  , mFrameRate( rh.mFrameRate )
 
   92  , mCurrentFrame( rh.mCurrentFrame )
 
   93  , mSymbolLayerClippingGeometries( rh.mSymbolLayerClippingGeometries )
 
   94  , mMaskRenderSettings( rh.mMaskRenderSettings )
 
   96  , mHasTransformContext( rh.mHasTransformContext )
 
   98  , mElevationMap( rh.mElevationMap )
 
 
  105  mRasterizedRenderingPolicy = rh.mRasterizedRenderingPolicy;
 
  106  mPainter = rh.mPainter;
 
  107  mPreviewRenderPainter = rh.mPreviewRenderPainter;
 
  108  mMaskPainter = rh.mMaskPainter;
 
  112  mIsGuiPreview = rh.mIsGuiPreview;
 
  113  mCoordTransform = rh.mCoordTransform;
 
  114  mExtent = rh.mExtent;
 
  115  mOriginalMapExtent = rh.mOriginalMapExtent;
 
  116  mMapToPixel = rh.mMapToPixel;
 
  117  mRenderingStopped = rh.mRenderingStopped;
 
  118  mFeedback = rh.mFeedback;
 
  119  mScaleFactor = rh.mScaleFactor;
 
  120  mDpiTarget = rh.mDpiTarget;
 
  121  mRendererScale = rh.mRendererScale;
 
  122  mSymbologyReferenceScale = rh.mSymbologyReferenceScale;
 
  123  mLabelingEngine = rh.mLabelingEngine;
 
  124  mLabelSink = rh.mLabelSink;
 
  125  mSelectionColor = rh.mSelectionColor;
 
  126  mVectorSimplifyMethod = rh.mVectorSimplifyMethod;
 
  127  mExpressionContext = rh.mExpressionContext;
 
  128  mGeometry = rh.mGeometry;
 
  129  mFeatureFilterProvider.reset( rh.mFeatureFilterProvider ? rh.mFeatureFilterProvider->clone() : nullptr );
 
  130  mSegmentationTolerance = rh.mSegmentationTolerance;
 
  131  mSegmentationToleranceType = rh.mSegmentationToleranceType;
 
  132  mDistanceArea = rh.mDistanceArea;
 
  133  mTransformContext = rh.mTransformContext;
 
  134  mPathResolver = rh.mPathResolver;
 
  135  mTextRenderFormat = rh.mTextRenderFormat;
 
  136  mRenderedFeatureHandlers = rh.mRenderedFeatureHandlers;
 
  137  mHasRenderedFeatureHandlers = rh.mHasRenderedFeatureHandlers;
 
  138  mCustomProperties = rh.mCustomProperties;
 
  139  mClippingRegions = rh.mClippingRegions;
 
  140  mFeatureClipGeometry = rh.mFeatureClipGeometry;
 
  141  mTextureOrigin = rh.mTextureOrigin;
 
  142  mZRange = rh.mZRange;
 
  144  mDevicePixelRatio = rh.mDevicePixelRatio;
 
  145  mImageFormat = rh.mImageFormat;
 
  147  mRendererUsage = rh.mRendererUsage;
 
  148  mFrameRate = rh.mFrameRate;
 
  149  mCurrentFrame = rh.mCurrentFrame;
 
  150  mSymbolLayerClippingGeometries = rh.mSymbolLayerClippingGeometries;
 
  151  mMaskRenderSettings = rh.mMaskRenderSettings;
 
  155  mHasTransformContext = rh.mHasTransformContext;
 
 
  177  if ( 
painter && 
painter->renderHints() & QPainter::SmoothPixmapTransform )
 
  179  if ( 
painter && 
painter->renderHints() & QPainter::LosslessImageRendering )
 
 
  201  if ( !mHasTransformContext )
 
  202    QgsDebugMsgLevel( QStringLiteral( 
"No QgsCoordinateTransformContext context set for transform" ), 4 );
 
  204  return mTransformContext;
 
 
  209  mTransformContext = context;
 
  211  mHasTransformContext = 
true;
 
 
  228  matchRasterizedRenderingPolicyToFlags();
 
 
  236    mFlags &= ~( 
static_cast< int >( flag ) );
 
  237  matchRasterizedRenderingPolicyToFlags();
 
 
  247  return mFlags.testFlag( flag );
 
 
  312  ctx.mFrameRate = mapSettings.
frameRate();
 
  315  const QStringList layerIds = mapSettings.
layerIds( 
true );
 
  316  if ( !layerIds.empty() )
 
 
  375    switch ( mRasterizedRenderingPolicy )
 
 
  407    mFeatureFilterProvider.reset( ffp->
clone() );
 
  411    mFeatureFilterProvider.reset( 
nullptr );
 
 
  417  return mFeatureFilterProvider.get();
 
 
  422  double conversionFactor = 1.0;
 
  423  bool isMapUnitHack = 
false;
 
  427      conversionFactor = mScaleFactor;
 
  453          conversionFactor = 1.0 / mup;
 
  457          conversionFactor = 1.0;
 
  464        isMapUnitHack = 
true;
 
  470      conversionFactor = 1.0;
 
  476      conversionFactor = 1.0;
 
  480  double convertedSize = size * conversionFactor;
 
  486      convertedSize = std::max( convertedSize, scale.
minSizeMM * mScaleFactor );
 
  488      convertedSize = std::min( convertedSize, scale.
maxSizeMM * mScaleFactor );
 
  494    convertedSize = std::clamp( convertedSize, 10.0, 100.0 );
 
  498    const double symbologyReferenceScaleFactor = mSymbologyReferenceScale > 0 ? mSymbologyReferenceScale / mRendererScale : 1;
 
  499    convertedSize *= symbologyReferenceScaleFactor;
 
  512        convertedSize = std::min( convertedSize, 100.0 );
 
  516        convertedSize = std::min<double>( convertedSize, 30 );
 
  520        convertedSize = std::min<double>( convertedSize, 50 );
 
  525  return convertedSize;
 
 
  530  double conversionFactor = 1.0;
 
  535      conversionFactor = 1 / mScaleFactor;
 
  543      conversionFactor = 1 / ( mScaleFactor * 
INCH_TO_MM );
 
  560          conversionFactor = mup / 1.0;
 
  564          conversionFactor = 1.0;
 
  576      conversionFactor = 1.0;
 
  582      conversionFactor = 1.0;
 
  587  return size * conversionFactor;
 
 
  594  const double symbologyReferenceScaleFactor = mSymbologyReferenceScale > 0 ? mSymbologyReferenceScale / mRendererScale : 1;
 
  607      double minSizeMU = std::numeric_limits<double>::lowest();
 
  610        minSizeMU = scale.
minSizeMM * mScaleFactor * mup;
 
  614        minSizeMU = std::max( minSizeMU, size * ( mRendererScale / scale.
minScale ) );
 
  616      size = std::max( size, minSizeMU );
 
  618      double maxSizeMU = std::numeric_limits<double>::max();
 
  621        maxSizeMU = scale.
maxSizeMM * mScaleFactor * mup;
 
  625        maxSizeMU = std::min( maxSizeMU, size * ( mRendererScale / scale.
maxScale ) );
 
  627      size = std::min( size, maxSizeMU );
 
  633      return size * mScaleFactor * mup / symbologyReferenceScaleFactor;
 
  637      return size * mScaleFactor * mup / 
POINTS_TO_MM / symbologyReferenceScaleFactor;
 
  641      return size * mScaleFactor * mup * 
INCH_TO_MM / symbologyReferenceScaleFactor;
 
  645      return size * mup / symbologyReferenceScaleFactor;
 
 
  659  const double symbologyReferenceScaleFactor = mSymbologyReferenceScale > 0 ? mSymbologyReferenceScale / mRendererScale : 1;
 
  661  switch ( outputUnit )
 
  669      return sizeInMapUnits;
 
  673      return sizeInMapUnits / ( mScaleFactor * mup ) * symbologyReferenceScaleFactor;
 
  677      return sizeInMapUnits / ( mScaleFactor * mup / 
POINTS_TO_MM ) * symbologyReferenceScaleFactor;
 
  681      return sizeInMapUnits / ( mScaleFactor * mup * 
INCH_TO_MM ) * symbologyReferenceScaleFactor;
 
  685      return sizeInMapUnits / mup * symbologyReferenceScaleFactor;
 
 
  718          pointCenter = mCoordTransform.
transform( pointCenter );
 
  722          QgsDebugError( QStringLiteral( 
"QgsRenderContext::convertMetersToMapUnits(): failed to reproject pointCenter" ) );
 
  728      const int multiplier = meters < 0 ? -1 : 1;
 
 
  786  return mRenderedFeatureHandlers;
 
 
  791  return mClippingRegions;
 
 
  796  return mFeatureClipGeometry;
 
 
  806  return mTextureOrigin;
 
 
  811  mTextureOrigin = origin;
 
 
  816  mMaskRenderSettings = settings;
 
 
  841  return mDevicePixelRatio;
 
 
  846  mDevicePixelRatio = ratio;
 
 
  856  return mRasterizedRenderingPolicy;
 
 
  861  mRasterizedRenderingPolicy = policy;
 
  862  switch ( mRasterizedRenderingPolicy )
 
 
  891  return mCurrentFrame;
 
 
  896  mCurrentFrame = frame;
 
 
  901  return mElevationMap;
 
 
  909void QgsRenderContext::matchRasterizedRenderingPolicyToFlags()
 
  932  QList<QPainterPath> res;
 
  933  res.reserve( geometries.size() );
 
 
  945    mSymbolLayerClippingGeometries[ symbolLayerId ].append( 
geometry.asGeometryCollection() );
 
  949    mSymbolLayerClippingGeometries[ symbolLayerId ].append( 
geometry );
 
 
  955  auto it = mSymbolLayerClippingGeometries.constFind( symbolLayerId );
 
  956  if ( it == mSymbolLayerClippingGeometries.constEnd() )
 
  958  return !it.value().isEmpty();
 
 
  963  return mSymbolLayerClippingGeometries[ symbolLayerId ];
 
 
  968  mDisabledSymbolLayers.clear();
 
  970    mDisabledSymbolLayers << symbolLayer->id();
 
 
  975  mDisabledSymbolLayers = symbolLayers;
 
 
  980  return QSet<const QgsSymbolLayer *>();
 
 
  985  return mDisabledSymbolLayers;
 
 
  990  return !mDisabledSymbolLayers.contains( layer->
id() );
 
 
Provides global constants and enumerations for use throughout the application.
 
RasterizedRenderingPolicy
Policies controlling when rasterisation of content during renders is permitted.
 
@ Default
Allow raster-based rendering in situations where it is required for correct rendering or where it wil...
 
@ PreferVector
Prefer vector-based rendering, when the result will still be visually near-identical to a raster-base...
 
@ ForceVector
Always force vector-based rendering, even when the result will be visually different to a raster-base...
 
RenderSubcomponentProperty
Rendering subcomponent properties.
 
@ ShadowOffset
Shadow offset.
 
@ GlowSpread
Glow spread size.
 
@ Generic
Generic subcomponent property.
 
@ NoSimplification
No simplification can be applied.
 
@ YardsBritishSears1922Truncated
British yards (Sears 1922 truncated)
 
@ MilesUSSurvey
US Survey miles.
 
@ LinksBritishSears1922
British links (Sears 1922)
 
@ YardsBritishBenoit1895A
British yards (Benoit 1895 A)
 
@ LinksBritishBenoit1895A
British links (Benoit 1895 A)
 
@ Centimeters
Centimeters.
 
@ YardsIndian1975
Indian yards (1975)
 
@ FeetUSSurvey
US Survey feet.
 
@ Millimeters
Millimeters.
 
@ FeetBritishSears1922
British feet (Sears 1922)
 
@ YardsClarkes
Clarke's yards.
 
@ YardsIndian
Indian yards.
 
@ FeetBritishBenoit1895B
British feet (Benoit 1895 B)
 
@ Miles
Terrestrial miles.
 
@ LinksUSSurvey
US Survey links.
 
@ ChainsUSSurvey
US Survey chains.
 
@ FeetClarkes
Clarke's feet.
 
@ Unknown
Unknown distance unit.
 
@ FeetBritish1936
British feet (1936)
 
@ FeetIndian1962
Indian feet (1962)
 
@ YardsBritishSears1922
British yards (Sears 1922)
 
@ FeetIndian1937
Indian feet (1937)
 
@ YardsIndian1937
Indian yards (1937)
 
@ Degrees
Degrees, for planar geographic CRS distance measurements.
 
@ ChainsBritishBenoit1895B
British chains (Benoit 1895 B)
 
@ LinksBritishSears1922Truncated
British links (Sears 1922 truncated)
 
@ ChainsBritishBenoit1895A
British chains (Benoit 1895 A)
 
@ YardsBritishBenoit1895B
British yards (Benoit 1895 B)
 
@ FeetBritish1865
British feet (1865)
 
@ YardsIndian1962
Indian yards (1962)
 
@ FeetBritishSears1922Truncated
British feet (Sears 1922 truncated)
 
@ MetersGermanLegal
German legal meter.
 
@ LinksBritishBenoit1895B
British links (Benoit 1895 B)
 
@ ChainsInternational
International chains.
 
@ LinksInternational
International links.
 
@ ChainsBritishSears1922Truncated
British chains (Sears 1922 truncated)
 
@ FeetIndian
Indian (geodetic) feet.
 
@ NauticalMiles
Nautical miles.
 
@ ChainsClarkes
Clarke's chains.
 
@ LinksClarkes
Clarke's links.
 
@ ChainsBritishSears1922
British chains (Sears 1922)
 
@ FeetIndian1975
Indian feet (1975)
 
@ FeetGoldCoast
Gold Coast feet.
 
@ FeetBritishBenoit1895A
British feet (Benoit 1895 A)
 
QFlags< RenderContextFlag > RenderContextFlags
Render context flags.
 
RenderUnit
Rendering size units.
 
@ Percentage
Percentage of another measurement (e.g., canvas size, feature size)
 
@ Millimeters
Millimeters.
 
@ Points
Points (e.g., for font sizes)
 
@ Unknown
Mixed or unknown units.
 
@ MetersInMapUnits
Meters value as Map units.
 
RenderContextFlag
Flags which affect rendering operations.
 
@ DrawEditingInfo
Enable drawing of vertex markers for layers in editing mode.
 
@ RenderSymbolPreview
The render is for a symbol preview only and map based properties may not be available,...
 
@ DrawSymbolBounds
Draw bounds of symbols (for debugging/testing)
 
@ RenderPreviewJob
Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering.
 
@ RenderMapTile
Draw map such that there are no problems between adjacent tiles.
 
@ RecordProfile
Enable run-time profiling while rendering.
 
@ RenderLayerTree
The render is for a layer tree display where map based properties are not available and where avoidan...
 
@ UseRenderingOptimization
Enable vector simplification and other rendering optimizations.
 
@ ForceVectorOutput
Vector graphics should not be cached and drawn as raster images.
 
@ RenderPartialOutput
Whether to make extra effort to update map image with partially rendered layers (better for interacti...
 
@ LosslessImageRendering
Render images losslessly whenever possible, instead of the default lossy jpeg rendering used for some...
 
@ AlwaysUseGlobalMasks
When applying clipping paths for selective masking, always use global ("entire map") paths,...
 
@ DrawSelection
Whether vector selections should be shown in the rendered map.
 
@ Antialiasing
Use antialiasing while drawing.
 
@ SkipSymbolRendering
Disable symbol rendering while still drawing labels if enabled.
 
@ Render3DMap
Render is for a 3D map.
 
@ UseAdvancedEffects
Enable layer opacity and blending effects.
 
@ HighQualityImageTransforms
Enable high quality image transformations, which results in better appearance of scaled or rotated ra...
 
@ RenderBlocking
Render and load remote sources in the same thread to ensure rendering remote sources (svg and images)...
 
@ DrawEditingInfo
Enable drawing of vertex markers for layers in editing mode.
 
@ DrawSymbolBounds
Draw bounds of symbols (for debugging/testing)
 
@ RenderPreviewJob
Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering.
 
@ RenderMapTile
Draw map such that there are no problems between adjacent tiles.
 
@ RecordProfile
Enable run-time profiling while rendering.
 
@ UseRenderingOptimization
Enable vector simplification and other rendering optimizations.
 
@ ForceVectorOutput
Vector graphics should not be cached and drawn as raster images.
 
@ RenderPartialOutput
Whether to make extra effort to update map image with partially rendered layers (better for interacti...
 
@ LosslessImageRendering
Render images losslessly whenever possible, instead of the default lossy jpeg rendering used for some...
 
@ AlwaysUseGlobalMasks
When applying clipping paths for selective masking, always use global ("entire map") paths,...
 
@ DrawSelection
Whether vector selections should be shown in the rendered map.
 
@ Antialiasing
Enable anti-aliasing for map rendering.
 
@ SkipSymbolRendering
Disable symbol rendering while still drawing labels if enabled.
 
@ Render3DMap
Render is for a 3D map.
 
@ UseAdvancedEffects
Enable layer opacity and blending effects.
 
@ HighQualityImageTransforms
Enable high quality image transformations, which results in better appearance of scaled or rotated ra...
 
@ RenderBlocking
Render and load remote sources in the same thread to ensure rendering remote sources (svg and images)...
 
virtual bool isEmpty() const
Returns true if the geometry is empty.
 
virtual QPainterPath asQPainterPath() const =0
Returns the geometry represented as a QPainterPath.
 
QString ellipsoidAcronym() const
Returns the ellipsoid acronym for the ellipsoid used by the CRS.
 
Qgis::DistanceUnit mapUnits
 
Contains information about the context in which a coordinate transform is executed.
 
Custom exception class for Coordinate Reference System related exceptions.
 
QgsCoordinateReferenceSystem sourceCrs() const
Returns the source spatial reference system.
 
void setSourceCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets source spatial reference system crs.
 
double measureLineProjected(const QgsPointXY &p1, double distance=1, double azimuth=M_PI_2, QgsPointXY *projectedPoint=nullptr) const
Calculates the distance from one point with distance in meters and azimuth (direction) When the sourc...
 
bool setEllipsoid(const QString &ellipsoid)
Sets the ellipsoid by its acronym.
 
QgsRange which stores a range of double values.
 
Stores a digital elevation model in a raster image which may get updated as a part of the map layer r...
 
Abstract interface for use by classes that filter the features or attributes of a layer.
 
virtual QgsFeatureFilterProvider * clone() const =0
Create a clone of the feature filter provider.
 
Base class for feedback objects to be used for cancellation of something running in a worker thread.
 
static QgsGeometry painterPathToGeometry(const QPainterPath &path)
Converts a painter path to a QgsGeometry.
 
A geometry is the spatial representation of a feature.
 
Contains configuration for rendering maps.
 
Qgis::RendererUsage rendererUsage() const
Returns the rendering usage.
 
double scale() const
Returns the calculated map scale.
 
double segmentationTolerance() const
Gets the segmentation tolerance applied when rendering curved geometries.
 
QgsDoubleRange zRange() const
Returns the range of z-values which will be visible in the map.
 
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings to use when rendering vector layers.
 
QList< QgsRenderedFeatureHandlerInterface * > renderedFeatureHandlers() const
Returns the list of rendered feature handlers to use while rendering the map settings.
 
QStringList layerIds(bool expandGroupLayers=false) const
Returns the list of layer IDs which will be rendered in the map.
 
double dpiTarget() const
Returns the target DPI (dots per inch) to be taken into consideration when rendering.
 
long long currentFrame() const
Returns the current frame number of the map, for maps which are part of an animation.
 
const QgsMapToPixel & mapToPixel() const
 
float devicePixelRatio() const
Returns the device pixel ratio.
 
QSize outputSize() const
Returns the size of the resulting map image, in pixels.
 
QImage::Format outputImageFormat() const
format of internal QImage, default QImage::Format_ARGB32_Premultiplied
 
double extentBuffer() const
Returns the buffer in map units to use around the visible extent for rendering symbols whose correspo...
 
double frameRate() const
Returns the frame rate of the map (in frames per second), for maps which are part of an animation.
 
QColor selectionColor() const
Returns the color that is used for drawing of selected vector features.
 
QgsAbstractGeometry::SegmentationToleranceType segmentationToleranceType() const
Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation...
 
QgsRectangle visibleExtent() const
Returns the actual extent derived from requested extent that takes output image size into account.
 
QVariantMap customRenderingFlags() const
Returns any custom rendering flags.
 
QString ellipsoid() const
Returns ellipsoid's acronym.
 
Qgis::TextRenderFormat textRenderFormat() const
Returns the text render format, which dictates how text is rendered (e.g.
 
double outputDpi() const
Returns the DPI (dots per inch) used for conversion between real world units (e.g.
 
bool testFlag(Qgis::MapSettingsFlag flag) const
Check whether a particular flag is enabled.
 
QList< QgsMapClippingRegion > clippingRegions() const
Returns the list of clipping regions to apply to the map.
 
Qgis::RasterizedRenderingPolicy rasterizedRenderingPolicy() const
Returns the policy controlling when rasterisation of content during renders is permitted.
 
const QgsPathResolver & pathResolver() const
Returns the path resolver for conversion between relative and absolute paths during rendering operati...
 
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for the map render.
 
const QgsExpressionContext & expressionContext() const
Gets the expression context.
 
const QgsMaskRenderSettings & maskSettings() const
Returns a reference to the mask render settings, which control how masks are drawn and behave during ...
 
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which stores various information regarding which datum tran...
 
bool isValid() const
Returns true if the object is valid (i.e.
 
double mapUnitsPerPixel() const
Returns the current map units per pixel.
 
Struct for storing maximum and minimum scales for measurements in map units.
 
double computeMapUnitsPerPixel(const QgsRenderContext &c) const
Computes a map units per pixel scaling factor, respecting the minimum and maximum scales set for the ...
 
bool minSizeMMEnabled
Whether the minimum size in mm should be respected.
 
double maxScale
The maximum scale, or 0.0 if unset.
 
double minScale
The minimum scale, or 0.0 if unset.
 
double maxSizeMM
The maximum size in millimeters, or 0.0 if unset.
 
bool maxSizeMMEnabled
Whether the maximum size in mm should be respected.
 
double minSizeMM
The minimum size in millimeters, or 0.0 if unset.
 
Contains settings regarding how masks are calculated and handled during a map render.
 
A rectangle specified with double values.
 
void grow(double delta)
Grows the rectangle in place by the specified amount.
 
Contains information about the context of a rendering operation.
 
Q_DECL_DEPRECATED void setForceVectorOutput(bool force)
Sets whether rendering operations should use vector operations instead of any faster raster shortcuts...
 
void setMapExtent(const QgsRectangle &extent)
Sets the original extent of the map being rendered.
 
void setTextureOrigin(const QPointF &origin)
Sets the texture origin, which should be used as a brush transform when rendering using QBrush object...
 
bool symbolLayerHasClipGeometries(const QString &symbolLayerId) const
Returns true if the symbol layer with matching ID has any associated clip geometries.
 
void setRenderingStopped(bool stopped)
Sets whether the rendering operation has been stopped and any ongoing rendering should be canceled im...
 
void setCoordinateTransform(const QgsCoordinateTransform &t)
Sets the current coordinate transform for the context.
 
double convertToMapUnits(double size, Qgis::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to map units.
 
void setShowSelection(bool showSelection)
Sets whether vector selections should be shown in the rendered map.
 
void setDrawEditingInformation(bool b)
Sets whether edit markers should be drawn during the render operation.
 
Q_DECL_DEPRECATED bool useAdvancedEffects() const
Returns true if advanced effects such as blend modes such be used.
 
void setScaleFactor(double factor)
Sets the scaling factor for the render to convert painter units to physical sizes.
 
void setImageFormat(QImage::Format format)
Sets QImage format which should be used for QImages created during rendering.
 
double convertFromPainterUnits(double size, Qgis::RenderUnit unit) const
Converts a size from painter units (pixels) to the specified render unit.
 
void setSegmentationToleranceType(QgsAbstractGeometry::SegmentationToleranceType type)
Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation...
 
QSet< QString > disabledSymbolLayersV2() const
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
 
void setDevicePixelRatio(float ratio)
Sets the device pixel ratio.
 
Q_DECL_DEPRECATED void setUseAdvancedEffects(bool enabled)
Used to enable or disable advanced effects such as blend modes.
 
void setCurrentFrame(long long frame)
Sets the current frame of the map, for maps which are part of an animation.
 
double convertToPainterUnits(double size, Qgis::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) const
Converts a size from the specified units to painter units (pixels).
 
QPainter * painter()
Returns the destination QPainter for the render operation.
 
void setMaskSettings(const QgsMaskRenderSettings &settings)
Sets the mask render settings, which control how masks are drawn and behave during render operations.
 
void setPainterFlagsUsingContext(QPainter *painter=nullptr) const
Sets relevant flags on a destination painter, using the flags and settings currently defined for the ...
 
void setTextRenderFormat(Qgis::TextRenderFormat format)
Sets the text render format, which dictates how text is rendered (e.g.
 
void setVectorSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Sets the simplification setting to use when rendering vector layers.
 
double convertFromMapUnits(double sizeInMapUnits, Qgis::RenderUnit outputUnit) const
Converts a size from map units to the specified units.
 
QgsCoordinateTransformContext transformContext() const
Returns the context's coordinate transform context, which stores various information regarding which ...
 
QSize outputSize() const
Returns the size of the resulting rendered image, in pixels.
 
QgsGeometry featureClipGeometry() const
Returns the geometry to use to clip features at render time.
 
QgsElevationMap * elevationMap() const
Returns the destination elevation map for the render operation.
 
const QgsRectangle & extent() const
When rendering a map layer, calling this method returns the "clipping" extent for the layer (in the l...
 
bool testFlag(Qgis::RenderContextFlag flag) const
Check whether a particular flag is enabled.
 
Q_DECL_DEPRECATED bool forceVectorOutput() const
Returns true if rendering operations should use vector operations instead of any faster raster shortc...
 
Q_DECL_DEPRECATED void setDisabledSymbolLayers(const QSet< const QgsSymbolLayer * > &symbolLayers)
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
 
long long currentFrame() const
Returns the current frame number of the map (in frames per second), for maps which are part of an ani...
 
void setDpiTarget(double dpi)
Sets the targeted dpi for rendering.
 
~QgsRenderContext() override
 
void setPathResolver(const QgsPathResolver &resolver)
Sets the path resolver for conversion between relative and absolute paths during rendering operations...
 
float devicePixelRatio() const
Returns the device pixel ratio.
 
void setFeedback(QgsFeedback *feedback)
Attach a feedback object that can be queried regularly during rendering to check if rendering should ...
 
Q_DECL_DEPRECATED void addSymbolLayerClipPath(const QString &symbolLayerId, QPainterPath path)
Add a clip path to be applied to the symbolLayer before rendering.
 
void setFeatureClipGeometry(const QgsGeometry &geometry)
Sets a geometry to use to clip features at render time.
 
void setDisabledSymbolLayersV2(const QSet< QString > &symbolLayers)
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
 
const QgsFeatureFilterProvider * featureFilterProvider() const
Gets the filter feature provider used for additional filtering of rendered features.
 
void setRasterizedRenderingPolicy(Qgis::RasterizedRenderingPolicy policy)
Sets the policy controlling when rasterisation of content during renders is permitted.
 
QList< QgsRenderedFeatureHandlerInterface * > renderedFeatureHandlers() const
Returns the list of rendered feature handlers to use while rendering map layers.
 
void setFlag(Qgis::RenderContextFlag flag, bool on=true)
Enable or disable a particular flag (other flags are not affected)
 
double frameRate() const
Returns the frame rate of the map, for maps which are part of an animation.
 
bool showSelection() const
Returns true if vector selections should be shown in the rendered map.
 
QList< QgsMapClippingRegion > clippingRegions() const
Returns the list of clipping regions to apply during the render.
 
void setFrameRate(double rate)
Sets the frame rate of the map (in frames per second), for maps which are part of an animation.
 
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
 
void setTransformContext(const QgsCoordinateTransformContext &context)
Sets the context's coordinate transform context, which stores various information regarding which dat...
 
void setFlags(Qgis::RenderContextFlags flags)
Set combination of flags that will be used for rendering.
 
void setExtent(const QgsRectangle &extent)
When rendering a map layer, calling this method sets the "clipping" extent for the layer (in the laye...
 
void setMapToPixel(const QgsMapToPixel &mtp)
Sets the context's map to pixel transform, which transforms between map coordinates and device coordi...
 
Q_DECL_DEPRECATED QSet< const QgsSymbolLayer * > disabledSymbolLayers() const
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
 
void setOutputSize(QSize size)
Sets the size of the resulting rendered image, in pixels.
 
void setCustomProperty(const QString &property, const QVariant &value)
Sets a custom rendering property.
 
QgsFeedback * feedback() const
Returns the feedback object that can be queried regularly during rendering to check if rendering shou...
 
QPointF textureOrigin() const
Returns the texture origin, which should be used as a brush transform when rendering using QBrush obj...
 
Qgis::RasterizedRenderingPolicy rasterizedRenderingPolicy() const
Returns the policy controlling when rasterisation of content during renders is permitted.
 
void setPainter(QPainter *p)
Sets the destination QPainter for the render operation.
 
QgsDoubleRange zRange() const
Returns the range of z-values which should be rendered.
 
bool isSymbolLayerEnabled(const QgsSymbolLayer *layer) const
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
 
QSize deviceOutputSize() const
Returns the device output size of the render.
 
QVector< QgsGeometry > symbolLayerClipGeometries(const QString &symbolLayerId) const
Returns clipping geometries to be applied to the symbolLayer before rendering.
 
static QgsRenderContext fromMapSettings(const QgsMapSettings &mapSettings)
create initialized QgsRenderContext instance from given QgsMapSettings
 
bool drawEditingInformation() const
Returns true if edit markers should be drawn during the render operation.
 
static QgsRenderContext fromQPainter(QPainter *painter)
Creates a default render context given a pixel based QPainter destination.
 
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.
 
void setUseRenderingOptimization(bool enabled)
Sets whether the rendering optimization (geometry simplification) should be executed.
 
void setRendererScale(double scale)
Sets the renderer map scale.
 
void setZRange(const QgsDoubleRange &range)
Sets the range of z-values which should be rendered.
 
double convertMetersToMapUnits(double meters) const
Convert meter distances to active MapUnit values for QgsUnitTypes::RenderMetersInMapUnits.
 
void addSymbolLayerClipGeometry(const QString &symbolLayerId, const QgsGeometry &geometry)
Add a clip geometry to be applied to the symbolLayer before rendering.
 
Qgis::RenderContextFlags flags() const
Returns combination of flags used for rendering.
 
Q_DECL_DEPRECATED QList< QPainterPath > symbolLayerClipPaths(const QString &symbolLayerId) const
Returns clip paths to be applied to the symbolLayer before rendering.
 
const QgsAbstractGeometry * geometry() const
Returns pointer to the unsegmentized geometry.
 
void setElevationMap(QgsElevationMap *map)
Sets the destination elevation map for the render operation.
 
QgsRenderContext & operator=(const QgsRenderContext &rh)
 
bool useRenderingOptimization() const
Returns true if the rendering optimization (geometry simplification) can be executed.
 
void setSelectionColor(const QColor &color)
Sets the color to use when rendering selected features.
 
void setSegmentationTolerance(double tolerance)
Sets the segmentation tolerance applied when rendering curved geometries.
 
void setFeatureFilterProvider(const QgsFeatureFilterProvider *ffp)
Set a filter feature provider used for additional filtering of rendered features.
 
Abstract base class for symbol layers.
 
QString id() const
Returns symbol layer identifier This id is unique in the whole project.
 
Base class for objects with an associated (optional) temporal range.
 
const QgsDateTimeRange & temporalRange() const
Returns the datetime range for the object.
 
bool isTemporal() const
Returns true if the object's temporal range is enabled, and the object will be filtered when renderin...
 
void setIsTemporal(bool enabled)
Sets whether the temporal range is enabled (i.e.
 
void setTemporalRange(const QgsDateTimeRange &range)
Sets the temporal range for the object.
 
static Q_INVOKABLE double fromUnitToUnitFactor(Qgis::DistanceUnit fromUnit, Qgis::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units.
 
void setSimplifyHints(Qgis::VectorRenderingSimplificationFlags simplifyHints)
Sets the simplification hints of the vector layer managed.
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
 
#define QgsDebugMsgLevel(str, level)
 
#define QgsDebugError(str)