mapserver/public/js/map/overlays/ShopOverlay.js

42 lines
1.0 KiB
JavaScript
Raw Normal View History

2019-06-11 16:01:16 +03:00
import AbstractIconOverlay from './AbstractIconOverlay.js';
2019-04-14 20:58:59 +03:00
var ShopIcon = L.icon({
iconUrl: 'pics/shop.png',
iconSize: [32, 32],
iconAnchor: [16, 16],
popupAnchor: [0, -16]
});
var ShopEmptyIcon = L.icon({
iconUrl: 'pics/shop_empty.png',
iconSize: [32, 32],
iconAnchor: [16, 16],
popupAnchor: [0, -16]
});
2019-06-11 16:01:16 +03:00
export default AbstractIconOverlay.extend({
2019-09-18 12:53:58 +03:00
initialize: function() {
AbstractIconOverlay.prototype.initialize.call(this, "shop");
2019-04-14 20:58:59 +03:00
},
getMaxDisplayedZoom: function(){
2019-04-20 18:59:22 +03:00
return 10;
2019-04-14 20:58:59 +03:00
},
2019-04-14 22:35:59 +03:00
getIcon: function(obj){
if (obj.attributes.stock > 0)
return ShopIcon;
else
return ShopEmptyIcon;
},
createPopup: function(obj){
return "<h4>" + obj.attributes.type + "</h4><hr>" +
"<b>Owner: </b> " + obj.attributes.owner + "<br>" +
"<b>Input: </b> " + obj.attributes.in_count + " x " + obj.attributes.in_item + "<br>" +
"<b>Output: </b> " + obj.attributes.out_count + " x " + obj.attributes.out_item + "<br>" +
"<b>Stock: </b> " + obj.attributes.stock + "<br>";
2019-04-14 20:58:59 +03:00
}
});