我用的是vue
然后这些代码都在mounted里面初始了,请问一下代码有什么问题,出不来飞行效果
//生成飞行站点
createFlyStop(pointLatlng,indexs){
let routeStop=new Cesium.RouteStop({
index:indexs,
duration:10,
waitTime:2,
point:pointLatlng,
heading:6.901089214916513,
tilt : -0.40668579780875524,
stopName :"gg"+indexs,
speed:20,
});//站点
return routeStop
},
//设置仓库飞行浏览
warehousePointFly(){
let routes=new Cesium.RouteCollection(this.viewer.entities)
routes.fromFile("./static/NewSceneRoutes.fpf");//这里是我自己新建的一个空的文件
this.viewer.scene.globe.depthTestAgainstTerrain = false;
let route=new Cesium.Route()
route.isAlongline = true;
route.flycircle = true;
this.routeFlyStopArr.map(el=>{//这里是通过上面createFlyStop生成的点位 routeFlyStopArr是站点的数组
route.addStop(el)
})
routes.addRoute(route)
this.flyManager = new Cesium.FlyManager({scene:this.viewer.scene,routes:routes});
this.flyManager.stopArrived.addEventListener((routeStop)=>{
routeStop.waitTime = 1;
})
Cesium.when(this.flyManager.readyPromise, function() {
var allStops = this.flyManager.getAllRouteStops();
});
},
//开始按钮
playFly(){
this.flyManager.play();
}