Skip to content

Commit ce27c35

Browse files
author
潘卓然ParnDeedlit
committed
【SDK】【Cesium】【新增矢量瓦片添加成功后的回调】
1 parent 4d4dd48 commit ce27c35

File tree

3 files changed

+431
-302
lines changed

3 files changed

+431
-302
lines changed

src/cesiumjs/render/VectorTileLayer.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import axios from 'axios';
2121
* @param {Cesium.TilingScheme} [option.tilingScheme] 矢量瓦片瓦片切分规则:经纬度还是墨卡托
2222
* @param {String} [option.token] 第三方需要的token,比如mapbox
2323
* @param {String} [option.show=true] 是否可见
24+
* @param {String} [option.callback] 加载矢量瓦片成功回调,返回Provider
2425
* @example
2526
* vectortileLayer = new CesiumZondy.Overlayer.VectorTileLayer(
2627
webGlobe.viewer,
@@ -42,6 +43,7 @@ export class VectorTileLayer {
4243
}
4344

4445
this.options = options;
46+
this.callback = options.callback;
4547
this.token = options.token || '';
4648
this.opacity = options.opacity || 1;
4749
this.vectortilejson = options.vectortilejson;
@@ -52,11 +54,9 @@ export class VectorTileLayer {
5254
this.tilingScheme = options.tilingScheme;
5355
this.provider = null;
5456

55-
console.log(options, this);
56-
5757
this.initDevicePixelRatio();
5858
//this.bindEvent();
59-
59+
6060
if (this.style) {
6161
if (this.style.indexOf('http') >= 0) {
6262
//如果是个网络地址,就通过url请求获取矢量瓦片json对象
@@ -165,6 +165,10 @@ export class VectorTileLayer {
165165
});
166166
this.provider = this.viewer.imageryLayers.addImageryProvider(vectortile);
167167
this.provider.show = this.show;
168+
169+
if (this.callback) {
170+
this.callback({ imageryLayer: this.provider });
171+
}
168172
}
169173
}
170174

@@ -199,15 +203,15 @@ export class VectorTileLayer {
199203
return this.styleData.vectortilejson.layers;
200204
}
201205

202-
unbindEvent() {}
206+
unbindEvent() { }
203207

204-
moveStartEvent() {}
208+
moveStartEvent() { }
205209

206-
moveEndEvent() {}
210+
moveEndEvent() { }
207211

208-
zoomStartEvent() {}
212+
zoomStartEvent() { }
209213

210-
zoomEndEvent() {}
214+
zoomEndEvent() { }
211215

212216
/**
213217
* 销毁图层-实际调用remove,为了接口保持一致

0 commit comments

Comments
 (0)