From a8f6d9fb7115c5a82dc3b6c43ae09bfbf14f45d0 Mon Sep 17 00:00:00 2001 From: "jean-philippe.bazonnais" Date: Thu, 29 Jun 2023 15:20:19 +0200 Subject: [PATCH 01/10] Fix sur les couches de type compute + lien vers les extensions (tgz de la branche develop) --- package.json | 2 +- samples-src/pages/3d/page-compute-bundle.html | 130 ++++++++++++++++++ src/Interface/IMapLayers.js | 2 +- src/OpenLayers/OlMapLayers.js | 17 ++- 4 files changed, 144 insertions(+), 7 deletions(-) create mode 100644 samples-src/pages/3d/page-compute-bundle.html diff --git a/package.json b/package.json index 6dd142369..bd610fed8 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "expose-loader": "^0.7.5", "fs-extra": "^9.0.0", "geoportal-extensions-itowns": "2.4.1", - "geoportal-extensions-openlayers": "3.3.1", + "geoportal-extensions-openlayers": "https://raw.githubusercontent.com/IGNF/geoportal-extensions/develop/build/scripts/release/geoportal-extensions-openlayers-3.3.2.tgz", "handlebars": "^4.7.5", "handlebars-layouts": "^3.1.4", "html-webpack-plugin": "^4.0.4", diff --git a/samples-src/pages/3d/page-compute-bundle.html b/samples-src/pages/3d/page-compute-bundle.html new file mode 100644 index 000000000..8219d266b --- /dev/null +++ b/samples-src/pages/3d/page-compute-bundle.html @@ -0,0 +1,130 @@ +{{#extend "sample-bundle-layout-3d"}} + +{{#content "head"}} + Sample SDK 3D Switch with compute layer +{{/content}} + +{{#content "style"}} + +{{/content}} + +{{#content "body"}} +

Test de la bascule 3D / 2D

+
+
+
+ +
+{{/content}} + +{{#content "js"}} + +{{/content}} +{{/extend}} diff --git a/src/Interface/IMapLayers.js b/src/Interface/IMapLayers.js index 69f7a7fd3..1590773c7 100644 --- a/src/Interface/IMapLayers.js +++ b/src/Interface/IMapLayers.js @@ -192,7 +192,7 @@ IMap.prototype.addLayers = function (layersOptions) { // on a trouve la couche Geoportail : on rajoute sa configuration à ses options. this.logger.trace("[IMap] addLayers : [" + layerId + "] is a geoportalLayer. Adding inner properties."); addLayerParam[layerId].format = format; - addLayerParam[layerId].originators = addLayerParam[layerId].originators; + addLayerParam[layerId].originators = []; // options du layerswitcher addLayerParam[layerId] = this._layerOptions2layerConf(layerConf, addLayerParam[layerId]); } diff --git a/src/OpenLayers/OlMapLayers.js b/src/OpenLayers/OlMapLayers.js index ec74e9f78..9c456bdc4 100644 --- a/src/OpenLayers/OlMapLayers.js +++ b/src/OpenLayers/OlMapLayers.js @@ -390,6 +390,8 @@ OlMap.prototype._addVectorLayer = function (layerObj) { break; case "COMPUTE": case "GEOJSON": + // INFO + // par defaut, les couches de calculs sont au format GeoJSON depuis l'espace personnel. this.logger.trace("[_addVectorLayer] : ajout d'une couche GeoJSON"); if (layerOpts.url) { constructorOpts.source = new VectorSource({ @@ -745,10 +747,13 @@ OlMap.prototype._registerUnknownLayer = function (layerObj) { switch (layerId.toLowerCase()) { case "measure:profil": + // INFO + // C'est une couche issue de l'outil d'import options.format = "COMPUTE"; options.graph = null; options.control = "elevationpath"; options.title = "Profil altimétrique"; + options.name = "profil altimetrique"; options.description = "Profil altimétrique"; options.controlOptions = this.getLibMapControl(options.control.toLowerCase()).getData(); options.data = this.getLibMapControl(options.control.toLowerCase()).getGeoJSON(); @@ -792,10 +797,12 @@ OlMap.prototype._registerUnknownLayer = function (layerObj) { break; case "layerimport:compute": // INFO - // Le widget d'import recherche si le fichier KML, GeoJSON ou GPX - // est un fichier de calcul avec la lecture de la balise 'geoportail:compute'. - // Si oui, property 'gpResultLayerId' -> 'layerimport:COMPUTE' - // Et, les options utiles au calcul sont dans les properties de la couche. + // C'est une couche issue de l'outil d'import. + // Les étapes de l'import : + // * recherche si le fichier KML, GeoJSON ou GPX est un fichier de calcul avec la lecture de la balise 'geoportail:compute'. + // * modification de la property 'gpResultLayerId' -> 'layerimport:COMPUTE' + // * ajout des options du calcul dans les properties de la couche + // * initialisation du contrôle avec les params de calcul options.format = "COMPUTE"; var prop = layerObj.getProperties(); options.graph = prop.graph; @@ -824,7 +831,7 @@ OlMap.prototype._registerUnknownLayer = function (layerObj) { case "pieton$ogc:openls;itineraire": case "pieton$geoportail:gpp:itineraire": // INFO - // Couches de calculs en cours avec les widgets : + // C'est une couche de calcul en cours de traitement avec les widgets : // - isocurve // - route var key = layerId.toLowerCase(); From 344263c11f99beb16a9111e2ea4a8cdb807af5c9 Mon Sep 17 00:00:00 2001 From: elias couppe Date: Fri, 28 Jul 2023 18:57:18 +0200 Subject: [PATCH 02/10] =?UTF-8?q?fix(layers):=20id=20ajout=C3=A9=20au=20ta?= =?UTF-8?q?bleau=20layers=20pour=20les=20couches=20inconnues=20ajout=C3=A9?= =?UTF-8?q?es=20directement=20depuis=20ol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OpenLayers/OlMapLayers.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OpenLayers/OlMapLayers.js b/src/OpenLayers/OlMapLayers.js index ec74e9f78..115225ce7 100644 --- a/src/OpenLayers/OlMapLayers.js +++ b/src/OpenLayers/OlMapLayers.js @@ -860,7 +860,10 @@ OlMap.prototype._registerUnknownLayer = function (layerObj) { // Et, si la couche est toujours non reconnue !? if (layerId === "unknownLayer") { - return; // pas super... + if (layerObj.getProperties) { + layerId = layerObj.getProperties().id; + } + // return; // pas super... } // on rajoute un timestamp From 1503e79235c1ebbc5ce57f699d6e530e7da90195 Mon Sep 17 00:00:00 2001 From: elias couppe Date: Mon, 31 Jul 2023 18:43:54 +0200 Subject: [PATCH 03/10] =?UTF-8?q?Fix(OL:LayerSwitcher):=20Ajout=20id=20?= =?UTF-8?q?=C3=A0=20la=20config=20de=20la=20couche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OpenLayers/OlMapControls.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OpenLayers/OlMapControls.js b/src/OpenLayers/OlMapControls.js index 8f06fdeba..cb935efd6 100644 --- a/src/OpenLayers/OlMapControls.js +++ b/src/OpenLayers/OlMapControls.js @@ -766,7 +766,9 @@ OlMap.prototype.addLayerSwitcherControl = function (controlOpts) { // INFO : les couches Geoportail sont aussi configurées. var layerConf = { layer : layer.obj, - config : {} + config : { + id : layer.id + } }; if (layer.options.title) { this.logger.trace("[OlMap] : layerSwitcher : setting title to [" + layer.options.title + "] for layer " + layer.id); From 9cc711a1e3a9992aa95f978cb8b5d71003cfb06a Mon Sep 17 00:00:00 2001 From: elias couppe Date: Tue, 1 Aug 2023 19:07:38 +0200 Subject: [PATCH 04/10] fix(2D:Layers): pas d'ajout de timestamp en suffix-id d'une unknown layer --- ...erSwitcher-layer-added-from-ol-bundle.html | 102 ++++++++++++++++++ src/OpenLayers/OlMapLayers.js | 10 +- 2 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 samples-src/pages/3d/page-layerSwitcher-layer-added-from-ol-bundle.html diff --git a/samples-src/pages/3d/page-layerSwitcher-layer-added-from-ol-bundle.html b/samples-src/pages/3d/page-layerSwitcher-layer-added-from-ol-bundle.html new file mode 100644 index 000000000..96e9786cd --- /dev/null +++ b/samples-src/pages/3d/page-layerSwitcher-layer-added-from-ol-bundle.html @@ -0,0 +1,102 @@ +{{#extend "sample-bundle-layout-3d"}} + +{{#content "head"}} +Sample SDK 3D Layer Switcher +{{/content}} + +{{#content "style"}} + +{{/content}} + +{{#content "body"}} +

Test de l'ajout du control LayerSwitcher

+ +
+
+
+
+{{/content}} + +{{#content "js"}} + +{{/content}} +{{/extend}} \ No newline at end of file diff --git a/src/OpenLayers/OlMapLayers.js b/src/OpenLayers/OlMapLayers.js index 115225ce7..9ce571726 100644 --- a/src/OpenLayers/OlMapLayers.js +++ b/src/OpenLayers/OlMapLayers.js @@ -860,15 +860,17 @@ OlMap.prototype._registerUnknownLayer = function (layerObj) { // Et, si la couche est toujours non reconnue !? if (layerId === "unknownLayer") { + // la couche est-elle une couche openlayers ? if (layerObj.getProperties) { + // le layerId est l'id renseigné par l'utilisateur layerId = layerObj.getProperties().id; } - // return; // pas super... + } else { + // dans le cas des couches import/compute + // on rajoute au layer Id un timestamp pour utilisation sur le portail + layerId += "-" + Date.now(); } - // on rajoute un timestamp - layerId += "-" + Date.now(); - this._layers.push({ id : layerId, obj : layerObj, From dca06d657234151e51f9d70156817385fdf73691 Mon Sep 17 00:00:00 2001 From: elias couppe Date: Tue, 1 Aug 2023 19:19:25 +0200 Subject: [PATCH 05/10] =?UTF-8?q?update(package):=20mise=20=C3=A0=20jour?= =?UTF-8?q?=20extension=20tmp=20branch=20fix/ol-unknown-layer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6dd142369..22c7ef72a 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "expose-loader": "^0.7.5", "fs-extra": "^9.0.0", "geoportal-extensions-itowns": "2.4.1", - "geoportal-extensions-openlayers": "3.3.1", + "geoportal-extensions-openlayers": "https://raw.githubusercontent.com/IGNF/geoportal-extensions/fix/unknown-ol-layer/build/scripts/release/geoportal-extensions-openlayers-3.3.2.tgz", "handlebars": "^4.7.5", "handlebars-layouts": "^3.1.4", "html-webpack-plugin": "^4.0.4", From 087e08ff44eac10612b0c45b8b4eecfd0676c5f8 Mon Sep 17 00:00:00 2001 From: elias couppe Date: Wed, 2 Aug 2023 11:11:05 +0200 Subject: [PATCH 06/10] fix(samples:3d): corrige exemple ol layer --- .../3d/page-layerSwitcher-layer-added-from-ol-bundle.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples-src/pages/3d/page-layerSwitcher-layer-added-from-ol-bundle.html b/samples-src/pages/3d/page-layerSwitcher-layer-added-from-ol-bundle.html index 96e9786cd..fdeb12b9b 100644 --- a/samples-src/pages/3d/page-layerSwitcher-layer-added-from-ol-bundle.html +++ b/samples-src/pages/3d/page-layerSwitcher-layer-added-from-ol-bundle.html @@ -16,10 +16,10 @@ {{#content "body"}}

Test de l'ajout du control LayerSwitcher

-