onload(Cesium) {
var toolbar = document.getElementById("toolbar");
var viewer = new Cesium.Viewer("cesiumContainer");
viewer.imageryLayers.addImageryProvider(
new Cesium.BingMapsImageryProvider({
url: "
https://dev.virtualearth.net",
mapStyle: Cesium.BingMapsStyle.AERIAL,
key: URL_CONFIG.BING_MAP_KEY
})
);
var scene = viewer.scene;
scene.globe.depthTestAgainstTerrain = false;
var camera = scene.camera;
//添加S3M图层服务
var promise = scene.open(URL_CONFIG.SCENE_NIAOCHAO);
Cesium.when(promise, layers => {
camera.setView({
destination: Cesium.Cartesian3.fromDegrees(116.3801, 39.9874, 12.0),
orientation: {
heading: 6.260995919619558,
pitch: 0,
roll: 0
}
});
var routes = new Cesium.RouteCollection(viewer.entities);
//添加fpf飞行文件,fpf由SuperMap iDesktop生成
var fpfUrl = "../utils/niaocao.fpf";
routes.fromFile(fpfUrl);
//初始化飞行管理
flyManager = new Cesium.FlyManager({
scene: scene,
routes: routes
});
//注册站点到达事件
flyManager.stopArrived.addEventListener(function(routeStop) {
routeStop.waitTime = 1; // 在每个站点处停留1s
});
flyManager.readyPromise.then(() => {
// 飞行路线就绪
var currentRoute = flyManager.currentRoute;
currentRoute.isLineVisible = true;
currentRoute.isStopVisible = true;
//生成飞行文件中的所有站点列表
var allStops = flyManager.getAllRouteStops();
console.log(allStops);
});
});
},