Cesium双屏联动、三屏联动、多屏联动

本文介绍了如何使用Cesium实现双屏及三屏联动的效果,通过分享的代码示例展示了如何同步不同视图的相机视角数据,确保多个屏幕显示一致的3D场景。此技术在多屏展示和对比中具有实用价值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Cesium多屏联动对比使用较多。

双屏联动对比

参考如下网址

https://juejin.cn/post/7100727011454222350

https://blog.youkuaiyun.com/wanyibin1998/article/details/124898102

三屏联动对比

由上面的双屏联动更改而来

function setManyView(viewer1, viewer2, viewer3) {
    const syncView = () => {
        // 获取第一个viewer的相机视角数据
        const {
            positionWC,
            heading,
            pitch,
            roll,
            up,
            _direction
        } = viewer1.scene.camera;

        // 设置另外两屏/多屏视角
        viewer2.camera.setView({
            destination: positionWC,
            orientation: {
                heading: heading,
                pitch: pitch,
                roll: roll,
                up: up,
                direction: _direction
            }
        });
        viewer3.camera.setView({
            destination: positionWC,
            orientation: {
                heading: heading,
                pitch: pitch,
                roll: roll,
                up: up,
                direction: _direction
            }
        });
    };

    //camera监听函数
    viewer1.camera.changed.addEventListener(syncView);
    //设置触发监听函数的时间
    viewer1.camera.percentageChanged = 0.01;
}
//循环监听每一屏变化
setManyView(viewer1, viewer2, viewer3)
setManyView(viewer2, viewer3, viewer3)
setManyView(viewer3, viewer2, viewer1)

多屏联动对比

基于上面的三屏联动对比继续增加viewer参数。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Q行天下

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值