54  , mLayerName( layer->name() )
 
   55  , mFields( layer->fields() )
 
   57  , mNoSetLayerExpressionContext( layer->customProperty( QStringLiteral( 
"_noset_layer_expression_context" ) ).toBool() )
 
   58  , mEnableProfile( context.flags() & 
Qgis::RenderContextFlag::RecordProfile )
 
   62  std::unique_ptr< QgsFeatureRenderer > mainRenderer( layer->
renderer() ? layer->
renderer()->
clone() : nullptr );
 
   65  switch ( selectionProperties->selectionRenderingMode() )
 
   73      const QColor layerSelectionColor = selectionProperties->selectionColor();
 
   74      if ( layerSelectionColor.isValid() )
 
   81      if ( 
QgsSymbol *selectionSymbol =  qobject_cast< QgsVectorLayerSelectionProperties * >( layer->
selectionProperties() )->selectionSymbol() )
 
   82        mSelectionSymbol.reset( selectionSymbol->clone() );
 
   93    return g1->level() < g2->level();
 
   96  bool insertedMainRenderer = 
false;
 
   97  double prevLevel = std::numeric_limits< double >::lowest();
 
   99  mRenderer = mainRenderer.get();
 
  102    if ( generator->level() >= 0 && prevLevel < 0 && !insertedMainRenderer )
 
  105      mRenderers.emplace_back( std::move( mainRenderer ) );
 
  106      insertedMainRenderer = 
true;
 
  108    mRenderers.emplace_back( generator->createRenderer() );
 
  109    prevLevel = generator->level();
 
  115    mRenderers.emplace_back( std::move( mainRenderer ) );
 
  120  mDrawVertexMarkers = 
nullptr != layer->
editBuffer();
 
  130    mTemporalFilter = qobject_cast< const QgsVectorLayerTemporalProperties * >( layer->
temporalProperties() )->createFilterString( temporalContext, context.
temporalRange() );
 
  131    QgsDebugMsgLevel( 
"Rendering with Temporal Filter: " + mTemporalFilter, 2 );
 
  151  if ( markerTypeString == QLatin1String( 
"Cross" ) )
 
  155  else if ( markerTypeString == QLatin1String( 
"SemiTransparentCircle" ) )
 
  169  if ( mDrawVertexMarkers )
 
  175  for ( 
const std::unique_ptr< QgsFeatureRenderer > &renderer : mRenderers )
 
  177    mAttrNames.unite( renderer->usedAttributes( context ) );
 
  183      mAttrNames.unite( handler->usedAttributes( layer, context ) );
 
  187  prepareLabeling( layer, mAttrNames );
 
  188  prepareDiagrams( layer, mAttrNames );
 
  192  if ( std::any_of( mRenderers.begin(), mRenderers.end(), []( 
const auto & renderer ) { return renderer->forceRasterRender(); } ) )
 
  195    mForceRasterRender = 
true;
 
  199  if ( allowFlattening &&
 
  200       ( ( layer->
blendMode() != QPainter::CompositionMode_SourceOver )
 
  205    mForceRasterRender = 
true;
 
  209  mPreparationTime = timer.elapsed();
 
 
  216  mRenderTimeHint = time;
 
 
  221  return mFeedback.get();
 
 
  226  return mForceRasterRender;
 
 
  245  if ( mRenderers.empty() )
 
  248    mErrors.append( QObject::tr( 
"No renderer for drawing." ) );
 
  252  std::unique_ptr< QgsScopedRuntimeProfile > profile;
 
  253  if ( mEnableProfile )
 
  255    profile = std::make_unique< QgsScopedRuntimeProfile >( mLayerName, QStringLiteral( 
"rendering" ), 
layerId() );
 
  256    if ( mPreparationTime > 0 )
 
  264    mBlockRenderUpdates = 
true;
 
  265    mElapsedTimer.start();
 
  269  int rendererIndex = 0;
 
  270  for ( 
const std::unique_ptr< QgsFeatureRenderer > &renderer : mRenderers )
 
  272    if ( mFeedback->isCanceled() || !res )
 
  276    res = renderInternal( renderer.get(), rendererIndex++ ) && res;
 
 
  283bool QgsVectorLayerRenderer::renderInternal( 
QgsFeatureRenderer *renderer, 
int rendererIndex )
 
  285  const bool isMainRenderer = renderer == mRenderer;
 
  290  if ( renderer->
type() == QLatin1String( 
"nullSymbol" ) )
 
  294    if ( !isMainRenderer ||
 
  295         ( !mDrawVertexMarkers && !mLabelProvider && !mDiagramProvider && mSelectedFeatureIds.isEmpty() ) )
 
  299  std::unique_ptr< QgsScopedRuntimeProfile > preparingProfile;
 
  300  if ( mEnableProfile )
 
  303    if ( mRenderers.size() > 1 )
 
  304      title = QObject::tr( 
"Preparing render %1" ).arg( rendererIndex + 1 );
 
  306      title = QObject::tr( 
"Preparing render" );
 
  307    preparingProfile = std::make_unique< QgsScopedRuntimeProfile >( title, QStringLiteral( 
"rendering" ) );
 
  312  bool usingEffect = 
false;
 
  321       && mFeatureBlendMode != QPainter::CompositionMode_SourceOver )
 
  325    context.
painter()->setCompositionMode( mFeatureBlendMode );
 
  337  QString rendererFilter = renderer->
filter( mFields );
 
  340  if ( !mClippingRegions.empty() )
 
  347    bool needsPainterClipPath = 
false;
 
  349    if ( needsPainterClipPath )
 
  350      context.
painter()->setClipPath( path, Qt::IntersectClip );
 
  354    if ( mDiagramProvider )
 
  370  if ( featureFilterProvider )
 
  383  if ( !rendererFilter.isEmpty() && rendererFilter != QLatin1String( 
"TRUE" ) )
 
  387  if ( !mTemporalFilter.isEmpty() )
 
  398  if ( mSimplifyGeometry )
 
  400    double map2pixelTol = mSimplifyMethod.
threshold();
 
  401    bool validTransform = 
true;
 
  430          double sourceHypothenuse = std::sqrt( minimumSrcPoint.sqrDist( maximumSrcPoint ) );
 
  431          double targetHypothenuse = std::sqrt( minimumDstPoint.sqrDist( maximumDstPoint ) );
 
  433          QgsDebugMsgLevel( QStringLiteral( 
"Simplify - SourceHypothenuse=%1" ).arg( sourceHypothenuse ), 4 );
 
  434          QgsDebugMsgLevel( QStringLiteral( 
"Simplify - TargetHypothenuse=%1" ).arg( targetHypothenuse ), 4 );
 
  437            map2pixelTol *= ( sourceHypothenuse / targetHypothenuse );
 
  443        validTransform = 
false;
 
  447    if ( validTransform )
 
  479  std::unique_ptr< QgsScopedRuntimeProfile > preparingFeatureItProfile;
 
  480  if ( mEnableProfile )
 
  482    preparingFeatureItProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( 
"Prepare feature iteration" ), QStringLiteral( 
"rendering" ) );
 
  493  preparingFeatureItProfile.reset();
 
  494  preparingProfile.reset();
 
  496  std::unique_ptr< QgsScopedRuntimeProfile > renderingProfile;
 
  497  if ( mEnableProfile )
 
  499    renderingProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( 
"Rendering" ), QStringLiteral( 
"rendering" ) );
 
  503    drawRendererLevels( renderer, fit );
 
  505    drawRenderer( renderer, fit );
 
  509    mErrors.append( QStringLiteral( 
"Data source invalid" ) );
 
  526  quint64 totalLabelTime = 0;
 
  528  const bool isMainRenderer = renderer == mRenderer;
 
  534  std::unique_ptr< QgsGeometryEngine > clipEngine;
 
  535  if ( mApplyClipFilter )
 
  538    clipEngine->prepareGeometry();
 
  541  if ( mSelectionSymbol && isMainRenderer )
 
  542    mSelectionSymbol->startRender( context, mFields );
 
  561      if ( mApplyClipGeometries )
 
  564      if ( ! mNoSetLayerExpressionContext )
 
  567      const bool featureIsSelected = isMainRenderer && context.
showSelection() && mSelectedFeatureIds.contains( fet.
id() );
 
  568      bool drawMarker = isMainRenderer && ( mDrawVertexMarkers && context.
drawEditingInformation() && ( !mVertexMarkerOnlyForSelection || featureIsSelected ) );
 
  571      bool rendered = 
false;
 
  574        if ( featureIsSelected && mSelectionSymbol )
 
  578          mSelectionSymbol->renderFeature( fet, context, -1, 
false, drawMarker );
 
  583          rendered = renderer->
renderFeature( fet, context, -1, featureIsSelected, drawMarker );
 
  603        if ( isMainRenderer && context.
labelingEngine() && ( mLabelProvider || mDiagramProvider ) )
 
  605          const quint64 startLabelTime = timer.elapsed();
 
  614          if ( !symbols.isEmpty() )
 
  616            symbol = symbols.at( 0 );
 
  620          if ( mApplyLabelClipGeometries )
 
  623          if ( mLabelProvider )
 
  625            mLabelProvider->
registerFeature( fet, context, obstacleGeometry, symbol );
 
  627          if ( mDiagramProvider )
 
  632          if ( mApplyLabelClipGeometries )
 
  635          totalLabelTime += ( timer.elapsed() - startLabelTime );
 
  642      QgsDebugError( QStringLiteral( 
"Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
 
  643                     .arg( fet.
id() ).arg( cse.
what() ) );
 
  649  std::unique_ptr< QgsScopedRuntimeProfile > cleanupProfile;
 
  650  if ( mEnableProfile )
 
  652    QgsApplication::profiler()->
record( QObject::tr( 
"Rendering features" ), ( timer.elapsed() - totalLabelTime ) / 1000.0, QStringLiteral( 
"rendering" ) );
 
  653    if ( totalLabelTime > 0 )
 
  657    cleanupProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( 
"Finalizing" ), QStringLiteral( 
"rendering" ) );
 
  660  if ( mSelectionSymbol && isMainRenderer )
 
  661    mSelectionSymbol->stopRender( context );
 
  663  stopRenderer( renderer, 
nullptr );
 
  668  const bool isMainRenderer = renderer == mRenderer;
 
  681  QList<QHash< QgsSymbol *, QList<QgsFeature> >> features;
 
  684  features.push_back( {} );
 
  686  QSet<int> orderByAttributeIdx;
 
  695  if ( !mSelectedFeatureIds.isEmpty() )
 
  704  auto scopePopper = std::make_unique< QgsExpressionContextScopePopper >( context.
expressionContext(), symbolScope );
 
  707  std::unique_ptr< QgsGeometryEngine > clipEngine;
 
  708  if ( mApplyClipFilter )
 
  711    clipEngine->prepareGeometry();
 
  714  if ( mApplyLabelClipGeometries )
 
  717  std::unique_ptr< QgsScopedRuntimeProfile > fetchFeaturesProfile;
 
  718  if ( mEnableProfile )
 
  720    fetchFeaturesProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( 
"Fetching features" ), QStringLiteral( 
"rendering" ) );
 
  725  quint64 totalLabelTime = 0;
 
  729  QVector<QVariant> prevValues; 
 
  734      qDebug( 
"rendering stop!" );
 
  735      stopRenderer( renderer, selRenderer );
 
  745    if ( ! mNoSetLayerExpressionContext )
 
  755      QVector<QVariant> currentValues;
 
  756      for ( 
const int idx : std::as_const( orderByAttributeIdx ) )
 
  758        currentValues.push_back( fet.
attribute( idx ) );
 
  760      if ( prevValues.empty() )
 
  762        prevValues = std::move( currentValues );
 
  764      else if ( currentValues != prevValues )
 
  768        prevValues = std::move( currentValues );
 
  769        features.push_back( {} );
 
  775      QHash<QgsSymbol *, QList<QgsFeature> > &featuresBack = features.back();
 
  776      auto featuresBackIt = featuresBack.find( sym );
 
  777      if ( featuresBackIt == featuresBack.end() )
 
  779        featuresBackIt = featuresBack.insert( sym, QList<QgsFeature>() );
 
  781      featuresBackIt->append( fet );
 
  785    if ( isMainRenderer && context.
labelingEngine() && ( mLabelProvider || mDiagramProvider ) )
 
  787      const quint64 startLabelTime = timer.elapsed();
 
  797      if ( !symbols.isEmpty() )
 
  799        symbol = symbols.at( 0 );
 
  803      if ( mLabelProvider )
 
  805        mLabelProvider->
registerFeature( fet, context, obstacleGeometry, symbol );
 
  807      if ( mDiagramProvider )
 
  812      totalLabelTime += ( timer.elapsed() - startLabelTime );
 
  816  fetchFeaturesProfile.reset();
 
  817  if ( mEnableProfile )
 
  819    if ( totalLabelTime > 0 )
 
  825  if ( mApplyLabelClipGeometries )
 
  830  if ( features.back().empty() )
 
  833    stopRenderer( renderer, selRenderer );
 
  838  std::unique_ptr< QgsScopedRuntimeProfile > sortingProfile;
 
  839  if ( mEnableProfile )
 
  841    sortingProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( 
"Sorting features" ), QStringLiteral( 
"rendering" ) );
 
  846  for ( 
int i = 0; i < symbols.count(); i++ )
 
  852      if ( level < 0 || level >= 1000 ) 
 
  855      while ( level >= levels.count() ) 
 
  857      levels[level].append( item );
 
  860  sortingProfile.reset();
 
  862  if ( mApplyClipGeometries )
 
  866  for ( 
const QHash< 
QgsSymbol *, QList<QgsFeature> > &featureLists : features )
 
  868    for ( 
int l = 0; l < levels.count(); l++ )
 
  871      std::unique_ptr< QgsScopedRuntimeProfile > renderingProfile;
 
  872      if ( mEnableProfile )
 
  874        renderingProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( 
"Rendering symbol level %1" ).arg( l + 1 ), QStringLiteral( 
"rendering" ) );
 
  877      for ( 
int i = 0; i < level.count(); i++ )
 
  880        if ( !featureLists.contains( item.
symbol() ) )
 
  882          QgsDebugError( QStringLiteral( 
"level item's symbol not found!" ) );
 
  885        const int layer = item.
layer();
 
  886        const QList<QgsFeature> &lst = featureLists[item.
symbol()];
 
  891            stopRenderer( renderer, selRenderer );
 
  895          const bool featureIsSelected = isMainRenderer && context.
showSelection() && mSelectedFeatureIds.contains( feature.id() );
 
  896          if ( featureIsSelected && mSelectionSymbol )
 
  900          const bool drawMarker = isMainRenderer && ( mDrawVertexMarkers && context.
drawEditingInformation() && ( !mVertexMarkerOnlyForSelection || featureIsSelected ) );
 
  902          if ( ! mNoSetLayerExpressionContext )
 
  907            renderer->
renderFeature( feature, context, layer, featureIsSelected, drawMarker );
 
  920            QgsDebugError( QStringLiteral( 
"Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
 
  921                           .arg( fet.
id() ).arg( cse.
what() ) );
 
  928  if ( mSelectionSymbol && !mSelectedFeatureIds.empty() && isMainRenderer && context.
showSelection() )
 
  930    mSelectionSymbol->startRender( context, mFields );
 
  932    for ( 
const QHash< 
QgsSymbol *, QList<QgsFeature> > &featureLists : features )
 
  934      for ( 
auto it = featureLists.constBegin(); it != featureLists.constEnd(); ++it )
 
  936        const QList<QgsFeature> &lst = it.value();
 
  944          const bool featureIsSelected = mSelectedFeatureIds.contains( feature.id() );
 
  945          if ( !featureIsSelected )
 
  951          mSelectionSymbol->renderFeature( feature, context, -1, 
false, drawMarker );
 
  956    mSelectionSymbol->stopRender( context );
 
  959  std::unique_ptr< QgsScopedRuntimeProfile > cleanupProfile;
 
  960  if ( mEnableProfile )
 
  962    cleanupProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( 
"Finalizing" ), QStringLiteral( 
"rendering" ) );
 
  965  stopRenderer( renderer, selRenderer );
 
  979void QgsVectorLayerRenderer::prepareLabeling( 
QgsVectorLayer *layer, QSet<QString> &attributeNames )
 
 1003      if ( mLabelProvider )
 
 1005        engine2->addProvider( mLabelProvider );
 
 1006        if ( !mLabelProvider->
prepare( context, attributeNames ) )
 
 1008          engine2->removeProvider( mLabelProvider );
 
 1009          mLabelProvider = 
nullptr; 
 
 1019  if ( palyr.limitNumLabels && palyr.maxNumLabels > 0 )
 
 1022                                          .setFilterRect( mContext.extent() )
 
 1027    int nFeatsToLabel = 0;
 
 1036  if ( !palyr.mTextFontFound && !mLabelFontNotFoundNotified )
 
 1038    emit labelingFontNotFound( 
this, palyr.mTextFontFamily );
 
 1039    mLabelFontNotFoundNotified = 
true;
 
 1044void QgsVectorLayerRenderer::prepareDiagrams( 
QgsVectorLayer *layer, QSet<QString> &attributeNames )
 
 1053      engine2->addProvider( mDiagramProvider );
 
 1054      if ( !mDiagramProvider->
prepare( context, attributeNames ) )
 
 1056        engine2->removeProvider( mDiagramProvider );
 
 1057        mDiagramProvider = 
nullptr;  
 
Provides global constants and enumerations for use throughout the application.
 
@ ForceVector
Always force vector-based rendering, even when the result will be visually different to a raster-base...
 
QFlags< MapLayerRendererFlag > MapLayerRendererFlags
Flags which control how map layer renderers behave.
 
QFlags< VectorRenderingSimplificationFlag > VectorRenderingSimplificationFlags
Simplification flags for vector feature rendering.
 
@ NoSimplification
No simplification can be applied.
 
@ FullSimplification
All simplification hints can be applied ( Geometry + AA-disabling )
 
@ GeometrySimplification
The geometries can be simplified using the current map2pixel context state.
 
@ Degrees
Degrees, for planar geographic CRS distance measurements.
 
@ EmbeddedSymbols
Retrieve any embedded feature symbology.
 
@ AffectsLabeling
If present, indicates that the renderer will participate in the map labeling problem.
 
@ AffectsLabeling
The layer rendering will interact with the map labeling.
 
@ SkipSymbolRendering
Disable symbol rendering while still drawing labels if enabled.
 
@ SemiTransparentCircle
Semi-transparent circle marker.
 
@ CustomColor
Use default symbol with a custom selection color.
 
@ CustomSymbol
Use a custom symbol.
 
@ Default
Use default symbol and selection colors.
 
virtual QgsPalLayerSettings settings(const QString &providerId=QString()) const =0
Gets associated label settings.
 
virtual QgsVectorLayerLabelProvider * provider(QgsVectorLayer *layer) const
Factory for label provider implementation.
 
static QgsRuntimeProfiler * profiler()
Returns the application runtime profiler.
 
Qgis::DistanceUnit mapUnits
 
Custom exception class for Coordinate Reference System related exceptions.
 
Single scope for storing variables and functions for use within a QgsExpressionContext.
 
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
 
QgsExpressionContextScope * popScope()
Removes the last scope from the expression context and return it.
 
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
 
void setFeedback(QgsFeedback *feedback)
Attach a feedback object that can be queried regularly by the expression engine to check if expressio...
 
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
 
Abstract interface for use by classes that filter the features or attributes of a layer.
 
virtual Q_DECL_DEPRECATED void filterFeatures(const QgsVectorLayer *layer, QgsFeatureRequest &featureRequest) const
Add additional filters to the feature request to further restrict the features returned by the reques...
 
virtual Q_DECL_DEPRECATED bool isFilterThreadSafe() const
Returns true if the filterFeature function is thread safe, which will lead to reliance on layer ID in...
 
Wrapper for iterator of features from vector data provider or vector layer.
 
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
 
void setInterruptionChecker(QgsFeedback *interruptionChecker)
Attach an object that can be queried regularly by the iterator to check if it must stopped.
 
bool isValid() const
Will return if this iterator is valid.
 
An interface for objects which generate feature renderers for vector layers.
 
Abstract base class for all 2D vector feature renderers.
 
virtual bool canSkipRender()
Returns true if the renderer can be entirely skipped, i.e.
 
virtual void modifyRequestExtent(QgsRectangle &extent, QgsRenderContext &context)
Allows for a renderer to modify the extent of a feature request prior to rendering.
 
virtual QString filter(const QgsFields &fields=QgsFields())
If a renderer does not require all the features this method may be overridden and return an expressio...
 
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the renderer.
 
virtual QgsSymbolList symbols(QgsRenderContext &context) const
Returns list of symbols used by the renderer.
 
virtual Qgis::FeatureRendererFlags flags() const
Returns flags associated with the renderer.
 
virtual void stopRender(QgsRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
 
virtual bool usesEmbeddedSymbols() const
Returns true if the renderer uses embedded symbols for features.
 
virtual bool renderFeature(const QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
Render a feature using this renderer in the given context.
 
double referenceScale() const
Returns the symbology reference scale.
 
bool usingSymbolLevels() const
 
virtual QString dump() const
Returns debug information about this renderer.
 
virtual QgsFeatureRenderer::Capabilities capabilities()
Returns details about internals of this renderer.
 
virtual QgsSymbol * symbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const =0
To be overridden.
 
@ SymbolLevels
Rendering with symbol levels (i.e. implements symbols(), symbolForFeature())
 
bool orderByEnabled() const
Returns whether custom ordering will be applied before features are processed by this renderer.
 
virtual bool willRenderFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns whether the renderer will render a feature or not.
 
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)
Must be called when a new render cycle is started.
 
void setVertexMarkerAppearance(Qgis::VertexMarkerType type, double size)
Sets type and size of editing vertex markers for subsequent rendering.
 
QgsFeatureRequest::OrderBy orderBy() const
Gets the order in which features shall be processed by this renderer.
 
virtual QgsSymbolList originalSymbolsForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbol...
 
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
 
QSet< int > CORE_EXPORT usedAttributeIndices(const QgsFields &fields) const
Returns a set of used, validated attribute indices.
 
Wraps a request for features to a vector layer (or directly its vector data provider).
 
QgsFeatureRequest & setFlags(Qgis::FeatureRequestFlags flags)
Sets flags that affect how features will be fetched.
 
QgsFeatureRequest & setSimplifyMethod(const QgsSimplifyMethod &simplifyMethod)
Set a simplification method for geometries that will be fetched.
 
QgsFeatureRequest & combineFilterExpression(const QString &expression)
Modifies the existing filter expression to add an additional expression filter.
 
Qgis::FeatureRequestFlags flags() const
Returns the flags which affect how features are fetched.
 
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
 
void setFeedback(QgsFeedback *feedback)
Attach a feedback object that can be queried regularly by the iterator to check if it should be cance...
 
QgsFeatureRequest & setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used to evaluate filter expressions.
 
QgsFeatureRequest & setNoAttributes()
Set that no attributes will be fetched.
 
QgsFeatureRequest & setOrderBy(const OrderBy &orderBy)
Set a list of order by clauses.
 
QgsFeatureRequest & setFilterRect(const QgsRectangle &rectangle)
Sets the rectangle from which features will be taken.
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
bool hasGeometry() const
Returns true if the feature has an associated geometry.
 
Q_INVOKABLE QVariant attribute(const QString &name) const
Lookup attribute value by attribute name.
 
Base class for feedback objects to be used for cancellation of something running in a worker thread.
 
A geometry is the spatial representation of a feature.
 
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
 
bool isEmpty() const
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geom...
 
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
 
static QgsGeometryEngine * createGeometryEngine(const QgsAbstractGeometry *geometry, double precision=0.0, Qgis::GeosCreationFlags flags=Qgis::GeosCreationFlag::SkipEmptyInteriorRings)
Creates and returns a new geometry engine representing the specified geometry using precision on a gr...
 
Implements a derived label provider for use with QgsLabelSink.
 
Provides map labeling functionality.
 
static QPainterPath calculatePainterClipRegion(const QList< QgsMapClippingRegion > ®ions, const QgsRenderContext &context, Qgis::LayerType layerType, bool &shouldClip)
Returns a QPainterPath representing the intersection of clipping regions from context which should be...
 
static QList< QgsMapClippingRegion > collectClippingRegionsForLayer(const QgsRenderContext &context, const QgsMapLayer *layer)
Collects the list of map clipping regions from a context which apply to a map layer.
 
static QgsGeometry calculateLabelIntersectionGeometry(const QList< QgsMapClippingRegion > ®ions, const QgsRenderContext &context, bool &shouldClip)
Returns the geometry representing the intersection of clipping regions from context which should be u...
 
static QgsGeometry calculateFeatureIntersectionGeometry(const QList< QgsMapClippingRegion > ®ions, const QgsRenderContext &context, bool &shouldClip)
Returns the geometry representing the intersection of clipping regions from context which should be u...
 
static QgsGeometry calculateFeatureRequestGeometry(const QList< QgsMapClippingRegion > ®ions, const QgsRenderContext &context, bool &shouldFilter)
Returns the geometry representing the intersection of clipping regions from context.
 
Base class for utility classes that encapsulate information necessary for rendering of map layers.
 
bool mReadyToCompose
The flag must be set to false in renderer's constructor if wants to use the smarter map redraws funct...
 
static constexpr int MAX_TIME_TO_USE_CACHED_PREVIEW_IMAGE
Maximum time (in ms) to allow display of a previously cached preview image while rendering layers,...
 
QString layerId() const
Gets access to the ID of the layer rendered by this class.
 
QgsRenderContext * renderContext()
Returns the render context associated with the renderer.
 
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
 
Perform transforms between map coordinates and device coordinates.
 
double mapUnitsPerPixel() const
Returns the current map units per pixel.
 
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true, const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE())
Adds a message to the log instance (and creates it if necessary).
 
virtual void begin(QgsRenderContext &context)
Begins intercepting paint operations to a render context.
 
virtual void end(QgsRenderContext &context)
Ends interception of paint operations to a render context, and draws the result to the render context...
 
bool enabled() const
Returns whether the effect is enabled.
 
Contains settings for how a map layer will be labeled.
 
A rectangle specified with double values.
 
Q_INVOKABLE QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
 
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
 
bool isFinite() const
Returns true if the rectangle has finite boundaries.
 
Contains information about the context of a rendering operation.
 
bool hasRenderedFeatureHandlers() const
Returns true if the context has any rendered feature handlers.
 
QgsVectorSimplifyMethod & vectorSimplifyMethod()
Returns the simplification settings to use when rendering vector layers.
 
QPainter * painter()
Returns the destination QPainter for the render operation.
 
QgsExpressionContext & expressionContext()
Gets the expression context.
 
void setVectorSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Sets the simplification setting to use when rendering vector layers.
 
QgsLabelSink * labelSink() const
Returns the associated label sink, or nullptr if not set.
 
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.
 
void setFeatureClipGeometry(const QgsGeometry &geometry)
Sets a geometry to use to clip features at render time.
 
const QgsFeatureFilterProvider * featureFilterProvider() const
Gets the filter feature provider used for additional filtering of rendered features.
 
QList< QgsRenderedFeatureHandlerInterface * > renderedFeatureHandlers() const
Returns the list of rendered feature handlers to use while rendering map layers.
 
void setSymbologyReferenceScale(double scale)
Sets the symbology reference scale.
 
bool showSelection() const
Returns true if vector selections should be shown in the rendered map.
 
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
 
QColor selectionColor() const
Returns the color to use when rendering selected features.
 
Qgis::RasterizedRenderingPolicy rasterizedRenderingPolicy() const
Returns the policy controlling when rasterisation of content during renders is permitted.
 
bool drawEditingInformation() const
Returns true if edit markers should be drawn during the render operation.
 
bool renderingStopped() const
Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled...
 
QgsLabelingEngine * labelingEngine() const
Gets access to new labeling engine (may be nullptr).
 
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
 
void setSelectionColor(const QColor &color)
Sets the color to use when rendering selected features.
 
An interface for classes which provide custom handlers for features rendered as part of a map render ...
 
Implements a derived label provider for rule based labels for use with QgsLabelSink.
 
Rule based labeling for a vector layer.
 
void record(const QString &name, double time, const QString &group="startup", const QString &id=QString())
Manually adds a profile event with the given name and total time (in seconds).
 
Scoped object for saving and restoring a QPainter object's state.
 
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
 
static const QgsSettingsEntryDouble * settingsDigitizingMarkerSizeMm
Settings entry digitizing marker size mm.
 
static const QgsSettingsEntryBool * settingsDigitizingMarkerOnlyForSelected
Settings entry digitizing marker only for selected.
 
static const QgsSettingsEntryString * settingsDigitizingMarkerStyle
Settings entry digitizing marker style.
 
Contains information about how to simplify geometries fetched from a QgsFeatureIterator.
 
void setTolerance(double tolerance)
Sets the tolerance of simplification in map units. Represents the maximum distance in map units betwe...
 
void setThreshold(float threshold)
Sets the simplification threshold in pixels. Represents the maximum distance in pixels between two co...
 
void setForceLocalOptimization(bool localOptimization)
Sets whether the simplification executes after fetch the geometries from provider,...
 
void setMethodType(MethodType methodType)
Sets the simplification type.
 
@ OptimizeForRendering
Simplify using the map2pixel data to optimize the rendering of geometries.
 
A feature renderer which renders all features with the same symbol.
 
QgsSymbol * symbol() const
Returns the symbol which will be rendered for every feature.
 
void stopRender(QgsRenderContext &context) override
Must be called when a render cycle has finished, to allow the renderer to clean up.
 
void startRender(QgsRenderContext &context, const QgsFields &fields) override
Must be called when a new render cycle is started.
 
int renderingPass() const
Specifies the rendering pass in which this symbol layer should be rendered.
 
Represents a symbol level during vector rendering operations.
 
int layer() const
The layer of this symbol level.
 
QgsSymbol * symbol() const
The symbol of this symbol level.
 
Abstract base class for all rendered symbols.
 
QgsSymbolLayer * symbolLayer(int layer)
Returns the symbol layer at the specified index.
 
void setColor(const QColor &color) const
Sets the color for the symbol.
 
int symbolLayerCount() const
Returns the total number of symbol layers contained in the symbol.
 
static QgsSymbol * defaultSymbol(Qgis::GeometryType geomType)
Returns a new default symbol for the specified geometry type.
 
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...
 
Implements support for diagrams within the labeling engine.
 
virtual bool prepare(const QgsRenderContext &context, QSet< QString > &attributeNames)
Prepare for registration of features.
 
virtual void registerFeature(QgsFeature &feature, QgsRenderContext &context, const QgsGeometry &obstacleGeometry=QgsGeometry())
Register a feature for labeling as one or more QgsLabelFeature objects stored into mFeatures.
 
void setClipFeatureGeometry(const QgsGeometry &geometry)
Sets a geometry to use to clip features to when registering them as diagrams.
 
Partial snapshot of vector layer's state (only the members necessary for access to features).
 
virtual bool prepare(QgsRenderContext &context, QSet< QString > &attributeNames)
Prepare for registration of features.
 
static QgsGeometry getPointObstacleGeometry(QgsFeature &fet, QgsRenderContext &context, const QgsSymbolList &symbols)
Returns the geometry for a point feature which should be used as an obstacle for labels.
 
virtual QList< QgsLabelFeature * > registerFeature(const QgsFeature &feature, QgsRenderContext &context, const QgsGeometry &obstacleGeometry=QgsGeometry(), const QgsSymbol *symbol=nullptr)
Register a feature for labeling as one or more QgsLabelFeature objects stored into mLabels.
 
Qgis::MapLayerRendererFlags flags() const override
Returns flags which control how the map layer rendering behaves.
 
bool forceRasterRender() const override
Returns true if the renderer must be rendered to a raster paint device (e.g.
 
QgsVectorLayerRenderer(QgsVectorLayer *layer, QgsRenderContext &context)
 
~QgsVectorLayerRenderer() override
 
void setLayerRenderingTimeHint(int time) override
Sets approximate render time (in ms) for the layer to render.
 
bool render() override
Do the rendering (based on data stored in the class).
 
QgsFeedback * feedback() const override
Access to feedback object of the layer renderer (may be nullptr)
 
Implementation of layer selection properties for vector layers.
 
Encapsulates the context in which a QgsVectorLayer's temporal capabilities will be applied.
 
void setLayer(QgsVectorLayer *layer)
Sets the associated layer.
 
Represents a vector layer which manages a vector based dataset.
 
bool labelsEnabled() const
Returns whether the layer contains labels which are enabled and should be drawn.
 
QgsMapLayerTemporalProperties * temporalProperties() override
Returns the layer's temporal properties.
 
QPainter::CompositionMode featureBlendMode() const
Returns the current blending mode for features.
 
bool diagramsEnabled() const
Returns whether the layer contains diagrams which are enabled and should be drawn.
 
Q_INVOKABLE const QgsFeatureIds & selectedFeatureIds() const
Returns a list of the selected features IDs in this layer.
 
const QgsAbstractVectorLayerLabeling * labeling() const
Access to const labeling configuration.
 
bool simplifyDrawingCanbeApplied(const QgsRenderContext &renderContext, Qgis::VectorRenderingSimplificationFlag simplifyHint) const
Returns whether the VectorLayer can apply the specified simplification hint.
 
QgsFeatureRenderer * renderer()
Returns the feature renderer used for rendering the features in the layer in 2D map views.
 
Q_INVOKABLE QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on.
 
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.
 
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
 
QList< const QgsFeatureRendererGenerator * > featureRendererGenerators() const
Returns a list of the feature renderer generators owned by the layer.
 
QgsMapLayerSelectionProperties * selectionProperties() override
Returns the layer's selection properties.
 
Contains settings for simplifying geometries fetched from a vector layer.
 
bool forceLocalOptimization() const
Gets where the simplification executes, after fetch the geometries from provider, or when supported,...
 
Qgis::VectorRenderingSimplificationFlags simplifyHints() const
Gets the simplification hints of the vector layer managed.
 
void setSimplifyHints(Qgis::VectorRenderingSimplificationFlags simplifyHints)
Sets the simplification hints of the vector layer managed.
 
void setTolerance(double tolerance)
Sets the tolerance of simplification in map units. Represents the maximum distance in map units betwe...
 
float threshold() const
Gets the simplification threshold of the vector layer managed.
 
#define Q_NOWARN_DEPRECATED_POP
 
#define Q_NOWARN_DEPRECATED_PUSH
 
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)
 
QList< QgsSymbolLevel > QgsSymbolLevelOrder
 
QList< QgsSymbolLevelItem > QgsSymbolLevel
 
QList< QgsSymbol * > QgsSymbolList