Cesium CallbackProperty实例

Cesium在三维上的实力我们都见识过了。。但是在时间上的效果要归功于CallbackProperty

因为使用CallbackProperty,cesium中一切可视化的要素都可以与时间联系起来。

一、定义CallbackProperty函数


new Cesium.CallbackProperty(getEndPoint, isConstant)
function getEndPoint (time, result) {
endLongitude = startLongitude - 0.001 * Cesium.JulianDate.secondsDifference(time, startTime);
return Cesium.Cartesian3.fromDegreesArray(
[startLongitude, startLatitude, endLongitude, startLatitude],
Cesium.Ellipsoid.WGS84,
result
);
}

二、CallbackProperty应用实例

下面的代码实例就是利用CallbackProperty函数获不断更新线段的终点,并在线段中点位置显示线段的长度。

参考1:https://blog.csdn.net/luoyun620/article/details/107182493/

CallbackProperty或许类似于vue里的watch,CallbackProperty监听:当变量变化时触发该监听,通过监听鼠标拾取坐标的变化实现动态绘制。

参考2:https://blog.csdn.net/weixin_30849591/article/details/95639788

使用Cesium.CallbackProperty可以实时更改Geometry.position等参数,从而达到绘制的效果。

https://blog.csdn.net/bretgui88/article/details/79076354

原文地址:https://www.cnblogs.com/2008nmj/p/15624478.html