Skip to content

Commit

Permalink
fix: only issue getlegendgraphic requests for wms layers (#1885)
Browse files Browse the repository at this point in the history
* fix: only issue getlegendgraphic requests for wms layers

* fix: refactor block
  • Loading branch information
Grammostola authored Oct 30, 2023
1 parent ac095cf commit 65fdb72
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/controls/print/print-legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,17 @@ const LayerRow = function LayerRow(options) {
async render() {
const title = layer.get('title') || 'Titel saknas';
let content = '';

const style = viewer.getStyle(layer.get('styleName'));
if (style && style[0] && (!style[0][0].extendedLegend)) {
content = getStyleContent(title, style);
} else if (!layer.get('type') || layer.get('styleName') === 'origoStylefunction') {
content = getTitleWithIcon(title, '');
} else if (layer.get('type').includes('AGS') || /\/arcgis\/services\/[^/]+\/[^/]+\/MapServer\/WMSServer/.test(getOneUrl(layer))) {
content = await getAGSJSONContent(title, layer.get('id'));
} else {
content = await getWMSJSONContent(title);
content = getTitleWithIcon(title, '');
const lType = layer.get('type');
if ((lType && lType.includes('AGS')) || /\/arcgis\/services\/[^/]+\/[^/]+\/MapServer\/WMSServer/.test(getOneUrl(layer))) {
content = await getAGSJSONContent(title, layer.get('id'));
} else if (lType && lType.includes('WMS')) {
content = await getWMSJSONContent(title);
}
}
return `
<li id="${this.getId()}" class="flex row align-center padding-left padding-right item legend-${layer.get('type')}">
Expand Down

0 comments on commit 65fdb72

Please sign in to comment.