Skip to content

Commit

Permalink
release sdk 3.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
elias75015 committed Feb 7, 2022
2 parents baa4a21 + 66a4b6d commit 13a72e8
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 24 deletions.
12 changes: 6 additions & 6 deletions DRAFT_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# SDK Geoportail 2D/3D, version 3.3.6
# SDK Geoportail 2D/3D, version 3.3.7

**28/01/2022 : version 3.3.6**
**07/02/2022 : version 3.3.7**

> Release SDK Geoportail 2D/3D
## Summary

Mise à jour de la documentation et des extensions geoportail pour openlayers en version 3.2.7
Corrections sur le centrage par geocodage et sur le rendu vecteur tuilé

## Changelog

* [Added]

* [Changed]

- Mise à jour de la documentation et des README (#88)
- Mise à jour des extensions geoportail pour openlayers en version 3.2.7

* [Removed]

* [Fixed]

- correction de la fonction de centrage par geocodage avec multiclés et autoconf local (#89)
- bug sur l'affichage du vecteur tuilé en superposition avec une autre couche (cf. <https://github.com/openlayers/openlayers/issues/9970>)

* [Deprecated]

* [Security]
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "geoportal-sdk",
"version": "3.3.6",
"date": "28/01/2022",
"SDK2DVersion": "3.3.6",
"SDK3DVersion": "3.3.6",
"version": "3.3.7",
"date": "07/02/2022",
"SDK2DVersion": "3.3.7",
"SDK3DVersion": "3.3.7",
"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
4 changes: 4 additions & 0 deletions samples-src/pages/2d/page-center-amd.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ <h2>Centrage dans une projection différente de celle de la carte.</h2>
Gp.Map.load('geoportalMap1',{
// apiKey : "{{apikey}}",
configUrl : "{{resources}}/autoconf.js",
zoom : 17,
center : {
location : "36 avenue d'Italie, paris"
},
mapEventsOptions : {
"mapLoaded" : function () {
loadMap2()
Expand Down
4 changes: 4 additions & 0 deletions samples-src/pages/2d/page-center-bundle.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ <h2>Centrage dans une projection différente de celle de la carte.</h2>
Gp.Map.load('geoportalMap1',{
// apiKey : "{{apikey}}",
configUrl : "{{resources}}/autoconf.js",
center : {
location : "36 avenue d'Italie, Paris"
},
zoom : 17,
mapEventsOptions : {
"mapLoaded" : function () {
loadMap2()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ <h1>Une carte affichant une couche MapBox (Plan IGN)</h1>
"layerimport" : {}
},
layersOptions : {
'GEOGRAPHICALGRIDSYSTEMS.MAPS': {
},
"ORTHOIMAGERY.ORTHOPHOTOS" : {},
'GEOGRAPHICALGRIDSYSTEMS.MAPS': {},
'PLAN.IGN.GEOPORTAIL' : {
format : "MapBox",
url : "{{resources}}/MAPBOX/styles/PLAN.IGN.GEOPORTAIL.json"
Expand Down
47 changes: 35 additions & 12 deletions src/Interface/IMapView.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,45 @@ IMap.prototype.centerGeocode = function (opts) {
// FIXME Config est créé en runtime dans la variable globale Gp
var scope = typeof window !== "undefined" ? window : {};
var Config = scope.Gp ? scope.Gp.Config : undefined;
var keys;

// le centrage par geocodage n'est possible que si l'utilisateur a les
// droits sur le service.
if (!Config || !this.apiKey) {
if (this.apiKey) {
// on transforme la liste de clés en tableau
this.logger.info("retrieve apiKeys from apiKey list");
keys = this.apiKey.split(",");
} else if (Config && Config.generalOptions && Config.generalOptions.apiKeys) {
this.logger.info("retrieve apiKeys from config");
keys = Object.keys(Config.generalOptions.apiKeys);
} else {
this.logger.info("no rights for geocoding services");
return;
}

// On cherche les types de géocodage disponibles
var layersIds = Config.getLayersId(this.apiKey);
var layersIds = {};

// si plusieurs clés en entrée, on récupère toutes les ressources par clé
for (var i = 0; i < keys.length; i++) {
layersIds[keys[i]] = Config.getLayersId(keys[i]);
}
var locTypes = opts.locationType || ["StreetAddress", "PositionOfInterest"];
var fo = {};
fo.type = [];
while (locTypes.length > 0) {
var lt = locTypes.pop();
if (layersIds.indexOf(lt + "$OGC:OPENLS;Geocode") >= 0) {
this.logger.trace("[IMap] centerGeocode : found rights for " + lt);
fo.type.push(lt);
fo.keys = [];
// pour chaque clé en entrée, on va vérifier à quelle ressource de géocodage elle a accès
var checkLocTypes;
for (var k = 0; k < keys.length; k++) {
checkLocTypes = locTypes.slice();
while (checkLocTypes.length > 0) {
var lt = checkLocTypes.pop();
if (layersIds[keys[k]].indexOf(lt + "$OGC:OPENLS;Geocode") >= 0) {
this.logger.trace("[IMap] centerGeocode : found rights for " + lt);
fo.type.push(lt);
// on récupère toutes les clés ayant accès à au moins une ressource de géocodage
fo.keys.push(keys[k]);
}
}
}
// Si on n'a rien trouve, on ne peut pas geocoder
Expand All @@ -39,8 +61,9 @@ IMap.prototype.centerGeocode = function (opts) {
return;
}
var map = this;
// On appelle le service de geocodage avec la première clé ayant accès à une ressource de géocodage
Services.geocode({
apiKey : this.apiKey,
apiKey : fo.keys[0],
location : opts.location,
filterOptions : fo,
// si le service de geocodage répond
Expand Down Expand Up @@ -345,8 +368,8 @@ IMap.prototype._getZoomFromResolution = function (resolution, projCode) {
this.logger.trace("[IMap] : _getZoomFromResolution");
var mapProj = this.getProjection();
var wmtsDefaults = IMap.WMTSDEFAULTS[projCode] ||
IMap.WMTSDEFAULTS[mapProj] ||
IMap.WMTSDEFAULTS["EPSG:3857"];
IMap.WMTSDEFAULTS[mapProj] ||
IMap.WMTSDEFAULTS["EPSG:3857"];

var zoom = 0;
var diffMin = Math.abs(wmtsDefaults.resolutions[0] - resolution);
Expand Down Expand Up @@ -376,8 +399,8 @@ IMap.prototype._getResolutionFromZoomLevel = function (zoom, projCode) {
this.logger.trace("[IMap] : _getResolutionFromZoomLevel");
var mapProj = this.getProjection();
var wmtsDefaults = IMap.WMTSDEFAULTS[projCode] ||
IMap.WMTSDEFAULTS[mapProj] ||
IMap.WMTSDEFAULTS["EPSG:3857"];
IMap.WMTSDEFAULTS[mapProj] ||
IMap.WMTSDEFAULTS["EPSG:3857"];
var res = -1;
if (zoom >= 0 && zoom < wmtsDefaults.resolutions.length) {
res = wmtsDefaults.resolutions[zoom];
Expand Down
3 changes: 3 additions & 0 deletions src/OpenLayers/OlMapVectorTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,7 @@ OlMap.prototype._addMapBoxLayer = function (layerObj) {
vectorSource._legends = _legends;
vectorSource._originators = _originators;
vectorLayer = new VectorTileLayer({
className : _title,
source : vectorSource,
visible : false,
zIndex : _position, // FIXME gerer l'ordre sur des multisources ?
Expand All @@ -1247,6 +1248,7 @@ OlMap.prototype._addMapBoxLayer = function (layerObj) {
// featureClass : RenderFeature
});
vectorLayer = new VectorTileLayer({
className : _title,
visible : false,
zIndex : _position,
declutter : true // utile ? option ?
Expand Down Expand Up @@ -1483,6 +1485,7 @@ OlMap.prototype._addMapBoxLayer = function (layerObj) {
vectorSource._legends = _legends;
vectorSource._originators = _originators;
vectorLayer = new VectorTileLayer({
className : _title,
source : vectorSource,
visible : false,
zIndex : _position, // FIXME gerer l'ordre sur des multisources ?
Expand Down

0 comments on commit 13a72e8

Please sign in to comment.