diff --git a/lizmap/modules/lizmap/lib/Project/QgisProject.php b/lizmap/modules/lizmap/lib/Project/QgisProject.php index cc895e2576..616960784c 100644 --- a/lizmap/modules/lizmap/lib/Project/QgisProject.php +++ b/lizmap/modules/lizmap/lib/Project/QgisProject.php @@ -1194,11 +1194,11 @@ protected function readXmlProject($qgs_path) $this->WMSInformation = $this->readWMSInformation($qgsXml); $this->canvasColor = $this->readCanvasColor($qgsXml); $this->allProj4 = $this->readAllProj4($qgsXml); - list($this->relations, $this->relationsFields) = $this->readRelations($qgsXml); $this->themes = $this->readThemes($qgsXml); $this->customProjectVariables = $this->readCustomProjectVariables($qgsXml); $this->useLayerIDs = $this->readUseLayerIDs($qgsXml); $this->layers = $this->readLayers($qgsXml); + list($this->relations, $this->relationsFields) = $this->readRelations($qgsXml); } protected function readWMSInformation($qgsLoad) diff --git a/tests/end2end/playwright/embedded-relation.spec.ts b/tests/end2end/playwright/embedded-relation.spec.ts new file mode 100644 index 0000000000..b2a69cfaeb --- /dev/null +++ b/tests/end2end/playwright/embedded-relation.spec.ts @@ -0,0 +1,102 @@ +import { test, expect } from '@playwright/test'; + +test.describe('Display embedded relation in popup',()=>{ + test.beforeEach(async ({ page }) => { + const url = '/index.php/view/map/?repository=testsrepository&project=relations_project_embed'; + await page.goto(url, { waitUntil: 'networkidle' }); + await page.locator('#dock-close').click(); + }); + + test('Visualize popup for embedded layers', async ({ page }) => { + + let getFeatureInfoRequestPromise = page.waitForRequest(request => request.method() === 'POST' && request.postData().includes('GetFeatureInfo')); + + //first point + await page.locator('#OpenLayers_Layer_Vector_45 canvas').click({ + position: { + x: 74, + y: 40 + } + }); + + await getFeatureInfoRequestPromise; + + //time for rendering the popup + await page.waitForTimeout(500); + + await expect(page.locator('.lizmapPopupContent > .lizmapPopupSingleFeature .lizmapPopupTitle').first()).toHaveText("father_layer"); + + let firstPointElements = page.locator(".container.popup_lizmap_dd .before-tabs p b"); + await expect(firstPointElements).toHaveCount(3); + + await expect(firstPointElements.nth(0)).toHaveText("fid"); + await expect(firstPointElements.nth(1)).toHaveText("ref_id"); + await expect(firstPointElements.nth(2)).toHaveText("description"); + + + let firstElementsValues = page.locator(".container.popup_lizmap_dd .before-tabs div.field"); + await expect(firstElementsValues).toHaveCount(3); + await expect(firstElementsValues.nth(0)).toHaveText("3"); + await expect(firstElementsValues.nth(1)).toHaveText("1"); + await expect(firstElementsValues.nth(2)).toHaveText("Father 1"); + + //check childrens + let firstChildrendElements = page.locator('.lizmapPopupSingleFeature .lizmapPopupChildren .lizmapPopupSingleFeature'); + await expect(firstChildrendElements).toHaveCount(2); + + let firstElementfirstChildRows = firstChildrendElements.nth(0).getByRole('table').locator('tbody tr'); + await expect(firstElementfirstChildRows).toHaveCount(3); + await expect(firstElementfirstChildRows.nth(0).locator("td")).toHaveText("2"); + await expect(firstElementfirstChildRows.nth(1).locator("td")).toHaveText("1"); + await expect(firstElementfirstChildRows.nth(2).locator("td")).toHaveText("Child 2"); + let firstElementSecondChildRow = firstChildrendElements.nth(1).getByRole('table').locator('tbody tr'); + await expect(firstElementSecondChildRow.nth(0).locator("td")).toHaveText("1"); + await expect(firstElementSecondChildRow.nth(1).locator("td")).toHaveText("1"); + await expect(firstElementSecondChildRow.nth(2).locator("td")).toHaveText("Child 1"); + + //clear screen + await page.locator('#dock-close').click(); + + //second point + await page.locator('#OpenLayers_Layer_Vector_45 canvas').click({ + position: { + x: 392, + y: 257 + } + }); + await getFeatureInfoRequestPromise; + + //time for rendering the popup + await page.waitForTimeout(500); + + await expect(page.locator('.lizmapPopupContent > .lizmapPopupSingleFeature .lizmapPopupTitle').first()).toHaveText("father_layer"); + + let elements = page.locator(".container.popup_lizmap_dd .before-tabs p b"); + await expect(elements).toHaveCount(3); + + await expect(elements.nth(0)).toHaveText("fid"); + await expect(elements.nth(1)).toHaveText("ref_id"); + await expect(elements.nth(2)).toHaveText("description"); + + + let elementsValues = page.locator(".container.popup_lizmap_dd .before-tabs div.field"); + await expect(elementsValues).toHaveCount(3); + await expect(elementsValues.nth(0)).toHaveText("4"); + await expect(elementsValues.nth(1)).toHaveText("2"); + await expect(elementsValues.nth(2)).toHaveText("Father 2"); + + //check childrens + let childrendElements = page.locator('.lizmapPopupSingleFeature .lizmapPopupChildren .lizmapPopupSingleFeature'); + await expect(childrendElements).toHaveCount(2); + + let firstChildRows = childrendElements.nth(0).getByRole('table').locator('tbody tr'); + await expect(firstChildRows).toHaveCount(3); + await expect(firstChildRows.nth(0).locator("td")).toHaveText("4"); + await expect(firstChildRows.nth(1).locator("td")).toHaveText("2"); + await expect(firstChildRows.nth(2).locator("td")).toHaveText("Child 4"); + let secondChildRow = childrendElements.nth(1).getByRole('table').locator('tbody tr'); + await expect(secondChildRow.nth(0).locator("td")).toHaveText("3"); + await expect(secondChildRow.nth(1).locator("td")).toHaveText("2"); + await expect(secondChildRow.nth(2).locator("td")).toHaveText("Child 3"); + }); +}) diff --git a/tests/qgis-projects/tests/relations_project.qgs b/tests/qgis-projects/tests/relations_project.qgs new file mode 100644 index 0000000000..a5d45a7909 --- /dev/null +++ b/tests/qgis-projects/tests/relations_project.qgs @@ -0,0 +1,1371 @@ + + + + + + + + + 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 + + + + + + + + + + + + + + + father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff + child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00 + + + + + + + + + + + + + + + + degrees + + -1.19953051643192499 + -0.93661971830985924 + 0.80046948356807501 + 1.06338028169014076 + + 0 + + + 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 + + + 0 + + + + + + + + + + + + + + Annotations_53e21d2e_6eb9_423b_ad44_901f0e23a8dd + + + + + Annotations + + + 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 + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + 1 + 0 + + + + + + -0.83625733852386497 + -0.298245638608932 + 0.35204678773879999 + 0.37076029181480402 + + + -0.83625733852386497 + -0.298245638608932 + 0.35204678773879999 + 0.37076029181480402 + + child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00 + ./test_embed.gpkg|layername=child_layer + child_layer + + + + child_layer + + + 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 + + + + + + + + + + + + + ogr + + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + tablayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "description" + + + + + -0.63040935993194602 + 0.0994151905179024 + -0.251461982727051 + 0.36140355467796298 + + + -0.63040935993194602 + 0.0994151905179024 + -0.251461982727051 + 0.36140355467796298 + + father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff + ./test_embed.gpkg|layername=father_layer + father_layer + + + + father_layer + + + 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 + + + + + + + + + + + + + ogr + + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + tablayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "fid" + + + + + + + + + + 0 + + + 255 + 255 + 255 + 255 + 0 + 255 + 255 + + + false + + + + + + EPSG:7030 + + + m2 + meters + + + 5 + 2.5 + false + false + 1 + 0 + false + false + true + 0 + 255,0,0,255 + + + false + + + true + 2 + + false + + 1 + + + + lizmap_repository + lizmap_user + lizmap_user_groups + + + intranet + + + + + + + + child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00 + father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff + + + 8 + 8 + + + + + + + + None + false + + + + + + + EPSG:4326 + + 1 + + -1.48591549300000003 + -0.93661971799999999 + 1.08685446000000008 + 1.06338028200000001 + + false + conditions unknown + 90 + + + + 1 + + 8 + relations_project + false + + true + relations_project + 0 + + false + + + + + + + + false + + + + + false + + 5000 + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + riccardo + 2023-07-04T10:05:46 + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + 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 + + + + diff --git a/tests/qgis-projects/tests/relations_project.qgs.cfg b/tests/qgis-projects/tests/relations_project.qgs.cfg new file mode 100644 index 0000000000..192db7014d --- /dev/null +++ b/tests/qgis-projects/tests/relations_project.qgs.cfg @@ -0,0 +1,166 @@ +{ + "metadata": { + "qgis_desktop_version": 32807, + "lizmap_plugin_version_str": "3.17.0", + "lizmap_plugin_version": 31700, + "lizmap_web_client_target_version": 30700, + "lizmap_web_client_target_status": "Dev", + "instance_target_url": "http://localhost:8130/", + "instance_target_repository": "intranet", + "project_valid": true + }, + "warnings": [], + "options": { + "projection": { + "proj4": "+proj=longlat +datum=WGS84 +no_defs", + "ref": "EPSG:4326" + }, + "bbox": [ + "-1.48591549300000003", + "-0.93661971799999999", + "1.08685446000000008", + "1.06338028200000001" + ], + "mapScales": [ + 10000, + 25000, + 50000, + 100000, + 250000, + 500000 + ], + "minScale": 1, + "maxScale": 1000000000, + "initialExtent": [ + -1.485915493, + -0.936619718, + 1.08685446, + 1.063380282 + ], + "popupLocation": "dock", + "pointTolerance": 25, + "lineTolerance": 10, + "polygonTolerance": 5, + "tmTimeFrameSize": 10, + "tmTimeFrameType": "seconds", + "tmAnimationFrameLength": 1000, + "datavizLocation": "dock", + "theme": "dark", + "fixed_scale_overview_map": true, + "dataviz_drag_drop": [] + }, + "layers": { + "child_layer": { + "id": "child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00", + "name": "child_layer", + "type": "layer", + "geometryType": "point", + "extent": [ + -0.836257338523865, + -0.298245638608932, + 0.3520467877388, + 0.370760291814804 + ], + "crs": "EPSG:4326", + "title": "child_layer", + "abstract": "", + "link": "", + "minScale": 1, + "maxScale": 1000000000000, + "toggled": "True", + "popup": "True", + "popupSource": "form", + "popupTemplate": "", + "popupMaxFeatures": 10, + "popupDisplayChildren": "False", + "popup_allow_download": true, + "legend_image_option": "hide_at_startup", + "groupAsLayer": "False", + "baseLayer": "False", + "displayInLegend": "True", + "group_visibility": [], + "singleTile": "True", + "imageFormat": "image/png", + "cached": "False", + "clientCacheExpiration": 300 + }, + "father_layer": { + "id": "father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff", + "name": "father_layer", + "type": "layer", + "geometryType": "point", + "extent": [ + -0.630409359931946, + 0.0994151905179024, + -0.251461982727051, + 0.361403554677963 + ], + "crs": "EPSG:4326", + "title": "father_layer", + "abstract": "", + "link": "", + "minScale": 1, + "maxScale": 1000000000000, + "toggled": "True", + "popup": "True", + "popupSource": "form", + "popupTemplate": "", + "popupMaxFeatures": 10, + "popupDisplayChildren": "True", + "popup_allow_download": true, + "legend_image_option": "hide_at_startup", + "groupAsLayer": "False", + "baseLayer": "False", + "displayInLegend": "True", + "group_visibility": [], + "singleTile": "True", + "imageFormat": "image/png", + "cached": "False", + "clientCacheExpiration": 300 + } + }, + "atlas": { + "layers": [] + }, + "locateByLayer": {}, + "attributeLayers": { + "father_layer": { + "layerId": "father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff", + "primaryKey": "fid", + "pivot": "False", + "hideAsChild": "False", + "hideLayer": "False", + "custom_config": "False", + "order": 0 + }, + "child_layer": { + "layerId": "child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00", + "primaryKey": "fid", + "pivot": "False", + "hideAsChild": "False", + "hideLayer": "False", + "custom_config": "False", + "order": 1 + } + }, + "tooltipLayers": {}, + "editionLayers": {}, + "layouts": { + "config": { + "default_popup_print": false + }, + "list": [] + }, + "loginFilteredLayers": {}, + "timemanagerLayers": {}, + "datavizLayers": {}, + "filter_by_polygon": { + "config": { + "polygon_layer_id": null, + "group_field": "", + "filter_by_user": false + }, + "layers": [] + }, + "formFilterLayers": {} +} diff --git a/tests/qgis-projects/tests/relations_project_embed.qgs b/tests/qgis-projects/tests/relations_project_embed.qgs new file mode 100644 index 0000000000..c16fb1ff62 --- /dev/null +++ b/tests/qgis-projects/tests/relations_project_embed.qgs @@ -0,0 +1,388 @@ + + + + + + + + + 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 + + + + + + + + + + + + + + + + + child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00 + father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff + + + + + + + + + + + + + + + + degrees + + -1.25007169798646167 + -0.62017303629660181 + 1.24536696716513484 + 0.78473941759324384 + + 0 + + + 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 + + + 0 + + + + + + + + + + + + + + Annotations_53e21d2e_6eb9_423b_ad44_901f0e23a8dd + + + + + Annotations + + + 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 + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + 1 + 0 + + + + + + + + + + + + + 0 + + + 255 + 255 + 255 + 255 + 0 + 255 + 255 + + + false + + + + + + EPSG:7030 + + + m2 + meters + + + 5 + 2.5 + false + false + 1 + 0 + false + false + true + 0 + 255,0,0,255 + + + false + + + true + 2 + + false + + 1 + + + + lizmap_repository + lizmap_user + lizmap_user_groups + + + intranet + + + + + + + + child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00 + father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff + + + 8 + 8 + + + + + + + + None + false + + + + + + + EPSG:4326 + + 1 + + -1.48591549300000003 + -0.93661971799999999 + 1.08685446000000008 + 1.06338028200000001 + + false + conditions unknown + 90 + + + + 1 + + 8 + relations_project_embed + false + + true + relations_project_embed + 0 + + false + + + + + + + + false + + + + + false + + 5000 + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + riccardo + 2023-07-04T10:29:04 + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + 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 + + + + diff --git a/tests/qgis-projects/tests/relations_project_embed.qgs.cfg b/tests/qgis-projects/tests/relations_project_embed.qgs.cfg new file mode 100644 index 0000000000..463e1487ac --- /dev/null +++ b/tests/qgis-projects/tests/relations_project_embed.qgs.cfg @@ -0,0 +1,166 @@ +{ + "metadata": { + "qgis_desktop_version": 32807, + "lizmap_plugin_version_str": "3.17.0", + "lizmap_plugin_version": 31700, + "lizmap_web_client_target_version": 30700, + "lizmap_web_client_target_status": "Dev", + "instance_target_url": "http://localhost:8130/", + "instance_target_repository": "intranet", + "project_valid": true + }, + "warnings": [], + "options": { + "projection": { + "proj4": "+proj=longlat +datum=WGS84 +no_defs", + "ref": "EPSG:4326" + }, + "bbox": [ + "-1.48591549300000003", + "-0.93661971799999999", + "1.08685446000000008", + "1.06338028200000001" + ], + "mapScales": [ + 10000, + 25000, + 50000, + 100000, + 250000, + 500000 + ], + "minScale": 1, + "maxScale": 1000000000, + "initialExtent": [ + -1.485915493, + -0.936619718, + 1.08685446, + 1.063380282 + ], + "popupLocation": "dock", + "pointTolerance": 25, + "lineTolerance": 10, + "polygonTolerance": 5, + "tmTimeFrameSize": 10, + "tmTimeFrameType": "seconds", + "tmAnimationFrameLength": 1000, + "datavizLocation": "dock", + "theme": "dark", + "fixed_scale_overview_map": true, + "dataviz_drag_drop": [] + }, + "layers": { + "father_layer": { + "id": "father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff", + "name": "father_layer", + "type": "layer", + "geometryType": "point", + "extent": [ + -0.630409359931946, + 0.0994151905179024, + -0.251461982727051, + 0.361403554677963 + ], + "crs": "EPSG:4326", + "title": "father_layer", + "abstract": "", + "link": "", + "minScale": 1, + "maxScale": 1000000000000, + "toggled": "True", + "popup": "True", + "popupSource": "form", + "popupTemplate": "", + "popupMaxFeatures": 10, + "popupDisplayChildren": "True", + "popup_allow_download": true, + "legend_image_option": "hide_at_startup", + "groupAsLayer": "False", + "baseLayer": "False", + "displayInLegend": "True", + "group_visibility": [], + "singleTile": "True", + "imageFormat": "image/png", + "cached": "False", + "clientCacheExpiration": 300 + }, + "child_layer": { + "id": "child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00", + "name": "child_layer", + "type": "layer", + "geometryType": "point", + "extent": [ + -0.836257338523865, + -0.298245638608932, + 0.3520467877388, + 0.370760291814804 + ], + "crs": "EPSG:4326", + "title": "child_layer", + "abstract": "", + "link": "", + "minScale": 1, + "maxScale": 1000000000000, + "toggled": "True", + "popup": "True", + "popupSource": "form", + "popupTemplate": "", + "popupMaxFeatures": 10, + "popupDisplayChildren": "False", + "popup_allow_download": true, + "legend_image_option": "hide_at_startup", + "groupAsLayer": "False", + "baseLayer": "False", + "displayInLegend": "True", + "group_visibility": [], + "singleTile": "True", + "imageFormat": "image/png", + "cached": "False", + "clientCacheExpiration": 300 + } + }, + "atlas": { + "layers": [] + }, + "locateByLayer": {}, + "attributeLayers": { + "father_layer": { + "layerId": "father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff", + "primaryKey": "fid", + "pivot": "False", + "hideAsChild": "False", + "hideLayer": "False", + "custom_config": "False", + "order": 0 + }, + "child_layer": { + "layerId": "child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00", + "primaryKey": "fid", + "pivot": "False", + "hideAsChild": "False", + "hideLayer": "False", + "custom_config": "False", + "order": 1 + } + }, + "tooltipLayers": {}, + "editionLayers": {}, + "layouts": { + "config": { + "default_popup_print": false + }, + "list": [] + }, + "loginFilteredLayers": {}, + "timemanagerLayers": {}, + "datavizLayers": {}, + "filter_by_polygon": { + "config": { + "polygon_layer_id": null, + "group_field": "", + "filter_by_user": false + }, + "layers": [] + }, + "formFilterLayers": {} +} diff --git a/tests/qgis-projects/tests/test_embed.gpkg b/tests/qgis-projects/tests/test_embed.gpkg new file mode 100644 index 0000000000..1ae5763c5e Binary files /dev/null and b/tests/qgis-projects/tests/test_embed.gpkg differ diff --git a/tests/units/classes/Project/QgisProjectTest.php b/tests/units/classes/Project/QgisProjectTest.php index f8b9a2f110..40210da994 100644 --- a/tests/units/classes/Project/QgisProjectTest.php +++ b/tests/units/classes/Project/QgisProjectTest.php @@ -277,6 +277,65 @@ public function testReadRelations() $this->assertEquals($expectedFields, $relationsFields); } + public function testEmbeddedRelation() + { + $file = __DIR__.'/Ressources/relations_project_embed.qgs'; + $testQgis = new qgisProjectForTests(); + $testQgis->setPath($file); + $testQgis->readXMLProjectTest($file); + + //check layers + foreach ($testQgis->getLayers() as $layers){ + $this->assertEquals($layers["embedded"],1); + $this->assertEquals($layers["projectPath"],'./relations_project.qgs'); + } + + //check relation on embedded project + $expectedRelationsOnEmbeddedLayers = array( + 'father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff' => array( + array('referencingLayer' => 'child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00', + 'referencedField' => 'ref_id', + 'referencingField' => 'father_id', + 'previewField'=>'fid', + 'relationName' => 'fk_father_child_relation', + 'relationId' => 'child_laye_father_id_father_lay_ref_id_1', + + ), + ), + 'pivot' => array(), + ); + + $expectedFieldsOnEmbeddedLayers = array( + array ( + 'id' => 'child_laye_father_id_father_lay_ref_id_1', + 'layerName' => 'father_layer', + 'typeName' => 'father_layer', + 'propertyName' => 'ref_id,fid', + 'filterExpression' => '', + 'referencedField' => 'ref_id', + 'referencingField' => 'father_id', + 'previewField' => 'fid', + ) + ); + + $relations = $testQgis->getRelations(); + $relationFields = $testQgis->getRelationsFields(); + $this->assertEquals($expectedRelationsOnEmbeddedLayers, $relations); + $this->assertEquals($expectedFieldsOnEmbeddedLayers, $relationFields); + + // check relations identity on main project + $file = __DIR__.'/Ressources/relations_project.qgs'; + $testQgisParent = new qgisProjectForTests(); + $testQgisParent->setPath($file); + $testQgisParent->readXMLProjectTest($file); + + $parentRelations = $testQgisParent->getRelations(); + $parentRelationFields = $testQgisParent->getRelationsFields(); + $this->assertEquals($relations,$parentRelations); + $this->assertEquals($relationFields,$parentRelationFields); + + } + public function testCacheConstruct() { $cachedProperties = array('WMSInformation', 'canvasColor', 'allProj4', diff --git a/tests/units/classes/Project/Ressources/relations_project.qgs b/tests/units/classes/Project/Ressources/relations_project.qgs new file mode 100644 index 0000000000..a5d45a7909 --- /dev/null +++ b/tests/units/classes/Project/Ressources/relations_project.qgs @@ -0,0 +1,1371 @@ + + + + + + + + + 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 + + + + + + + + + + + + + + + father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff + child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00 + + + + + + + + + + + + + + + + degrees + + -1.19953051643192499 + -0.93661971830985924 + 0.80046948356807501 + 1.06338028169014076 + + 0 + + + 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 + + + 0 + + + + + + + + + + + + + + Annotations_53e21d2e_6eb9_423b_ad44_901f0e23a8dd + + + + + Annotations + + + 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 + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + 1 + 0 + + + + + + -0.83625733852386497 + -0.298245638608932 + 0.35204678773879999 + 0.37076029181480402 + + + -0.83625733852386497 + -0.298245638608932 + 0.35204678773879999 + 0.37076029181480402 + + child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00 + ./test_embed.gpkg|layername=child_layer + child_layer + + + + child_layer + + + 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 + + + + + + + + + + + + + ogr + + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + tablayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "description" + + + + + -0.63040935993194602 + 0.0994151905179024 + -0.251461982727051 + 0.36140355467796298 + + + -0.63040935993194602 + 0.0994151905179024 + -0.251461982727051 + 0.36140355467796298 + + father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff + ./test_embed.gpkg|layername=father_layer + father_layer + + + + father_layer + + + 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 + + + + + + + + + + + + + ogr + + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + tablayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "fid" + + + + + + + + + + 0 + + + 255 + 255 + 255 + 255 + 0 + 255 + 255 + + + false + + + + + + EPSG:7030 + + + m2 + meters + + + 5 + 2.5 + false + false + 1 + 0 + false + false + true + 0 + 255,0,0,255 + + + false + + + true + 2 + + false + + 1 + + + + lizmap_repository + lizmap_user + lizmap_user_groups + + + intranet + + + + + + + + child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00 + father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff + + + 8 + 8 + + + + + + + + None + false + + + + + + + EPSG:4326 + + 1 + + -1.48591549300000003 + -0.93661971799999999 + 1.08685446000000008 + 1.06338028200000001 + + false + conditions unknown + 90 + + + + 1 + + 8 + relations_project + false + + true + relations_project + 0 + + false + + + + + + + + false + + + + + false + + 5000 + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + riccardo + 2023-07-04T10:05:46 + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + 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 + + + + diff --git a/tests/units/classes/Project/Ressources/relations_project_embed.qgs b/tests/units/classes/Project/Ressources/relations_project_embed.qgs new file mode 100644 index 0000000000..c16fb1ff62 --- /dev/null +++ b/tests/units/classes/Project/Ressources/relations_project_embed.qgs @@ -0,0 +1,388 @@ + + + + + + + + + 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 + + + + + + + + + + + + + + + + + child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00 + father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff + + + + + + + + + + + + + + + + degrees + + -1.25007169798646167 + -0.62017303629660181 + 1.24536696716513484 + 0.78473941759324384 + + 0 + + + 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 + + + 0 + + + + + + + + + + + + + + Annotations_53e21d2e_6eb9_423b_ad44_901f0e23a8dd + + + + + Annotations + + + 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 + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + 1 + 0 + + + + + + + + + + + + + 0 + + + 255 + 255 + 255 + 255 + 0 + 255 + 255 + + + false + + + + + + EPSG:7030 + + + m2 + meters + + + 5 + 2.5 + false + false + 1 + 0 + false + false + true + 0 + 255,0,0,255 + + + false + + + true + 2 + + false + + 1 + + + + lizmap_repository + lizmap_user + lizmap_user_groups + + + intranet + + + + + + + + child_layer_8dec6d75_eeed_494b_b97f_5f2c7e16fd00 + father_layer_79f5a996_39db_4a1f_b270_dfe21d3e44ff + + + 8 + 8 + + + + + + + + None + false + + + + + + + EPSG:4326 + + 1 + + -1.48591549300000003 + -0.93661971799999999 + 1.08685446000000008 + 1.06338028200000001 + + false + conditions unknown + 90 + + + + 1 + + 8 + relations_project_embed + false + + true + relations_project_embed + 0 + + false + + + + + + + + false + + + + + false + + 5000 + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + riccardo + 2023-07-04T10:29:04 + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + 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 + + + + diff --git a/tests/units/testslib/QgisProjectForTests.php b/tests/units/testslib/QgisProjectForTests.php index a2072283fa..70f4a45fb2 100644 --- a/tests/units/testslib/QgisProjectForTests.php +++ b/tests/units/testslib/QgisProjectForTests.php @@ -11,6 +11,23 @@ public function __construct($data = null) } } + public function readXMLProjectTest($file) + { + return $this->readXMLProject($file); + } + + public function getLayers() + { + return $this->layers; + } + public function getRelations() + { + return $this->relations; + } + public function getRelationsFields() + { + return $this->relationsFields; + } public function readWMSInfoTest($xml) { return $this->readWMSInformation($xml); @@ -70,6 +87,12 @@ public function setXml($xml) $this->xml = $xml; } + + public function setPath($path) + { + $this->path = $path; + } + public function setLayers($layers) { $this->layers = $layers;