/
qgspalettedrasterrenderer.h
55 lines (43 loc) · 2.15 KB
/
qgspalettedrasterrenderer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/***************************************************************************
qgspalettedrasterrenderer.h
---------------------------
begin : December 2011
copyright : (C) 2011 by Marco Hugentobler
email : marco at sourcepole dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSPALETTEDRASTERRENDERER_H
#define QGSPALETTEDRASTERRENDERER_H
#include "qgsrasterrenderer.h"
class QColor;
class QDomElement;
class CORE_EXPORT QgsPalettedRasterRenderer: public QgsRasterRenderer
{
public:
/**Renderer owns color array*/
QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QColor* colorArray, int nColors );
~QgsPalettedRasterRenderer();
static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterInterface* input );
void draw( QPainter* p, QgsRasterViewPort* viewPort, const QgsMapToPixel* theQgsMapToPixel );
void * readBlock( int bandNo, QgsRectangle const & extent, int width, int height );
/**Returns number of colors*/
int nColors() const { return mNColors; }
/**Returns copy of color array (caller takes ownership)*/
QColor* colors() const;
void writeXML( QDomDocument& doc, QDomElement& parentElem ) const;
void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const;
private:
int mBandNumber;
/**Color array*/
QColor* mColors;
/**Number of colors*/
int mNColors;
};
#endif // QGSPALETTEDRASTERRENDERER_H