tileLayer和webgltilelayer的层刷滑动实现

发布于 2025-02-06 04:58:29 字数 1140 浏览 1 评论 0 原文

OpenLayers当前有2个示例,介绍了如何实现一层滑动: 经典瓷砖层: https://popenlayers.org/en/latest/exampless/ layer-swipe.html webgltile层:

我需要使其适合N Tile和WebGltile层的混合。

将它们结合在一起时,当裁剪到比以前的农作物较小的区域时,似乎没有清除Webgltile层。此结果在上一部分图像的一部分中保持在下部的tileLayer之上:

gif

(请不要介意缺少的关键图像,只是为了显示行为,我确认了使用工作层的行为)。

繁殖:

从这个意义上讲,WebGltile层的行为与正常的瓷砖层的行为不同,即使单独删除也可以正确删除。

我尝试调用 gl.clear(gl.color_buffer_bit); 在“ prerender”回调中不是解决方案,因为它在其下方擦除了另一个WebGltile层,该层将在滑动的另一侧裁剪。

有人知道如何在不依赖层数,下层类型等的假设的情况下实施这种裁剪效果?

OpenLayers currently has 2 examples on how to implement a layer swipe:
Classic Tile layers: https://openlayers.org/en/latest/examples/layer-swipe.html
WebGLTile layers: https://openlayers.org/en/latest/examples/webgl-layer-swipe.html

I need to make it work for a mix of N Tile and WebGLTile layers.

When combining them, it seems like the WebGLTile layers are not cleared when cropped to a smaller area than the previous crop. This result in parts of the previous image to stay on top of a lower TileLayer:

GIF of the behavior

(Please don't mind the missing key image, it is just to show the behavior and I confirmed the same behavior with working layers).

Reproduction:

https://codesandbox.io/s/webgl-layer-swipe-broken-crrnvq?file=/main.js

In that sense, the WebGLTile layers are behaving differently than regular Tile layers that get erased properly even alone.

I tried calling gl.clear(gl.COLOR_BUFFER_BIT); in the 'prerender' callback is not a solution because it erases another WebGLTile layer below it that would be cropped on the other side of the swipe.

Does someone know how to implement this cropping effect without relying on assumptions of the number of layers, the type of lower layers and so on?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文