Skip to content

Commit ad9be35

Browse files
committed
【SDK】【增加图层加载完毕判断】
1 parent 39305a4 commit ad9be35

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/service/2DPlot/PlotLayer2D.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,16 @@ class PlotLayer2D {
260260
fromJSON(geoJson) {
261261
if (geoJson.type === 'FeatureCollection') {
262262
const { features } = geoJson;
263+
let that = this;
263264
features.forEach((/** @type {any} */ s) => {
264265
this.addGeoJSONObject(s);
265266
});
267+
let layerInterval = setInterval(function () {
268+
if(features.length === that.getPlotObjects().length){
269+
that.loaded = true;
270+
clearInterval(layerInterval);
271+
}
272+
},50);
266273
} else {
267274
// eslint-disable-next-line no-new
268275
new Error('GeoJSON类型错误,传入值非要素集!');

src/service/3DPlot/PlotLayer3D.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ class PlotLayer3D extends Observable {
248248
let layerInterval = setInterval(function () {
249249
if(features.length === that._primitiveCollection._primitives.length){
250250
that.loaded = true;
251+
clearInterval(layerInterval);
251252
}
252253
},50);
253254
} else {

0 commit comments

Comments
 (0)