QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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:
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 };
161 
162 
163 #endif // QGSVECTORLAYERRENDERER_H
VertexMarkerType
Editing vertex markers, used for showing vertices during a edit operation.
Definition: qgis.h:574
@ SemiTransparentCircle
Semi-transparent circle marker.
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:125
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.
Implementation of threaded rendering for vector layers.
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)
QgsFeatureRenderer * featureRenderer()
Returns the feature renderer.
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