Class: QgsRasterPipe

Contains a pipeline of raster interfaces for sequential raster processing.

Enums

Property

Data definable properties.

ResamplingStage

alias of RasterResamplingStage

Role

alias of RasterPipeInterfaceRole

Methods

at

Returns the interface at the specified index.

brightnessFilter

Returns the brightness filter interface, or None if no brightness filter is present in the pipe.

canSetOn

Returns True if the interface at the specified index may be switched on or off.

dataDefinedProperties

Returns a reference to the pipe's property collection, used for data defined overrides.

evaluateDataDefinedProperties

Evaluates any data defined properties set on the pipe, applying their results to the corresponding interfaces in place.

hueSaturationFilter

Returns the hue/saturation interface, or None if no hue/saturation filter is present in the pipe.

insert

Attempts to insert interface at specified index and connect if connection would fail, the interface is not inserted and False is returned

last

Returns last interface in the pipe.

moveToThread

Moves the pipe to another thread.

nuller

Returns the raster nuller interface, or None if no raster nuller is present in the pipe.

projector

Returns the projector interface, or None if no projector is present in the pipe.

provider

Returns the data provider interface, or None if no data provider is present in the pipe.

remove

Removes and deletes the interface at given index (if possible).

renderer

Returns the raster renderer interface, or None if no raster renderer is present in the pipe.

replace

Attempts to replace the interface at specified index and reconnect the pipe.

resampleFilter

Returns the resample filter interface, or None if no resample filter is present in the pipe.

resamplingStage

Returns which stage of the pipe should apply resampling

set

Inserts a new known interface in default place or replace interface of the same role if it already exists.

setDataDefinedProperties

Sets the pipe's property collection, used for data defined overrides.

setOn

Set whether the interface at the specified index is enabled.

setResamplingStage

Sets which stage of the pipe should apply resampling.

size

Returns the size of the pipe (the number of interfaces contained in the pipe).

Static Methods

propertyDefinitions

Returns the definitions for data defined properties available for use in raster pipes.

class qgis.core.QgsRasterPipe[source]

Bases: object

__init__()

Constructor for an empty QgsRasterPipe.

class Property(*values)

Bases: IntEnum

Data definable properties.

Added in version 3.22.

  • RendererOpacity: Raster renderer global opacity

ResamplingStage

alias of RasterResamplingStage

Role

alias of RasterPipeInterfaceRole

at(self, idx: int) QgsRasterInterface | None[source]

Returns the interface at the specified index.

Parameters:

idx (int)

Return type:

Optional[QgsRasterInterface]

brightnessFilter(self) QgsBrightnessContrastFilter | None[source]

Returns the brightness filter interface, or None if no brightness filter is present in the pipe.

Return type:

Optional[QgsBrightnessContrastFilter]

canSetOn(self, idx: int, on: bool) bool[source]

Returns True if the interface at the specified index may be switched on or off.

Parameters:
  • idx (int)

  • on (bool)

Return type:

bool

dataDefinedProperties(self) QgsPropertyCollection

Returns a reference to the pipe’s property collection, used for data defined overrides.

Added in version 3.22.

Return type:

QgsPropertyCollection

evaluateDataDefinedProperties(self, context: QgsExpressionContext)[source]

Evaluates any data defined properties set on the pipe, applying their results to the corresponding interfaces in place.

Added in version 3.22.

Parameters:

context (QgsExpressionContext)

hueSaturationFilter(self) QgsHueSaturationFilter | None[source]

Returns the hue/saturation interface, or None if no hue/saturation filter is present in the pipe.

Return type:

Optional[QgsHueSaturationFilter]

insert(self, idx: int, interface: QgsRasterInterface | None) bool[source]

Attempts to insert interface at specified index and connect if connection would fail, the interface is not inserted and False is returned

See also

set()

See also

replace()

Parameters:
Return type:

bool

last(self) QgsRasterInterface | None[source]

Returns last interface in the pipe.

Return type:

Optional[QgsRasterInterface]

moveToThread(self, thread: QThread | None)[source]

Moves the pipe to another thread.

This effects all QObject derived interfaces in the pipe, and follows the same behavior as QObject.moveToThread. Specifically, it is permitted to PUSH the pipe from the current thread to another thread, but NOT to PULL a pipe from another thread over to the current thread. Pulling is only supported by first pushsing the pipe from its current thread to a None thread, and then later pulling to the current thread. See QObject documentation for more details.

Added in version 3.30.

Parameters:

thread (Optional[QThread])

nuller(self) QgsRasterNuller | None[source]

Returns the raster nuller interface, or None if no raster nuller is present in the pipe.

Return type:

Optional[QgsRasterNuller]

projector(self) QgsRasterProjector | None[source]

Returns the projector interface, or None if no projector is present in the pipe.

Return type:

Optional[QgsRasterProjector]

static propertyDefinitions() Dict[int, QgsPropertyDefinition][source]

Returns the definitions for data defined properties available for use in raster pipes.

Added in version 3.22.

Return type:

Dict[int, QgsPropertyDefinition]

provider(self) QgsRasterDataProvider | None[source]

Returns the data provider interface, or None if no data provider is present in the pipe.

Return type:

Optional[QgsRasterDataProvider]

remove(self, idx: int) bool[source]

Removes and deletes the interface at given index (if possible).

Returns True if the interface was successfully removed.

Parameters:

idx (int)

Return type:

bool

remove(self, interface: QgsRasterInterface | None) bool[source]

Removes and deletes interface from pipe (if possible).

Returns True if the interface was successfully removed.

Parameters:

interface (Optional[QgsRasterInterface])

Return type:

bool

renderer(self) QgsRasterRenderer | None[source]

Returns the raster renderer interface, or None if no raster renderer is present in the pipe.

Return type:

Optional[QgsRasterRenderer]

replace(self, idx: int, interface: QgsRasterInterface | None) bool[source]

Attempts to replace the interface at specified index and reconnect the pipe.

If the connection would fail, the interface is not inserted and False is returned.

See also

insert()

See also

set()

Parameters:
Return type:

bool

resampleFilter(self) QgsRasterResampleFilter | None[source]

Returns the resample filter interface, or None if no resample filter is present in the pipe.

Return type:

Optional[QgsRasterResampleFilter]

resamplingStage(self) Qgis.RasterResamplingStage[source]

Returns which stage of the pipe should apply resampling

Added in version 3.16.

Return type:

Qgis.RasterResamplingStage

set(self, interface: QgsRasterInterface | None) bool[source]

Inserts a new known interface in default place or replace interface of the same role if it already exists.

Known interfaces are:

(and their subclasses).

For other interfaces the position of the interface in the pipe must be explicitly specified using the insert() method.

See also

insert()

See also

replace()

Parameters:

interface (Optional[QgsRasterInterface])

Return type:

bool

setDataDefinedProperties(self, collection: QgsPropertyCollection)[source]

Sets the pipe’s property collection, used for data defined overrides.

Any existing properties will be discarded.

See also

Property

Added in version 3.22.

Parameters:

collection (QgsPropertyCollection)

setOn(self, idx: int, on: bool) bool[source]

Set whether the interface at the specified index is enabled.

Returns True on success.

Parameters:
  • idx (int)

  • on (bool)

Return type:

bool

setResamplingStage(self, stage: Qgis.RasterResamplingStage)[source]

Sets which stage of the pipe should apply resampling.

Provider resampling is only supported if provider sets ProviderHintCanPerformProviderResampling in providerCapabilities().

Added in version 3.16.

Parameters:

stage (Qgis.RasterResamplingStage)

size(self) int[source]

Returns the size of the pipe (the number of interfaces contained in the pipe).

Return type:

int