【问题标题】:How to listen the load event of specific layer on Cesium如何在 Cesium 上监听特定层的加载事件
【发布时间】:2022-10-05 10:05:03
【问题描述】:

根据这个答案https://stackoverflow.com/a/67883291/14326456,我现在能够知道地球上的瓷砖何时加载。但是,我想知道是否有办法在特定 imageryLayer 上监听加载事件?而不是同时开启。

viewer.scene.globe.tileLoadProgressEvent.addEventListener(function (queuedTileCount) {
    console.log(queuedTileCount);
    console.log(viewer.scene.globe.tilesLoaded);
    if(viewer.scene.globe.tilesLoaded){
        // doSomething
    }
});
  • CesiumJs 不支持你想要的功能

标签: cesiumjs terrain


【解决方案1】:

我不认为这是个好主意,但我别无选择,只能像这样使用setInterval 来知道tilesLoaded 何时为真。
告诉我是否有更好的方法。谢谢。

setInterval(() => {
    if(viewer.scene.globe.tilesLoaded){
        // viewer's been fully loaded
        // do what you want
        // .... 



        clearInterval(interval) // clearing setInterval
    }
}, 100)

【讨论】:

    猜你喜欢
    • 2021-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-17
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    相关资源
    最近更新 更多