diff --git a/assets/src/legacy/map.js b/assets/src/legacy/map.js index edce851a16..f0587655b4 100644 --- a/assets/src/legacy/map.js +++ b/assets/src/legacy/map.js @@ -1819,10 +1819,8 @@ window.lizMap = function() { // get the baselayer select content // and adding baselayers to the map - var select = []; baselayers.reverse(); - for (var i=0,len=baselayers.length; i'+blConfig.title+''; - else - select += ''; - + map.baseLayer.setVisibility(false); } catch(e) { var qgisName = baselayer.name; if ( baselayer.name in cleanNameMap ) @@ -1847,37 +1837,7 @@ window.lizMap = function() { } } - if (baselayers.length!=0) { - // active the select element for baselayers - $('#switcher-baselayer-select').append(select); - $('#switcher-baselayer-select') - .change(function() { - var val = $(this).val(); - var blName = map.getLayersByName(val)[0]; - map.setBaseLayer( blName ); - - // Trigger event - lizMap.events.triggerEvent("lizmapbaselayerchanged", - { 'layer': blName} - ); - - $(this).blur(); - }); - // Hide switcher-baselayer if only one base layer inside - if (baselayers.length==1){ - $('#switcher-baselayer').hide(); - } - else if ( 'startupBaselayer' in config.options ) { - var startupBaselayer = config.options['startupBaselayer']; - if ( startupBaselayer in startupBaselayersReplacement ) - startupBaselayer = startupBaselayersReplacement[startupBaselayer]; - else if ( startupBaselayer in config.layers ) - startupBaselayer = cleanName(startupBaselayer); - - if ( $('#switcher-baselayer-select option[value="'+startupBaselayer+'"]').length != 0) - $('#switcher-baselayer-select').val(startupBaselayer).change(); - } - } else { + if (baselayers.length === 0) { // hide elements for baselayers map.addLayer(new OpenLayers.Layer.Vector('baselayer',{ maxExtent:map.maxExtent diff --git a/tests/end2end/playwright/base-layers.spec.js b/tests/end2end/playwright/base-layers.spec.js index 4252acbfbd..3e13fa8b90 100644 --- a/tests/end2end/playwright/base-layers.spec.js +++ b/tests/end2end/playwright/base-layers.spec.js @@ -11,7 +11,7 @@ test.describe('Base layers', () => { }); test('Base layers list', async ({ page }) => { - await expect(page.locator('lizmap-base-layers select option')).toHaveCount(11); + await expect(page.locator('lizmap-base-layers select option')).toHaveCount(12); await expect(page.locator('lizmap-base-layers select')).toHaveValue('osm-mapnik'); await page.locator('lizmap-base-layers select').selectOption('empty'); await expect(page.locator('lizmap-base-layers select')).toHaveValue('empty'); diff --git a/tests/qgis-projects/tests/base_layers.qgs b/tests/qgis-projects/tests/base_layers.qgs index c2e74b6f4a..a14403ecf5 100644 --- a/tests/qgis-projects/tests/base_layers.qgs +++ b/tests/qgis-projects/tests/base_layers.qgs @@ -1,4 +1,4 @@ - + @@ -26,13 +26,20 @@ + + + + + quartiers_c253f702_37b3_42f8_8e81_8458a742ec97 + quartiers_07141d42_3703_4726_9ff0_6afeb14b6bde + @@ -69,6 +76,11 @@ + + + @@ -123,6 +135,550 @@ + + + 3.80707036695971279 + 43.56670409545019851 + 3.94133068060567293 + 43.65337122449288643 + + + 3.80707036695971279 + 43.56670409545019851 + 3.94133068060567293 + 43.65337122449288643 + + quartiers_07141d42_3703_4726_9ff0_6afeb14b6bde + service='lizmapdb' sslmode=disable key='quartier' estimatedmetadata=true srid=4326 type=MultiPolygon checkPrimaryKeyUnicity='1' table="tests_projects"."quartiers" (geom) + quartiers_baselayer + + + + quartiers_baselayer + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + dataset + + + + + + + + + + + + + + + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + + + + + + + postgres + + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + # -*- coding: utf-8 -*- +""" +QGIS forms can have a Python function that is called when the form is +opened. + +Use this function to add extra logic to your forms. + +Enter the name of the function in the "Python Init function" +field. +An example follows: +""" +from qgis.PyQt.QtWidgets import QWidget + +def my_form_open(dialog, layer, feature): + geom = feature.geometry() + control = dialog.findChild(QWidget, "MyLineEdit") + + 0 + generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + "quartmno" + + 3.80707036695971279 @@ -360,6 +916,7 @@ + @@ -529,7 +1086,7 @@ - + PROJCRS["WGS 84 / Pseudo-Mercator",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["Popular Visualisation Pseudo-Mercator",METHOD["Popular Visualisation Pseudo Mercator",ID["EPSG",1024]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["easting (X)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["northing (Y)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Web mapping and visualisation."],AREA["World between 85.06°S and 85.06°N."],BBOX[-85.06,-180,85.06,180]],ID["EPSG",3857]] +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs diff --git a/tests/qgis-projects/tests/base_layers.qgs.cfg b/tests/qgis-projects/tests/base_layers.qgs.cfg index a0638ced20..4adf03b4ed 100644 --- a/tests/qgis-projects/tests/base_layers.qgs.cfg +++ b/tests/qgis-projects/tests/base_layers.qgs.cfg @@ -1,8 +1,8 @@ { "metadata": { "qgis_desktop_version": 32216, - "lizmap_plugin_version_str": "3.14.2-alpha", - "lizmap_plugin_version": 31402, + "lizmap_plugin_version_str": "3.15.2-alpha", + "lizmap_plugin_version": 31502, "lizmap_web_client_target_version": 30700, "lizmap_web_client_target_status": "Dev", "instance_target_url": "http://localhost:8130/", @@ -86,7 +86,6 @@ "maxScale": 1000000000000, "toggled": "False", "popup": "False", - "popupFrame": null, "popupSource": "auto", "popupTemplate": "", "popupMaxFeatures": 10, @@ -100,7 +99,40 @@ "singleTile": "False", "imageFormat": "image/png; mode=8bit", "cached": "False", - "serverFrame": null, + "clientCacheExpiration": 300 + }, + "quartiers_baselayer": { + "id": "quartiers_07141d42_3703_4726_9ff0_6afeb14b6bde", + "name": "quartiers_baselayer", + "type": "layer", + "geometryType": "polygon", + "extent": [ + 3.807070366959713, + 43.5667040954502, + 3.941330680605673, + 43.653371224492886 + ], + "crs": "EPSG:4326", + "title": "quartiers_baselayer", + "abstract": "", + "link": "", + "minScale": 1, + "maxScale": 1000000000000, + "toggled": "False", + "popup": "False", + "popupSource": "auto", + "popupTemplate": "", + "popupMaxFeatures": 10, + "popupDisplayChildren": "False", + "popup_allow_download": true, + "legend_image_option": "hide_at_startup", + "groupAsLayer": "False", + "baseLayer": "True", + "displayInLegend": "True", + "group_visibility": [], + "singleTile": "True", + "imageFormat": "image/png", + "cached": "False", "clientCacheExpiration": 300 } },