Skip to content

Commit

Permalink
release 3.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
elias75015 committed Aug 4, 2023
2 parents d768b7f + 24aa00b commit 59e9f42
Show file tree
Hide file tree
Showing 9 changed files with 317 additions and 63 deletions.
8 changes: 8 additions & 0 deletions DRAFT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down
130 changes: 130 additions & 0 deletions samples-src/pages/3d/page-compute-bundle.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{{#extend "sample-bundle-layout-3d"}}

{{#content "head"}}
<title>Sample SDK 3D Layer Switcher</title>
{{/content}}

{{#content "style"}}
<style>
#viewerDiv {
height: 600px;
width: 100%;
position: "relative";
}
</style>
{{/content}}

{{#content "body"}}
<h1>Test de l'ajout du control LayerSwitcher</h1>
<div id="BoutonSwitchToItowns">
<input type="button" name="switch" onclick="switchTo3D();" value="Switch from 2D to 3D" /><br />
</div>
<div id="BoutonSwitchToOl" hidden>
<input type="button" name="switch" onclick="switchTo2D();" value="Switch from 3D to 2D" /><br />
</div>
<div id="viewerDiv"></div>
{{/content}}

{{#content "js"}}
<script>
var map = Gp.Map.load("viewerDiv", {
customConfigFile: "{{resources}}/ConfigFile/fullConfig.json",
viewMode: "2d",
controlsOptions: {
layerSwitcher: {
maximised: true
}
},
layersOptions: {
"GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2": {
originators: [{
"name": "IGN",
"attribution": "Institut national de l'information géographique et forestière",
"url": "http://www.ign.fr",
"constraints": [{ "crs": "EPSG:4326", "bbox": { "left": -63.09696, "right": 55.826077, "top": 51.073032, "bottom": -21.385712 }, "minScaleDenominator": 0, "maxScaleDenominator": 559082265, "temporalExtent": ["2016-02-18", "2016-02-18"] }]
}]
}
},
center: {
x: 850357,
y: 6204583
},
zoom: 14
});

const resolutions = [];
const matrixIds = [];
const proj3857 = ol.proj.get('EPSG:3857');
const maxResolution = ol.extent.getWidth(proj3857.getExtent()) / 256;

for (let i = 0; i < 20; i++) {
matrixIds[i] = i.toString();
resolutions[i] = maxResolution / Math.pow(2, i);
}

const tileGrid = new ol.tilegrid.WMTS({
origin: [-20037508, 20037508],
resolutions: resolutions,
matrixIds: matrixIds
});

var orthoSource = new ol.source.WMTS({
url: 'https://wxs.ign.fr/{{apikey3}}/geoportail/wmts',
layer: 'ORTHOIMAGERY.ORTHOPHOTOS',
matrixSet: 'PM',
format: 'image/jpeg',
projection: 'EPSG:3857',
tileGrid: tileGrid,
style: 'normal',
wrapX: true
});

var orthoLayer = new ol.layer.Tile({
source: orthoSource,
id: 'orthoIGN'
});

map.getLibMap().addLayer(orthoLayer);
function switchTo3D() {
map = map.switch2D3D("3d");
document.getElementById("BoutonSwitchToOl").style.display = "inline";
document.getElementById("BoutonSwitchToItowns").style.display = "none";
};

function switchTo2D() {
map = map.switch2D3D("2d");
document.getElementById("BoutonSwitchToItowns").style.display = "inline";
document.getElementById("BoutonSwitchToOl").style.display = "none";
};

</script>
{{/content}}
{{/extend}}
34 changes: 17 additions & 17 deletions scripts/release/package-SDK2D.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
{
"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/",
"LICENCE.md",
"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",
"webservice",
"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"
}
}
58 changes: 29 additions & 29 deletions scripts/release/package-SDK3D.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
{
"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/",
"LICENCE.md",
"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"
}
2 changes: 1 addition & 1 deletion src/Interface/IMapLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down
4 changes: 3 additions & 1 deletion src/OpenLayers/OlMapControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
30 changes: 21 additions & 9 deletions src/OpenLayers/OlMapLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 59e9f42

Please sign in to comment.