diff --git a/web/client/components/map/cesium/Map.jsx b/web/client/components/map/cesium/Map.jsx index 6fb7ad9ef2..2f7721403d 100644 --- a/web/client/components/map/cesium/Map.jsx +++ b/web/client/components/map/cesium/Map.jsx @@ -319,8 +319,7 @@ class CesiumMap extends React.Component { // we can use pick so the only first intersect feature will be returned // this is more intuitive for uses such as get feature info const feature = map.scene.drillPick(position).find((aFeature) => { - const {entityCollection: {owner: {queryable}}} = aFeature.id; - return queryable; + return !(aFeature?.id?.entityCollection?.owner?.queryable === false); }); if (feature instanceof Cesium.Cesium3DTileFeature && feature?.tileset?.msId) { const msId = feature.tileset.msId; diff --git a/web/client/components/map/cesium/__tests__/Layer-test.jsx b/web/client/components/map/cesium/__tests__/Layer-test.jsx index 556b780d91..af2e1fff6e 100644 --- a/web/client/components/map/cesium/__tests__/Layer-test.jsx +++ b/web/client/components/map/cesium/__tests__/Layer-test.jsx @@ -1378,6 +1378,37 @@ describe('Cesium layer', () => { expect(cmp.layer.dataSource.entities.values.length).toBe(1); expect(cmp.layer.detached).toBe(true); }); + it('should create a vector layer queryable', () => { + const options = { + type: 'vector', + features: [{ type: 'Feature', properties: {}, geometry: { type: 'Point', coordinates: [0, 0] } }], + title: 'Title', + visibility: true, + bbox: { + crs: 'EPSG:4326', + bounds: { + minx: -180, + miny: -90, + maxx: 180, + maxy: 90 + } + }, + queryable: false + }; + // create layers + const cmp = ReactDOM.render( + , document.getElementById('container')); + expect(cmp).toBeTruthy(); + expect(cmp.layer).toBeTruthy(); + expect(cmp.layer.dataSource).toBeTruthy(); + expect(cmp.layer.dataSource.entities.values.length).toBe(1); + expect(cmp.layer.detached).toBe(true); + expect(cmp.layer.dataSource.queryable).toBe(false); + }); it('should create a wfs layer', () => { const options = { type: 'wfs', diff --git a/web/client/components/map/cesium/plugins/VectorLayer.js b/web/client/components/map/cesium/plugins/VectorLayer.js index 1b128d75f4..a07b7ea662 100644 --- a/web/client/components/map/cesium/plugins/VectorLayer.js +++ b/web/client/components/map/cesium/plugins/VectorLayer.js @@ -54,6 +54,7 @@ const createLayer = (options, map) => { } dataSource.show = !!options.visibility; + dataSource.queryable = options.queryable === undefined || options.queryable; return { detached: true, diff --git a/web/client/utils/cesium/ClickUtils.js b/web/client/utils/cesium/ClickUtils.js index c544f51d61..920fc97919 100644 --- a/web/client/utils/cesium/ClickUtils.js +++ b/web/client/utils/cesium/ClickUtils.js @@ -25,8 +25,7 @@ export const getMouseXYZ = (viewer, event) => { } const feature = viewer.scene.drillPick(mousePosition).find((aFeature) => { - const {entityCollection: {owner: {queryable}}} = aFeature.id; - return queryable; + return !(aFeature?.id?.entityCollection?.owner?.queryable === false); }); if (feature) { let currentDepthTestAgainstTerrain = scene.globe.depthTestAgainstTerrain;