From b6699a7e7a0b5c3813d9a9248016b3f6c25ce9a9 Mon Sep 17 00:00:00 2001 From: Blottiere Paul Date: Wed, 26 Jun 2024 15:00:04 +0200 Subject: [PATCH] Add gradient stops --- qsa-api/qsa_api/api/symbology.py | 1 + qsa-api/qsa_api/raster/renderer.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/qsa-api/qsa_api/api/symbology.py b/qsa-api/qsa_api/api/symbology.py index 76d2786..a0d46bb 100644 --- a/qsa-api/qsa_api/api/symbology.py +++ b/qsa-api/qsa_api/api/symbology.py @@ -88,6 +88,7 @@ def symbology_raster_singlebandpseudocolor(): "name": f"Spectral ({ramps})", "color1": "0,0,0,255", "color2": "255,255,255,255", + "stops": "0.2;2,2,11,255:0.8;200,200,110,255", "interpolation": "Linear (Linear, Discrete, Exact)", } props["contrast_enhancement"] = { diff --git a/qsa-api/qsa_api/raster/renderer.py b/qsa-api/qsa_api/raster/renderer.py index 2e66bef..52746a5 100644 --- a/qsa-api/qsa_api/raster/renderer.py +++ b/qsa-api/qsa_api/raster/renderer.py @@ -266,8 +266,12 @@ def _singlebandpseudocolor_properties(renderer) -> dict: color_2 = ( shader_fct.sourceColorRamp().properties()["color2"].split("rgb")[0] ) + stops = ( + shader_fct.sourceColorRamp().properties()["stops"] + ) props["ramp"]["color1"] = color_1 props["ramp"]["color2"] = color_2 + props["ramp"]["stops"] = stops ramp_type = shader_fct.colorRampType() if ramp_type == QgsColorRampShader.Discrete: