数据:南城矢量数据、影像地形数据
使用产品:idesktop 8C、iserver
问题:在idesktop中,已经设置了场景的可见高度和透明度等参数(第一张图),但是在前端调用发布的场景服务时,可见高度和透明度等参数都消失(第二张图)。请问这是什么原因造成的?
没有,都是一句代码搞定,比如设置s3m图层最大可见高度500米,把下面在线范例修改成如下代码即可:http://support.supermap.com.cn:8090/webgl/examples/editor.html#S3MTiles_vector
<!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>矢量</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"> var host = document.location.toString().match(/file:\/\//)?"http://localhost:8090":'http://' + document.location.host; function onload(Cesium) { //初始化viewer部件 var viewer = new Cesium.Viewer('cesiumContainer',{ imageryProvider : new Cesium.BingMapsImageryProvider({ key : "AjQhMyw76oicHqFz7cUc3qTEy3M2fC2YIbcHjqgyMPuQprNVBr3SsvVdOfmlVc0v",//可至官网(https://www.bingmapsportal.com/)申请key url : URL_CONFIG.BINGMAP }) }); var scene = viewer.scene; var widget = viewer.cesiumWidget; $('#loadingbar').remove(); try{ //打开所发布三维服务下的所有图层 var promise = scene.open('http://www.supermapol.com/realspace/services/3D-GuangZhou/rest/realspace'); Cesium.when.all(promise,function(layers){ var layer=scene.layers.findByIndex(0); var color = new Cesium.Color(1.0, 0.0, 0.0); layer.style3D.fillForeColor = color; layer.maxVisibleAltitude=500; //设置后需刷新图层 layer.refresh(); //设置图层的阴影模式 scene.camera.setView({ //将经度、纬度、高度的坐标转换为笛卡尔坐标 destination : new Cesium.Cartesian3(-2323607.7945701713,5386182.530303348,2505814.811681112), orientation : { heading : 4.844795866469065, pitch : -0.58125995096984, roll :1.2504663970958063e-11 } }); },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>
这样使用transperantBackColor代码是不是有点问题?
//添加SuperMap iServer发布的影像服务 var layer = viewer.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({ url : 'http://59.55.128.155:8090/iserver/services/3D-HMHSD/rest/realspace/datas/ncimage@terriandata'//江西影像 })); layer.transperantBackColor = '#000000';
var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF');