QGIS API Documentation  3.19.0-Master (f616be29d3)
qgsvectorlayerrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayerrenderer.h
3  --------------------------------------
4  Date : December 2013
5  Copyright : (C) 2013 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSVECTORLAYERRENDERER_H
17 #define QGSVECTORLAYERRENDERER_H
18 
19 class QgsFeatureRenderer;
20 class QgsRenderContext;
21 class QgsVectorLayer;
23 
24 class QgsDiagramRenderer;
26 
27 class QgsFeatureIterator;
30 
31 #define SIP_NO_FILE
32 
33 #include <QList>
34 #include <QPainter>
35 #include <QElapsedTimer>
36 
37 typedef QList<int> QgsAttributeList;
38 
39 #include "qgis_sip.h"
40 #include "qgsfields.h" // QgsFields
41 #include "qgsfeatureiterator.h"
43 #include "qgsfeedback.h"
44 #include "qgsfeatureid.h"
45 
46 #include "qgsmaplayerrenderer.h"
47 
50 
57 {
58  Q_OBJECT
59 
60  public:
63 
64  private:
65  const QgsRenderContext &mContext;
66  QTimer *mTimer = nullptr;
67 };
68 
77 {
78  public:
81  QgsFeedback *feedback() const override;
82  bool forceRasterRender() const override;
83 
90 
91  bool render() override;
92 
93  void setLayerRenderingTimeHint( int time ) override;
94 
95  private:
96 
102  void prepareLabeling( QgsVectorLayer *layer, QSet<QString> &attributeNames );
103  void prepareDiagrams( QgsVectorLayer *layer, QSet<QString> &attributeNames );
104 
108  void drawRenderer( QgsFeatureRenderer *renderer, QgsFeatureIterator &fit );
109 
113  void drawRendererLevels( QgsFeatureRenderer *renderer, QgsFeatureIterator &fit );
114 
116  void stopRenderer( QgsFeatureRenderer *renderer, QgsSingleSymbolRenderer *selRenderer );
117 
118 
119  bool renderInternal( QgsFeatureRenderer *renderer );
120  protected:
121 
122  std::unique_ptr< QgsVectorLayerRendererInterruptionChecker > mInterruptionChecker;
123 
125  QgsVectorLayer *mLayer = nullptr;
126 
127  QgsFields mFields; // TODO: use fields from mSource
128 
130 
132 
133  std::unique_ptr< QgsVectorLayerFeatureSource > mSource;
134 
136  std::vector< std::unique_ptr< QgsFeatureRenderer> > mRenderers;
137 
141  double mVertexMarkerSize = 2.0;
142 
144 
145  QSet<QString> mAttrNames;
146 
148  bool mLabeling;
150  bool mDiagrams;
151 
157 
163 
164  QPainter::CompositionMode mFeatureBlendMode;
165 
168 
169  QList< QgsMapClippingRegion > mClippingRegions;
171  bool mApplyClipFilter = false;
173  bool mApplyClipGeometries = false;
176  bool mForceRasterRender = false;
177 
179  bool mBlockRenderUpdates = false;
180  QElapsedTimer mElapsedTimer;
181 
182 };
183 
184 
185 #endif // QGSVECTORLAYERRENDERER_H
Stores the settings for rendering of all diagrams for a layer.
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
Wrapper for iterator of features from vector data provider or vector layer.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
Container of fields for a vector layer.
Definition: qgsfields.h:45
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
A map clipping region (in map coordinates and CRS).
Base class for utility classes that encapsulate information necessary for rendering of map layers.
Contains information about the context of a rendering operation.
The QgsVectorLayerDiagramProvider class implements support for diagrams within the labeling engine.
Partial snapshot of vector layer's state (only the members necessary for access to features)
The QgsVectorLayerLabelProvider class implements a label provider for vector layers.
Interruption checker used by QgsVectorLayerRenderer::render()
QgsVectorLayerRendererInterruptionChecker(const QgsRenderContext &context)
Constructor.
Implementation of threaded rendering for vector layers.
std::vector< std::unique_ptr< QgsFeatureRenderer > > mRenderers
QgsVectorLayerLabelProvider * mLabelProvider
used with new labeling engine (QgsLabelingEngine): provider for labels.
bool forceRasterRender() const override
Returns true if the renderer must be rendered to a raster paint device (e.g.
QgsVectorSimplifyMethod mSimplifyMethod
bool mLabeling
used with old labeling engine (QgsPalLabeling): whether labeling is enabled
QgsVectorLayerRenderer(QgsVectorLayer *layer, QgsRenderContext &context)
QPainter::CompositionMode mFeatureBlendMode
~QgsVectorLayerRenderer() override
QgsVectorLayer * mLayer
The rendered layer.
QgsWkbTypes::GeometryType mGeometryType
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).
QgsFeatureRenderer * mRenderer
bool mDiagrams
used with new labeling engine (QgsPalLabeling): whether diagrams are enabled
QList< QgsMapClippingRegion > mClippingRegions
QgsFeedback * feedback() const override
Access to feedback object of the layer renderer (may be nullptr)
std::unique_ptr< QgsVectorLayerRendererInterruptionChecker > mInterruptionChecker
QgsFeatureRenderer * featureRenderer()
Returns the feature renderer.
std::unique_ptr< QgsVectorLayerFeatureSource > mSource
QgsVectorLayerDiagramProvider * mDiagramProvider
used with new labeling engine (QgsLabelingEngine): provider for diagrams.
Represents a vector layer which manages a vector based data sets.
This class contains information how to simplify geometries fetched from a vector layer.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:141
#define SIP_SKIP
Definition: qgis_sip.h:126
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:37
QList< int > QgsAttributeList