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