cesium 1.73 bug ?

似乎发现了一个 cesium 1.73 的bug,

官方样例中的《Plane.html》 对比其他例子,如《Polygon》,《Polyline Volume》等,有个特殊之处,就是当选中一个平面后,
右上角回弹出信息展示框,点击摄像头图标,相机视角会锁定到选中平面,这时按住鼠标左键,拖动鼠标,视角会以选中平面为中心进行旋转,这种相机交互比较舒服;其他例子中就不是这样的,选中物体后,按住鼠标左键进行拖到,视角仍然以地球中心来旋转。

《Polyline Volume》中的var redTube = viewer.entities.add({ … 放到《Plane.html》中,可以看到点击小摄像机图标后的行为是跟选中对象的类型绑定的,分别选中平面 和 3d管道,出现了小摄像机图标,点击它,会发现不同的逻辑。

另一个尝试,可能是cesium自带的bug,把《Plane.html》中的任意一个平面,添加到《Polyline Volume》中,

var redPlane = viewer.entities.add({
          name: "Red plane with black outline",
          position: Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
          plane: {
            plane: new Cesium.Plane(Cesium.Cartesian3.UNIT_Y, 0.0),
            dimensions: new Cesium.Cartesian2(400000.0, 300000.0),
            material: Cesium.Color.RED.withAlpha(0.5),
            outline: true,
            outlineColor: Cesium.Color.BLACK,
          },
        });

把上面代码插入到 Polyling Volume.html 的39行,

var viewer = new Cesium.Viewer("cesiumContainer");

下面,然后在webstorm打开Polyling Volume.html , 运行后报错:

An error occurred while rendering.  Rendering has stopped.
DataCloneError: Failed to execute 'postMessage' on 'Worker': ArrayBuffer at index 0 is already detached.
Error: Failed to execute 'postMessage' on 'Worker': ArrayBuffer at index 0 is already detached.
    at http://localhost:63342/cesium/Source/Core/TaskProcessor.js:264:23
    at Promise.then (http://localhost:63342/cesium/Source/ThirdParty/when.js:194:34)
    at http://localhost:63342/cesium/Source/ThirdParty/when.js:295:13
    at processQueue (http://localhost:63342/cesium/Source/ThirdParty/when.js:645:4)
    at _resolve (http://localhost:63342/cesium/Source/ThirdParty/when.js:331:4)
    at Object.promiseResolve [as resolve] (http://localhost:63342/cesium/Source/ThirdParty/when.js:357:11)
    at Worker.worker.onmessage (http://localhost:63342/cesium/Source/Core/TaskProcessor.js:47:16)

有两种解决方法,一个是把插入代码,插入到

var greenBox = viewer.entities.add({...});

的后面;

另一种是注释掉插入代码中的

outline: true,
outlineColor: Cesium.Color.BLACK,

{“pos_size”:[[32.414,-6.458,23.988,44.522],[-8.458,-22.912,23.988,48.708],[-24.912,-48.388,23.988,35.8],[12.606,-37.394,6.988,21.988],[-24.912,-48.31,37.8,63.546]]}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值