三维尾迹线绘制完成后,尾迹线没有运动,只有在地图滚动缩放的时候尾迹线才有短暂的运动,并且占用掉了电脑大量运行内存(不绘制尾迹线不会出现这个问题)。地图中其他内容添加了地形、三维管道、一些模型图标等。代码写法如下,请问各位有办法遇到过类似无操作情况下尾迹线无法运动的问题吗
const draw_primitive_line = (Cesium, viewer, data) => {
data.pipe_vertices.forEach((item, index) => {
let startNode = data.pipe_startNode[index];
let endNode = data.pipe_endNode[index];
const endNodeIndex = data.junction_id.findIndex(item => item == endNode);
const startNodeIndex = data.junction_id.findIndex(item => item == startNode);
viewerMap.entities.add({
polyline: {
positions: Cesium.Cartesian3.fromDegreesArrayHeights(handleData(item, startNodeIndex, endNodeIndex)),
width: 2,
// clampToGround: true,
material: new Cesium.PolylineTrailMaterialProperty({
// 尾迹线材质
color: Cesium.Color.RED, //尾迹线颜色
trailLength: 0.2, //尾迹线长度
period: 10.0 //终点到起点的运行周期
})
}
});
});
// initLineObj.value = viewer.scene.primitives.add(primitive_line_list);
function handleData(data1, startNodeIndex, endNodeIndex) {
let arr = [];
data1.forEach((item, idx) => {
let height = 0;
if (idx === 0) {
height = data.junction_elev[startNodeIndex] || 0;
} else {
height = data.junction_elev[endNodeIndex] || 0;
}
arr.push(item[1], item[0], height + 1);
});
return arr;
}
};