From 2af121b89bc4dd7e17d49deccc3873fc0da21000 Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Sun, 14 Apr 2019 19:58:59 +0200 Subject: [PATCH] shop overlay wip --- server/static/js/Overlaysetup.js | 7 ++++++ server/static/js/overlays/ShopOverlay.js | 32 ++++++++++++++++++++++++ server/static/manifest.js | 1 + 3 files changed, 40 insertions(+) create mode 100644 server/static/js/overlays/ShopOverlay.js diff --git a/server/static/js/Overlaysetup.js b/server/static/js/Overlaysetup.js index 9c51b65..a9a5e02 100644 --- a/server/static/js/Overlaysetup.js +++ b/server/static/js/Overlaysetup.js @@ -17,6 +17,13 @@ function Overlaysetup(cfg, map, overlays, wsChannel, layerMgr){ } } + if (cfg.mapobjects.smartshop || cfg.mapobjects.fancyvend) { + overlays.Shop = new ShopOverlay(wsChannel, layerMgr); + if (cfg.defaultoverlays.indexOf("smartshop") >= 0 || cfg.defaultoverlays.indexOf("fancyvend") >= 0) { + map.addLayer(overlays.Shop); + } + } + if (cfg.mapobjects.mapserver_label) { overlays.Label = new LabelOverlay(wsChannel, layerMgr); if (cfg.defaultoverlays.indexOf("mapserver_label") >= 0) { diff --git a/server/static/js/overlays/ShopOverlay.js b/server/static/js/overlays/ShopOverlay.js new file mode 100644 index 0000000..472ef6f --- /dev/null +++ b/server/static/js/overlays/ShopOverlay.js @@ -0,0 +1,32 @@ +/* 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", ShopIcon); + }, + + getMaxDisplayedZoom: function(){ + return 5; + }, + + createPopup: function(poi){ + return "

" + poi.attributes.type + "


" + + "Owner: " + poi.attributes.owner + "
"; + } +}); diff --git a/server/static/manifest.js b/server/static/manifest.js index a485fd0..aded117 100644 --- a/server/static/manifest.js +++ b/server/static/manifest.js @@ -18,6 +18,7 @@ "/js/overlays/AbstractIconOverlay.js", "/js/overlays/AbstractGeoJsonOverlay.js", "/js/overlays/TravelnetOverlay.js", + "/js/overlays/ShopOverlay.js", "/js/overlays/PoiOverlay.js", "/js/overlays/LabelOverlay.js", "/js/overlays/PlayerOverlay.js",