QGIS API Documentation  2.4.0-Chugiak
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "qgsmaplayerrenderer.h"
18 
19 QgsPluginLayer::QgsPluginLayer( QString layerType, QString layerName )
20  : QgsMapLayer( PluginLayer, layerName ), mPluginLayerType( layerType )
21 {
22 }
23 
25 {
26  return mPluginLayerType;
27 }
28 
30 {
31  mExtent = extent;
32 }
33 
35 {
36  Q_UNUSED( iconSize );
37  return QgsLegendSymbologyList();
38 }
39 
45 {
46  public:
48  : QgsMapLayerRenderer( layer->id() )
49  , mLayer( layer )
50  , mRendererContext( rendererContext )
51  {}
52 
53  virtual bool render()
54  {
55  return mLayer->draw( mRendererContext );
56  }
57 
58  protected:
61 };
62 
64 {
65  return new QgsPluginLayerRenderer( this, rendererContext );
66 }
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Base class for all map layer types.
Definition: qgsmaplayer.h:47
virtual QgsLegendSymbologyList legendSymbologyItems(const QSize &iconSize)
return a list of symbology items for the legend (defult implementation returns nothing) ...
QgsPluginLayer(QString layerType, QString layerName=QString())
Base class for plugin layers.
QgsPluginLayerRenderer(QgsPluginLayer *layer, QgsRenderContext &rendererContext)
virtual bool draw(QgsRenderContext &rendererContext)
This is the method that does the actual work of drawing the layer onto a paint device.
QgsRectangle mExtent
Extent of the layer.
Definition: qgsmaplayer.h:485
QString pluginLayerType()
return plugin layer type (the same as used in QgsPluginLayerRegistry)
QgsRenderContext & mRendererContext
virtual QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext)
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context...
QList< QPair< QString, QPixmap > > QgsLegendSymbologyList
Contains information about the context of a rendering operation.
virtual bool render()
Do the rendering (based on data stored in the class)
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...
virtual QgsRectangle extent()
Return the extent of the layer.
void setExtent(const QgsRectangle &extent)
Set the extent.