QGIS API Documentation  2.15.0-Master (02a0ebe)
qgsrasterrendererregistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterrendererregistry.h
3  ---------------------------
4  begin : January 2012
5  copyright : (C) 2012 by Marco Hugentobler
6  email : marco at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSRASTERRENDERERREGISTRY_H
19 #define QGSRASTERRENDERERREGISTRY_H
20 
21 #include "qgsrasterlayer.h" //for DrawingStyle enum
22 #include <QHash>
23 #include <QString>
24 
25 class QDomElement;
26 class QgsRasterInterface;
27 class QgsRasterLayer;
28 class QgsRasterRenderer;
30 
31 typedef QgsRasterRenderer*( *QgsRasterRendererCreateFunc )( const QDomElement&, QgsRasterInterface* input );
32 typedef QgsRasterRendererWidget*( *QgsRasterRendererWidgetCreateFunc )( QgsRasterLayer*, const QgsRectangle &extent );
33 
38 {
39  QgsRasterRendererRegistryEntry( const QString& theName, const QString& theVisibleName, QgsRasterRendererCreateFunc rendererFunction,
40  QgsRasterRendererWidgetCreateFunc widgetFunction );
41  QgsRasterRendererRegistryEntry();
43  QString visibleName; //visible (and translatable) name
44  QIcon icon();
46  QgsRasterRendererWidgetCreateFunc widgetCreateFunction; //pointer to create function for renderer widget
47 };
48 
53 class CORE_EXPORT QgsRasterRendererRegistry
54 {
55  public:
56  static QgsRasterRendererRegistry* instance();
57 
58  void insert( const QgsRasterRendererRegistryEntry& entry );
59  void insertWidgetFunction( const QString& rendererName, QgsRasterRendererWidgetCreateFunc func );
60  bool rendererData( const QString& rendererName, QgsRasterRendererRegistryEntry& data ) const;
61  QStringList renderersList() const;
63 
66  QgsRasterRenderer* defaultRendererForDrawingStyle( QgsRaster::DrawingStyle theDrawingStyle, QgsRasterDataProvider* provider ) const;
67 
68  protected:
70 
71  private:
72  static QgsRasterRendererRegistry* mInstance;
74  QStringList mSortedEntries;
75 
76  //read min/max values from
77  bool minMaxValuesForBand( int band, QgsRasterDataProvider* provider, double& minValue, double& maxValue ) const;
78 };
79 
80 #endif // QGSRASTERRENDERERREGISTRY_H
A rectangle specified with double values.
Definition: qgsrectangle.h:35
DrawingStyle
This enumerator describes the different kinds of drawing we can do.
Definition: qgsraster.h:95
QgsRasterRendererWidgetCreateFunc widgetCreateFunction
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QgsRasterRenderer *(* QgsRasterRendererCreateFunc)(const QDomElement &, QgsRasterInterface *input)
Registry for raster renderers.
Base class for processing filters like renderers, reprojector, resampler etc.
QgsRasterRendererWidget *(* QgsRasterRendererWidgetCreateFunc)(QgsRasterLayer *, const QgsRectangle &extent)
Registry for raster renderer entries.
Raster renderer pipe that applies colors to a raster.
QgsRasterRendererCreateFunc rendererCreateFunction
Base class for raster data providers.