Class: QgsInterpolatedLineColor¶
Defines color interpolation for rendering mesh datasets.
The color can vary depending on the dataset value.
Added in version 3.14.
Methods
Returns the color corresponding to the magnitude |
|
Returns the color ramp shader |
|
Returns the coloring method used |
|
Returns the break values, graduated colors and the associated gradients between two values |
|
Reads configuration from the given DOM element |
|
Sets the color ramp to define the coloring |
|
Sets the coloring method used |
|
Returns the single color that is used if SingleColor coloring mode is set |
|
Writes configuration to a new DOM element |
Attributes
- class qgis.core.QgsInterpolatedLineColor[source]¶
Bases:
object
- __init__()
Default constructor
- __init__(colorRampShader: QgsColorRampShader)
Constructor with variable color depending on magnitude
- Parameters:
colorRampShader (QgsColorRampShader)
- __init__(color: QColor | Qt.GlobalColor)
Constructor with fixed color
- Parameters:
color (Union[QColor, Qt.GlobalColor])
- __init__(a0: QgsInterpolatedLineColor)
- Parameters:
- ColorRamp = 1¶
- class ColoringMethod¶
Bases:
int
- SingleColor = 0¶
- color(self, magnitude: float) QColor [source]¶
Returns the color corresponding to the magnitude
- Parameters:
magnitude (float)
- Return type:
QColor
- colorRampShader(self) QgsColorRampShader [source]¶
Returns the color ramp shader
- Return type:
- coloringMethod(self) QgsInterpolatedLineColor.ColoringMethod [source]¶
Returns the coloring method used
- Return type:
- graduatedColors(self, value1: float, value2: float, breakValues: Iterable[float], breakColors: Iterable[QColor | Qt.GlobalColor], gradients: Iterable[QLinearGradient])[source]¶
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 forbreakValues
,gradients
If the color ramp is classified with ‘exact’, returns void
gradients
If the color ramp is classified with ‘discrete’, return
gradients
with uniform colorsif nothing to render (out of range), return all lists void
- Parameters:
value1 (float)
value2 (float)
breakValues (Iterable[float])
breakColors (Iterable[Union[QColor, Qt.GlobalColor]])
gradients (Iterable[QLinearGradient])
- readXml(self, elem: QDomElement, context: QgsReadWriteContext)[source]¶
Reads configuration from the given DOM element
- Parameters:
elem (QDomElement)
context (QgsReadWriteContext)
- setColor(self, colorRampShader: QgsColorRampShader)[source]¶
Sets the color ramp to define the coloring
- Parameters:
colorRampShader (
QgsColorRampShader
)
- setColor(self, color: QColor | Qt.GlobalColor)[source]
Sets the single color to define the coloring
- Parameters:
color (Union[QColor, Qt.GlobalColor])
- setColoringMethod(self, coloringMethod: QgsInterpolatedLineColor.ColoringMethod)[source]¶
Sets the coloring method used
Added in version 3.20.
- Parameters:
coloringMethod (QgsInterpolatedLineColor.ColoringMethod)
- singleColor(self) QColor [source]¶
Returns the single color that is used if SingleColor coloring mode is set
Added in version 3.20.
- Return type:
QColor
- writeXml(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement [source]¶
Writes configuration to a new DOM element
- Parameters:
doc (QDomDocument)
context (QgsReadWriteContext)
- Return type:
QDomElement