首页 / 浏览问题 / 三维 / 问题详情
webgl临近数据采样示例代码有一处没看懂
奋斗的小...  (25分)  初出茅庐
11月17日, 2021
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也没有 把关于这个参数的代码去掉 也不运行到这

1个回答

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