Skip to content

Commit

Permalink
Merge pull request #4750 from camptocamp/print-opacity
Browse files Browse the repository at this point in the history
Print WMST to WMS layer opacity
  • Loading branch information
sbrunner committed Mar 19, 2019
2 parents 87969c8 + b67963b commit 84ae087
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
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
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 84ae087

Please sign in to comment.