首页 / 浏览问题 / 三维GIS / 问题详情
使用webgl选择BIM要素,前面的没有消失。
7EXP 2017年11月30日

我要做的功能是显示选择块的信息。但是点击选择后之前选择的块还在。这个能改吗?

2 个回答

您的代码是怎么写的呢?
5,560EXP 2017年11月30日
我是参照这个例子做的。 S3MTiles.html

function onload(Cesium) {
        var infoboxContainer = document.getElementById("bubble");
        //初始化viewer部件
        var viewer = new Cesium.Viewer('cesiumContainer');
        viewer.customInfobox = infoboxContainer;
        var scene = viewer.scene;
        var canvas = scene.canvas;
        var widget = viewer.cesiumWidget;
        $('#loadingbar').remove();
        try {
            //添加S3M图层服务
            var promise = scene.addS3MTilesLayerByScp('http://localhost:8090/iserver/services/3D-wlm/rest/realspace/datas/UDB2/config', {
                name: 'UDB2'
            });
            Cesium.when(promise, function (layer) {
                if(!scene.pickPositionSupported){
                    alert('不支持深度拾取,属性查询功能无法使用!');
                }
                //设置属性查询参数
                layer.setQueryParameter({
                    url: 'http://localhost:8090/iserver/services/data-wlm/rest/data',
                    dataSourceName: 'UDB2',
                    dataSetName: '常规模型',
                    keyWord: 'SmID'
                });
                //设置相机视角
               scene.camera.setView({
                    //将经度、纬度、高度的坐标转换为笛卡尔坐标
                    destination : Cesium.Cartesian3.fromDegrees(115.50106863595444,39.49799153880207,700),
                    orientation : {
                        heading : 5.154573786584606,
                        pitch : -0.94229615865957967,
                        roll :3.2294167340296553e-12
                    }
                });
            }, function (e) {
                if (widget._showRenderLoopErrors) {
                    var title = '渲染时发生错误,已停止渲染。';
                    widget.showErrorPanel(title, undefined, e);
                }
            });
        }
        catch (e) {
            if (widget._showRenderLoopErrors) {
                var title = '渲染时发生错误,已停止渲染。';
                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){
            //alert(feature.TYPENAME);
            //var title = Cesium.defaultValue(feature.NAME,'');
           // var description = Cesium.defaultValue(feature.DES,'');
          //  title.innerText = title;
            des.innerText = feature.TYPENAME;
          //  myimg.src = "./images/" + title + ".jpg";
        });
    }

数据是BIM数据转换过来的,类型是OSGB的。
你好,从截图上看,是对象取消选择之后,纹理颜色又变化,并非原来纹理的颜色,需要对图层设置属性。

解决方案如下:

var promise = scene.addS3MTilesLayerByScp('http://localhost:8090/iserver/services/3D-wlm/rest/realspace/datas/UDB2/config', {
                name: 'UDB2',

               bReleaseColor:false
            });
449EXP 2017年12月06日
...