Class: QgsInterpolatedLineColor

class qgis.core.QgsInterpolatedLineColor

Bases: sip.wrapper

Class defining color to render mesh datasets. The color can vary depending on the dataset value.

New in version 3.14.

QgsInterpolatedLineColor() Default constructor

QgsInterpolatedLineColor(colorRampShader: QgsColorRampShader) Constructor with variable color depending on magnitude

QgsInterpolatedLineColor(color: Union[QColor, Qt.GlobalColor]) Constructor with fixed color

QgsInterpolatedLineColor(QgsInterpolatedLineColor)

Methods

color

Returns the color corresponding to the magnitude

colorRampShader

Returns the color ramp shader

coloringMethod

Returns the coloring method used

graduatedColors

Returns the break values, graduated colors and the associated gradients between two values

readXml

Reads configuration from the given DOM element

setColor

Sets the color ramp to define the coloring

setColoringMethod

Sets the coloring method used

singleColor

Returns the single color that is used if SingleColor coloring mode is set

writeXml

Writes configuration to a new DOM element

Attributes

ColorRamp

SingleColor

ColorRamp = 1
class ColoringMethod

Bases: int

SingleColor = 0
color(self, magnitude: float) QColor

Returns the color corresponding to the magnitude

Parameters:

magnitude (float) –

Return type:

QColor

colorRampShader(self) QgsColorRampShader

Returns the color ramp shader

Return type:

QgsColorRampShader

coloringMethod(self) QgsInterpolatedLineColor.ColoringMethod

Returns the coloring method used

Return type:

QgsInterpolatedLineColor.ColoringMethod

graduatedColors(self, value1: float, value2: float, breakValues: Iterable[float], breakColors: Iterable[QColor | Qt.GlobalColor], gradients: Iterable[QLinearGradient])

Returns the break values, graduated colors and the associated gradients between two values

  • If the color is fixed or only one color for the interval (value1, value2), returns only one color in breakColors and void lists for breakValues, gradients

  • If the color ramp is classified with ‘exact’, returns void gradients

  • If the color ramp is classified with ‘discrete’, return gradients with uniform colors

  • if nothing to render (out of range), return all lists void

Parameters:
  • value1 (float) –

  • value2 (float) –

  • breakValues (Iterable[float]) –

  • breakColors (Iterable[Union[QColor) –

  • gradients (Iterable[QLinearGradient]) –

readXml(self, elem: QDomElement, context: QgsReadWriteContext)

Reads configuration from the given DOM element

Parameters:
setColor(self, colorRampShader: QgsColorRampShader)

Sets the color ramp to define the coloring

setColor(self, color: Union[QColor, Qt.GlobalColor]) Sets the single color to define the coloring

Parameters:

colorRampShader (QgsColorRampShader) –

setColoringMethod(self, coloringMethod: QgsInterpolatedLineColor.ColoringMethod)

Sets the coloring method used

New in version 3.20.

Parameters:

coloringMethod (QgsInterpolatedLineColor.ColoringMethod) –

singleColor(self) QColor

Returns the single color that is used if SingleColor coloring mode is set

New in version 3.20.

Return type:

QColor

writeXml(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement

Writes configuration to a new DOM element

Parameters:
Return type:

QDomElement