webgl临近数据采样示例代码有一处没看懂

0 投票
getFeatureService = new SuperMap.REST.GetFeaturesByBufferService("http://www.supermapol.com/realspace/services/data-compare/rest/data", {
                eventListeners: {
                    "processCompleted": processCompleted,
                    "processFailed": null
                }
            });

这里面这个processCompleted这个方法我这没有运行

function processCompleted(getFeaturesEventArgs) {
            var dis = 999999;
            var data;
            getFeaturesEventArgs.result.features.forEach(function (item, i) {

                var cart3 = new Cesium.Cartesian3.fromDegrees(Number(item.data.SMX), Number(item.data.SMY), Number(item.data.Z));
                var _dis = Cesium.Cartesian3.distance(clickPt, cart3);
                if (dis > _dis) {
                    dis = _dis;
                    data = item.data;
                }
            });
            viewer.entities.removeAll();
            if (getFeaturesEventArgs.result.features.length > 0) {
                var pt = {
                    x: Number(data.SMX),
                    y: Number(data.SMY),
                    z: Number(data.Z)
                }

                viewer.entities.add({
                    position: Cesium.Cartesian3.fromDegrees(pt.x, pt.y, pt.z),
                    point: {
                        pixelSize: 10,
                        color: Cesium.Color.RED
                    }
                });
                var colorE = getColor(Number(data.GRIDRSCP));
                viewer.entities.add({
                    position: Cesium.Cartesian3.fromDegrees(pt.x, pt.y, pt.z),
                    box: {
                        dimensions: new Cesium.Cartesian3(5, 6, 3),
                        material: Cesium.Color.fromCssColorString(colorE).withAlpha(0.5),
                        outline: true,
                        outlineColor: Cesium.Color.BLACK
                    }
                });
                valueGRIDRSCP = data.GRIDRSCP;
                var entity = new Cesium.Entity({
                    name: "",
                    description: createDescription(Cesium, [valueGRIDRSCP])
                });
                viewer.selectedEntity = entity;
            }
        }

而且getFeaturesEventArgs也没有 把关于这个参数的代码去掉 也不运行到这

11月 17, 2021 分类:  33次浏览 | 用户: 奋斗的小人物 才疏学浅 (17 分)

1个回答

0 投票
你好,我这边测试了一下没有问题,这个是要查询成功了才会进入 processCompleted 方法,数据服务要与三维服务对应
11月 17, 2021 用户: 卷饼先生 登峰造极 (5,838 分)
...