Skip to content

Commit

Permalink
Merge pull request #9326 from camptocamp/backport/9325-to-master
Browse files Browse the repository at this point in the history
[Backport master] Fix WMTS opacity from permalink
  • Loading branch information
sbrunner committed Apr 11, 2024
2 parents 0bcb8c3 + 144ecc5 commit cd6f2c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/datasource/ExternalDataSourcesManager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2017-2023 Camptocamp SA
// Copyright (c) 2017-2024 Camptocamp SA
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -441,7 +441,7 @@ export class ExternalDatSourcesManager {
* @param {any} capabilities WMTS Capabilities definition
* @param {string} wmtsUrl The WMTS capabilities url
*/
createAndAddDataSourceFromWMTSCapability(layer, capabilities, wmtsUrl) {
createAndAddDataSourceFromWMTSCapability(layer, capabilities, wmtsUrl, opacity) {
const id = getId(layer);

// (1) No need to do anything if there's already a WMTS data source (and its
Expand Down Expand Up @@ -489,6 +489,7 @@ export class ExternalDatSourcesManager {

// (4) Create and add the OL layer
const layerObj = this.ngeoLayerHelper_.createWMTSLayerFromCapabilititesObj(capabilities, layer);
layerObj.setOpacity(opacity);
this.addLayer_(layerObj);

// (5) Add data source to ngeo collection
Expand Down
4 changes: 2 additions & 2 deletions src/import/wmtsCapabilityLayertreeComponent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2017-2023 Camptocamp SA
// Copyright (c) 2017-2024 Camptocamp SA
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -127,7 +127,7 @@ export class Controller {
throw new Error('Missing url');
}
const manager = this.gmfExternalDataSourcesManager_;
manager.createAndAddDataSourceFromWMTSCapability(layer, this.capabilities, this.url);
manager.createAndAddDataSourceFromWMTSCapability(layer, this.capabilities, this.url, 1);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/permalink/Permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -1731,6 +1731,7 @@ PermalinkService.prototype.initExternalDataSources_ = function () {
layerCap,
response.capabilities,
response.url,
this.ngeoStateManager_.getInitialNumberValue(`${ParamPrefix.TREE_OPACITY}${layerName}`),
);
} else {
// TODO - handle 'not found' layer in capabilities
Expand Down

0 comments on commit cd6f2c9

Please sign in to comment.