1
0
forked from MTSR/mapserver
mapserver/server/static/js/overlays/LabelOverlay.js
2019-04-04 10:49:55 +02:00

36 lines
862 B
JavaScript

/* exported LabelOverlay */
/* globals AbstractIconOverlay: true */
var LabelIcon = L.Icon.extend({
initialize: function(options) {
L.Icon.prototype.initialize.call(this, options);
},
createIcon: function() {
var div = document.createElement('div'),
options = this.options;
div.innerHTML = options.html || "";
return div;
}
});
var LabelOverlay = AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "label");
},
getIcon: function(lbl){
return new LabelIcon({
iconAnchor: [15, 50],
iconSize: [30, 100],
html: "<svg height='30' width='100'><text x='0' y='15'>" + lbl.attributes.text + "</text></svg>"
});
},
createPopup: function(lbl){
return "<p>" + lbl.attributes.text + "</p>";
}
});