Skip to content

Commit

Permalink
Html getFeatureInfo response in query panel
Browse files Browse the repository at this point in the history
fixes #340
  • Loading branch information
raitisbe committed Oct 10, 2019
1 parent 3549305 commit 584f62b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions components/query/partials/infopanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
</div>
</div>
</div>
<div ng-repeat="html in data.featureInfoHtmls" ng-bind-html="html">
</div>
</div>
<iframe id="invisible_popup" style="display:block; z-index:12122;left:-10000px; position:absolute"></iframe>
</div>
7 changes: 7 additions & 0 deletions components/query/query-base.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default ['$rootScope', 'hs.map.service', 'Core', '$sce', 'config',
this.data = {};
this.data.attributes = [];
this.data.features = [];
this.data.featureInfoHtmls = [];
this.data.coordinates = [];
this.queryActive = false;
this.popupClassname = "";
Expand Down Expand Up @@ -74,6 +75,7 @@ export default ['$rootScope', 'hs.map.service', 'Core', '$sce', 'config',
me.data.attributes.length = 0;
me.data.features = [];
me.data.coordinates.length = 0;
me.data.featureInfoHtmls = [];
}
var invisiblePopup = me.getInvisiblePopup();
invisiblePopup.contentDocument.body.innerHTML = '';
Expand All @@ -86,6 +88,11 @@ export default ['$rootScope', 'hs.map.service', 'Core', '$sce', 'config',
return document.getElementById('invisible_popup');
}

this.pushFeatureInfoHtml = (html) => {
me.data.featureInfoHtmls.push($sce.trustAsHtml(html));
dataCleared = false;
}

this.fillIframeAndResize = function (iframe, response, append) {
var iframe = me.getInvisiblePopup();
if (append)
Expand Down
10 changes: 7 additions & 3 deletions components/query/query-wms.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export default ['$rootScope', '$http', '$sce', 'hs.query.baseService', 'hs.map.s
});
});
doc.querySelectorAll("featureMember").forEach(function ($this) {
debugger;
var feature = $this.firstChild;
var group = {
name: "Feature",
Expand Down Expand Up @@ -128,8 +127,13 @@ export default ['$rootScope', '$http', '$sce', 'hs.query.baseService', 'hs.map.s
}
if (infoFormat.indexOf("html") > 0) {
if (response.length <= 1) return;
Base.fillIframeAndResize(Base.getInvisiblePopup(), response, true);
if (layer.get('popupClass') != undefined) Base.popupClassname = "ol-popup " + layer.get('popupClass');
if(layer.get('getFeatureInfoTarget') == 'info-panel'){
Base.pushFeatureInfoHtml(response);
} else {
Base.fillIframeAndResize(Base.getInvisiblePopup(), response, true);
if (layer.get('popupClass') != undefined)
Base.popupClassname = "ol-popup " + layer.get('popupClass');
}
}
me.infoCounter--;
if (me.infoCounter === 0) {
Expand Down

0 comments on commit 584f62b

Please sign in to comment.