QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgspluginlayer.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgspluginlayer.cpp
3  ---------------------
4  begin : January 2010
5  copyright : (C) 2010 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 #include "qgspluginlayer.h"
16 
17 #include "qgsmaplayerlegend.h"
18 #include "qgsmaplayerrenderer.h"
19 
20 QgsPluginLayer::QgsPluginLayer( const QString& layerType, const QString& layerName )
21  : QgsMapLayer( PluginLayer, layerName )
22  , mPluginLayerType( layerType )
23 {
25 }
26 
28 {
29  return mPluginLayerType;
30 }
31 
33 {
34  mExtent = extent;
35 }
36 
38 {
40 }
41 
43 {
44  Q_UNUSED( iconSize );
45  return QgsLegendSymbologyList();
46 }
47 
55 {
56  public:
58  : QgsMapLayerRenderer( layer->id() )
59  , mLayer( layer )
60  , mRendererContext( rendererContext )
61  {}
62 
63  virtual bool render() override
64  {
65  return mLayer->draw( mRendererContext );
66  }
67 
68  protected:
71 };
72 
74 {
75  return new QgsPluginLayerRenderer( this, rendererContext );
76 }
void setExtent(const QgsRectangle &extent) override
Set extent of the layer.
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Base class for all map layer types.
Definition: qgsmaplayer.h:49
virtual QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext) override
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context...
static QgsMapLayerLegend * defaultPluginLegend(QgsPluginLayer *pl)
Create new legend implementation for raster layer.
Base class for plugin layers.
QgsPluginLayerRenderer(QgsPluginLayer *layer, QgsRenderContext &rendererContext)
QgsRectangle mExtent
Extent of the layer.
Definition: qgsmaplayer.h:765
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
QString pluginLayerType()
Return plugin layer type (the same as used in QgsPluginLayerRegistry)
QgsRenderContext & mRendererContext
QList< QPair< QString, QPixmap > > QgsLegendSymbologyList
virtual bool render() override
Do the rendering (based on data stored in the class)
Contains information about the context of a rendering operation.
QString mDataSource
Data source description string, varies by layer type.
Definition: qgsmaplayer.h:771
QString source() const
Returns the source for the layer.
Fallback layer renderer implementation for layer that do not support map renderer yet...
QString mPluginLayerType
QgsPluginLayer * mLayer
Base class for utility classes that encapsulate information necessary for rendering of map layers...
QgsPluginLayer(const QString &layerType, const QString &layerName=QString())
void setLegend(QgsMapLayerLegend *legend)
Assign a legend controller to the map layer.
virtual QgsRectangle extent()
Return the extent of the layer.
void setSource(const QString &source)
Set source string.
virtual QgsLegendSymbologyList legendSymbologyItems(QSize iconSize)
return a list of symbology items for the legend (defult implementation returns nothing) ...