根据事件获取经纬度等坐标数据
let position = window.map3D.viewer.scene.pickPosition(e.position);
let pickedFeature = window.map3D.viewer.scene.pick(e.position);
var cartographic = Cesium.Cartographic.fromCartesian(position);
(e.postion,Cartesian3坐标 {x:,y:,z:})
var lon = Cesium.Math.toDegrees(cartographic.longitude);
var lat = Cesium.Math.toDegrees(cartographic.latitude);
var h_=cartographic.height;
飞行
viewer.scene.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(lon,lat,height),
orientation: {
heading:v_.heading,
pitch:v_.pitch,
roll: v_.roll
},
duration: 1
});
绘制线
console.log(linearr);
var zbarr = []
for(var i=0;i<linearr.length;i++) {
zbarr.push(linearr[i].lon,linearr[i].lat,linearr[i].alt)
}
var Cartesian3arr = Cesium.Cartesian3.fromDegreesArrayHeights(zbarr)
this.viewer.entities.add({
polyline: {
positions: Cartesian3arr,
width: 2,
material: Cesium.Color.YELLOW,
}
})