要注意两者定位不一样
相机定位会出现偏移
let alt=that.getHeightByLevel(14)
//相机定位
// viewer.camera.flyTo({
// destination : Cesium.Cartesian3.fromDegrees(lon,lat,alt),
// orientation : {
// heading : Cesium.Math.toRadians(0.0),
// pitch : Cesium.Math.toRadians(-15.0),//倾斜角度
// roll : 0.0
// },
// // duration:1.5//动画持续时间
// complete:()=>{//飞行结束之后执行的方法
// }
// });
//经纬度定位
if (that.entity){
viewer.entities.remove(that.entity);
that.entity=null;
}
that.entity = new Cesium.Entity({
id : 'flyTmp',
position : Cesium.Cartesian3.fromDegrees(lon, lat),
point : {
pixelSize : 15,
color : Cesium.Color.RED.withAlpha(0.9),
outlineColor : Cesium.Color.RED.withAlpha(0.9),
outlineWidth : 1,
disableDepthTestDistance: Number.POSITIVE_INFINITY,
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
}
});
viewer.entities.add(that.entity);
viewer.flyTo(that.entity, {
offset : {
heading : Cesium.Math.toRadians(0.0),
pitch : Cesium.Math.toRadians(-25),
range : alt
}
});