QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgspalettedrasterrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspalettedrasterrenderer.h
3  ---------------------------
4  begin : December 2011
5  copyright : (C) 2011 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 QGSPALETTEDRASTERRENDERER_H
19 #define QGSPALETTEDRASTERRENDERER_H
20 
21 #include <QVector>
22 
23 #include "qgsrasterrenderer.h"
24 
25 class QColor;
26 class QDomElement;
27 
32 {
33  public:
35  QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QColor* colorArray, int nColors, const QVector<QString> labels = QVector<QString>() );
36  QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QRgb* colorArray, int nColors, const QVector<QString> labels = QVector<QString>() );
38  QgsRasterInterface * clone() const;
39  static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterInterface* input );
40 
41  QgsRasterBlock *block( int bandNo, const QgsRectangle & extent, int width, int height );
42 
44  int nColors() const { return mNColors; }
46  QColor* colors() const;
47 
51  QRgb* rgbArray() const;
52 
55  QString label( int idx ) const { return mLabels.value( idx ); }
56 
59  void setLabel( int idx, QString label );
60 
61  void writeXML( QDomDocument& doc, QDomElement& parentElem ) const;
62 
63  void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const;
64 
65  QList<int> usesBands() const;
66 
67  private:
68  int mBand;
70  QRgb* mColors;
72  int mNColors;
74  QVector<QString> mLabels;
75 };
76 
77 #endif // QGSPALETTEDRASTERRENDERER_H