/* exported ShopOverlay */ /* globals AbstractIconOverlay: true */ 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] }); var ShopOverlay = AbstractIconOverlay.extend({ initialize: function(wsChannel, layerMgr) { AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "shop"); }, getMaxDisplayedZoom: function(){ return 10; }, getIcon: function(obj){ if (obj.attributes.stock > 0) return ShopIcon; else return ShopEmptyIcon; }, createPopup: function(obj){ return "

" + obj.attributes.type + "


" + "Owner: " + obj.attributes.owner + "
" + "Input: " + obj.attributes.in_count + " x " + obj.attributes.in_item + "
" + "Output: " + obj.attributes.out_count + " x " + obj.attributes.out_item + "
" + "Stock: " + obj.attributes.stock + "
"; } });