使用产品:iClient3D for Cesium
问题描述:使用pick及queryRenderedFeatures进行点击查询时,获取不到点击的线段
vtmLayer = viewer.scene.addVectorTilesMap({
url: 'http://localhost:8092/iserver/services/map-line/restjsr/v1/vectortile/maps/line',
name: 'line',
canvasWidth: 512,
viewer,
});
vtmLayer.readyPromise.then(function() {
viewer.camera.flyTo({
destination: vtmLayer.rectangle,
});
});
viewer.screenSpaceEventHandler.setInputAction((e) => {
let pickedObject = this.viewer.scene.pick(e.position);
let data = pickedObject?.primitive?._mvtProperties;
console.log(data); // data的值为undefined
let position = viewer.scene.pickPosition(e.position);
let cartographic = new Cesium.Cartographic.fromCartesian(position);
let result = window.vtmLayer.queryRenderedFeatures([cartographic]);
console.log(result); // result的值为[]
})