QGIS API Documentation 4.3.0-Master (0de80482b60)
Loading...
Searching...
No Matches
qgsrastersinglecolorrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsrastersinglecolorrenderer.h
3 ---------------------------
4 begin : April 2024
5 copyright : (C) 2024 by Mathieu Pellerin
6 email : mathieu at opengis 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 QGSRASTERSINGLECOLORRENDERER_H
19#define QGSRASTERSINGLECOLORRENDERER_H
20
21#include <memory>
22
23#include "qgis_core.h"
24#include "qgis_sip.h"
25#include "qgsrasterrenderer.h"
26
27class QDomElement;
28
35{
36 public:
39
44
46 Qgis::RasterRendererFlags flags() const override;
47
49 static std::unique_ptr<QgsRasterRenderer> create( const QDomElement &elem, QgsRasterInterface *input );
50
51 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
52
57 QColor color() const;
58
63 void setColor( const QColor &color );
64
65 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
66
67 int inputBand() const override;
68 bool setInputBand( int band ) override;
69 QList<int> usesBands() const override;
70
71 private:
72#ifdef SIP_RUN
75#endif
76
77 int mInputBand = -1;
78 QColor mColor;
79};
80
81#endif // QGSRASTERSINGLECOLORRENDERER_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
Feedback object tailored for raster block reading.
Raster data container.
QgsRasterInterface(QgsRasterInterface *input=nullptr)
virtual QgsRectangle extent() const
Gets the extent of the interface.
virtual QgsRasterInterface * input() const
Current input.
QgsRasterRenderer(QgsRasterInterface *input=nullptr, const QString &type=QString())
Constructor for QgsRasterRenderer.
const QgsRasterRenderer & operator=(const QgsRasterRenderer &)=delete
QgsRasterRenderer cannot be copied. Use clone() instead.
QgsRasterRenderer * clone() const override=0
Clone itself, create deep copy.
int inputBand() const override
Returns the input band for the renderer, or -1 if no input band is available.
static std::unique_ptr< QgsRasterRenderer > create(const QDomElement &elem, QgsRasterInterface *input)
Creates an instance of the renderer based on definition from XML (used by the renderer registry).
bool setInputBand(int band) override
Attempts to set the input band for the renderer.
void writeXml(QDomDocument &doc, QDomElement &parentElem) const override
Write base class members to xml.
Qgis::RasterRendererFlags flags() const override
Returns flags which dictate renderer behavior.
const QgsRasterSingleColorRenderer & operator=(const QgsRasterSingleColorRenderer &)=delete
QgsRasterSingleColorRenderer cannot be copied. Use clone() instead.
QgsRasterSingleColorRenderer(QgsRasterInterface *input, int band, const QColor &color)
Creates a single color renderer.
QColor color() const
Returns the single color used by the renderer.
QList< int > usesBands() const override
Returns a list of band numbers used by the renderer.
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.
QgsRasterSingleColorRenderer(const QgsRasterSingleColorRenderer &)=delete
QgsRasterSingleColorRenderer cannot be copied. Use clone() instead.
void setColor(const QColor &color)
Sets the single color used by the renderer.
A rectangle specified with double values.
#define SIP_FACTORY
Definition qgis_sip.h:83