diff --git a/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js b/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js index 46e8a6d43509b3c1f1253e1d6daaddb5b2c8fa2d..9be86716daf868493c5aa935da9ca52f34e476e9 100644 --- a/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js @@ -169,7 +169,8 @@ AbstractDbOverlay.prototype.searchByQuery = function (originalQuery, perfect, fi return self.callListeners('onSearch', { fitBounds: fitBounds, identifiedElements: res, - type: AbstractDbOverlay.QueryType.SEARCH_BY_QUERY + type: AbstractDbOverlay.QueryType.SEARCH_BY_QUERY, + query: originalQuery }); }).then(function () { return res; diff --git a/frontend-js/src/main/js/minerva.js b/frontend-js/src/main/js/minerva.js index 4e73c0d76047515b4987e72906c172024363247c..177c948a91b7b029acae1a9c577ce6dcbcad7b08 100644 --- a/frontend-js/src/main/js/minerva.js +++ b/frontend-js/src/main/js/minerva.js @@ -351,7 +351,17 @@ function addUrlChangeListenersToCustomMap(customMap) { customMap.getSubmaps().forEach(function (submap) { submap.addListener("onCenterChanged", onCenterChangedHandler); submap.addListener("onZoomChanged", onZoomChangedHandler); - }) + }); + + customMap.getOverlayByName("search").addListener("onSearch", function (e) { + if (e.arg.type === AbstractDbOverlay.QueryType.SEARCH_BY_COORDINATES || + e.arg.type === AbstractDbOverlay.QueryType.SEARCH_BY_TARGET) { + console.log(e.arg); + } else if (e.arg.type === AbstractDbOverlay.QueryType.SEARCH_BY_QUERY) { + GuiConnector.setUrlParam("search", e.arg.query); + } + }); + } @@ -419,7 +429,6 @@ function create(params) { customMap = new CustomMap(params); - addUrlChangeListenersToCustomMap(customMap); new DbOverlayCollection({ map: customMap @@ -446,7 +455,6 @@ function create(params) { configuration: params.getConfiguration(), project: params.getProject() }); - addUrlChangeListenersToTopMenu(topMenu); legend = new Legend({ element: functions.getElementByName(element, "legendDiv"), @@ -483,6 +491,9 @@ function create(params) { }).then(function () { return mapContextMenu.init(); }).then(function () { + addUrlChangeListenersToCustomMap(customMap); + addUrlChangeListenersToTopMenu(topMenu); + if (GuiConnector.getParams["layout"] !== undefined) { var overlays = params.getProject().getDataOverlays(); for (var j = 0; j < overlays.length; j++) {