diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8c1a85afb..decb5146b 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,4 +1,4 @@
-name: Build project ...
+name: Build
on:
pull_request:
diff --git a/.github/workflows/release-itowns.yml b/.github/workflows/release-itowns.yml
index b1c5677b2..f6e59798e 100644
--- a/.github/workflows/release-itowns.yml
+++ b/.github/workflows/release-itowns.yml
@@ -251,8 +251,8 @@ jobs:
- name: Reset draft changelog
run: |
sed -i -e '/# Extension Geoportail Itowns/{:a; N; /---/!ba; r .github/CHANGELOG_TEMPLATE.md' -e 'd;}' DRAFT_CHANGELOG.md
- sed -e 's/__UP_LIBRARY__/Itowns/' DRAFT_CHANGELOG.md
- sed -e 's/__LO_LIBRARY__/itowns/' DRAFT_CHANGELOG.md
+ sed -i '0,/__UP_LIBRARY__/s/__UP_LIBRARY__/Itowns/' DRAFT_CHANGELOG.md
+ sed -i '0,/__LO_LIBRARY__/s/__LO_LIBRARY__/itowns/' DRAFT_CHANGELOG.md
- name: Archive changelog
run: |
diff --git a/.github/workflows/release-leaflet.yml b/.github/workflows/release-leaflet.yml
index a3b664c3b..569a09a55 100644
--- a/.github/workflows/release-leaflet.yml
+++ b/.github/workflows/release-leaflet.yml
@@ -251,8 +251,8 @@ jobs:
- name: Reset draft changelog
run: |
sed -i -e '/# Extension Geoportail Leaflet/{:a; N; /---/!ba; r .github/CHANGELOG_TEMPLATE.md' -e 'd;}' DRAFT_CHANGELOG.md
- sed -e 's/__UP_LIBRARY__/Leaflet/' DRAFT_CHANGELOG.md
- sed -e 's/__LO_LIBRARY__/leaflet/' DRAFT_CHANGELOG.md
+ sed -i '0,/__UP_LIBRARY__/s/__UP_LIBRARY__/Leaflet/' DRAFT_CHANGELOG.md
+ sed -i '0,/__LO_LIBRARY__/s/__LO_LIBRARY__/leaflet/' DRAFT_CHANGELOG.md
- name: Archive changelog
run: |
diff --git a/.github/workflows/release-ol.yml b/.github/workflows/release-ol.yml
index 91e8bb304..1369a9efb 100644
--- a/.github/workflows/release-ol.yml
+++ b/.github/workflows/release-ol.yml
@@ -252,9 +252,9 @@ jobs:
# cf. http://fahdshariff.blogspot.com/2012/12/sed-mutli-line-replacement-between-two.html
- name: Reset draft changelog
run: |
- sed -i -e '/# Extension Geoportail OpenLayers/{:a; N; /---/!ba; r .github/CHANGELOG_TEMPLATE.md' -e 'd;}' DRAFT_CHANGELOG.md
- sed -e 's/__UP_LIBRARY__/OpenLayers/' DRAFT_CHANGELOG.md
- sed -e 's/__LO_LIBRARY__/openlayers/' DRAFT_CHANGELOG.md
+ sed -i '/# Extension Geoportail OpenLayers/{:a; N; /---/!ba; r .github/CHANGELOG_TEMPLATE.md' -e 'd;}' DRAFT_CHANGELOG.md
+ sed -i '0,/__UP_LIBRARY__/s/__UP_LIBRARY__/OpenLayers/' DRAFT_CHANGELOG.md
+ sed -i '0,/__LO_LIBRARY__/s/__LO_LIBRARY__/openlayers/' DRAFT_CHANGELOG.md
- name: Archive changelog
run: |
diff --git a/DRAFT_CHANGELOG.md b/DRAFT_CHANGELOG.md
index 1bce0b682..e43303716 100644
--- a/DRAFT_CHANGELOG.md
+++ b/DRAFT_CHANGELOG.md
@@ -1,8 +1,8 @@
-# Extension Geoportail __UP_LIBRARY__, version __VERSION__
+# Extension Geoportail OpenLayers, version __VERSION__
**__DATE__**
-> Release Extension Geoportail __LO_LIBRARY__
+> Release Extension Geoportail openLayers
## Summary
@@ -12,21 +12,26 @@
* [Changed]
+ - mise à jour de la jsDoc (95cff8206ef2e0fcfb7fee5989d2d74d236b9f9f)
+
* [Deprecated]
* [Removed]
* [Fixed]
+ - corrections des erreurs à partir de DeepScan (#288)
+ - corrections syntaxiques eslint (da275a284a07ddd8e32753eda57ad4ef283d34fb et 306506a2255b2f05558ddcb05210dce39135c804)
+
* [Security]
---
-# Extension Geoportail __UP_LIBRARY__, version __VERSION__
+# Extension Geoportail Leaflet, version __VERSION__
**__DATE__**
-> Release Extension Geoportail __LO_LIBRARY__
+> Release Extension Geoportail leaflet
## Summary
@@ -42,27 +47,29 @@
* [Fixed]
+ - corrections des erreurs à partir de DeepScan (#288)
+ - corrections syntaxiques eslint (da275a284a07ddd8e32753eda57ad4ef283d34fb et 306506a2255b2f05558ddcb05210dce39135c804)
+
* [Security]
---
-# Extension Geoportail Leaflet, version __VERSION__
+
+# Extension Geoportail Itowns, version __VERSION__
**__DATE__**
-> Release Extension Geoportail Leaflet
+> Release Extension Geoportail itowns
## Summary
-Nouveau widget de profil altimétrique par défaut, et correctif mineur
-
## Changelog
* [Added]
* [Changed]
- - nouvel affichage du profil altimétrique par défaut (DISPLAY_PROFILE_BY_DEFAULT)
+ - mise à jour d'iTowns en version 2.30 (#292)
* [Deprecated]
@@ -70,7 +77,10 @@ Nouveau widget de profil altimétrique par défaut, et correctif mineur
* [Fixed]
- - correctif sur l'export de la version en mode module
+ - corrections des erreurs à partir de DeepScan (#288)
+ - corrections syntaxiques eslint (da275a284a07ddd8e32753eda57ad4ef283d34fb et 306506a2255b2f05558ddcb05210dce39135c804)
+ - correction de la synchronisation des couches vecteur tuilé avec leurs labels (#290)
+
* [Security]
diff --git a/README.md b/README.md
index c81fbd122..2d0777b33 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
# Extensions Géoportail
-[![CeCILL License](https://img.shields.io/badge/licence-CeCILL--B-blue.svg)](https://raw.githubusercontent.com/IGNF/geoportal-extensions/master/LICENCE.md) [![Build Status](https://img.shields.io/travis/IGNF/geoportal-extensions/master.svg)](https://travis-ci.org/IGNF/geoportal-extensions)
+[![Build](https://github.com/IGNF/geoportal-extensions/actions/workflows/build.yml/badge.svg)](https://github.com/IGNF/geoportal-extensions/actions/workflows/build.yml)
+[![CeCILL License](https://img.shields.io/badge/licence-CeCILL--B-blue.svg)](https://raw.githubusercontent.com/IGNF/geoportal-extensions/master/LICENCE.md)
+[![DeepScan grade](https://deepscan.io/api/teams/12425/projects/15469/branches/309621/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=12425&pid=15469&bid=309621)
Ce projet a pour but de fournir des extensions facilitant l'accès aux ressources de la plateforme Géoportail pour les bibliothèques cartographiques Leaflet, OpenLayers (versions 3 et supérieures) et iTowns.
diff --git a/build/scripts/release/geoportal-extensions-itowns-2.3.0.tgz b/build/scripts/release/geoportal-extensions-itowns-2.3.0.tgz
deleted file mode 100644
index 00351bac3..000000000
Binary files a/build/scripts/release/geoportal-extensions-itowns-2.3.0.tgz and /dev/null differ
diff --git a/build/scripts/release/geoportal-extensions-itowns-2.3.1.tgz b/build/scripts/release/geoportal-extensions-itowns-2.3.1.tgz
new file mode 100644
index 000000000..86a331151
Binary files /dev/null and b/build/scripts/release/geoportal-extensions-itowns-2.3.1.tgz differ
diff --git a/build/scripts/release/geoportal-extensions-openlayers-3.0.13.tgz b/build/scripts/release/geoportal-extensions-openlayers-3.0.13.tgz
deleted file mode 100644
index 89b0bbc3f..000000000
Binary files a/build/scripts/release/geoportal-extensions-openlayers-3.0.13.tgz and /dev/null differ
diff --git a/build/scripts/release/geoportal-extensions-openlayers-3.0.14.tgz b/build/scripts/release/geoportal-extensions-openlayers-3.0.14.tgz
new file mode 100644
index 000000000..e7a7fc635
Binary files /dev/null and b/build/scripts/release/geoportal-extensions-openlayers-3.0.14.tgz differ
diff --git a/build/scripts/release/package-itowns.json b/build/scripts/release/package-itowns.json
index d63aef024..d8a84cc59 100644
--- a/build/scripts/release/package-itowns.json
+++ b/build/scripts/release/package-itowns.json
@@ -1,20 +1,6 @@
{
- "main" : "dist/GpPluginItowns-src.js",
- "scripts" : {},
- "module" : "src/Itowns/index.js",
- "dependencies" : {
- "proj4" : "2.6.2",
- "itowns" : "2.27.0",
- "xmldom" : "^0.1.27",
- "geoportal-access-lib" : "2.1.6",
- "request" : "^2.83.0",
- "three" : "0.121.1",
- "loglevel" : "1.6.6",
- "sortablejs" : "1.8.4"
- },
- "author" : "IGNF",
- "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-itowns.html",
- "bugs" : {},
+ "directories" : {},
+ "name" : "geoportal-extensions-itowns",
"files" : [
"dist/",
"src/",
@@ -22,15 +8,28 @@
"README.md",
"package.json"
],
- "license" : "CECILL-B",
- "version" : "2.3.0",
+ "bugs" : {},
"repository" : {
"url" : "https://github.com/IGNF/geoportal-extensions.git",
"type" : "git"
},
- "description" : "French Geoportal Extensions for iTowns",
+ "module" : "src/Itowns/index.js",
+ "dependencies" : {
+ "three" : "0.124.0",
+ "loglevel" : "1.6.6",
+ "sortablejs" : "1.8.4",
+ "itowns" : "2.30.0",
+ "geoportal-access-lib" : "2.1.6",
+ "xmldom" : "^0.1.27",
+ "request" : "^2.83.0",
+ "proj4" : "2.7.0"
+ },
+ "date" : "12/02/2021",
+ "main" : "dist/GpPluginItowns-src.js",
+ "peerDependencies" : {},
+ "scripts" : {},
"bundleDependencies" : [],
- "directories" : {},
+ "version" : "2.3.1",
"keywords" : [
"geoportail",
"plugin",
@@ -38,7 +37,8 @@
"Itowns"
],
"devDependencies" : {},
- "peerDependencies" : {},
- "date" : "09/12/2020",
- "name" : "geoportal-extensions-itowns"
+ "description" : "French Geoportal Extensions for iTowns",
+ "author" : "IGNF",
+ "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-itowns.html",
+ "license" : "CECILL-B"
}
diff --git a/build/scripts/release/package-openlayers.json b/build/scripts/release/package-openlayers.json
index 48395e4a7..e11391813 100644
--- a/build/scripts/release/package-openlayers.json
+++ b/build/scripts/release/package-openlayers.json
@@ -1,38 +1,39 @@
{
- "devDependencies" : {},
- "name" : "geoportal-extensions-openlayers",
- "peerDependencies" : {},
- "module" : "src/OpenLayers/index.js",
- "directories" : {},
- "description" : "French Geoportal Extensions for OpenLayers",
- "version" : "3.0.13",
+ "dependencies" : {
+ "proj4" : "2.6.0",
+ "geoportal-access-lib" : "2.1.6",
+ "xmldom" : "^0.1.27",
+ "sortablejs" : "1.8.4",
+ "request" : "^2.83.0",
+ "ol" : "5.3.0",
+ "@mapbox/mapbox-gl-style-spec" : "13.11.0",
+ "loglevel" : "1.6.6",
+ "eventbusjs" : "0.2.0",
+ "ol-mapbox-style" : "4.2.1"
+ },
"keywords" : [
"geoportail",
"plugin",
"javascript",
"OpenLayers"
],
+ "scripts" : {},
+ "name" : "geoportal-extensions-openlayers",
+ "author" : "IGNF",
+ "bugs" : {},
+ "description" : "French Geoportal Extensions for OpenLayers",
+ "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-openlayers.html",
+ "date" : "12/02/2021",
+ "module" : "src/OpenLayers/index.js",
"license" : "CECILL-B",
+ "main" : "dist/GpPluginOpenLayers-src.js",
+ "directories" : {},
"repository" : {
"type" : "git",
"url" : "https://github.com/IGNF/geoportal-extensions.git"
},
- "dependencies" : {
- "ol" : "5.3.0",
- "sortablejs" : "1.8.4",
- "@mapbox/mapbox-gl-style-spec" : "13.11.0",
- "proj4" : "2.6.0",
- "loglevel" : "1.6.6",
- "xmldom" : "^0.1.27",
- "eventbusjs" : "0.2.0",
- "geoportal-access-lib" : "2.1.6",
- "request" : "^2.83.0",
- "ol-mapbox-style" : "4.2.1"
- },
"bundleDependencies" : [],
- "main" : "dist/GpPluginOpenLayers-src.js",
- "scripts" : {},
- "bugs" : {},
+ "peerDependencies" : {},
"files" : [
"dist/",
"src/",
@@ -40,7 +41,6 @@
"README.md",
"package.json"
],
- "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-openlayers.html",
- "author" : "IGNF",
- "date" : "09/12/2020"
+ "devDependencies" : {},
+ "version" : "3.0.14"
}
diff --git a/doc/CHANGELOG-leaflet.md b/doc/CHANGELOG-leaflet.md
index b4126bac5..f9b89e954 100644
--- a/doc/CHANGELOG-leaflet.md
+++ b/doc/CHANGELOG-leaflet.md
@@ -51,6 +51,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Extension Geoportail Leaflet, version 2.1.7](#extension-geoportail-leaflet-version-217)
* [Summary](#summary-13)
* [Changelog](#changelog-10)
+- [Extension Geoportail Leaflet, version 2.1.8](#extension-geoportail-leaflet-version-218)
+ * [Summary](#summary-14)
+ * [Changelog](#changelog-11)
@@ -418,3 +421,31 @@ Mise à jour de Leaflet en version 1.7.1
* [Security]
---
+# Extension Geoportail Leaflet, version 2.1.8
+
+**12/02/2021**
+> Release Extension Geoportail Leaflet
+
+## Summary
+
+Nouveau widget de profil altimétrique par défaut, et correctif mineur
+
+## Changelog
+
+* [Added]
+
+* [Changed]
+
+ - nouvel affichage du profil altimétrique par défaut (DISPLAY_PROFILE_BY_DEFAULT)
+
+* [Deprecated]
+
+* [Removed]
+
+* [Fixed]
+
+ - correctif sur l'export de la version en mode module
+
+* [Security]
+
+---
diff --git a/doc/README-itowns.md b/doc/README-itowns.md
index bd703cf35..4e2767cf6 100644
--- a/doc/README-itowns.md
+++ b/doc/README-itowns.md
@@ -317,7 +317,7 @@ Gp.Services.getConfig(...)
### Versions d'iTowns supportées
-La dernière version de l'extension Géoportail pour iTowns peut s'utiliser avec la **version 2.15.3** d'iTowns. [Cliquer ici](https://github.com/iTowns/itowns/releases/) pour télécharger directement la version 2.15.3 de la librairie iTowns. [Cliquer ici](https://www.npmjs.com/package/itowns?activeTab=readme) pour accéder à la page du package npm iTowns.
+La dernière version de l'extension Géoportail pour iTowns peut s'utiliser avec la **version 2.27.0** d'iTowns. [Cliquer ici](https://github.com/iTowns/itowns/releases/) pour télécharger directement la version 2.27.0 de la librairie iTowns. [Cliquer ici](https://www.npmjs.com/package/itowns?activeTab=readme) pour accéder à la page du package npm iTowns.
### Navigateurs supportés
diff --git a/package.json b/package.json
index cc622b3c8..ad17303e3 100644
--- a/package.json
+++ b/package.json
@@ -1,14 +1,14 @@
{
"name": "geoportal-extensions",
"description": "French Geoportal Extensions for OpenLayers, Leaflet and iTowns libraries",
- "version": "2.3.2",
- "date": "12/02/2021",
+ "version": "2.3.3",
+ "date": "30/03/2021",
"leafletExtName": "French Geoportal Extension for Leaflet",
"leafletExtVersion": "2.1.8",
"olExtName": "French Geoportal Extension for OpenLayers",
"olExtVersion": "3.0.14",
"itownsExtName": "French Geoportal Extension for Itowns",
- "itownsExtVersion": "2.3.1",
+ "itownsExtVersion": "2.3.2",
"main": "dist/leaflet/GpPluginLeaflet.js, dist/openlayers/GpPluginOpenLayers.js, dist/itowns/GpPluginItowns.js",
"module": "src/Leaflet/index.js, src/OpenLayers/index.js, src/Itowns/index.js",
"directories": {},
@@ -67,17 +67,17 @@
"@mapbox/mapbox-gl-style-spec": "13.11.0",
"eventbusjs": "0.2.0",
"geoportal-access-lib": "2.1.7",
- "itowns": "2.27.0",
+ "itowns": "2.30.0",
"leaflet": "1.7.1",
"leaflet-draw": "1.0.4",
"loglevel": "^1.6.7",
"markdown-toc": "^1.2.0",
"ol": "5.3.0",
"ol-mapbox-style": "4.2.1",
- "proj4": "^2.6.2",
+ "proj4": "2.7.0",
"proj4leaflet": "1.0.2",
"sortablejs": "1.8.4",
- "three": "^0.121.1",
+ "three": "0.124.0",
"whatwg-fetch": "3.0.0"
},
"devDependencies": {
diff --git a/src/Common/Controls/MousePositionDOM.js b/src/Common/Controls/MousePositionDOM.js
index e24ce7352..4c1f2feb9 100644
--- a/src/Common/Controls/MousePositionDOM.js
+++ b/src/Common/Controls/MousePositionDOM.js
@@ -831,7 +831,7 @@ var MousePositionDOM = {
*/
GPdisplayCoords : function (coordinate) {
// Compute coords in case of cursor position (desktop)
- if (coordinate && coordinate != null) {
+ if (coordinate) {
var labelLon = document.getElementById(this._addUID("GPmousePositionLonLabel"));
var labelLat = document.getElementById(this._addUID("GPmousePositionLatLabel"));
@@ -911,7 +911,7 @@ var MousePositionDOM = {
var minThreshold = noDataValue - noDataValueTolerance;
// Compute coords in case of cursor position (desktop)
- if (coordinate && coordinate != null) {
+ if (coordinate) {
// If no altitude panel, don't call altitude request
if (document.getElementById(this._addUID("GPmousePositionAltitude"))) {
altitudeTimeout = setTimeout(function () {
diff --git a/src/Common/Controls/ProfileElevationPathDOM.js b/src/Common/Controls/ProfileElevationPathDOM.js
index c78d8a411..fa66fd1d0 100644
--- a/src/Common/Controls/ProfileElevationPathDOM.js
+++ b/src/Common/Controls/ProfileElevationPathDOM.js
@@ -106,17 +106,19 @@ var ProfileElevationPathDOM = {
displayProfileByDefault : function (data, container, context, className) {
var self = context;
- // on nettoie toujours...
- if (container) {
- while (container.firstChild) {
- container.removeChild(container.firstChild);
- }
+ if (!container) {
+ return;
}
if (!data) {
return;
}
+ // on nettoie toujours...
+ while (container.firstChild) {
+ container.removeChild(container.firstChild);
+ }
+
const margin = {
top : 25,
right : 15,
@@ -639,14 +641,16 @@ var ProfileElevationPathDOM = {
* @returns {DOMElement} profil container
*/
displayProfileRaw : function (data, container, context, className) {
+ if (!container) {
+ return;
+ }
+
// on nettoie toujours...
- if (container) {
- while (container.firstChild) {
- container.removeChild(container.firstChild);
- }
+ while (container.firstChild) {
+ container.removeChild(container.firstChild);
}
- var _points = data.points;
+ var _points = (data && data.points) ? data.points : {};
var div = document.createElement("textarea");
div.id = "profilElevationResults";
@@ -686,11 +690,17 @@ var ProfileElevationPathDOM = {
displayProfileLibD3 : function (data, container, context, className) {
var self = context;
+ if (!container) {
+ return;
+ }
+
+ if (!data) {
+ return;
+ }
+
// on nettoie toujours...
- if (container) {
- while (container.firstChild) {
- container.removeChild(container.firstChild);
- }
+ while (container.firstChild) {
+ container.removeChild(container.firstChild);
}
var _points = data.points;
@@ -916,6 +926,14 @@ var ProfileElevationPathDOM = {
displayProfileLibAmCharts : function (data, container, context, className) {
var self = context;
+ if (!container) {
+ return;
+ }
+
+ if (!data) {
+ return;
+ }
+
var _points = data.points;
var ballonText = "[[title]] : [[value]]m
";
diff --git a/src/Common/Utils/AutoLoadConfig.js b/src/Common/Utils/AutoLoadConfig.js
index 36122b19b..d8143602d 100644
--- a/src/Common/Utils/AutoLoadConfig.js
+++ b/src/Common/Utils/AutoLoadConfig.js
@@ -7,7 +7,7 @@ import Gp from "geoportal-access-lib";
// in case of several keys
if (key) {
var splitKeys = key.split(/;|,|\|/);
- if (key && splitKeys.length > 1) {
+ if (splitKeys.length > 1) {
var keys = [];
for (var i = 0; i < splitKeys.length; i++) {
keys.push(splitKeys[i]);
diff --git a/src/Common/Utils/CheckRightManagement.js b/src/Common/Utils/CheckRightManagement.js
index e6c2a1b16..e23f983b1 100644
--- a/src/Common/Utils/CheckRightManagement.js
+++ b/src/Common/Utils/CheckRightManagement.js
@@ -35,7 +35,7 @@ export default {
// si aucune information sur les ressources,
// il est impossible de controler quelquechose !!!
- if (!_resources || _resources.length === 0) {
+ if (_resources.length === 0) {
// message orienté pour le developpeur !
logger.error("WARNING : " +
"no parameter 'resources' specified !");
@@ -44,7 +44,7 @@ export default {
// si aucune information sur les services,
// il est impossible de controler quelquechose !!!
- if (!_services || _services.length === 0) {
+ if (_services.length === 0) {
// message orienté pour le developpeur !
logger.error("WARNING : " +
"no parameter 'services' specified !");
@@ -152,7 +152,7 @@ export default {
}
}
- if (!_rightManagement || Object.keys(_rightManagement).length === 0) {
+ if (Object.keys(_rightManagement).length === 0) {
logger.warn("WARNING : " +
"The contract key configuration has been loaded, " +
"and the 'apiKey' parameter has been set, " +
diff --git a/src/Common/Utils/LayerUtils.js b/src/Common/Utils/LayerUtils.js
index 477f76da9..a49267540 100644
--- a/src/Common/Utils/LayerUtils.js
+++ b/src/Common/Utils/LayerUtils.js
@@ -217,7 +217,7 @@ var LayerUtils = {
}
// max zoom constraints
- if (drawLogo && maxZoomLevel !== null && (maxZoomLevel < zoom)) {
+ if (drawLogo && maxZoomLevel && (maxZoomLevel < zoom)) {
drawLogo = false;
}
diff --git a/src/Itowns/Controls/Attributions.js b/src/Itowns/Controls/Attributions.js
index 315ade0df..e935c19fb 100644
--- a/src/Itowns/Controls/Attributions.js
+++ b/src/Itowns/Controls/Attributions.js
@@ -36,7 +36,7 @@ function Attributions (aOptions) {
throw new TypeError("ERROR CLASS_CONSTRUCTOR");
}
- if (options && typeof options !== "object") {
+ if (typeof options !== "object") {
throw new Error("ERROR WRONG_TYPE : options should be an object");
}
diff --git a/src/Itowns/Controls/BoostRelief.js b/src/Itowns/Controls/BoostRelief.js
index 36f05b60d..85a854be4 100644
--- a/src/Itowns/Controls/BoostRelief.js
+++ b/src/Itowns/Controls/BoostRelief.js
@@ -37,7 +37,7 @@ function BoostRelief (brOptions) {
throw new TypeError("ERROR CLASS_CONSTRUCTOR");
}
- if (options && typeof options !== "object") {
+ if (typeof options !== "object") {
throw new Error("ERROR WRONG_TYPE : options should be an object");
}
diff --git a/src/Itowns/Controls/LayerSwitcher.js b/src/Itowns/Controls/LayerSwitcher.js
index b251822c7..f49c44ff2 100644
--- a/src/Itowns/Controls/LayerSwitcher.js
+++ b/src/Itowns/Controls/LayerSwitcher.js
@@ -52,11 +52,11 @@ function LayerSwitcher (lsOptions) {
throw new TypeError("ERROR CLASS_CONSTRUCTOR");
}
- if (layers && !Array.isArray(layers)) {
+ if (!Array.isArray(layers)) {
throw new Error("ERROR WRONG_TYPE : layers should be an array");
}
- if (options && typeof options !== "object") {
+ if (typeof options !== "object") {
throw new Error("ERROR WRONG_TYPE : options should be an object");
}
@@ -316,7 +316,7 @@ LayerSwitcher.prototype.addLayer = function (layer, config) {
this._updateLayerListContainer();
// user may also add a new configuration for an already added layer
- } else if (this._layers[id] && config) {
+ } else {
// add new configuration parameters to layer informations
for (var prop in config) {
if (config.hasOwnProperty(prop)) {
@@ -799,11 +799,11 @@ LayerSwitcher.prototype._onDragAndDropLayerClick = function (e) {
}
var targetIndex = null;
- if (!e.newIndex || e.newIndex === 0) {
- targetIndex = globe.getColorLayers().length - 1;
- } else {
+ if (e.newIndex) {
var layerTargetID = this._resolveLayerId(e.from.childNodes[e.newIndex + (e.newIndex - e.oldIndex < 0 ? 1 : -1)].id);
targetIndex = globe.getLayerById(layerTargetID).sequence;
+ } else {
+ targetIndex = globe.getColorLayers().length - 1;
}
var layerID = this._resolveLayerId(e.item.id);
diff --git a/src/Itowns/Controls/MiniGlobe.js b/src/Itowns/Controls/MiniGlobe.js
index 8c4c21ac8..3b0f5ea34 100644
--- a/src/Itowns/Controls/MiniGlobe.js
+++ b/src/Itowns/Controls/MiniGlobe.js
@@ -24,7 +24,7 @@ function MiniGlobe (options) {
throw new TypeError("ERROR CLASS_CONSTRUCTOR");
}
- if (options && typeof options !== "object") {
+ if (typeof options !== "object") {
throw new Error("ERROR WRONG_TYPE : options should be an object");
}
diff --git a/src/Itowns/Controls/MousePosition.js b/src/Itowns/Controls/MousePosition.js
index ad4f24b2f..2b5eb3f7b 100644
--- a/src/Itowns/Controls/MousePosition.js
+++ b/src/Itowns/Controls/MousePosition.js
@@ -80,7 +80,7 @@ function MousePosition (options) {
throw new TypeError("ERROR CLASS_CONSTRUCTOR");
}
- if (options && typeof options !== "object") {
+ if (typeof options !== "object") {
throw new Error("ERROR WRONG_TYPE : options should be an object");
}
@@ -891,9 +891,9 @@ MousePosition.prototype._setCoordinate = function (coords) {
// transforms the point in the wanted coords system
var oSrs = this._currentProjectionSystems;
- var crsProp = oSrs.crs;
+ var crsProp = (oSrs) ? oSrs.crs : null;
- if (!oSrs || !crsProp) {
+ if (!crsProp) {
logger.error("system crs not found");
return;
}
@@ -1080,7 +1080,7 @@ MousePosition.prototype.onRequestAltitude = function (coordinate, callback) {
if (!options.rawResponse) {
// in the general case
options.onSuccess = function (results) {
- if (results && Object.keys(results)) {
+ if (results && Object.keys(results).length) {
callback.call(this, results.elevations[0].z);
}
};
@@ -1102,7 +1102,7 @@ MousePosition.prototype.onRequestAltitude = function (coordinate, callback) {
if (typeof this.options.ssl === "boolean") {
options.ssl = this.options.ssl;
}
-
+
Gp.Services.getAltitude(options);
};
diff --git a/src/Itowns/GlobeViewExtended.js b/src/Itowns/GlobeViewExtended.js
index 32610d4f1..49867b955 100644
--- a/src/Itowns/GlobeViewExtended.js
+++ b/src/Itowns/GlobeViewExtended.js
@@ -27,7 +27,7 @@ var logger = Logger.getLogger("GlobeViewExtended");
* @param {String} [options.position="relative"] - "absolute" or "relative"
*/
function GlobeViewExtended (viewerDiv, coordCarto, options) {
- if (!viewerDiv.style.position || (options & options.position)) {
+ if (!viewerDiv.style.position || (options && options.position)) {
viewerDiv.style.position = (!options || !options.position) ? "relative" : options.position;
}
@@ -338,6 +338,16 @@ GlobeViewExtended.prototype.setLayerOpacity = function (layerId, opacityValue) {
GlobeViewExtended.prototype.setLayerVisibility = function (layerId, visible) {
var layer = this.getColorLayerById(layerId);
layer.visible = visible;
+
+ // sync the vectorTiles layer visibility with its labels
+ if (layer.source.isVectorSource === true) {
+ if (layer.visible === true) {
+ layer.labelEnabled = true;
+ } else {
+ layer.labelEnabled = false;
+ }
+ }
+
this.getGlobeView().notifyChange(layer);
};
diff --git a/src/Itowns/Layer/LayerElevation.js b/src/Itowns/Layer/LayerElevation.js
index 887078424..b0162527d 100644
--- a/src/Itowns/Layer/LayerElevation.js
+++ b/src/Itowns/Layer/LayerElevation.js
@@ -60,7 +60,7 @@ function LayerElevation (options) {
var config = {};
var wmtsParams = Config.getLayerParams(options.layer, "WMTS", options.apiKey);
- if (wmtsParams.projection === "EPSG:3857" && wmtsParams.extent) {
+ if (wmtsParams.projection === "EPSG:3857") {
wmtsParams.extent = new ItExtent("EPSG:4326", wmtsParams.extent.left, wmtsParams.extent.right, wmtsParams.extent.bottom, wmtsParams.extent.top).as("EPSG:3857");
} else {
wmtsParams.projection = "EPSG:4326";
diff --git a/src/Itowns/Layer/LayerWMS.js b/src/Itowns/Layer/LayerWMS.js
index 245b0815d..f17156a7a 100644
--- a/src/Itowns/Layer/LayerWMS.js
+++ b/src/Itowns/Layer/LayerWMS.js
@@ -59,7 +59,7 @@ function LayerWMS (options) {
var config = {};
var wmsParams = Config.getLayerParams(options.layer, "WMS", options.apiKey);
- if (wmsParams.projection === "EPSG:3857" && wmsParams.extent) {
+ if (wmsParams.projection === "EPSG:3857") {
wmsParams.extent = new ItExtent("EPSG:4326", wmsParams.extent.left, wmsParams.extent.right, wmsParams.extent.bottom, wmsParams.extent.top).as("EPSG:3857");
} else {
wmsParams.extent = new ItExtent("EPSG:4326", wmsParams.extent.left, wmsParams.extent.right, wmsParams.extent.bottom, wmsParams.extent.top);
diff --git a/src/Itowns/Layer/LayerWMTS.js b/src/Itowns/Layer/LayerWMTS.js
index d068a13ba..c74174d3b 100644
--- a/src/Itowns/Layer/LayerWMTS.js
+++ b/src/Itowns/Layer/LayerWMTS.js
@@ -59,7 +59,7 @@ function LayerWMTS (options) {
var config = {};
var wmtsParams = Config.getLayerParams(options.layer, "WMTS", options.apiKey);
- if (wmtsParams.projection === "EPSG:3857" && wmtsParams.extent) {
+ if (wmtsParams.projection === "EPSG:3857") {
wmtsParams.extent = new ItExtent("EPSG:4326", wmtsParams.extent.left, wmtsParams.extent.right, wmtsParams.extent.bottom, wmtsParams.extent.top).as("EPSG:3857");
} else {
wmtsParams.projection = "EPSG:4326";
diff --git a/src/Leaflet/CRS/EPSG27572.js b/src/Leaflet/CRS/EPSG27572.js
index 89c757b11..38c43dd07 100644
--- a/src/Leaflet/CRS/EPSG27572.js
+++ b/src/Leaflet/CRS/EPSG27572.js
@@ -71,7 +71,7 @@ var EPSG27572 = {
// resolutions issues de l'autoconf
if (Config.isConfigLoaded()) {
var o = Config.getTileMatrix("LAMB2E");
- if (o && Object.keys(o)) {
+ if (o && Object.keys(o).length) {
resolutions = o.nativeResolutions;
}
}
diff --git a/src/Leaflet/Controls/ElevationPath.js b/src/Leaflet/Controls/ElevationPath.js
index 9d45cfc63..912709447 100644
--- a/src/Leaflet/Controls/ElevationPath.js
+++ b/src/Leaflet/Controls/ElevationPath.js
@@ -667,7 +667,7 @@ var ElevationPath = L.Control.extend(/** @lends L.geoportalControl.ElevationPath
var _sampling = options.sampling;
if (!_sampling) {
// computing sampling
- var _computeSampling = 50;
+ var _computeSampling;
var _length = this._currentFeature._measurementRunningTotal; // FIXME !!!
logger.trace("length", _length);
var p = Math.floor(_length) / 5; // en mètre sur un pas moyen de 5m !
diff --git a/src/Leaflet/Controls/LayerSwitcher.js b/src/Leaflet/Controls/LayerSwitcher.js
index c5f893303..cf6f48359 100644
--- a/src/Leaflet/Controls/LayerSwitcher.js
+++ b/src/Leaflet/Controls/LayerSwitcher.js
@@ -94,7 +94,7 @@ var LayerSwitcher = L.Control.Layers.extend(/** @lends L.geoportalControl.LayerS
// de titre ou description ...
// a ton une configuration des layers ?
- this._hasLayersConfig = !((!this.options.layers || Object.keys(this.options.layers).length === 0));
+ this._hasLayersConfig = !(!this.options.layers || Object.keys(this.options.layers).length === 0);
// configuration des layers
this._layersConfig = (this._hasLayersConfig) ? this.options.layers : [];
@@ -302,7 +302,7 @@ var LayerSwitcher = L.Control.Layers.extend(/** @lends L.geoportalControl.LayerS
};
// surcharge la config ci dessus avec les options de configuration saisies
- if (layerConfig && Object.keys(layerConfig)) {
+ if (layerConfig && Object.keys(layerConfig).length) {
L.Util.extend(this._layers[id], layerConfig);
}
@@ -506,11 +506,7 @@ var LayerSwitcher = L.Control.Layers.extend(/** @lends L.geoportalControl.LayerS
this._update();
}
- var type = (e.type === "layeradd") ? "overlayadd" : "overlayremove";
-
- if (type) {
- this._map.fire(type, obj);
- }
+ this._map.fire((e.type === "layeradd") ? "overlayadd" : "overlayremove", obj);
},
/**
diff --git a/src/Leaflet/Controls/Logo.js b/src/Leaflet/Controls/Logo.js
index 2f8c80e28..e5d8c2cfb 100644
--- a/src/Leaflet/Controls/Logo.js
+++ b/src/Leaflet/Controls/Logo.js
@@ -60,7 +60,7 @@ var Logo = L.Control.extend(/** @lends Logo.prototype */ {
var container = null;
container = L.DomUtil.create("div", "gp-control-logo", container);
- var bLink = !!((this.options.url || this.options.text));
+ var bLink = !!(this.options.url || this.options.text);
var link = null;
if (bLink) {
diff --git a/src/Leaflet/Controls/MousePosition.js b/src/Leaflet/Controls/MousePosition.js
index ac341525c..90648794c 100644
--- a/src/Leaflet/Controls/MousePosition.js
+++ b/src/Leaflet/Controls/MousePosition.js
@@ -886,7 +886,7 @@ var MousePosition = L.Control.extend(/** @lends L.geoportalControl.MousePosition
}
coordinate = format(this._project(oLatLng, oSrs));
- if (!coordinate || Object.keys(coordinate).lenght === 0) {
+ if (!coordinate || Object.keys(coordinate).length === 0) {
return;
}
@@ -1027,7 +1027,7 @@ var MousePosition = L.Control.extend(/** @lends L.geoportalControl.MousePosition
// callback onSuccess
onSuccess : function (results) {
logger.log(results);
- if (results && Object.keys(results)) {
+ if (results && Object.keys(results).length) {
// var context = this.options.scope;
// context._setAltidude(results.elevations[0].z);
callback.call(this, results.elevations[0].z);
diff --git a/src/Leaflet/Controls/ReverseGeocoding.js b/src/Leaflet/Controls/ReverseGeocoding.js
index faed7a581..575983b72 100644
--- a/src/Leaflet/Controls/ReverseGeocoding.js
+++ b/src/Leaflet/Controls/ReverseGeocoding.js
@@ -236,9 +236,7 @@ var ReverseGeocoding = L.Control.extend(/** @lends L.geoportalControl.ReverseGeo
this.options.apiKey = rightManagementGeocode.key;
}
- if (rightManagementGeocode) {
- this._servicesRightManagement["Geocode"] = rightManagementGeocode["Geocode"];
- }
+ this._servicesRightManagement["Geocode"] = rightManagementGeocode["Geocode"];
},
/**
@@ -253,35 +251,37 @@ var ReverseGeocoding = L.Control.extend(/** @lends L.geoportalControl.ReverseGeo
if (this.options.resources) {
var resources = this.options.resources;
// on vérifie que la liste des ressources de geocodage est bien un tableau
- if (!Array.isArray(resources)) {
+ if (Array.isArray(resources)) {
+ var resourcesList = ["StreetAddress", "PositionOfInterest", "CadastralParcel", "Administratif"];
+ for (i = 0; i < resources.length; i++) {
+ if (resourcesList.indexOf(resources[i]) === -1) {
+ // si la resource n'est pas référencée, on l'enlève
+ // resources.splice(i, 1);
+ logger.log("[ReverseGeocoding] options.resources : " + resources[i] + " is not a resource for reverse geocode");
+ }
+ }
+ } else {
logger.log("[ReverseGeocoding] 'options.resources' parameter should be an array");
resources = null;
}
- var resourcesList = ["StreetAddress", "PositionOfInterest", "CadastralParcel", "Administratif"];
- for (i = 0; i < resources.length; i++) {
- if (resourcesList.indexOf(resources[i]) === -1) {
- // si la resource n'est pas référencée, on l'enlève
- // resources.splice(i, 1);
- logger.log("[ReverseGeocoding] options.resources : " + resources[i] + " is not a resource for reverse geocode");
- }
- }
}
// et le tableau des délimitations
if (this.options.delimitations) {
var delimitations = this.options.delimitations;
// on vérifie que la liste des delimitations est bien un tableau
- if (!Array.isArray(delimitations)) {
+ if (Array.isArray(delimitations)) {
+ var delimitationsList = ["Circle", "Point", "Extent"];
+ for (i = 0; i < delimitations.length; i++) {
+ if (delimitationsList.indexOf(delimitations[i]) === -1) {
+ // si la delimitations n'est pas référencée, on l'enlève
+ // resources.splice(i, 1);
+ logger.log("[ReverseGeocoding] options.delimitations : " + delimitations[i] + " is not a delimitation for reverse geocode");
+ }
+ }
+ } else {
logger.log("[ReverseGeocoding] 'options.delimitations' parameter should be an array");
delimitations = null;
}
- var delimitationsList = ["Circle", "Point", "Extent"];
- for (i = 0; i < delimitations.length; i++) {
- if (delimitationsList.indexOf(delimitations[i]) === -1) {
- // si la delimitations n'est pas référencée, on l'enlève
- // resources.splice(i, 1);
- logger.log("[ReverseGeocoding] options.delimitations : " + delimitations[i] + " is not a delimitation for reverse geocode");
- }
- }
}
},
diff --git a/src/Leaflet/Controls/Route.js b/src/Leaflet/Controls/Route.js
index 1d06b3515..b7280d6f8 100644
--- a/src/Leaflet/Controls/Route.js
+++ b/src/Leaflet/Controls/Route.js
@@ -1033,7 +1033,7 @@ var Route = L.Control.extend(/** @lends L.geoportalControl.Route.prototype */ {
}
// existe t il une geometrie pour chaque troncon de route ?
- var bGeometryInstructions = (instructions[0].geometry.length !== 0);
+ var bGeometryInstructions = (instructions && Array.isArray(instructions) && instructions[0].geometry.length !== 0);
// Geometries des tronçon
if (instructions && bGeometryInstructions) {
diff --git a/src/Leaflet/Controls/SearchEngine.js b/src/Leaflet/Controls/SearchEngine.js
index 5fb7e65e4..2e76641bf 100644
--- a/src/Leaflet/Controls/SearchEngine.js
+++ b/src/Leaflet/Controls/SearchEngine.js
@@ -770,10 +770,8 @@ var SearchEngine = L.Control.extend(/** @lends L.geoportalControl.SearchEngine.p
// au cas où les options du services ne sont pas renseignées, on y ajoute
// les tables de ressources
- if (resources && L.Util.isArray(resources) && !options.filterOptions) {
- if (!options.filterOptions) {
- options.filterOptions = {};
- }
+ if (L.Util.isArray(resources) && !options.filterOptions) {
+ options.filterOptions = {};
options.filterOptions.type = resources;
}
@@ -880,10 +878,8 @@ var SearchEngine = L.Control.extend(/** @lends L.geoportalControl.SearchEngine.p
// au cas où les options du services ne sont pas renseignées, on y ajoute
// les tables de ressources
- if (resources && L.Util.isArray(resources) && !options.filterOptions) {
- if (!options.filterOptions) {
- options.filterOptions = {};
- }
+ if (L.Util.isArray(resources) && !options.filterOptions) {
+ options.filterOptions = {};
options.filterOptions.type = resources;
}
diff --git a/src/Leaflet/Layers/LayerEvent.js b/src/Leaflet/Layers/LayerEvent.js
index 421a83e59..ac436e7bc 100644
--- a/src/Leaflet/Layers/LayerEvent.js
+++ b/src/Leaflet/Layers/LayerEvent.js
@@ -130,9 +130,7 @@ var LayerEvent = {
}
// suppression des attributions de liste
- if (this._attributions) {
- this._attributions = [];
- }
+ this._attributions = [];
},
/**
diff --git a/src/Leaflet/Layers/Layers.js b/src/Leaflet/Layers/Layers.js
index 742428e0b..5e4228077 100644
--- a/src/Leaflet/Layers/Layers.js
+++ b/src/Leaflet/Layers/Layers.js
@@ -29,7 +29,7 @@ var Layers = {
* initialize options
*/
_initOptions : function () {
- if (!this.options || Object.keys(this.options) === 0) {
+ if (!this.options || Object.keys(this.options).length === 0) {
throw new Error("PARAM_MISSING : options !");
}
@@ -75,7 +75,7 @@ var Layers = {
service : service
});
- if (!this.params || Object.keys(this.params) === 0) {
+ if (!this.params || Object.keys(this.params).length === 0) {
this.params = {};
if (!this.options.apiKey) {
// FIXME on retire l'exception...
diff --git a/src/OpenLayers/Controls/Drawing.js b/src/OpenLayers/Controls/Drawing.js
index 9077b1b0f..1822b10ea 100644
--- a/src/OpenLayers/Controls/Drawing.js
+++ b/src/OpenLayers/Controls/Drawing.js
@@ -61,7 +61,7 @@ var logger = Logger.getLogger("Drawing");
* @param {Object} options - options for function call.
* @param {Boolean} [options.collapsed = true] - Specify if Drawing control should be collapsed at startup. Default is true.
* @param {Boolean} [options.draggable = false] - Specify if widget is draggable
- * @param {ol.layer.Vector} [options.layer = null] - Openlayers layer that will hosts created features. If none, an empty vector layer will be created.
+ * @param {Object} [options.layer = {}] - Openlayers layer that will hosts created features. If none, an empty vector layer will be created.
* @param {Object} [options.popup = {}] - Popup informations
* @param {Boolean} [options.popup.display = true] - Specify if popup is displayed when create a drawing
* @param {Function} [options.popup.function] - Function to display popup informations if you want to cutomise it. You may also provide your own function with params : {geomType / feature / saveFunc(message) / closeFunc()}. This function must return the DOM object of the popup content.
@@ -100,7 +100,7 @@ var logger = Logger.getLogger("Drawing");
* @param {String} [options.labels.strokeWidth] - Label for stroke width.
* @param {String} [options.labels.fillColor] - Label for fill color.
* @param {String} [options.labels.fillOpacity] - Label for fillOpacity.
- * @param {Array.