我的页面上有两个实体;卫星及其“地面位置”,随着时间的推移,它们都会在铯中移动。我想用一条随它们一起移动的直线将两者连接起来。
该CZML魅力似乎如果您使用的是CZML文件演示了类似的功能,但我想知道如何在代码中做到这一点。他们的演示在卫星和地面位置之间包含多条线,并且实际上,他们向前走了一步,仅在不与地球相交的情况下(如果两个实体之间存在视线)显示该线。我不需要那么花哨的东西。
有没有很好的例子,或者有人可以指出我的文档?谢谢!
弄清楚了:@emackey通过将我指向simple.czml的这一部分来使我走上了正确的轨道。我从CZML转换为javascript时遇到的困难是本部分动态指定了行的开始和结束位置:
"positions":{
"references":[
"Facility/AGI#position","Satellite/ISS#position"
]
}
Run Code Online (Sandbox Code Playgroud)
原来我需要的类是PositionPropertyArray和ReferenceProperty。通过这两个,我可以向其中一个实体添加动态行,如下所示:
var groundTrackEntity = cesiumViewer.entities.add({
id: "groundTrackEntity",
position: groundTrackPosition,
point: /* ... */,
path: /* ... */,
polyline: {
followSurface: false,
positions: new Cesium.PositionPropertyArray([
new Cesium.ReferenceProperty(
cesiumViewer.entities,
'orbitEntity',
[ 'position' ]
),
new Cesium.ReferenceProperty(
cesiumViewer.entities,
'groundTrackEntity',
[ 'position' ]
)
]),
material: new Cesium.ColorMaterialProperty(
Cesium.Color.YELLOW.withAlpha( 0.25 )
)
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2161 次 |
| 最近记录: |