Skip to content

Commit

Permalink
Merge pull request 3liz#4365 from rldhont/fix-layer-min-max-resolutio…
Browse files Browse the repository at this point in the history
…n-singlelayer

[Bugfix] Apply min and max resolutions to base layers removed by single WMS Layer
  • Loading branch information
rldhont authored Apr 15, 2024
2 parents e5d87d9 + b071e3a commit 8505f41
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions assets/src/modules/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { mainLizmap, mainEventDispatcher } from './Globals.js';
import Utils from './Utils.js';
import { BaseLayerTypes } from './config/BaseLayer.js';
import { MapLayerLoadStatus } from './state/MapLayer.js';
import { MapLayerLoadStatus, MapLayerState } from './state/MapLayer.js';
import olMap from 'ol/Map.js';
import View from 'ol/View.js';
import { ADJUSTED_DPI } from '../utils/Constants.js';
Expand Down Expand Up @@ -443,13 +443,13 @@ export default class map extends olMap {
} else {
if(mainLizmap.state.map.singleWMSLayer){
baseLayerState.singleWMSLayer = true;
this._statesSingleWMSLayers.set(baseLayerState.name, baseLayerState);
this._statesSingleWMSLayers.set(baseLayerState.name, baseLayerState);
} else {
if (this._useTileWms) {
baseLayer = new TileLayer({
// extent: extent,
minResolution: minResolution,
maxResolution: maxResolution,
minResolution: layerMinResolution,
maxResolution: layerMaxResolution,
source: new TileWMS({
url: mainLizmap.serviceURL,
projection: qgisProjectProjection,
Expand Down Expand Up @@ -760,7 +760,7 @@ export default class map extends olMap {
}
/**
* Map and base Layers are loaded as TileWMS
* @type {Boolean}
* @type {boolean}
*/
get useTileWms(){
return this._useTileWms;
Expand All @@ -774,14 +774,14 @@ export default class map extends olMap {
}
/**
* WMS/TileWMS high dpi support
* @type {Boolean}
* @type {boolean}
*/
get hidpi(){
return this._hidpi;
}
/**
* Is dragZoom active?
* @type {Boolean}
* @type {boolean}
*/
get isDragZoomActive(){
return this._dragZoom.getActive();
Expand Down Expand Up @@ -891,8 +891,8 @@ export default class map extends olMap {
/**
* Return overlay layer if `name` matches.
* `name` is unique for every layers
* @param name
* @returns {Layer|undefined}
* @param {string} name The layer name.
* @returns {ImageLayer|undefined} The OpenLayers layer or undefined
*/
getLayerByName(name){
return this.overlayLayers.find(
Expand All @@ -903,8 +903,8 @@ export default class map extends olMap {
/**
* Return overlay layer or group if `name` matches.
* `name` is unique for every layers/groups
* @param name
* @returns {Layer|LayerGroup|undefined}
* @param {string} name The layer or group name.
* @returns {ImageLayer|LayerGroup|undefined} The OpenLayers layer or OpenLayers group or undefined
*/
getLayerOrGroupByName(name){
return this.overlayLayersAndGroups.find(
Expand All @@ -914,9 +914,8 @@ export default class map extends olMap {

/**
* Return MapLayerState instance of WMS layer or group if the layer is loaded in the single WMS image, undefined if not.
*
* @param name
* @returns {MapLayerState|undefined}
* @param {string} name the WMS layer or group name
* @returns {MapLayerState|undefined} the MapLayerState instance of WMS layer or group if the layer is loaded in the single WMS image or undefined.
*/
isSingleWMSLayer(name){

Expand Down

0 comments on commit 8505f41

Please sign in to comment.