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();
|
2017-05-03 07:45:22 +02:00
|
|
|
virtual QgsPalettedRasterRenderer *clone() const /Factory/;
|
2017-05-01 18:13:15 +02:00
|
|
|
static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) /Factory/;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-03 07:45:22 +02:00
|
|
|
QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = 0 ) /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 );
|
2017-03-27 11:19:12 +10:00
|
|
|
static QgsPalettedRasterRenderer::ClassData classDataFromFile( const QString &path );
|
2017-03-27 12:26:02 +10:00
|
|
|
static QString classDataToString( const QgsPalettedRasterRenderer::ClassData &classes );
|
2017-03-27 14:41:47 +10:00
|
|
|
static QgsPalettedRasterRenderer::ClassData classDataFromRaster( QgsRasterInterface *raster, int bandNumber, QgsColorRamp *ramp = 0 );
|
2016-01-20 17:06:04 +11:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
QgsPalettedRasterRenderer( const QgsPalettedRasterRenderer& );
|
2017-05-01 18:13:15 +02:00
|
|
|
const QgsPalettedRasterRenderer &operator=( const QgsPalettedRasterRenderer& );
|
2013-03-09 14:05:12 +01:00
|
|
|
};
|