gpt4 book ai didi

javascript - OL3 : How to clear the cache of a ImageWMS layer while waiting for updateParams to return an updated layer

转载 作者:行者123 更新时间:2023-12-05 07:51:15 25 4
gpt4 key购买 nike

在 OpenLayers 3 的 ImageWMS 上调用 source.updateParams() 时,当前层不会立即清除,它会等待新参数成功返回结果,然后删除当前图像并用新结果替换它。我正在寻找一种方法来立即清除当前缓存的图像,以便用户在等待新图像时看不到旧图像。我试过关闭可见性然后再打开,但这不起作用。各种方法都试过了

source.dispatchEvent('change')
source.changed()
source.setImageLoadFunction(source.getImageLoadFunction())

但是没有一个有效。我能够模拟我正在寻找的唯一方法是在用户更新参数后立即将图层的不透明度设置为 0,然后重新打开不透明度

theimageloadend

来自源的事件。

最佳答案

在 OL6 中:

layer.renderer_.image_ = null;

关于javascript - OL3 : How to clear the cache of a ImageWMS layer while waiting for updateParams to return an updated layer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35159490/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com