您好,我这重现不了这个问题。
可以把以下代码复制到我们examples目录试试。
<!DOCTYPE html>
<html lang="en">
<head>
<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>BIM模型</title>
<link href="../Build/Cesium/Widgets/widgets.css" rel="stylesheet">
<link href="./css/pretty.css" rel="stylesheet">
<script src="./js/jquery.min.js"></script>
<script src="./js/config.js"></script>
<script type="text/javascript" src="./js/require.min.js" data-main="js/main"></script>
<style>
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;background-color: #000000;
}
</style>
</head>
<body>
<div id="cesiumContainer"></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>
<script type="text/javascript">
function onload(Cesium) {
//初始化viewer部件
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
scene.camera.frustum.near = 0.01;
var widget = viewer.cesiumWidget;
$('#loadingbar').remove();
try{
//场景添加S3M图层服务
var promise = scene.open('http://www.supermapol.com/realspace/services/3D-BIM3/rest/realspace');
Cesium.when(promise,function(layers){
for(var i = 0,j = layers.length;i < j;i++){
layers[i].bReleaseColor = false;
layers[i]._id = -1;
}
//设置相机位置、方向,定位至模型
scene.camera.setView({
destination : new Cesium.Cartesian3.fromDegrees(115.50106,39.500207,23),
orientation : {
heading : 4.6680822715717945,
pitch : -0.3992332123139557,
roll : 0
}
});
},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>