<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>模型加载</title>
<link href="./css/widgets.css" rel="stylesheet">
<link href="./css/bootstrap.min.css" rel="stylesheet">
<link href="./css/pretty.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/require.min.js" data-main="js/main"></script>
<script src="./js/config.js"></script>
</head>
<body>
<div id="container" style="width: 100%; height: 100%;"></div>
<script>
function onload(Cesium) {
var viewer = new Cesium.Viewer('container');
<!-- iServer 服务地址 -->
var myurl = "http://localhost:8090/"
<!-- 天地图服务 -->
viewer.imageryLayers.addImageryProvider(new Cesium.TiandituImageryProvider({
token: URL_CONFIG.TOKEN_TIANDITU
}));
<!-- 天地图中文注记服务 -->
viewer.imageryLayers.addImageryProvider(new Cesium.TiandituImageryProvider({
mapStyle : Cesium.TiandituMapsStyle.CIA_C,
token: URL_CONFIG.TOKEN_TIANDITU
}));
var scene = viewer.scene;
var widget = viewer.cesiumWidget;
try {
<!-- 模型服务地址 -->
var promise = scene.open(myurl + "iserver/services/3D-xxx/rest/realspace");
Cesium.when(promise,function(layers){
scene.camera.setView({
destination:
<!-- 场景定位经度、纬度、高度 -->
new Cesium.Cartesian3.fromDegrees(x, y, z),
});
},
function(e){
if (widget._showRenderLoopErrors) {
var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
widget.showErrorPanel(title, undefined, e);
}
});
}
catch(e){
if (widget._showRenderLoopErrors) {
var title = '渲染时发生错误,已停止渲染。';
widget.showErrorPanel(title, undefined, e);
}
};
};
</script>
</body>
</html>
网友评论