QGIS API Documentation  3.17.0-Master (3b262f2a79)
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 <QStringList>
20 
21 #include "qgis_core.h"
22 
23 class QgsFeedback;
24 class QgsRenderContext;
25 
50 class CORE_EXPORT QgsMapLayerRenderer
51 {
52  public:
53 
57  QgsMapLayerRenderer( const QString &layerID, QgsRenderContext *context = nullptr )
58  : mLayerID( layerID )
59  , mContext( context )
60  {}
61 
62  virtual ~QgsMapLayerRenderer() = default;
63 
65  virtual bool render() = 0;
66 
71  virtual QgsFeedback *feedback() const { return nullptr; }
72 
74  QStringList errors() const { return mErrors; }
75 
77  QString layerId() const { return mLayerID; }
78 
84  QgsRenderContext *renderContext() { return mContext; }
85 
86  protected:
87  QStringList mErrors;
88  QString mLayerID;
89 
90  private:
91 
92  // TODO QGIS 4.0 - make reference instead of pointer!
93 
99  QgsRenderContext *mContext = nullptr;
100 };
101 
102 #endif // QGSMAPLAYERRENDERER_H
QgsMapLayerRenderer(const QString &layerID, QgsRenderContext *context=nullptr)
Constructor for QgsMapLayerRenderer, with the associated layerID and render context.
Base class for feedback objects to be used for cancellation of something running in a worker thread...
Definition: qgsfeedback.h:43
Contains information about the context of a rendering operation.
QString layerId() const
Gets access to the ID of the layer rendered by this class.
Base class for utility classes that encapsulate information necessary for rendering of map layers...
QStringList errors() const
Returns list of errors (problems) that happened during the rendering.
QgsRenderContext * renderContext()
Returns the render context associated with the renderer.
virtual QgsFeedback * feedback() const
Access to feedback object of the layer renderer (may be nullptr)