Skip to content

Commit 94d85ab

Browse files
committed
【fix】webmap创建图层时图层的最大级别为地图最大级别+1
1 parent 2a8fe12 commit 94d85ab

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
@@ -445,7 +445,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
445445
const { minScale, maxScale } = layer.visibleScale;
446446
const crs = this.map.getCRS();
447447
layer.minzoom = Math.max(this._transformScaleToZoom(minScale, crs, layer.tileSize), 0);
448-
layer.maxzoom = Math.min(24, this._transformScaleToZoom(maxScale, crs, layer.tileSize) + 0.0000001);
448+
layer.maxzoom = Math.min(this.map.getMaxZoom()+1, this._transformScaleToZoom(maxScale, crs, layer.tileSize) + 0.0000001);
449449
}
450450

451451
if (type === 'tile') {
@@ -752,7 +752,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
752752
return resolutions.every((item, i) => this.numberEqual(item, conversion * mapResolutions[i]));
753753
}
754754
_getMapResolutions() {
755-
return this._getResolutionsByExtent({extent: this.map.getCRS().getExtent(), tileSize: 512})
755+
return this._getResolutionsByExtent({extent: this.map.getCRS().getExtent(), maxZoom: this.map.getMaxZoom() + 1, tileSize: 512})
756756
}
757757
_getResolutionsByExtent({ extent, maxZoom = 24, tileSize }) {
758758
const width = extent[2] - extent[0];
@@ -1375,7 +1375,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
13751375
},
13761376
layout,
13771377
minzoom: minzoom || 0,
1378-
maxzoom: maxzoom || 22
1378+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
13791379
},
13801380
layerInfo.layerID
13811381
);
@@ -1427,7 +1427,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
14271427
visibility: layerInfo.visible
14281428
},
14291429
minzoom: minzoom || 0,
1430-
maxzoom: maxzoom || 22
1430+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
14311431
};
14321432
if (filter) {
14331433
layerOptions.filter = filter;
@@ -1482,7 +1482,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
14821482
'icon-rotate': iconRotateExpression || ((layerInfo.style.rotation || 0) * 180) / Math.PI
14831483
},
14841484
minzoom: minzoom || 0,
1485-
maxzoom: maxzoom || 22
1485+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
14861486
};
14871487
if (filter) {
14881488
layerOptions.filter = filter;
@@ -1534,7 +1534,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
15341534
'icon-color': style.fillColor
15351535
},
15361536
minzoom: minzoom || 0,
1537-
maxzoom: maxzoom || 22
1537+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
15381538
};
15391539
if (filter) {
15401540
layerOptions.filter = filter;
@@ -1838,7 +1838,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
18381838
visibility: visible
18391839
},
18401840
minzoom: minzoom || 0,
1841-
maxzoom: maxzoom || 22
1841+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
18421842
};
18431843
if (filterExpression.length > 1) {
18441844
layerOptions.filter = filterExpression;
@@ -1956,7 +1956,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
19561956
'icon-rotate': symbolStyle.rotation || 0
19571957
},
19581958
minzoom: minzoom || 0,
1959-
maxzoom: maxzoom || 22,
1959+
maxzoom: maxzoom || this.map.getMaxZoom() + 1,
19601960
filter: imagefilterExpression
19611961
},
19621962
layerID
@@ -1991,7 +1991,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
19911991
'icon-color': symbolStyle.fillColor
19921992
},
19931993
minzoom: minzoom || 0,
1994-
maxzoom: maxzoom || 22,
1994+
maxzoom: maxzoom || this.map.getMaxZoom() + 1,
19951995
filter: svgfilterExpression
19961996
},
19971997
layerID
@@ -2162,7 +2162,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
21622162
paint: this._transformStyleToMapBoxGl(defaultStyle, geomType),
21632163
layout: {},
21642164
minzoom: minzoom || 0,
2165-
maxzoom: maxzoom || 22
2165+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
21662166
},
21672167
markerLayerID
21682168
);
@@ -2180,7 +2180,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
21802180
visibility: layerInfo.visible
21812181
},
21822182
minzoom: minzoom || 0,
2183-
maxzoom: maxzoom || 22
2183+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
21842184
},
21852185
markerLayerID
21862186
);
@@ -2284,7 +2284,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
22842284
visibility: layerInfo.visible
22852285
},
22862286
minzoom: minzoom || 0,
2287-
maxzoom: maxzoom || 22
2287+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
22882288
});
22892289
if (addToMap) {
22902290
this._addLayerSucceeded({ layerInfo, features });
@@ -2491,7 +2491,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
24912491
paint: layerStyle.style,
24922492
layout: layerStyle.layout || {},
24932493
minzoom: minzoom || 0,
2494-
maxzoom: maxzoom || 22
2494+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
24952495
};
24962496
if (filter) {
24972497
style.filter = filter;
@@ -2506,7 +2506,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
25062506
parentLayerId,
25072507
visibility = true,
25082508
minzoom = 0,
2509-
maxzoom = 22,
2509+
maxzoom,
25102510
isIserver = false,
25112511
tileSize = 256,
25122512
bounds
@@ -2515,7 +2515,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
25152515
type: 'raster',
25162516
tiles: url,
25172517
minzoom: minzoom || 0,
2518-
maxzoom: maxzoom || 22,
2518+
maxzoom: maxzoom || this.map.getMaxZoom() + 1,
25192519
tileSize: isIserver ? this.rasterTileSize : tileSize,
25202520
rasterSource: isIserver ? 'iserver' : '',
25212521
prjCoordSys:
@@ -2538,7 +2538,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
25382538
type: 'raster',
25392539
source: sourceId,
25402540
minzoom: minzoom || 0,
2541-
maxzoom: maxzoom || 22,
2541+
maxzoom: maxzoom || this.map.getMaxZoom() + 1,
25422542
layout: {
25432543
visibility: this._getVisibility(visibility)
25442544
}
@@ -2713,7 +2713,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
27132713
visibility: layerInfo.visible ? 'visible' : 'none'
27142714
},
27152715
minzoom: minzoom || 0,
2716-
maxzoom: maxzoom || 22
2716+
maxzoom: maxzoom || this.map.getMaxZoom() + 1
27172717
});
27182718
this._addLayerSucceeded();
27192719
}

0 commit comments

Comments
 (0)