1
0
forked from MTSR/mapserver
mapserver/server/static/js/Overlaysetup.js

146 lines
4.7 KiB
JavaScript
Raw Normal View History

2019-04-04 11:19:29 +03:00
/* jshint undef: false */
/* exported Overlaysetup */
2019-02-15 14:47:43 +03:00
function Overlaysetup(cfg, map, overlays, wsChannel, layerMgr){
2019-04-04 13:50:40 +03:00
if (cfg.mapobjects.mapserver_player) {
2019-04-04 11:19:29 +03:00
overlays.Player = new PlayerOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("mapserver_player") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.Player);
}
}
if (cfg.mapobjects.mapserver_poi) {
2019-04-04 11:19:29 +03:00
overlays.POI = new PoiOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("mapserver_poi") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.POI);
}
}
2019-04-14 20:58:59 +03:00
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);
}
}
2019-04-04 13:50:40 +03:00
if (cfg.mapobjects.mapserver_label) {
2019-04-04 11:19:29 +03:00
overlays.Label = new LabelOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("mapserver_label") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.Label);
}
}
2019-02-15 14:47:43 +03:00
2019-04-04 13:50:40 +03:00
if (cfg.mapobjects.mapserver_trainline) {
overlays.Trainlines = new TrainlineOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("mapserver_trainline") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.Trainlines);
}
}
if (cfg.mapobjects.mapserver_border) {
overlays.Border = new BorderOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("mapserver_border") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.Border);
}
2019-02-15 14:47:43 +03:00
}
if (cfg.mapobjects.travelnet) {
2019-04-04 11:19:29 +03:00
overlays.Travelnet = new TravelnetOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("travelnet") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.Travelnet);
}
2019-02-15 14:47:43 +03:00
}
if (cfg.mapobjects.bones) {
2019-04-04 11:19:29 +03:00
overlays.Bones = new BonesOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("bones") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.Bones);
}
2019-02-15 14:47:43 +03:00
}
if (cfg.mapobjects.digilines) {
overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("digilines") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays["Digilines LCD"]);
}
2019-02-15 14:47:43 +03:00
}
if (cfg.mapobjects.digiterms) {
2019-04-04 11:19:29 +03:00
overlays.Digiterms = new DigitermOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("digiterms") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.Digiterms);
}
2019-02-15 14:47:43 +03:00
}
if (cfg.mapobjects.luacontroller) {
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("luacontroller") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays["Lua Controller"]);
}
2019-02-15 14:47:43 +03:00
}
2019-04-04 13:50:40 +03:00
if (cfg.mapobjects.technic_anchor) {
2019-02-15 14:47:43 +03:00
overlays["Technic Anchor"] = new TechnicAnchorOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("technic_anchor") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays["Technic Anchor"]);
}
}
if (cfg.mapobjects.technic_quarry) {
2019-02-15 14:47:43 +03:00
overlays["Technic Quarry"] = new TechnicQuarryOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("technic_quarry") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays["Technic Quarry"]);
}
}
if (cfg.mapobjects.technic_switch) {
2019-02-15 14:47:43 +03:00
overlays["Technic Switching station"] = new TechnicSwitchOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("technic_switch") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays["Technic Switching station"]);
}
2019-02-15 14:47:43 +03:00
}
if (cfg.mapobjects.protector) {
2019-04-04 11:19:29 +03:00
overlays.Protector = new ProtectorOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("protector") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.Protector);
}
2019-02-15 14:47:43 +03:00
}
if (cfg.mapobjects.xpprotector) {
overlays["XP Protector"] = new XPProtectorOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("xpprotector") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays["XP Protector"]);
}
}
if (cfg.mapobjects.privprotector) {
overlays["Priv Protector"] = new PrivProtectorOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("privprotector") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays["Priv Protector"]);
}
}
2019-02-15 14:47:43 +03:00
if (cfg.mapobjects.mission) {
2019-04-04 11:19:29 +03:00
overlays.Missions = new MissionOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("mission") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.Missions);
}
2019-02-15 14:47:43 +03:00
}
2019-02-24 22:06:20 +03:00
if (cfg.mapobjects.train) {
2019-04-04 11:19:29 +03:00
overlays.Trains = new TrainOverlay(wsChannel, layerMgr);
2019-04-04 18:53:21 +03:00
if (cfg.defaultoverlays.indexOf("train") >= 0) {
2019-04-04 13:50:40 +03:00
map.addLayer(overlays.Trains);
}
2019-02-24 22:06:20 +03:00
}
2019-04-24 17:21:04 +03:00
if (cfg.mapobjects.minecart) {
overlays.Minecart = new MinecartOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("minecart") >= 0) {
map.addLayer(overlays.Minecart);
}
}
2019-02-15 14:47:43 +03:00
}