QGIS API Documentation  2.99.0-Master (b8fd1fd)
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 "qgis_core.h"
22 #include "qgsrasterlayer.h" //for DrawingStyle enum
23 #include <QHash>
24 #include <QString>
25 
26 class QDomElement;
27 class QgsRasterInterface;
28 class QgsRasterLayer;
29 class QgsRasterRenderer;
31 
32 typedef QgsRasterRenderer *( *QgsRasterRendererCreateFunc )( const QDomElement &, QgsRasterInterface *input );
33 typedef QgsRasterRendererWidget *( *QgsRasterRendererWidgetCreateFunc )( QgsRasterLayer *, const QgsRectangle &extent );
34 
39 {
40  QgsRasterRendererRegistryEntry( const QString &name, const QString &visibleName, QgsRasterRendererCreateFunc rendererFunction,
41  QgsRasterRendererWidgetCreateFunc widgetFunction );
42  QgsRasterRendererRegistryEntry();
43  QString name;
44  QString visibleName; //visible (and translatable) name
45  QIcon icon();
47  QgsRasterRendererWidgetCreateFunc widgetCreateFunction; //pointer to create function for renderer widget
48 };
49 
58 class CORE_EXPORT QgsRasterRendererRegistry
59 {
60  public:
61 
63 
64  void insert( const QgsRasterRendererRegistryEntry &entry );
65  void insertWidgetFunction( const QString &rendererName, QgsRasterRendererWidgetCreateFunc func );
66  bool rendererData( const QString &rendererName, QgsRasterRendererRegistryEntry &data ) const;
67  QStringList renderersList() const;
68  QList< QgsRasterRendererRegistryEntry > entries() const;
69 
72  QgsRasterRenderer *defaultRendererForDrawingStyle( QgsRaster::DrawingStyle drawingStyle, QgsRasterDataProvider *provider ) const;
73 
74  private:
75  QHash< QString, QgsRasterRendererRegistryEntry > mEntries;
76  QStringList mSortedEntries;
77 
78  //read min/max values from
79  bool minMaxValuesForBand( int band, QgsRasterDataProvider *provider, double &minValue, double &maxValue ) const;
80 };
81 
82 #endif // QGSRASTERRENDERERREGISTRY_H
A rectangle specified with double values.
Definition: qgsrectangle.h:36
DrawingStyle
This enumerator describes the different kinds of drawing we can do.
Definition: qgsraster.h:104
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.