From 8eacc19ab315710eb5a3d7e6e9e261cab5e8e94e 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] - fix #9464: fix issue of not showing background layer in case of switching from 2D mode to 3D mode --- .../mapstore-migration-guide.md | 81 +++++++++ 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 | 165 ++++++++++++----- web/client/configs/new.json | 171 ++++++++++++------ 6 files changed, 339 insertions(+), 110 deletions(-) diff --git a/docs/developer-guide/mapstore-migration-guide.md b/docs/developer-guide/mapstore-migration-guide.md index 242c6e756c..d0a493a30c 100644 --- a/docs/developer-guide/mapstore-migration-guide.md +++ b/docs/developer-guide/mapstore-migration-guide.md @@ -20,6 +20,87 @@ This is a list of things to check if you want to update from a previous version - Optionally check also accessory files like `.eslinrc`, if you want to keep aligned with lint standards. - Follow the instructions below, in order, from your version to the one you want to update to. +## Migration from 2023.02.xx to 2024.01.00 + +### 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: + +- **useEmbeddedMap**: flag to enable the embedded map +- **spatialOperations**: The list of spatial operations allowed for this plugin +- **spatialMethodOptions**: the list of spatial methods to use. + +```json +... +"dashboard": [ +... +{ + "name": "QueryPanel", + "cfg": { + "toolsOptions": { + "hideCrossLayer": true, + "useEmbeddedMap": true + }, + "spatialPanelExpanded": false, + "spatialOperations": [ + {"id": "INTERSECTS", "name": "queryform.spatialfilter.operations.intersects"}, + {"id": "CONTAINS", "name": "queryform.spatialfilter.operations.contains"}, + {"id": "WITHIN", "name": "queryform.spatialfilter.operations.within"} + ], + "spatialMethodOptions": [ + {"id": "BBOX", "name": "queryform.spatialfilter.methods.box"}, + {"id": "Circle", "name": "queryform.spatialfilter.methods.circle"}, + {"id": "Polygon", "name": "queryform.spatialfilter.methods.poly"} + ], + "containerPosition": "columns" + } +} + +``` + +### MapFish Print update + +The **MapFish Print** library has been updated to work with the latest GeoTools version and Java 11 as well as being aligned with the same dependency used by the official GeoServer printing extension (see this issue ) +For this reason, if you are using the printing plugin in your project you have to update it by following the following steps: + +- Change the version of the mapfish-print dependency in the project `pom.xml` file: + +```diff + + + org.mapfish.print + print-lib +- geosolutions-2.3-SNAPSHOT ++ 2.3-SNAPSHOT + +``` + +- Add the mvn repository where this library is hosted in the `repositories` section of the same `pom.xml` (usually in `web` folder of a project) + +```diff + + osgeo-snapshot + Open Source Geospatial Foundation Repository + https://repo.osgeo.org/repository/snapshot/ + + true + + +``` + +### Annotations plugin refactor + +The Annotation plugin has been updated to be supported also in 3D maps. This update introduced some changes: + +- All the configurations related to the "Annotations" plugin has been removed from `localConfig.json` `defaultState` entry and moved to the `cfg` property of the plugin +- The annotations reducers is not needed anymore inside the default reducers of the app + +Please update by: + +- Removing `annotations` entry from your `localConfig.json` `defaultState` +- If you customized the app, you can remove the `annotations` reducer from default reducers. +- If some customizations were applied to the Annotations plugin in `defaultState`, apply these changes to the plugin configuration, following the documentation of the plugin. + ## Migration from 2023.01.02 to 2023.02.00 ### About plugin cfg changes 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 4c32239878..732ebf0ad5 100644 --- a/web/client/configs/localConfig.json +++ b/web/client/configs/localConfig.json @@ -104,48 +104,129 @@ }, "staticServices": { "default_map_backgrounds": { - "type": "backgrounds", - "title": "Default Backgrounds", - "titleMsgId": "defaultMapBackgroundsServiceTitle", - "autoload": true, - "backgrounds": [{ - "type": "osm", - "title": "Open Street Map", - "name": "mapnik", - "source": "osm", - "group": "background" - }, { - "type": "tileprovider", - "title": "NASAGIBS Night 2012", - "provider": "NASAGIBS.ViirsEarthAtNight2012", - "name": "Night2012", - "source": "nasagibs", - "group": "background" - }, { - "type": "tileprovider", - "title": "OpenTopoMap", - "provider": "OpenTopoMap", - "name": "OpenTopoMap", - "source": "OpenTopoMap", - "group": "background" - }, { - "format": "image/jpeg", - "group": "background", - "name": "s2cloudless:s2cloudless", - "opacity": 1, - "title": "Sentinel 2 Cloudless", - "type": "wms", - "url": "https://1maps.geo-solutions.it/geoserver/wms", - "source": "s2cloudless", - "singleTile": false - }, { - "source": "ol", - "group": "background", - "title": "Empty Background", - "fixed": true, - "type": "empty" - }] - } + "type": "backgrounds", + "title": "Default Backgrounds", + "titleMsgId": "defaultMapBackgroundsServiceTitle", + "autoload": true, + "backgrounds": [{ + "format": "image/jpeg", + "group": "background", + "name": "osm:osm_simple_light", + "opacity": 1, + "title": "OSM Simple Light", + "thumbURL": "product/assets/img/osm-simple-light.jpg", + "type": "wms", + "url": [ + "https://maps1.geosolutionsgroup.com/geoserver/wms", + "https://maps2.geosolutionsgroup.com/geoserver/wms", + "https://maps3.geosolutionsgroup.com/geoserver/wms", + "https://maps4.geosolutionsgroup.com/geoserver/wms", + "https://maps5.geosolutionsgroup.com/geoserver/wms", + "https://maps6.geosolutionsgroup.com/geoserver/wms" + ], + "visibility": false, + "singleTile": false, + "credits": { + "title": "OSM Simple Light | Rendering GeoSolutions | Data © OpenStreetMap contributors, ODbL" + } + }, { + "format": "image/jpeg", + "group": "background", + "name": "osm:osm_simple_dark", + "opacity": 1, + "title": "OSM Simple Dark", + "thumbURL": "product/assets/img/osm-simple-dark.jpg", + "type": "wms", + "url": [ + "https://maps6.geosolutionsgroup.com/geoserver/wms", + "https://maps3.geosolutionsgroup.com/geoserver/wms", + "https://maps1.geosolutionsgroup.com/geoserver/wms", + "https://maps4.geosolutionsgroup.com/geoserver/wms", + "https://maps2.geosolutionsgroup.com/geoserver/wms", + "https://maps5.geosolutionsgroup.com/geoserver/wms" + ], + "visibility": false, + "singleTile": false, + "credits": { + "title": "OSM Simple Dark | Rendering GeoSolutions | Data © OpenStreetMap contributors, ODbL" + } + }, { + "format": "image/jpeg", + "group": "background", + "name": "osm:osm", + "opacity": 1, + "title": "OSM Bright", + "thumbURL": "product/assets/img/osm-bright.jpg", + "type": "wms", + "url": [ + "https://maps1.geosolutionsgroup.com/geoserver/wms", + "https://maps2.geosolutionsgroup.com/geoserver/wms", + "https://maps3.geosolutionsgroup.com/geoserver/wms", + "https://maps4.geosolutionsgroup.com/geoserver/wms", + "https://maps5.geosolutionsgroup.com/geoserver/wms", + "https://maps6.geosolutionsgroup.com/geoserver/wms" + ], + "visibility": true, + "singleTile": false, + "credits": { + "title": "OSM Bright | Rendering GeoSolutions | Data © OpenStreetMap contributors, ODbL" + } + }, { + "format": "image/jpeg", + "group": "background", + "name": "ne:ne-political", + "opacity": 1, + "title": "NE Political", + "thumbURL": "product/assets/img/ne-political.jpg", + "type": "wms", + "url": [ + "https://maps1.geosolutionsgroup.com/geoserver/wms", + "https://maps2.geosolutionsgroup.com/geoserver/wms", + "https://maps3.geosolutionsgroup.com/geoserver/wms", + "https://maps4.geosolutionsgroup.com/geoserver/wms", + "https://maps5.geosolutionsgroup.com/geoserver/wms", + "https://maps6.geosolutionsgroup.com/geoserver/wms" + ], + "visibility": false, + "singleTile": false, + "credits": { + "title": "

\n" + } + }, { + "format": "image/jpeg", + "group": "background", + "name": "s2cloudless:s2cloudless", + "opacity": 1, + "title": "Sentinel 2 Cloudless", + "type": "wms", + "url": [ + "https://maps1.geosolutionsgroup.com/geoserver/wms", + "https://maps2.geosolutionsgroup.com/geoserver/wms", + "https://maps3.geosolutionsgroup.com/geoserver/wms", + "https://maps4.geosolutionsgroup.com/geoserver/wms", + "https://maps5.geosolutionsgroup.com/geoserver/wms", + "https://maps6.geosolutionsgroup.com/geoserver/wms" + ], + "source": "s2cloudless", + "singleTile": false, + "visibility": false + }, { + "type": "osm", + "title": "Open Street Map", + "name": "mapnik", + "source": "osm", + "group": "background", + "visibility": false + }, { + "source": "ol", + "group": "background", + "title": "Empty Background", + "fixed": true, + "type": "empty", + "visibility": false + } + ] + } } } }, diff --git a/web/client/configs/new.json b/web/client/configs/new.json index 5752187fec..2cfb7049ef 100644 --- a/web/client/configs/new.json +++ b/web/client/configs/new.json @@ -9,60 +9,123 @@ -20037508.34, -20037508.34, 20037508.34, 20037508.34 ], - "layers": [ - { - "type": "osm", - "title": "Open Street Map", - "name": "mapnik", - "source": "osm", - "group": "background", - "visibility": true - }, - { - "type": "tileprovider", - "title": "NASAGIBS Night 2012", - "provider": "NASAGIBS.ViirsEarthAtNight2012", - "name": "Night2012", - "source": "nasagibs", - "group": "background", - "visibility": false - }, - { - "type": "tileprovider", - "title": "OpenTopoMap", - "provider": "OpenTopoMap", - "name": "OpenTopoMap", - "source": "OpenTopoMap", - "group": "background", - "visibility": false - }, - { - "format": "image/jpeg", - "group": "background", - "name": "s2cloudless:s2cloudless", - "opacity": 1, - "title": "Sentinel 2 Cloudless", - "type": "wms", - "url": [ - "https://1maps.geo-solutions.it/geoserver/wms", "https://2maps.geo-solutions.it/geoserver/wms", "https://3maps.geo-solutions.it/geoserver/wms", "https://4maps.geo-solutions.it/geoserver/wms", "https://5maps.geo-solutions.it/geoserver/wms", "https://6maps.geo-solutions.it/geoserver/wms" - ], - "source": "s2cloudless", - "visibility": false, - "singleTile": false - }, - { - "source": "ol", - "group": "background", - "title": "Empty Background", - "fixed": true, - "type": "empty", - "visibility": false, - "args": [ - "Empty Background", { - "visibility": false - } + "layers": [{ + "format": "image/jpeg", + "group": "background", + "name": "osm:osm_simple_light", + "opacity": 1, + "title": "OSM Simple Light", + "thumbURL": "product/assets/img/osm-simple-light.jpg", + "type": "wms", + "url": [ + "https://maps1.geosolutionsgroup.com/geoserver/wms", + "https://maps2.geosolutionsgroup.com/geoserver/wms", + "https://maps3.geosolutionsgroup.com/geoserver/wms", + "https://maps4.geosolutionsgroup.com/geoserver/wms", + "https://maps5.geosolutionsgroup.com/geoserver/wms", + "https://maps6.geosolutionsgroup.com/geoserver/wms" + ], + "visibility": false, + "singleTile": false, + "credits": { + "title": "OSM Simple Light | Rendering GeoSolutions | Data © OpenStreetMap contributors, ODbL" + } + }, { + "format": "image/jpeg", + "group": "background", + "name": "osm:osm_simple_dark", + "opacity": 1, + "title": "OSM Simple Dark", + "thumbURL": "product/assets/img/osm-simple-dark.jpg", + "type": "wms", + "url": [ + "https://maps6.geosolutionsgroup.com/geoserver/wms", + "https://maps3.geosolutionsgroup.com/geoserver/wms", + "https://maps1.geosolutionsgroup.com/geoserver/wms", + "https://maps4.geosolutionsgroup.com/geoserver/wms", + "https://maps2.geosolutionsgroup.com/geoserver/wms", + "https://maps5.geosolutionsgroup.com/geoserver/wms" + ], + "visibility": false, + "singleTile": false, + "credits": { + "title": "OSM Simple Dark | Rendering GeoSolutions | Data © OpenStreetMap contributors, ODbL" + } + }, { + "format": "image/jpeg", + "group": "background", + "name": "osm:osm", + "opacity": 1, + "title": "OSM Bright", + "thumbURL": "product/assets/img/osm-bright.jpg", + "type": "wms", + "url": [ + "https://maps1.geosolutionsgroup.com/geoserver/wms", + "https://maps2.geosolutionsgroup.com/geoserver/wms", + "https://maps3.geosolutionsgroup.com/geoserver/wms", + "https://maps4.geosolutionsgroup.com/geoserver/wms", + "https://maps5.geosolutionsgroup.com/geoserver/wms", + "https://maps6.geosolutionsgroup.com/geoserver/wms" + ], + "visibility": true, + "singleTile": false, + "credits": { + "title": "OSM Bright | Rendering GeoSolutions | Data © OpenStreetMap contributors, ODbL" + } + }, { + "format": "image/jpeg", + "group": "background", + "name": "ne:ne-political", + "opacity": 1, + "title": "NE Political", + "thumbURL": "product/assets/img/ne-political.jpg", + "type": "wms", + "url": [ + "https://maps1.geosolutionsgroup.com/geoserver/wms", + "https://maps2.geosolutionsgroup.com/geoserver/wms", + "https://maps3.geosolutionsgroup.com/geoserver/wms", + "https://maps4.geosolutionsgroup.com/geoserver/wms", + "https://maps5.geosolutionsgroup.com/geoserver/wms", + "https://maps6.geosolutionsgroup.com/geoserver/wms" + ], + "visibility": false, + "singleTile": false, + "credits": { + "title": "

\n" + } + }, { + "format": "image/jpeg", + "group": "background", + "name": "s2cloudless:s2cloudless", + "opacity": 1, + "title": "Sentinel 2 Cloudless", + "type": "wms", + "url": [ + "https://maps1.geosolutionsgroup.com/geoserver/wms", + "https://maps2.geosolutionsgroup.com/geoserver/wms", + "https://maps3.geosolutionsgroup.com/geoserver/wms", + "https://maps4.geosolutionsgroup.com/geoserver/wms", + "https://maps5.geosolutionsgroup.com/geoserver/wms", + "https://maps6.geosolutionsgroup.com/geoserver/wms" + ], + "source": "s2cloudless", + "singleTile": false, + "visibility": false + }, { + "type": "osm", + "title": "Open Street Map", + "name": "mapnik", + "source": "osm", + "group": "background", + "visibility": false + }, { + "source": "ol", + "group": "background", + "title": "Empty Background", + "fixed": true, + "type": "empty", + "visibility": false + } ] } - ] - } }