2013-03-09 14:05:12 +01:00
|
|
|
class QgsPalettedRasterRenderer : QgsRasterRenderer
|
2012-09-24 02:28:15 +02:00
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgspalettedrasterrenderer.h"
|
|
|
|
%End
|
|
|
|
public:
|
2017-03-23 11:17:20 +10:00
|
|
|
|
|
|
|
struct Class
|
|
|
|
{
|
|
|
|
|
2017-03-23 18:30:04 +10:00
|
|
|
Class( int value, const QColor &color = QColor(), const QString &label = QString() );
|
|
|
|
int value;
|
2017-03-23 11:17:20 +10:00
|
|
|
QColor color;
|
|
|
|
QString label;
|
|
|
|
};
|
|
|
|
|
2017-03-23 18:30:04 +10:00
|
|
|
typedef QList< QgsPalettedRasterRenderer::Class > ClassData;
|
|
|
|
|
2017-03-23 11:17:20 +10:00
|
|
|
QgsPalettedRasterRenderer( QgsRasterInterface *input, int bandNumber, const ClassData &classes );
|
2012-09-24 02:28:15 +02:00
|
|
|
~QgsPalettedRasterRenderer();
|
2015-11-12 19:35:14 +11:00
|
|
|
virtual QgsPalettedRasterRenderer * clone() const /Factory/;
|
2013-03-09 14:05:12 +01:00
|
|
|
static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterInterface* input ) /Factory/;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-07-22 23:26:47 +02:00
|
|
|
QgsRasterBlock *block( int bandNo, const QgsRectangle & extent, int width, int height, QgsRasterBlockFeedback* feedback = nullptr ) /Factory/;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Returns number of colors*/
|
2012-09-24 02:28:15 +02:00
|
|
|
int nColors() const;
|
2017-03-23 11:17:20 +10:00
|
|
|
ClassData classes() const;
|
2014-01-27 09:22:24 +01:00
|
|
|
QString label( int idx ) const;
|
2017-03-23 11:17:20 +10:00
|
|
|
void setLabel( int idx, const QString &label );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2017-03-23 11:17:20 +10:00
|
|
|
void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-03-23 11:17:20 +10:00
|
|
|
void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems /Out/ ) const;
|
2013-03-09 14:05:12 +01:00
|
|
|
|
|
|
|
QList<int> usesBands() const;
|
2017-03-23 15:54:13 +10:00
|
|
|
void setSourceColorRamp( QgsColorRamp *ramp /Transfer/ );
|
|
|
|
QgsColorRamp *sourceColorRamp() const;
|
2017-03-23 13:47:58 +10:00
|
|
|
static QgsPalettedRasterRenderer::ClassData colorTableToClassData( const QList<QgsColorRampShader::ColorRampItem> &table );
|
2017-03-27 10:54:40 +10:00
|
|
|
static QgsPalettedRasterRenderer::ClassData classDataFromString( const QString &string );
|
2016-01-20 17:06:04 +11:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
QgsPalettedRasterRenderer( const QgsPalettedRasterRenderer& );
|
|
|
|
const QgsPalettedRasterRenderer& operator=( const QgsPalettedRasterRenderer& );
|
2013-03-09 14:05:12 +01:00
|
|
|
};
|