diff --git a/DRAFT_CHANGELOG.md b/DRAFT_CHANGELOG.md
index cfc60e76e..52ac01f01 100644
--- a/DRAFT_CHANGELOG.md
+++ b/DRAFT_CHANGELOG.md
@@ -6,16 +6,24 @@
## Summary
+Amélioration de la gestion des couches ajoutées directement via OpenLayers.
+
## Changelog
* [Added]
* [Changed]
+ - mise à jour extension Gp pour openlayers en version 3.3.3
+ - mise à jour extension Gp pour itowns en version 2.4.3
+
* [Removed]
* [Fixed]
+ - amélioration de la gestion des couches ajoutées directement via openlayers (#107)
+ - correction sur les couches COMPUTE (a8f6d9fb7115c5a82dc3b6c43ae09bfbf14f45d0)
+
* [Deprecated]
* [Security]
diff --git a/package.json b/package.json
index 6dd142369..934c3927f 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,9 @@
{
"name": "geoportal-sdk",
- "version": "3.4.1",
- "date": "07/06/2023",
- "SDK2DVersion": "3.4.1",
- "SDK3DVersion": "3.4.1",
+ "version": "3.4.2",
+ "date": "04/08/2023",
+ "SDK2DVersion": "3.4.2",
+ "SDK3DVersion": "3.4.2",
"description": "French Geoportal SDK based on OpenLayers (2D) and iTowns (3D) libraries",
"main": "dist/2d/GpSDK2D-src.js, dist/3d/GpSDK3d-src.js",
"module": "src/SDK2D.js, src/SDK3D.js",
@@ -72,8 +72,8 @@
"exports-loader": "^0.7.0",
"expose-loader": "^0.7.5",
"fs-extra": "^9.0.0",
- "geoportal-extensions-itowns": "2.4.1",
- "geoportal-extensions-openlayers": "3.3.1",
+ "geoportal-extensions-itowns": "2.4.3",
+ "geoportal-extensions-openlayers": "3.3.3",
"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/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..fdeb12b9b
--- /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/scripts/release/package-SDK2D.json b/scripts/release/package-SDK2D.json
index b8c7112b5..ec0bd8d1d 100644
--- a/scripts/release/package-SDK2D.json
+++ b/scripts/release/package-SDK2D.json
@@ -1,19 +1,14 @@
{
- "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/sdk.html",
- "main" : "dist/GpSDK2D-src.js",
- "scripts" : {},
- "directories" : {},
- "version" : "3.4.0",
- "repository" : {
- "url" : "https://github.com/IGNF/geoportal-sdk.git",
- "type" : "git"
- },
- "author" : "IGNF",
"bugs" : {
"url" : "https://github.com/IGNF/geoportal-sdk/issues"
},
- "license" : "CECILL-B",
+ "name" : "@ignf-geoportal/sdk-2d",
"description" : "French Geoportal SDK based on OpenLayers (2D)",
+ "date" : "04/08/2023",
+ "scripts" : {},
+ "module" : "src/SDK2D.js",
+ "author" : "IGNF",
+ "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/sdk.html",
"files" : [
"dist/",
"src/",
@@ -21,9 +16,8 @@
"README.md",
"package.json"
],
- "module" : "src/SDK2D.js",
- "date" : "07/06/2023",
- "name" : "@ignf-geoportal/sdk-2d",
+ "directories" : {},
+ "main" : "dist/GpSDK2D-src.js",
"keywords" : [
"openlayers",
"geoportail",
@@ -31,9 +25,15 @@
"javascript"
],
"dependencies" : {
- "xmldom" : "^0.1.27",
- "ol" : "6.9.0",
+ "geoportal-extensions-openlayers" : "3.3.3",
"node-fetch" : "^2.6.1",
- "geoportal-extensions-openlayers" : "3.3.1"
+ "xmldom" : "^0.1.27",
+ "ol" : "6.9.0"
+ },
+ "license" : "CECILL-B",
+ "version" : "3.4.2",
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/IGNF/geoportal-sdk.git"
}
}
diff --git a/scripts/release/package-SDK3D.json b/scripts/release/package-SDK3D.json
index ddbbf6ced..beecc83ed 100644
--- a/scripts/release/package-SDK3D.json
+++ b/scripts/release/package-SDK3D.json
@@ -1,18 +1,18 @@
{
- "name" : "@ignf-geoportal/sdk-3d",
- "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/sdk.html",
- "dependencies" : {
- "ol" : "6.9.0",
- "geoportal-extensions-openlayers" : "3.3.1",
- "itowns" : "2.38.2",
- "geoportal-extensions-itowns" : "2.4.1",
- "node-fetch" : "^2.6.1",
- "xmldom" : "^0.1.27"
- },
- "directories" : {},
- "module" : "src/SDK3D.js",
+ "keywords" : [
+ "openlayers",
+ "itowns",
+ "geoportail",
+ "webservice",
+ "javascript"
+ ],
+ "scripts" : {},
+ "date" : "04/08/2023",
+ "description" : "French Geoportal SDK based on OpenLayers (2D) and iTowns (3D) libraries",
"main" : "dist/GpSDK3D-src.js",
- "author" : "IGNF",
+ "module" : "src/SDK3D.js",
+ "directories" : {},
+ "license" : "CECILL-B",
"files" : [
"dist/",
"src/",
@@ -20,23 +20,23 @@
"README.md",
"package.json"
],
- "description" : "French Geoportal SDK based on OpenLayers (2D) and iTowns (3D) libraries",
- "repository" : {
- "type" : "git",
- "url" : "https://github.com/IGNF/geoportal-sdk.git"
- },
- "version" : "3.4.0",
- "scripts" : {},
"bugs" : {
"url" : "https://github.com/IGNF/geoportal-sdk/issues"
},
- "keywords" : [
- "openlayers",
- "itowns",
- "geoportail",
- "webservice",
- "javascript"
- ],
- "license" : "CECILL-B",
- "date" : "07/06/2023"
+ "version" : "3.4.2",
+ "dependencies" : {
+ "geoportal-extensions-openlayers" : "3.3.3",
+ "ol" : "6.9.0",
+ "node-fetch" : "^2.6.1",
+ "geoportal-extensions-itowns" : "2.4.3",
+ "itowns" : "2.38.2",
+ "xmldom" : "^0.1.27"
+ },
+ "name" : "@ignf-geoportal/sdk-3d",
+ "repository" : {
+ "url" : "https://github.com/IGNF/geoportal-sdk.git",
+ "type" : "git"
+ },
+ "author" : "IGNF",
+ "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/sdk.html"
}
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/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);
diff --git a/src/OpenLayers/OlMapLayers.js b/src/OpenLayers/OlMapLayers.js
index ec74e9f78..cf93119a7 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();
@@ -860,12 +867,17 @@ OlMap.prototype._registerUnknownLayer = function (layerObj) {
// Et, si la couche est toujours non reconnue !?
if (layerId === "unknownLayer") {
- return; // pas super...
+ // la couche est-elle une couche openlayers ?
+ if (layerObj.getProperties) {
+ // le layerId est l'id renseigné par l'utilisateur
+ layerId = layerObj.getProperties().id;
+ }
+ } 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,