三维飞行 点击开始按钮没反应 不能实现功能 希望大佬能帮我看看 谢谢了!!
<html>
<head>
<meta http-equiv="content-type" content="text/html"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Wbestart</title>
<link rel="stylesheet" type="text/css" href="./css/pretty.css"/>
<link href="./css/widgets.css" rel="stylesheet">
<link href="./css/bootstrap.min.css" rel="stylesheet">
<script src="./js/jquery.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/bootstrap-select.min.js"></script>
<script src="./js/config.js"></script>
<script type="text/javascript" src="./js/require.min.js" data-main="js/main"></script>
<style>
#play {
content: url("./图片/开始.png");
height: 30px;
padding: 5px;
}
#pause {
content: url("./图片/暂停.png");
height: 30px;
padding: 5px;
}
#stop {
content: url("./图片/停止.png");
height: 30px;
padding: 5px;
}
.bootstrap-select {
width: 150px;
}
</style>
<script type="text/javascript">
function onload(Cesium) {
var toolbar =document.getElementById('toolbar');
var viewer = new Cesium.Viewer('cesiumContainer');
var scene=viewer.scene;
var url1="http://localhost:8090/iserver/services/3D-CBD-2/rest/realspace/datas/Building@CBD/config";
var url2="http://localhost:8090/iserver/services/3D-CBD-2/rest/realspace/datas/Ground@CBD/config";
var url3="http://localhost:8090/iserver/services/3D-CBD-2/rest/realspace/datas/Waters@CBD/config";
var infoboxContainer=document.getElementById("bubble");
viewer.customInfobox=infoboxContainer;
var widget =viewer.cesiumWidget;
try{
var promise =scene.addS3MTilesLayerByScp(url1 ,{name :'Building'});
var promise1=scene.addS3MTilesLayerByScp(url2, {name :'Ground'});
var promise2=scene.addS3MTilesLayerByScp(url3, {name :'Waters'});
Cesium.when(promise,function(layer){scene.camera.setView({destination : Cesium.Cartesian3.fromDegrees(116.4581104772965,39.91229850123048,2500)});
},function(e){
if (widget._showRenderLoopErrors){
var title ='An error';
widget.showErrorPanel(title,undefined,e);
}
});
}
catch(e){
if(widget._showRenderLoopErrors){
var title='An error';
widget.showErrorPanel(title,undefined,e);
}
}
}
</script>
<script type="text/javascript">
var flyManager;
function onload(Cesium) {
var routes = new Cesium.RouteCollection(viewer.entities);
//添加fpf飞行文件,fpf由SuperMap iDesktop生成
var fpfUrl='D:\supermapiserver\webapps\WebStart\飞行.fpf';
routes.fromFile(fpfUrl);
var scene = viewer.scene;
scene.globe.depthTestAgainstTerrain = false;
//初始化飞行管理
var flyManager = new Cesium.FlyManager({
scene: scene,
routes: routes
});
//注册站点到达事件
flyManager.stopArrived.addEventListener(function (routeStop) {
routeStop.waitTime = 1.5; // 在每个站点处停留1.5s
});
flyManager.readyPromise.then(function () { // 飞行路线就绪
var currentRoute = flyManager.currentRoute;
currentRoute.isLineVisible = true;
currentRoute.isStopVisible = true;
//生成飞行文件中的所有站点列表
var allStops = flyManager.getAllRouteStops();
var menu = document.getElementById('stopList');
for (var i = 0, j = allStops.length; i < j; i++) {
var option = document.createElement('option');
option.innerHTML = "站点 " + (i + 1);
option.value = allStops[i].index;
menu.appendChild(option);
}
$('#stopList').change(function () { //注册站点切换事件
flyManager && flyManager.stop();
var index = parseInt($(this).val()); // 站点的索引
var route = flyManager.currentRoute;
var stop = route.get(index);
flyManager.currentStopIndex = index;
flyManager.viewToStop(stop);
});
$('#play').click(function () {
flyManager && flyManager.play();
});
$('#pause').click(function () {
flyManager && flyManager.pause();
});
$('#stop').click(function () {
flyManager && flyManager.stop();
});
$('#show-line').change(function(){
currentRoute.isLineVisible = $(this).prop('checked');
});
$('#show-stop').change(function(){
currentRoute.isStopVisible = $(this).prop('checked');
});
$('#toolbar').show();
$('#loadingbar').remove();
});
});
}
</script>
</head>
<body>
<div id="cesiumContainer" style="width=100%;height=100%" ></div>
<div id="loadingbar" class="spinner">
<div class="spinner-container container1">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
<div class="spinner-container container2">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
<div class="spinner-container container3">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
</div>
<div id="toolbar" class="param-container tool-bar">
<span type="button" id="play" class="button black" title="开始"></span>
<span type="button" id="pause" class="button black" title="暂停"></span>
<span type="button" id="stop" class="button black" title="停止"></span>
<div style="width: 150px;">
<select id="stopList" class="form-control" style="width: 100%;">
</select>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="show-line" checked> 显示飞行路线
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="show-stop" checked> 显示飞行站点
</label>
</div>
</div>
</body>
</html>