QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsmaplayerrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaplayerrenderer.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 QGSMAPLAYERRENDERER_H
17#define QGSMAPLAYERRENDERER_H
18
19#include "qgis.h"
20#include "qgis_core.h"
21#include "qgis_sip.h"
22
23#include <QStringList>
24
25class QgsFeedback;
28
51class CORE_EXPORT QgsMapLayerRenderer
52{
53 public:
54
58 QgsMapLayerRenderer( const QString &layerID, QgsRenderContext *context = nullptr )
59 : mLayerID( layerID )
60 , mContext( context )
61 {}
62
64
71 virtual bool render() = 0;
72
89 virtual bool forceRasterRender() const;
90
96 virtual Qgis::MapLayerRendererFlags flags() const;
97
101 virtual QgsFeedback *feedback() const;
102
104 QStringList errors() const { return mErrors; }
105
107 QString layerId() const { return mLayerID; }
108
114 QgsRenderContext *renderContext() { return mContext; }
115
122 const QgsRenderContext *renderContext() const SIP_SKIP { return mContext; }
123
130 bool isReadyToCompose() const { return mReadyToCompose; }
131
142 virtual void setLayerRenderingTimeHint( int time ) SIP_SKIP { Q_UNUSED( time ) }
143
152 QList< QgsRenderedItemDetails * > takeRenderedItemDetails() SIP_TRANSFERBACK;
153
154 protected:
155 QStringList mErrors;
156 QString mLayerID;
157
158 // TODO QGIS 4.0 - make false as default
159
174 bool mReadyToCompose = true;
175
185
197
198 private:
199
200 // TODO QGIS 4.0 - make reference instead of pointer!
201
207 QgsRenderContext *mContext = nullptr;
208
209 QList<QgsRenderedItemDetails *> mRenderedItemDetails;
210};
211
212#endif // QGSMAPLAYERRENDERER_H
QFlags< MapLayerRendererFlag > MapLayerRendererFlags
Flags which control how map layer renderers behave.
Definition qgis.h:2796
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
const QgsRenderContext * renderContext() const
Returns the render context associated with the renderer.
bool mReadyToCompose
The flag must be set to false in renderer's constructor if wants to use the smarter map redraws funct...
virtual bool render()=0
Do the rendering (based on data stored in the class).
bool isReadyToCompose() const
Returns whether the renderer has already drawn (at least partially) some data.
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.
void appendRenderedItemDetails(QgsRenderedItemDetails *details)
Appends the details of a rendered item to the renderer.
virtual QgsFeedback * feedback() const
Access to feedback object of the layer renderer (may be nullptr).
virtual bool forceRasterRender() const
Returns true if the renderer must be rendered to a raster paint device (e.g.
virtual Qgis::MapLayerRendererFlags flags() const
Returns flags which control how the map layer rendering behaves.
virtual ~QgsMapLayerRenderer()
QgsRenderContext * renderContext()
Returns the render context associated with the renderer.
QStringList errors() const
Returns list of errors (problems) that happened during the rendering.
QgsMapLayerRenderer(const QString &layerID, QgsRenderContext *context=nullptr)
Constructor for QgsMapLayerRenderer, with the associated layerID and render context.
virtual void setLayerRenderingTimeHint(int time)
Sets approximate render time (in ms) for the layer to render.
Contains information about the context of a rendering operation.
Base class for detailed information about a rendered item.
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_TRANSFERBACK
Definition qgis_sip.h:48