(1)BIM数据导到超图平台就已经带一些属性数据,如果需要另外补充,可以在生成OSGB缓存前先添加字段,补充信息之后再生成OSGB缓存。
(2)简单的查询就是通过鼠标点选模型,然后弹出所选模型的信息,这个可以参考范例:
http://support.supermap.com.cn:8090/iserver/iClient/for3D/webgl/examples/S3MTiles.html
(3)复杂一点的查询是SQL查询,输入一个条件比如查某个字段“Name”,条件为Name = '超图大厦',这种缓存数据做不了,需要将原始数据用iserver发布数据服务,通过数据服务返回查询结果,再通过气泡将结果展示再球上,并且高亮查询出来的模型。请参考:
http://support.supermap.com.cn:8090/iserver/iClient/forJavaScript/examples/examples.html#queryByBounds
中的数据集查询。
<body> <div id="cesiumContainer"></div> <blockquote id="bubble" class="example-right"> <img id="myimg" src="./images/home_banner.jpg" width="50%" height="auto"> <h2 id="title"></h2> <p id="des" class="word"></p> <audio controls="controls"> <source src="./media/song.mp3" type="audio/mpeg" /> Your browser does not support the audio tag. </audio> </blockquote> <script type="text/javascript"> var host = document.location.toString().match(/file:\/\//)?"http://localhost:8090":'http://' + document.location.host; var viewer; function onload(Cesium) { var infoboxContainer = document.getElementById("bubble"); viewer = new Cesium.Viewer('cesiumContainer'); viewer.customInfobox = infoboxContainer; var scene = viewer.scene; var canvas = scene.canvas; var canvasWidth = canvas.width; var canvasHeight = canvas.height; var widget = viewer.cesiumWidget; try { var promise = scene.addS3MTilesLayerByScp('http://localhost:8090/iserver/services/3D-shijiao01/rest/realspace/datas/墙@CreateDatasource01/config', { name: '墙@CreateDatasource01' }); Cesium.when(promise, function (layer) { //设置属性查询参数 layer.setQueryParameter({ queryClazz: SuperMap, url: 'http://localhost:8090/iserver/services/3D-shijiao01/rest/realspace/datas', dataSourceName: 'CreateDatasource01', dataSetName: '墙@CreateDatasource01', keyWord: 'SmUserID' }); scene.camera.setView({ destination: Cesium.Cartesian3.fromDegrees(115.497, 39.498, 600) }); }, function (e) { if (widget._showRenderLoopErrors) { var title = 'An error occurred while rendering. Rendering has stopped.'; widget.showErrorPanel(title, undefined, e); } }); } catch (e) { if (widget._showRenderLoopErrors) { var title = 'An error occurred while rendering. Rendering has stopped.'; widget.showErrorPanel(title, undefined, e); } } //添加自定义infobox var title = document.getElementById("title"); var des = document.getElementById("des"); var myimg = document.getElementById("myimg"); viewer.pickEvent.addEventListener(function (feature) { var title = Cesium.defaultValue(feature.NAME, ''); var description = Cesium.defaultValue(feature.DES, ''); title.innerText = title; des.innerText = description; myimg.src = "./images/" + title + ".jpg"; }); } </script> </body>
<blockquote id="bubble" class="example-right"> <img id="myimg" src="./images/home_banner.jpg" width="50%" height="auto"> <h2 id="title"></h2> <p id="des" class="word"></p> </blockquote> var title = document.getElementById("title"); var des = document.getElementById("des"); var myimg = document.getElementById("myimg"); viewer.pickEvent.addEventListener(function(feature){ var title = Cesium.defaultValue(feature.NAME,''); var description = Cesium.defaultValue(feature.DES,''); title.innerText = title; des.innerText = description; myimg.src = "./images/" + title + ".jpg"; });
您好,实质是用的JavaScript客户端的数据查询服务:
只是WebGL客户端把过程封装起来了。