Skip to content

Commit e4e6796

Browse files
committed
【SDK】【增加图层加载完毕判断】
1 parent e88241d commit e4e6796

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/service/2DPlot/PlotLayer2D.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class PlotLayer2D {
3636
this._isDrawing = false;
3737
// 是否为可编辑活跃图层
3838
this.editable = false;
39+
//是否加载完毕
40+
this.loaded = false;
3941
}
4042

4143
/**

src/service/3DPlot/PlotLayer3D.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class PlotLayer3D extends Observable {
5858
//二三维联动工具
5959
this._linkTool = undefined;
6060

61+
//是否加载完毕
62+
this.loaded = false;
63+
6164
this._primitiveCollection._id = this._id;
6265
let scene = this._getScene();
6366
scene.primitives.add(this._primitiveCollection);
@@ -238,9 +241,15 @@ class PlotLayer3D extends Observable {
238241
if (geoJson.type === "FeatureCollection") {
239242
this.removeAll();
240243
const {features} = geoJson;
244+
let that = this;
241245
features.forEach((s) => {
242246
this._addGeoJSONObject(s);
243247
});
248+
let layerInterval = setInterval(function () {
249+
if(features.length === that._primitiveCollection._primitives.length){
250+
that.loaded = true;
251+
}
252+
},50);
244253
} else {
245254
// eslint-disable-next-line no-new
246255
new Error("GeoJSON类型错误,传入值非要素集!");

0 commit comments

Comments
 (0)