From a10fc92d888b1de5da72be8cfbaec1e8ef508396 Mon Sep 17 00:00:00 2001
From: Armand Bahi <armand.bahi@veremes.com>
Date: Fri, 1 Feb 2019 15:39:28 +0100
Subject: [PATCH] =?UTF-8?q?Bug=20param=C3=A8tres=20URL?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../app/vmap/mapmanager/layerstree.js         | 36 ++++++++++---------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/module_vmap/module/javascript/app/vmap/mapmanager/layerstree.js b/src/module_vmap/module/javascript/app/vmap/mapmanager/layerstree.js
index 593b84d2..120e98bd 100644
--- a/src/module_vmap/module/javascript/app/vmap/mapmanager/layerstree.js
+++ b/src/module_vmap/module/javascript/app/vmap/mapmanager/layerstree.js
@@ -464,23 +464,25 @@ nsVmap.nsMapManager.LayersTree.prototype.LayertreeController.prototype.loadTree
     }
 
     // Va à la position fournie
-    if (goog.isDefAndNotNull(oPositionOptions['lon']) &&
-        goog.isDefAndNotNull(oPositionOptions['lat']) &&
-        goog.isDefAndNotNull(oPositionOptions['zoom'])){
-
-        // Projette les coordonnées
-        var coordinates = [parseFloat(oPositionOptions['lon']), parseFloat(oPositionOptions['lat'])];
-        var projection = 'EPSG:4326';
-        var currentProjeciton = this['map'].getView().getProjection();
-        var projectedCoordinates = ol.proj.transform(coordinates, projection, currentProjeciton);
-
-        this['map'].getView().setCenter(projectedCoordinates);
-        this['map'].getView().setZoom(oPositionOptions['zoom']);
-    }
-    if (goog.isDefAndNotNull(oPositionOptions['extent'])) {
-        this['map'].getView().fit(oPositionOptions['extent'], {
-            nearest : true
-        });
+    if (goog.isDefAndNotNull(oPositionOptions)) {        
+        if (goog.isDefAndNotNull(oPositionOptions['lon']) &&
+            goog.isDefAndNotNull(oPositionOptions['lat']) &&
+            goog.isDefAndNotNull(oPositionOptions['zoom'])){
+
+            // Projette les coordonnées
+            var coordinates = [parseFloat(oPositionOptions['lon']), parseFloat(oPositionOptions['lat'])];
+            var projection = 'EPSG:4326';
+            var currentProjeciton = this['map'].getView().getProjection();
+            var projectedCoordinates = ol.proj.transform(coordinates, projection, currentProjeciton);
+
+            this['map'].getView().setCenter(projectedCoordinates);
+            this['map'].getView().setZoom(oPositionOptions['zoom']);
+        }
+        if (goog.isDefAndNotNull(oPositionOptions['extent'])) {
+            this['map'].getView().fit(oPositionOptions['extent'], {
+                nearest : true
+            });
+        }
     }
 };
 
-- 
GitLab