From b444282ea934c153b681ef3d93405e22af91724b Mon Sep 17 00:00:00 2001 From: Jose Zambudio Date: Tue, 24 Mar 2026 09:06:31 +0100 Subject: [PATCH] feat(geoengine.vector.layer): add `intermediate_colors` field for gradient customization - Introduced `intermediate_colors` field to `geoengine.vector.layer` model, allowing users to specify comma-separated hex color values for intermediate gradient stops. - Updated the GeoengineRenderer to utilize the new field for dynamic gradient generation. - Modified relevant views and documentation to reflect the new feature. --- base_geoengine/README.rst | 16 +++-- base_geoengine/__manifest__.py | 2 +- base_geoengine/models/geo_vector_layer.py | 5 ++ base_geoengine/readme/CONTRIBUTORS.md | 1 + base_geoengine/readme/HISTORY.md | 8 +++ base_geoengine/static/description/index.html | 62 ++++++++++--------- .../geoengine_renderer.esm.js | 14 ++++- .../views/geo_vector_layer_view.xml | 8 +++ 8 files changed, 79 insertions(+), 37 deletions(-) diff --git a/base_geoengine/README.rst b/base_geoengine/README.rst index cd9579f9f..693caeed5 100644 --- a/base_geoengine/README.rst +++ b/base_geoengine/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - =========================== Geospatial support for Odoo =========================== @@ -17,7 +13,7 @@ Geospatial support for Odoo .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fgeospatial-lightgray.png?logo=github @@ -175,6 +171,15 @@ Known issues / Roadmap Changelog ========= +17.0.1.3.0 (2026-03-24) +----------------------- + +- Added ``intermediate_colors`` field to ``geoengine.vector.layer``. + Accepts comma-separated hex color values (e.g. ``#FF0000,#00FF00``) to + define intermediate gradient stops in the colored representation. The + gradient is built as: begin → intermediate(s) → end. The field is + optional; existing behavior is unchanged when left empty. + 16.0.1.0.0 (2023-03-20) ----------------------- @@ -349,6 +354,7 @@ Contributors - Red Butay <> - Sergio Sancho +- Jose Zambudio Maintainers ----------- diff --git a/base_geoengine/__manifest__.py b/base_geoengine/__manifest__.py index 0d61dcd6f..c75aa9536 100644 --- a/base_geoengine/__manifest__.py +++ b/base_geoengine/__manifest__.py @@ -4,7 +4,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Geospatial support for Odoo", - "version": "18.0.1.2.0", + "version": "18.0.1.3.0", "category": "GeoBI", "author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)", "license": "AGPL-3", diff --git a/base_geoengine/models/geo_vector_layer.py b/base_geoengine/models/geo_vector_layer.py index e30c77842..20ef64705 100644 --- a/base_geoengine/models/geo_vector_layer.py +++ b/base_geoengine/models/geo_vector_layer.py @@ -50,6 +50,11 @@ class GeoVectorLayer(models.Model): ) name = fields.Char("Layer Name", translate=True, required=True) begin_color = fields.Char("Begin color class", required=False, help="hex value") + intermediate_colors = fields.Char( + "Intermediate colors", + required=False, + help="Comma-separated hex values for intermediate gradient stops", + ) end_color = fields.Char( "End color class", required=False, help="hex value", default="#FF680A" ) diff --git a/base_geoengine/readme/CONTRIBUTORS.md b/base_geoengine/readme/CONTRIBUTORS.md index 7313dd40f..a78ce9f7e 100644 --- a/base_geoengine/readme/CONTRIBUTORS.md +++ b/base_geoengine/readme/CONTRIBUTORS.md @@ -23,3 +23,4 @@ - Miquel Alzanillas \<\> - Red Butay \<\> - Sergio Sancho \<\> +- Jose Zambudio \<\> diff --git a/base_geoengine/readme/HISTORY.md b/base_geoengine/readme/HISTORY.md index 77872b7ff..1a10ab332 100644 --- a/base_geoengine/readme/HISTORY.md +++ b/base_geoengine/readme/HISTORY.md @@ -1,3 +1,11 @@ +## 17.0.1.3.0 (2026-03-24) + +- Added `intermediate_colors` field to `geoengine.vector.layer`. Accepts + comma-separated hex color values (e.g. `#FF0000,#00FF00`) to define + intermediate gradient stops in the colored representation. The gradient + is built as: begin → intermediate(s) → end. The field is optional; + existing behavior is unchanged when left empty. + ## 16.0.1.0.0 (2023-03-20) - LayerSwitcher has been removed as it was not really practical. A diff --git a/base_geoengine/static/description/index.html b/base_geoengine/static/description/index.html index 9c9a0c6fa..9e389e41f 100644 --- a/base_geoengine/static/description/index.html +++ b/base_geoengine/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Geospatial support for Odoo -
+
+

Geospatial support for Odoo

- - -Odoo Community Association - -
-

Geospatial support for Odoo

-

Beta License: AGPL-3 OCA/geospatial Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/geospatial Translate me on Weblate Try me on Runboat

GeoEngine is an Odoo module that adds spatial/GIS capabilites to Odoo. It will allow you to :

-

Installation

+

Installation

To install this module, you need to have PostGIS installed.

On Ubuntu:

@@ -435,9 +431,9 @@

Installation

documenation

-

Usage

+

Usage

-

Geoengine Demo

+

Geoengine Demo

  1. As a user/admin, when I am in the Geoengine Demo module and I go to the ZIP menu. When I click on an item in the list view, I get to the @@ -502,7 +498,7 @@

    Geoengine Demo

-

Geoengine Backend

+

Geoengine Backend

  1. As an admin, if I go into the configuration of the raster layers and it has elements, I can click on one and see its information.
  2. @@ -523,12 +519,22 @@

    Geoengine Backend

-

Changelog

+

Changelog

-

16.0.1.0.0 (2023-03-20)

+

17.0.1.3.0 (2026-03-24)

+
    +
  • Added intermediate_colors field to geoengine.vector.layer. +Accepts comma-separated hex color values (e.g. #FF0000,#00FF00) to +define intermediate gradient stops in the colored representation. The +gradient is built as: begin → intermediate(s) → end. The field is +optional; existing behavior is unchanged when left empty.
  • +
+
+
+

16.0.1.0.0 (2023-03-20)

  • LayerSwitcher has been removed as it was not really practical. A LayerPanel is now active.
  • @@ -656,7 +662,7 @@

    16.0.1.0.0 (2023-03-20)

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -664,16 +670,16 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Camptocamp
  • ACSONE SA/NV
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -718,6 +725,5 @@

Maintainers

-
diff --git a/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js b/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js index 3f10ecf12..f3c8198da 100644 --- a/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js +++ b/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js @@ -1083,9 +1083,17 @@ export class GeoengineRenderer extends Component { var end_color_hex = cfg.end_color || DEFAULT_END_COLOR; var begin_color = chroma(begin_color_hex).alpha(opacity).css(); var end_color = chroma(end_color_hex).alpha(opacity).css(); - // Function that maps numeric values to a color palette. - // This scale function is only used when geo_repr is basic - var scale = chroma.scale([begin_color, end_color]); + var gradient_colors = [begin_color]; + if (cfg.intermediate_colors) { + cfg.intermediate_colors.split(",").forEach((hex) => { + var trimmed = hex.trim(); + if (trimmed) { + gradient_colors.push(chroma(trimmed).alpha(opacity).css()); + } + }); + } + gradient_colors.push(end_color); + var scale = chroma.scale(gradient_colors); var serie = new geostats(values); var vals = null; switch (cfg.classification) { diff --git a/base_geoengine/views/geo_vector_layer_view.xml b/base_geoengine/views/geo_vector_layer_view.xml index 68b6558e1..720265d1c 100644 --- a/base_geoengine/views/geo_vector_layer_view.xml +++ b/base_geoengine/views/geo_vector_layer_view.xml @@ -56,6 +56,10 @@ colspan="4" invisible="geo_repr in ['basic', 'proportion']" > + +