Skip to content

Commit 6388720

Browse files
committed
【fix】1.修复restjsr服务mvt瓦片渲染问题
2.创建地图成功回调函数增加 底图信息 参数 review by chengl
1 parent dbe4cd4 commit 6388720

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import WMTSTileGrid from 'ol/tilegrid/WMTS';
3838
import * as olGeometry from 'ol/geom';
3939
import * as olSource from 'ol/source';
4040
import Feature from 'ol/Feature';
41+
import olRenderFeature from 'ol/render/Feature';
4142
import Style from 'ol/style/Style';
4243
import FillStyle from 'ol/style/Fill';
4344
import StrokeStyle from 'ol/style/Stroke';
@@ -198,6 +199,7 @@ export class WebMap extends Observable {
198199
}
199200
that.baseProjection = mapInfo.projection;
200201
that.webMapVersion = mapInfo.version;
202+
that.baseLayer = mapInfo.baseLayer;
201203
that.mapParams = {
202204
title: mapInfo.title,
203205
description: mapInfo.description
@@ -1785,7 +1787,7 @@ export class WebMap extends Observable {
17851787
*/
17861788
sendMapToUser(layersLen) {
17871789
if (this.layerAdded === layersLen && this.successCallback) {
1788-
this.successCallback(this.map, this.mapParams, this.layers);
1790+
this.successCallback(this.map, this.mapParams, this.layers, this.baseLayer);
17891791
}
17901792
}
17911793

@@ -4048,22 +4050,18 @@ export class WebMap extends Observable {
40484050
});
40494051
return new Promise((resolve) => {
40504052
mapboxStyles.on('styleloaded', function () {
4051-
let styleUrl = layerInfo.url;
4052-
if (styleUrl.indexOf('/restjsr/') > -1) {
4053-
styleUrl = styleUrl + '/style.json'
4054-
}
40554053
let visibleScale = layerInfo.visibleScale;
40564054
let minResolution = visibleScale && that.resolutions[visibleScale.maxScale];
40574055
let maxResolution = visibleScale && that.resolutions[visibleScale.minScale];
40584056
let layer = new olLayer.VectorTile({
40594057
//设置避让参数
40604058
declutter: true,
40614059
source: new olSource.VectorTileSuperMapRest({
4062-
style: styleUrl,
4060+
style: styles,
40634061
withCredentials,
40644062
projection: layerInfo.projection,
40654063
format: new MVT({
4066-
featureClass: Feature
4064+
featureClass: olRenderFeature
40674065
}),
40684066
wrapX: false
40694067
}),

0 commit comments

Comments
 (0)