Skip to content

Commit

Permalink
feat: add custom print params for wms (#923)
Browse files Browse the repository at this point in the history
* feat: add custom print params for wms
  • Loading branch information
hblitza authored Jan 23, 2023
1 parent 635fef5 commit 04dc9fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/LayerUtil/InkmapTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type InkmapWmsLayer = {
tiled?: boolean;
legendUrl?: string;
layerName?: string;
customParams?: any;
};

export type InkmapWmtsLayer = {
Expand Down
15 changes: 13 additions & 2 deletions src/LayerUtil/LayerUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface UnknownOlSource {
getUrls?: any;
attribution?: any;
getLegendUrl?: any;
getParams?: any;
}

/**
Expand Down Expand Up @@ -110,6 +111,10 @@ class LayerUtil {
const opacity = olLayer.getOpacity();
const legendUrl = olLayer.get('legendUrl');
const layerName = olLayer.get('name');
let time;
if (LayerUtil.isOlSourceTileWMS(source) || LayerUtil.isOlSourceImageWMS(source)) {
time = source.getParams().TIME;
}

// todo: introduce config object which hold possible additional configurations
const attributionString = LayerUtil.getLayerAttributionsText(olLayer, ' ,', true);
Expand All @@ -123,7 +128,10 @@ class LayerUtil {
layer: source.getParams()?.LAYERS,
tiled: true,
legendUrl,
layerName
layerName,
customParams: {
...(time && { time })
}
};
} else if (LayerUtil.isOlSourceImageWMS(source)) {
return {
Expand All @@ -134,7 +142,10 @@ class LayerUtil {
layer: source.getParams()?.LAYERS,
tiled: false,
legendUrl,
layerName
layerName,
customParams: {
...(time && { time })
}
};
} else if (LayerUtil.isOlSourceWMTS(source)) {
const olTileGrid = source.getTileGrid();
Expand Down

0 comments on commit 04dc9fb

Please sign in to comment.