Skip to content

Commit

Permalink
Merge pull request #9509 from camptocamp/GSSIT-115_fix-kml-print
Browse files Browse the repository at this point in the history
Fix printing KML with Polygon fill to null
  • Loading branch information
llienher authored Oct 15, 2024
2 parents b75905e + 1d3610f commit 4ae85f0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/print/VectorEncoder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2018-2021 Camptocamp SA
// Copyright (c) 2018-2024 Camptocamp SA
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 4ae85f0

Please sign in to comment.