QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
45 {
46  QgsRasterRendererRegistryEntry( const QString &name, const QString &visibleName, QgsRasterRendererCreateFunc rendererFunction,
47  QgsRasterRendererWidgetCreateFunc widgetFunction );
48 
53  QString name;
54  QString visibleName; //visible (and translatable) name
55  QIcon icon();
56  QgsRasterRendererCreateFunc rendererCreateFunction = nullptr ; //pointer to create function
57  QgsRasterRendererWidgetCreateFunc widgetCreateFunction = nullptr ; //pointer to create function for renderer widget
58 };
59 
69 class CORE_EXPORT QgsRasterRendererRegistry
70 {
71  public:
72 
74 
75  void insert( const QgsRasterRendererRegistryEntry &entry );
76  void insertWidgetFunction( const QString &rendererName, QgsRasterRendererWidgetCreateFunc func );
77  bool rendererData( const QString &rendererName, QgsRasterRendererRegistryEntry &data ) const;
78  QStringList renderersList() const;
79  QList< QgsRasterRendererRegistryEntry > entries() const;
80 
84  QgsRasterRenderer *defaultRendererForDrawingStyle( QgsRaster::DrawingStyle drawingStyle, QgsRasterDataProvider *provider ) const;
85 
86  private:
87  QHash< QString, QgsRasterRendererRegistryEntry > mEntries;
88  QStringList mSortedEntries;
89 
90  //read min/max values from
91  bool minMaxValuesForBand( int band, QgsRasterDataProvider *provider, double &minValue, double &maxValue ) const;
92 };
93 
94 #endif // QGSRASTERRENDERERREGISTRY_H
qgsrasterlayer.h
QgsRasterRendererRegistryEntry::name
QString name
Definition: qgsrasterrendererregistry.h:53
QgsRasterRendererRegistryEntry
Definition: qgsrasterrendererregistry.h:44
QgsRaster::DrawingStyle
DrawingStyle
This enumerator describes the different kinds of drawing we can do.
Definition: qgsraster.h:102
QgsRasterRendererCreateFunc
QgsRasterRenderer *(* QgsRasterRendererCreateFunc)(const QDomElement &, QgsRasterInterface *input)
Definition: qgsrasterrendererregistry.h:37
QgsRectangle
Definition: qgsrectangle.h:41
QgsRasterRenderer
Definition: qgsrasterrenderer.h:38
QgsRasterRendererRegistryEntry::visibleName
QString visibleName
Definition: qgsrasterrendererregistry.h:54
QgsRasterLayer
Definition: qgsrasterlayer.h:72
QgsRasterRendererWidgetCreateFunc
QgsRasterRendererWidget *(* QgsRasterRendererWidgetCreateFunc)(QgsRasterLayer *, const QgsRectangle &extent)
Definition: qgsrasterrendererregistry.h:38
QgsRasterInterface
Definition: qgsrasterinterface.h:116
QgsRasterRendererRegistry
Definition: qgsrasterrendererregistry.h:69
QgsRasterRendererWidget
Definition: qgsrasterrendererwidget.h:36
QgsRasterDataProvider
Definition: qgsrasterdataprovider.h:88