Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#8871 Improve getLegendGraphic compatibility for print #10041

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/client/utils/PrintUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,13 +576,13 @@ export const specCreators = {
SERVICE: "WMS",
REQUEST: "GetLegendGraphic",
LAYER: layer.name,
LANGUAGE: spec.language || '',
STYLE: layer.style || '',
SCALE: spec.scale,
...getLegendIconsSize(spec, layer),
LEGEND_OPTIONS: "forceLabels:" + (spec.forceLabels ? "on" : "") + ";fontAntialiasing:" + spec.antiAliasing + ";dpi:" + spec.legendDpi + ";fontStyle:" + (spec.bold && "bold" || (spec.italic && "italic") || '') + ";fontName:" + spec.fontFamily + ";fontSize:" + spec.fontSize,
format: "image/png",
...assign({}, layer.params)
...(spec.language ? {LANGUAGE: spec.language} : {}),
...layer?.params
})
})
]
Expand Down
11 changes: 11 additions & 0 deletions web/client/utils/__tests__/PrintUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,17 @@ describe('PrintUtils', () => {
const specs = getMapfishLayersSpecification([layer], { projection: "EPSG:3857" }, {}, 'legend');
expect(specs).toExist();
expect(specs.length).toBe(1);
expect(specs[0].classes.length).toBe(1);
// legendURL is a GetLegendGraphic request
expect(specs[0].classes[0].icons[0].indexOf('GetLegendGraphic') !== -1).toBe(true);
// LANGUAGE, if not included, should not be a parameter of the legend URL
expect(specs[0].classes[0].icons[0].indexOf('LANGUAGE')).toBe(-1);
const specs2 = getMapfishLayersSpecification([layer], { projection: "EPSG:3857", language: 'de' }, {}, 'legend');
expect(specs2).toExist();
expect(specs2.length).toBe(1);
expect(specs2[0].classes.length).toBe(1);
// LANGUAGE, if included, should be a parameter of the legend URL
expect(specs2[0].classes[0].icons[0].indexOf('LANGUAGE=de')).toBeGreaterThan(0);
});
it('toOpenLayers2Style for vector layer wich contains a FeatureCollection using the default style', () => {
const style = toOpenLayers2Style(vectorWithFtCollInside, null, "FeatureCollection");
Expand Down
Loading