Skip to content

Commit

Permalink
Fix printing KML with Polygon fill to null
Browse files Browse the repository at this point in the history
  • Loading branch information
llienher committed Oct 14, 2024
1 parent b75905e commit 1d3610f
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 1d3610f

Please sign in to comment.