Skip to content

Commit

Permalink
Print WMST to WMS layer opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Mar 15, 2019
1 parent 1ff6f73 commit b67963b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 6 additions & 1 deletion contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,12 @@ exports.Controller_ = class {
server.url,
layer_names,
server.imageType,
server.type
server.type,
undefined,
undefined,
undefined,
undefined,
{opacity: ol_layers.opacity}
);
layer.setZIndex(-200);
} else {
Expand Down
11 changes: 7 additions & 4 deletions src/map/LayerHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ exports.REFRESH_PARAM = 'random';
* @param {string=} opt_time time parameter for layer queryable by time/periode
* @param {Object.<string, string>=} opt_params WMS parameters.
* @param {string=} opt_crossOrigin crossOrigin.
* @param {Object=} opt_customOptions Some initial options.
* @param {Object=} opt_customSourceOptions Some initial options.
* @param {Object=} opt_customLayerOptions The layer opacity.
* @return {ol.layer.Image} WMS Layer.
* @export
*/
exports.prototype.createBasicWMSLayer = function(sourceURL,
sourceLayersName, sourceFormat, opt_serverType, opt_time, opt_params, opt_crossOrigin, opt_customOptions) {
sourceLayersName, sourceFormat, opt_serverType, opt_time, opt_params, opt_crossOrigin,
opt_customSourceOptions, opt_customLayerOptions) {

const params = {
'FORMAT': sourceFormat,
Expand All @@ -93,7 +95,7 @@ exports.prototype.createBasicWMSLayer = function(sourceURL,
// OpenLayers expects 'qgis' insteads of 'qgisserver'
olServerType = opt_serverType.replace('qgisserver', 'qgis');
}
const options = Object.assign({}, opt_customOptions, {
const options = Object.assign({}, opt_customSourceOptions, {
url: sourceURL,
params: params,
serverType: olServerType,
Expand All @@ -104,7 +106,8 @@ exports.prototype.createBasicWMSLayer = function(sourceURL,
source.updateParams(opt_params);
}

return new olLayerImage({source});
const layerOptions = Object.assign({}, opt_customLayerOptions, {source});
return new olLayerImage(layerOptions);
};


Expand Down

0 comments on commit b67963b

Please sign in to comment.