From 9930da873b3e09ca19646f342333baa978013d8f Mon Sep 17 00:00:00 2001 From: Laurent Lienher Date: Mon, 14 Oct 2024 16:51:03 +0200 Subject: [PATCH] Fix printing KML with Polygon fill to null --- src/print/VectorEncoder.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/print/VectorEncoder.js b/src/print/VectorEncoder.js index 64069f25cbbb..74e8f531ecf1 100644 --- a/src/print/VectorEncoder.js +++ b/src/print/VectorEncoder.js @@ -254,9 +254,7 @@ VectorEncoder.prototype.encodeVectorStyle_ = function ( const fillStyle = style.getFill(); const strokeStyle = style.getStroke(); if (styleType === PrintStyleType.POLYGON) { - if (fillStyle !== null) { - symbolizers.push(this.encodeVectorStylePolygon_(fillStyle, strokeStyle)); - } + symbolizers.push(this.encodeVectorStylePolygon_(fillStyle, strokeStyle)); } else if (styleType === PrintStyleType.LINE_STRING) { if (strokeStyle !== null) { symbolizers.push(this.encodeVectorStyleLine_(strokeStyle)); @@ -377,7 +375,11 @@ VectorEncoder.prototype.encodeVectorStylePolygon_ = function (fillStyle, strokeS const symbolizer = /** @type {import('ngeo/print/mapfish-print-v3').MapFishPrintSymbolizerPolygon} */ ({ type: 'polygon', }); - this.encodeVectorStyleFill_(symbolizer, fillStyle); + if (fillStyle !== null) { + this.encodeVectorStyleFill_(symbolizer, fillStyle); + } else { + symbolizer.fillOpacity = 0; + } if (strokeStyle !== null) { this.encodeVectorStyleStroke_(symbolizer, strokeStyle); }