From 0dc8fec9a2cc24ad099f0d31e1464fac124dc136 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 21 Nov 2016 11:58:36 +0100 Subject: ol3: display specific marker not present on the map (useful for permalink) --- chimere/static/chimere/js/jquery.chimere.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 4461297..294c5dc 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -1550,12 +1550,17 @@ function transformCoordToLonLat(coord) { } }, */ - loadMarker: function(object_id) { + loadMarker: function(object_id, open_popup) { var uri = extra_url + "get-marker/" + object_id; $.ajax({url: uri, dataType: "json", success: function (data) { - for (idx in data) methods.addMarker(data[idx]); + var c_feat = null; + for (idx in data){ + c_feat = methods.addMarker(data[idx]); + } + if (c_feat && open_popup != 'undefined' && open_popup) + methods.openPopup(c_feat); } }); }, @@ -1596,7 +1601,7 @@ function transformCoordToLonLat(coord) { if (settings.enable_clustering){ settings.clusterSource.getSource().clear(); } - if (!data.features) return; + if (!data.features) data.features = []; if (data.zoom_need_reload){ settings._zoom_need_reload = data.zoom_need_reload; } @@ -3124,6 +3129,10 @@ function transformCoordToLonLat(coord) { return true } } + // only manage marker for now + if (feature_pk.substring(0, 7) == "marker-"){ + var feat = methods.loadMarker(feature_pk.substring(7), true); + } return false; //feature.markerClick(); //OpenLayers.Popup.popupSelect.clickFeature(feature); -- cgit v1.2.3