Class: QgsSingleBandGrayRenderer

class qgis.core.QgsSingleBandGrayRenderer

Bases: QgsRasterRenderer

Raster renderer pipe for single band gray.

Methods

block

param bandNo:

clone

QgsSingleBandGrayRenderer cannot be copied.

contrastEnhancement

rtype:

Optional[QgsContrastEnhancement]

create

param elem:

createLegendNodes

param nodeLayer:

flags

rtype:

Qgis.RasterRendererFlags

gradient

rtype:

QgsSingleBandGrayRenderer.Gradient

grayBand

Deprecated since version QGIS: 3.38

initHistogram

Fill in histogram defaults if not specified

initStatistics

Fill in statistics defaults if not specified

inputBand

rtype:

int

legendSettings

Returns the color ramp shader legend settings.

legendSymbologyItems

rtype:

List[Tuple[str, QColor]]

renderColorForNodataPixel

Returns the color for the renderer to use to represent nodata pixels.

setContrastEnhancement

Takes ownership

setGradient

param gradient:

setGrayBand

Deprecated since version QGIS: 3.38

setInputBand

param band:

setLegendSettings

Sets the color ramp shader legend settings.

toSld

param doc:

usesBands

rtype:

List[int]

writeXml

param doc:

Attributes

BlackToWhite

WhiteToBlack

BlackToWhite = 0
class Gradient

Bases: int

WhiteToBlack = 1
block(self, bandNo: int, extent: QgsRectangle, width: int, height: int, feedback: QgsRasterBlockFeedback | None = None) QgsRasterBlock | None
Parameters:
Return type:

Optional[QgsRasterBlock]

clone(self) QgsSingleBandGrayRenderer | None

QgsSingleBandGrayRenderer cannot be copied. Use clone() instead.

Return type:

Optional[QgsSingleBandGrayRenderer]

contrastEnhancement(self) QgsContrastEnhancement | None
Return type:

Optional[QgsContrastEnhancement]

create(elem: QDomElement, input: QgsRasterInterface | None) QgsRasterRenderer | None
Parameters:
Return type:

Optional[QgsRasterRenderer]

createLegendNodes(self, nodeLayer: QgsLayerTreeLayer | None) List[QgsLayerTreeModelLegendNode]
Parameters:

nodeLayer (Optional[QgsLayerTreeLayer])

Return type:

List[QgsLayerTreeModelLegendNode]

flags(self) Qgis.RasterRendererFlags
Return type:

Qgis.RasterRendererFlags

gradient(self) QgsSingleBandGrayRenderer.Gradient
Return type:

QgsSingleBandGrayRenderer.Gradient

grayBand(self) int

Deprecated since version QGIS: 3.38 use inputBand() instead

Return type:

int

initHistogram(self, histogram: QgsRasterHistogram, bandNo: int, binCount: int, minimum: Any = Py_None, maximum: Any = 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 for stats argument

initStatistics(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

legendSettings(self) QgsColorRampLegendNodeSettings | None

Returns the color ramp shader legend settings.

Added in version 3.18.

Return type:

Optional[QgsColorRampLegendNodeSettings]

legendSymbologyItems(self) List[Tuple[str, QColor]]
Return type:

List[Tuple[str, QColor]]

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.

setContrastEnhancement(self, ce: QgsContrastEnhancement | None)

Takes ownership

Parameters:

ce (Optional[QgsContrastEnhancement])

setGradient(self, gradient: QgsSingleBandGrayRenderer.Gradient)
Parameters:

gradient (QgsSingleBandGrayRenderer.Gradient)

setGrayBand(self, band: int)

Deprecated since version QGIS: 3.38 use setInputBand() instead

Parameters:

band (int)

setInputBand(self, band: int) bool
Parameters:

band (int)

Return type:

bool

setLegendSettings(self, settings: QgsColorRampLegendNodeSettings | None)

Sets the color ramp shader legend settings.

Ownership of settings is transferred.

See also

legendSettings()

Added in version 3.18.

Parameters:

settings (Optional[QgsColorRampLegendNodeSettings])

toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, Any] = {})
Parameters:
  • doc (QDomDocument)

  • element (QDomElement)

  • props (Dict[str)

usesBands(self) List[int]
Return type:

List[int]

writeXml(self, doc: QDomDocument, parentElem: QDomElement)
Parameters:
  • doc (QDomDocument)

  • parentElem (QDomElement)