Class: QgsRasterSingleColorRenderer¶
- class qgis.core.QgsRasterSingleColorRenderer¶
Bases:
QgsRasterRenderer
Raster renderer which renders all data pixels using a single color.
Added in version 3.38.
QgsRasterSingleColorRenderer(input:
QgsRasterInterface
, band: int, color: Union[QColor, Qt.GlobalColor, QGradient]) Creates a singlecolor
rendererMethods
- param bandNo:
QgsRasterSingleColorRenderer
cannot be copied.Returns the single color used by the renderer.
Creates an instance of the renderer based on definition from XML (used by the renderer registry)
- rtype:
Qgis.RasterRendererFlags
Fill in histogram defaults if not specified
Fill in statistics defaults if not specified
- rtype:
int
Returns the color for the renderer to use to represent nodata pixels.
Sets the single
color
used by the renderer.- param band:
- rtype:
List[int]
- param doc:
- block(self, bandNo: int, extent: QgsRectangle, width: int, height: int, feedback: QgsRasterBlockFeedback = None) QgsRasterBlock ¶
- Parameters:
bandNo (int)
extent (QgsRectangle)
width (int)
height (int)
feedback (
QgsRasterBlockFeedback
= None)
- Return type:
- clone(self) QgsRasterSingleColorRenderer ¶
QgsRasterSingleColorRenderer
cannot be copied. Useclone()
instead.- Return type:
- color(self) QColor ¶
Returns the single color used by the renderer.
See also
- Return type:
QColor
- create(elem: QDomElement, input: QgsRasterInterface) QgsRasterRenderer ¶
Creates an instance of the renderer based on definition from XML (used by the renderer registry)
- Parameters:
elem (QDomElement)
input (QgsRasterInterface)
- Return type:
- flags(self) Qgis.RasterRendererFlags ¶
- Return type:
- initHistogram(self, histogram: QgsRasterHistogram, bandNo: int, binCount: int, minimum: object = Py_None, maximum: object = Py_None, boundingBox: QgsRectangle = QgsRectangle(), sampleSize: int = 0, includeOutOfRange: bool = False)¶
Fill in histogram defaults if not specified
Note
the parameters are the same as in
histogram()
- initStatistics(self, statistics: QgsRasterBandStats, bandNo: int, stats: int, boundingBox: QgsRectangle = QgsRectangle(), binCount: int = 0)¶
Fill in statistics defaults if not specified
Deprecated since version Use:
Qgis
.RasterBandStatistic instead of int forstats
argumentinitStatistics(self, statistics:
QgsRasterBandStats
, bandNo: int, stats: Union[Qgis.RasterBandStatistics, Qgis.RasterBandStatistic] = Qgis.RasterBandStatistic.All, boundingBox:QgsRectangle
= QgsRectangle(), binCount: int = 0) Fill in statistics defaults if not specified
- inputBand(self) int ¶
- Return type:
int
- renderColorForNodataPixel(self) int ¶
Returns the color for the renderer to use to represent nodata pixels.
Subclasses should use this rather then
nodataColor()
to determine the color to use for nodata pixels during an actual rendering operation.Added in version 3.10.
- setColor(self, color: QColor | Qt.GlobalColor | QGradient)¶
Sets the single
color
used by the renderer.See also
- Parameters:
color (Union[QColor)
- setInputBand(self, band: int) bool ¶
- Parameters:
band (int)
- Return type:
bool
- usesBands(self) List[int] ¶
- Return type:
List[int]
- writeXml(self, doc: QDomDocument, parentElem: QDomElement)¶
- Parameters:
doc (QDomDocument)
parentElem (QDomElement)