From 52cdb6b30a51a075dbb98da8a081933559585b7b Mon Sep 17 00:00:00 2001 From: mahmoud adel <58145645+mahmoudadel54@users.noreply.github.com> Date: Mon, 23 Oct 2023 10:32:12 +0300 Subject: [PATCH] #9464: fix issue of not showing background layer in case of switching from 2D mode to 3D mode (#9614) * #9464: fix issue of not showing background layer in case of switching from 2D mode to 3D mode --- .../mapstore-migration-guide.md | 7 +++++++ web/client/components/map/cesium/Layer.jsx | 2 +- .../map/cesium/__tests__/Layer-test.jsx | 12 ++++++++---- .../map/cesium/__tests__/Map-test.jsx | 18 +++++++++--------- web/client/configs/localConfig.json | 3 ++- web/client/configs/new.json | 3 ++- 6 files changed, 29 insertions(+), 16 deletions(-) diff --git a/docs/developer-guide/mapstore-migration-guide.md b/docs/developer-guide/mapstore-migration-guide.md index d0a493a30c..85cf9b5455 100644 --- a/docs/developer-guide/mapstore-migration-guide.md +++ b/docs/developer-guide/mapstore-migration-guide.md @@ -22,6 +22,13 @@ This is a list of things to check if you want to update from a previous version ## Migration from 2023.02.xx to 2024.01.00 +### Fixing background config + +From this version in order to fix default 3d background config a change is needed here: + +- update `localConfig.json` by adding **visibility: false** to the Empty Background entry in `intialState.defaultState.catalog.default.staticServices.default_map_backgrounds.backgrounds` +- update `new.json` by adding **visibility: false** to the Empty Background entry. + ### Adding spatial filter to dashboard widgets In order to enable the possibility to add in and the spatial filter to the widgets ( see [#9098](https://github.com/geosolutions-it/MapStore2/issues/9098) ) you have to edit the `QueryPanel` config in the `plugins.dashboard` array of the `localConfig.json` file by adding: diff --git a/web/client/components/map/cesium/Layer.jsx b/web/client/components/map/cesium/Layer.jsx index 30942dfc4b..6896af105b 100644 --- a/web/client/components/map/cesium/Layer.jsx +++ b/web/client/components/map/cesium/Layer.jsx @@ -167,7 +167,7 @@ class CesiumLayer extends React.Component { return false; } } - return visibility !== false; + return visibility; }; setLayerOpacity = (opacity) => { diff --git a/web/client/components/map/cesium/__tests__/Layer-test.jsx b/web/client/components/map/cesium/__tests__/Layer-test.jsx index b5dcc42850..2e7ab23bb2 100644 --- a/web/client/components/map/cesium/__tests__/Layer-test.jsx +++ b/web/client/components/map/cesium/__tests__/Layer-test.jsx @@ -98,7 +98,9 @@ describe('Cesium layer', () => { }); it('creates a osm layer for cesium map', () => { - var options = {}; + var options = { + visibility: true + }; // create layers var layer = ReactDOM.render( { "source": "osm", "title": "Open Street Map", "name": "mapnik", - "group": "background" + "group": "background", + "visibility": true }; // create layer var layer = ReactDOM.render( @@ -455,7 +458,8 @@ describe('Cesium layer', () => { "title": "Bing Aerial", "name": "Aerial", "group": "background", - "apiKey": "required" + "apiKey": "required", + "visibility": true }; // create layers var layer = ReactDOM.render( @@ -472,7 +476,7 @@ describe('Cesium layer', () => { options={{}} position={0} map={map}/>, document.getElementById("container")); expect(layer).toExist(); - expect(map.imageryLayers.length).toBe(1); + expect(map.imageryLayers.length).toBe(0); // not visibile layers are removed from the leaflet maps layer = ReactDOM.render( { act(() => { ReactDOM.render( { ref = value; } } id="mymap" center={{ y: 43.9, x: 10.3 }} zoom={11}> - - - + + + , document.getElementById('container') ); @@ -455,9 +455,9 @@ describe('CesiumMap', () => { act(() => { ReactDOM.render( { ref = value; } } id="mymap" center={{ y: 43.9, x: 10.3 }} zoom={11}> - - - + + + , document.getElementById('container') ); @@ -468,9 +468,9 @@ describe('CesiumMap', () => { act(() => { ReactDOM.render( { ref = value; } } id="mymap" center={{ y: 43.9, x: 10.3 }} zoom={11}> - - - + + + , document.getElementById('container') ); diff --git a/web/client/configs/localConfig.json b/web/client/configs/localConfig.json index 9551f09a05..b01959f586 100644 --- a/web/client/configs/localConfig.json +++ b/web/client/configs/localConfig.json @@ -215,7 +215,8 @@ "group": "background", "title": "Empty Background", "fixed": true, - "type": "empty" + "type": "empty", + "visibility": false } ] } diff --git a/web/client/configs/new.json b/web/client/configs/new.json index ac765c5b6c..ac5f20fdba 100644 --- a/web/client/configs/new.json +++ b/web/client/configs/new.json @@ -123,7 +123,8 @@ "group": "background", "title": "Empty Background", "fixed": true, - "type": "empty" + "type": "empty", + "visibility": false } ] }