QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
59 {
60  public:
62  ~QgsVectorLayerRenderer() override;
63  QgsFeedback *feedback() const override;
64  bool forceRasterRender() const override;
65 
71  QgsFeatureRenderer *featureRenderer() SIP_SKIP { return mRenderer; }
72 
73  bool render() override;
74 
75  void setLayerRenderingTimeHint( int time ) override;
76 
77  private:
78 
84  void prepareLabeling( QgsVectorLayer *layer, QSet<QString> &attributeNames );
85  void prepareDiagrams( QgsVectorLayer *layer, QSet<QString> &attributeNames );
86 
90  void drawRenderer( QgsFeatureRenderer *renderer, QgsFeatureIterator &fit );
91 
95  void drawRendererLevels( QgsFeatureRenderer *renderer, QgsFeatureIterator &fit );
96 
98  void stopRenderer( QgsFeatureRenderer *renderer, QgsSingleSymbolRenderer *selRenderer );
99 
100 
101  bool renderInternal( QgsFeatureRenderer *renderer );
102 
103  private:
104 
105  std::unique_ptr<QgsFeedback> mFeedback = nullptr;
106 
108  QgsVectorLayer *mLayer = nullptr;
109 
110  QgsFields mFields; // TODO: use fields from mSource
111 
112  QgsFeatureIds mSelectedFeatureIds;
113 
114  QString mTemporalFilter;
115 
116  std::unique_ptr< QgsVectorLayerFeatureSource > mSource;
117 
118  QgsFeatureRenderer *mRenderer = nullptr;
119  std::vector< std::unique_ptr< QgsFeatureRenderer> > mRenderers;
120 
121  bool mDrawVertexMarkers;
122  bool mVertexMarkerOnlyForSelection;
124  double mVertexMarkerSize = 2.0;
125 
126  QgsWkbTypes::GeometryType mGeometryType;
127 
128  QSet<QString> mAttrNames;
129 
134  QgsVectorLayerLabelProvider *mLabelProvider = nullptr;
135 
140  QgsVectorLayerDiagramProvider *mDiagramProvider = nullptr;
141 
142  QPainter::CompositionMode mFeatureBlendMode;
143 
144  QgsVectorSimplifyMethod mSimplifyMethod;
145  bool mSimplifyGeometry;
146 
147  QList< QgsMapClippingRegion > mClippingRegions;
148  QgsGeometry mClipFilterGeom;
149  bool mApplyClipFilter = false;
150  QgsGeometry mClipFeatureGeom;
151  bool mApplyClipGeometries = false;
152  QgsGeometry mLabelClipFeatureGeom;
153  bool mApplyLabelClipGeometries = false;
154  bool mForceRasterRender = false;
155 
156  int mRenderTimeHint = 0;
157  bool mBlockRenderUpdates = false;
158  QElapsedTimer mElapsedTimer;
159 
160  bool mNoSetLayerExpressionContext = false;
161 
162 };
163 
164 
165 #endif // QGSVECTORLAYERRENDERER_H
qgsfields.h
QgsVectorSimplifyMethod
This class contains information how to simplify geometries fetched from a vector layer.
Definition: qgsvectorsimplifymethod.h:29
Qgis::VertexMarkerType::SemiTransparentCircle
@ SemiTransparentCircle
Semi-transparent circle marker.
QgsMapClippingRegion
A map clipping region (in map coordinates and CRS).
Definition: qgsmapclippingregion.h:33
QgsVectorLayerDiagramProvider
The QgsVectorLayerDiagramProvider class implements support for diagrams within the labeling engine....
Definition: qgsvectorlayerdiagramprovider.h:57
qgsfeatureiterator.h
QgsFields
Container of fields for a vector layer.
Definition: qgsfields.h:44
QgsVectorLayerRenderer::QgsVectorLayerRenderer
QgsVectorLayerRenderer(QgsVectorLayer *layer, QgsRenderContext &context)
Definition: qgsvectorlayerrenderer.cpp:49
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:59
QgsSingleSymbolRenderer
Definition: qgssinglesymbolrenderer.h:29
qgsfeatureid.h
QgsVectorLayerLabelProvider
The QgsVectorLayerLabelProvider class implements a label provider for vector layers....
Definition: qgsvectorlayerlabelprovider.h:41
QgsMapLayerRenderer
Base class for utility classes that encapsulate information necessary for rendering of map layers.
Definition: qgsmaplayerrenderer.h:54
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsAttributeList
QList< int > QgsAttributeList
Definition: qgsvectorlayerrenderer.h:37
Qgis::VertexMarkerType
VertexMarkerType
Editing vertex markers, used for showing vertices during a edit operation.
Definition: qgis.h:806
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44
qgis_sip.h
QgsDiagramLayerSettings
Stores the settings for rendering of all diagrams for a layer.
Definition: qgsdiagramrenderer.h:61
QgsVectorLayerRenderer::setLayerRenderingTimeHint
void setLayerRenderingTimeHint(int time) override
Sets approximate render time (in ms) for the layer to render.
Definition: qgsvectorlayerrenderer.cpp:184
qgsvectorsimplifymethod.h
qgsmaplayerrenderer.h
QgsDiagramRenderer
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
Definition: qgsdiagramrenderer.h:684
QgsFeatureIds
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:37
QgsVectorLayerRenderer::forceRasterRender
bool forceRasterRender() const override
Returns true if the renderer must be rendered to a raster paint device (e.g.
Definition: qgsvectorlayerrenderer.cpp:194
QgsFeatureRenderer
Definition: qgsrenderer.h:101
QgsWkbTypes::GeometryType
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:140
QgsGeometry
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsVectorLayerRenderer::featureRenderer
QgsFeatureRenderer * featureRenderer()
Returns the feature renderer.
Definition: qgsvectorlayerrenderer.h:71
QgsVectorLayerFeatureSource
Partial snapshot of vector layer's state (only the members necessary for access to features)
Definition: qgsvectorlayerfeatureiterator.h:52
QgsFeatureIterator
Wrapper for iterator of features from vector data provider or vector layer.
Definition: qgsfeatureiterator.h:289
qgsfeedback.h
QgsVectorLayerRenderer::feedback
QgsFeedback * feedback() const override
Access to feedback object of the layer renderer (may be nullptr)
Definition: qgsvectorlayerrenderer.cpp:189
QgsVectorLayerRenderer::render
bool render() override
Do the rendering (based on data stored in the class).
Definition: qgsvectorlayerrenderer.cpp:199
QgsVectorLayerRenderer
Implementation of threaded rendering for vector layers.
Definition: qgsvectorlayerrenderer.h:58
QgsVectorLayerRenderer::~QgsVectorLayerRenderer
~QgsVectorLayerRenderer() override