发布的三维服务,在写html时不能加载出来

0 投票

使用产品idesktop的版本时10i,iserver 10i 操作系统 win10 X64

问题详细描述,按照超图上的资源SuperMap iClient3D for WebGL倾斜摄影数据查询,写的代码出现,在浏览器中不能打开。浏览器报错.Uncaught SyntaxError: Invalid or unexpected token

VM17:1 Fetch API cannot load file:///D:/iServer/webapps/Build/Cesium/ThirdParty/Module.wasm. URL scheme must be "http" or "https" for CORS request.

n @ VM17:1

Uncaught (in promise) TypeError: Failed to fetch
    at n (eval at <anonymous> (Cesium.js:1), <anonymous>:1:2826104)
    at w (eval at <anonymous> (Cesium.js:1), <anonymous>:1:2826556)
    at Object.R.asm (eval at <anonymous> (Cesium.js:1), <anonymous>:1:2830927)
    at eval (eval at <anonymous> (Cesium.js:1), <anonymous>:1:2830987)
    at u (eval at <anonymous> (Cesium.js:1), <anonymous>:1:2379)
    at a (eval at <anonymous> (Cesium.js:1), <anonymous>:1:1179)
    at u (eval at <anonymous> (Cesium.js:1), <anonymous>:1:2277)
    at a (eval at <anonymous> (Cesium.js:1), <anonymous>:1:1179)
    at u (eval at <anonymous> (Cesium.js:1), <anonymous>:1:2277)
    at a (eval at <anonymous> (Cesium.js:1), <anonymous>:1:1179)

代码如下:

<!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">
    <link href="Build/Cesium/Widgets/widgets.css" rel="stylesheet">
	<link href="./css/pretty.css" rel="stylesheet">
	<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>
<blockquote id="bubble" class="bubble">
        <img id="myimg" src="./images/home_banner.jpg" width="50%" height="auto">
        <h2 id="title"></h2>
</blockquote>
<script type="text/javascript">
    function onload(Cesium) {
      
        //初始化viewer部件
        var viewer = new Cesium.Viewer('cesiumContainer');
        var url="http://localhost:8090/iserver/services/3D-MaSai/rest/realspace/datas/compressed/config";
        var scene = viewer.scene;
        var canvas = scene.canvas;
        var widget = viewer.cesiumWidget;
        try {
            //添加S3M图层服务
            var promise = scene.adds3MTilesLayerByScp(url,{
			name:'Test'});
            Cesium.when(promise, function (layer) {
                if(!scene.pickPositionSupported){
                    alert('不支持深度拾取,属性查询功能无法使用!');
                }
                //设置相机视角
               scene.camera.setView({
                    //将经度、纬度、高度的坐标转换为笛卡尔坐标
                    destination : new Cesium.Cartesian3(43.2963888888889980,5.3700000000000001,-30.0000000000000000),
                   /* orientation : {
                        heading : 4.7793869967010565,
                        pitch : -0.5899023527373464,
                        roll : 8.539835505416704e-12
                    }*/
                });
				layer.setQueryParameter({
				url:'http://localhost:8090/iserver/services/data-MaSai/rest/data',dataSourceName:'vector',dataSetName:'test',keyWord:'SmID'
				});


            }, function (e) {
                if (widget._showRenderLoopErrors) {
                    var title = '渲染时发生错误,已停止渲染。';
                    widget.showErrorPanel(title, undefined, e);
                }
            });
        }
        catch (e) {
            if (widget._showRenderLoopErrors) {
                var title = '渲染时发生错误,已停止渲染。';
                widget.showErrorPanel(title, undefined, e);
            }
        }
		//http://localhost:8090/iserver/services/data-MaSai/rest/data
        //添加自定义infobox
        var ti = document.getElementById("title");
        var des = document.getElementById("des");
        var myimg = document.getElementById("myimg");
		var infoboxContainer=document.getElementById("buble");
		viewer.customInfobox=infoboxContainer;
		//显示查询结果
		viewer.pickEvent.addEventListener(function(feature){
		var title=Cesium.defaultValue(feature.NAME,'');
		ti.innerText=title
		});
    }
</script>
</body>
</html>


 

4月 29, 2020 分类:  287次浏览 | 用户: Marry 初出茅庐 (66 分)

1个回答

0 投票
4月 29, 2020 用户: 三次鱼疯啦 名扬四海 (2,409 分)
...