Skip to content

Commit 217e41d

Browse files
committed
【fix】webmap创建图层时图层的最大级别为地图最大级别+1
1 parent 4042539 commit 217e41d

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/common/mapping/WebMapV2.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
513513
const { minScale, maxScale } = layer.visibleScale;
514514
const crs = this.map.getCRS();
515515
layer.minzoom = Math.max(this._transformScaleToZoom(minScale, crs, layer.tileSize), 0);
516-
layer.maxzoom = Math.min(24, this._transformScaleToZoom(maxScale, crs, layer.tileSize) + 0.0000001);
516+
layer.maxzoom = Math.min(this.map.getMaxZoom()+1, this._transformScaleToZoom(maxScale, crs, layer.tileSize) + 0.0000001);
517517
}
518518

519519
if (type === 'tile') {
@@ -820,7 +820,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
820820
return resolutions.every((item, i) => this.numberEqual(item, conversion * mapResolutions[i]));
821821
}
822822
_getMapResolutions() {
823-
return this._getResolutionsByExtent({extent: this.map.getCRS().getExtent(), tileSize: 512})
823+
return this._getResolutionsByExtent({extent: this.map.getCRS().getExtent(), maxZoom: this.map.getMaxZoom() + 1, tileSize: 512})
824824
}
825825
_getResolutionsByExtent({ extent, maxZoom = 24, tileSize }) {
826826
const width = extent[2] - extent[0];
@@ -1443,7 +1443,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
14431443
},
14441444
layout,
14451445
minzoom: minzoom || 0,
1446-
maxzoom: maxzoom || 22
1446+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
14471447
},
14481448
layerInfo.layerID
14491449
);
@@ -1495,7 +1495,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
14951495
visibility: layerInfo.visible
14961496
},
14971497
minzoom: minzoom || 0,
1498-
maxzoom: maxzoom || 22
1498+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
14991499
};
15001500
if (filter) {
15011501
layerOptions.filter = filter;
@@ -1550,7 +1550,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
15501550
'icon-rotate': iconRotateExpression || ((layerInfo.style.rotation || 0) * 180) / Math.PI
15511551
},
15521552
minzoom: minzoom || 0,
1553-
maxzoom: maxzoom || 22
1553+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
15541554
};
15551555
if (filter) {
15561556
layerOptions.filter = filter;
@@ -1602,7 +1602,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
16021602
'icon-color': style.fillColor
16031603
},
16041604
minzoom: minzoom || 0,
1605-
maxzoom: maxzoom || 22
1605+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
16061606
};
16071607
if (filter) {
16081608
layerOptions.filter = filter;
@@ -1906,7 +1906,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
19061906
visibility: visible
19071907
},
19081908
minzoom: minzoom || 0,
1909-
maxzoom: maxzoom || 22
1909+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
19101910
};
19111911
if (filterExpression.length > 1) {
19121912
layerOptions.filter = filterExpression;
@@ -2024,7 +2024,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
20242024
'icon-rotate': symbolStyle.rotation || 0
20252025
},
20262026
minzoom: minzoom || 0,
2027-
maxzoom: maxzoom || 22,
2027+
maxzoom: maxzoom || this.map.getMaxZoom() + 1,
20282028
filter: imagefilterExpression
20292029
},
20302030
layerID
@@ -2059,7 +2059,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
20592059
'icon-color': symbolStyle.fillColor
20602060
},
20612061
minzoom: minzoom || 0,
2062-
maxzoom: maxzoom || 22,
2062+
maxzoom: maxzoom || this.map.getMaxZoom() + 1,
20632063
filter: svgfilterExpression
20642064
},
20652065
layerID
@@ -2230,7 +2230,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
22302230
paint: this._transformStyleToMapBoxGl(defaultStyle, geomType),
22312231
layout: {},
22322232
minzoom: minzoom || 0,
2233-
maxzoom: maxzoom || 22
2233+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
22342234
},
22352235
markerLayerID
22362236
);
@@ -2248,7 +2248,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
22482248
visibility: layerInfo.visible
22492249
},
22502250
minzoom: minzoom || 0,
2251-
maxzoom: maxzoom || 22
2251+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
22522252
},
22532253
markerLayerID
22542254
);
@@ -2352,7 +2352,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
23522352
visibility: layerInfo.visible
23532353
},
23542354
minzoom: minzoom || 0,
2355-
maxzoom: maxzoom || 22
2355+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
23562356
});
23572357
if (addToMap) {
23582358
this._addLayerSucceeded({ layerInfo, features });
@@ -2559,7 +2559,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
25592559
paint: layerStyle.style,
25602560
layout: layerStyle.layout || {},
25612561
minzoom: minzoom || 0,
2562-
maxzoom: maxzoom || 22
2562+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
25632563
};
25642564
if (filter) {
25652565
style.filter = filter;
@@ -2574,7 +2574,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
25742574
parentLayerId,
25752575
visibility = true,
25762576
minzoom = 0,
2577-
maxzoom = 22,
2577+
maxzoom,
25782578
isIserver = false,
25792579
tileSize = 256,
25802580
bounds
@@ -2583,7 +2583,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
25832583
type: 'raster',
25842584
tiles: url,
25852585
minzoom: minzoom || 0,
2586-
maxzoom: maxzoom || 22,
2586+
maxzoom: maxzoom || this.map.getMaxZoom() + 1,
25872587
tileSize: isIserver ? this.rasterTileSize : tileSize,
25882588
rasterSource: isIserver ? 'iserver' : '',
25892589
prjCoordSys:
@@ -2606,7 +2606,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
26062606
type: 'raster',
26072607
source: sourceId,
26082608
minzoom: minzoom || 0,
2609-
maxzoom: maxzoom || 22,
2609+
maxzoom: maxzoom || this.map.getMaxZoom() + 1,
26102610
layout: {
26112611
visibility: this._getVisibility(visibility)
26122612
}
@@ -2781,7 +2781,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
27812781
visibility: layerInfo.visible ? 'visible' : 'none'
27822782
},
27832783
minzoom: minzoom || 0,
2784-
maxzoom: maxzoom || 22
2784+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
27852785
});
27862786
this._addLayerSucceeded();
27872787
}

0 commit comments

Comments
 (0)