
{ "id": "2129c05288d445708a601d5953be57ac", "name": "测试 001", "type": "004", "properties": { "status": "use" }, "position": { "interpolationAlgorithm": "LAGRANGE", "interpolationDegree": 1, "epoch": "2022-09-10T00:00:00Z", "cartographicDegrees": [ 0, 11, 22, 100, 5000, 33, 55, 200 ] }, "model": { "show": true, "gltf": "http://localhost:1024/earth/model/missile.glb", "scale": 10, "minimumPixelSize": 16 }, "label": { "fillColor": { "rgba": [ 233, 150, 122, 255 ] }, "outlineWidth": 2, "verticalOrigin": "CENTER", "outlineColor": { "rgba": [ 0, 0, 0, 255 ] }, "show": true, "horizontalOrigin": "LEFT", "scale": 0.5, "style": "FILL_AND_OUTLINE", "text": "测试", "pixelOffset": { "cartesian2": [ 5, -60 ] }, "font": "21pt Lucida Console" } } 这里创建了一个运动实体测试 001
positions: new Cesium.CallbackProperty(function() { try { const userEntityExists = ds.entities.getById(userEntity.id); const closestSatelliteExists = closestDataSource.entities.getById(closestSatellite.id); if (userEntityExists && userEntityExists.position && closestSatelliteExists && closestSatelliteExists.position) { return [userEntityExists.position.getValue(viewer.clock.currentTime), closestSatelliteExists.position.getValue(viewer.clock.currentTime)]; } else { viewer.entities.removeById(lineID); return null; } } catch (error) { console.error(`An error occurred while creating the polyline for ${lineID}: `, error); viewer.entities.removeById(lineID); return null; } }, false), 这里使用了 Cesium.CallbackProperty 来获取 postion 创建实体测试 001 和卫星的连线,现在当测试 001 消失的时候会报错 Uncaught TypeError: Cannot read property ‘x‘ of undefined 这个要怎么处理呢