Skip to content

Commit

Permalink
Changed to generic setting of params for source
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyblasta committed Mar 30, 2023
1 parent 36903d0 commit 0f37048
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/layer/wms.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ function createTileSource(options) {
STYLES: options.style
}
};
if (options.filter) {
if (options.filterType === 'qgis') {
sourceOptions.params.EXP_FILTER = options.filter;
} else {
sourceOptions.params.CQL_FILTER = options.filter;
}
if (options.params) {
Object.keys(options.params).forEach((element) => {
sourceOptions.params[element] = options.params[element];
});
}
return new TileWMSSource((sourceOptions));
}
Expand All @@ -43,12 +41,10 @@ function createImageSource(options) {
STYLES: options.style
}
};
if (options.filter) {
if (options.filterType === 'qgis') {
sourceOptions.params.EXP_FILTER = options.filter;
} else {
sourceOptions.params.CQL_FILTER = options.filter;
}
if (options.params) {
Object.keys(options.params).forEach((element) => {
sourceOptions.params[element] = options.params[element];
});
}
return new ImageWMSSource((sourceOptions));
}
Expand Down Expand Up @@ -121,6 +117,7 @@ const wms = function wms(layerOptions, viewer) {
sourceOptions.id = wmsOptions.id;
sourceOptions.filter = wmsOptions.filter;
sourceOptions.filterType = wmsOptions.filterType;
sourceOptions.params = wmsOptions.sourceParams;
sourceOptions.format = wmsOptions.format ? wmsOptions.format : sourceOptions.format;
const styleSettings = viewer.getStyle(wmsOptions.styleName);
const wmsStyleObject = styleSettings ? styleSettings[0].find(s => s.wmsStyle) : undefined;
Expand Down

0 comments on commit 0f37048

Please sign in to comment.