<!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');
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){
''' 修改模型高度 '''
for(var i=0; i < layers.length; i++){
var style3D = new Cesium.Style3D();
''' 可调节此数值,然后依次查看是否合适'''
style3D.bottomAltitude = -100;
layers[i].style3D = style3D;
layers[i].refresh();
};
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>
网友评论