mapserver/static/js/Overlaysetup.js

185 lines
5.6 KiB
JavaScript
Raw Normal View History

2019-06-11 16:01:16 +03:00
import PlayerOverlay from './overlays/PlayerOverlay.js';
import PoiOverlay from './overlays/PoiOverlay.js';
import ShopOverlay from './overlays/ShopOverlay.js';
import LabelOverlay from './overlays/LabelOverlay.js';
import TrainlineOverlay from './overlays/TrainlineOverlay.js';
import TravelnetOverlay from './overlays/TravelnetOverlay.js';
import BonesOverlay from './overlays/BonesOverlay.js';
import LcdOverlay from './overlays/LcdOverlay.js';
import DigitermOverlay from './overlays/DigitermOverlay.js';
import LuacontrollerOverlay from './overlays/LuacontrollerOverlay.js';
import TechnicAnchorOverlay from './overlays/TechnicAnchorOverlay.js';
import TechnicQuarryOverlay from './overlays/TechnicQuarryOverlay.js';
import TechnicSwitchOverlay from './overlays/TechnicSwitchOverlay.js';
import ProtectorOverlay from './overlays/ProtectorOverlay.js';
import XPProtectorOverlay from './overlays/XPProtectorOverlay.js';
import PrivProtectorOverlay from './overlays/PrivProtectorOverlay.js';
import MissionOverlay from './overlays/MissionOverlay.js';
import MinecartOverlay from './overlays/MinecartOverlay.js';
import ATMOverlay from './overlays/ATMOverlay.js';
import LocatorOverlay from './overlays/LocatorOverlay.js';
import BorderOverlay from './overlays/BorderOverlay.js';
import TrainOverlay from './overlays/TrainOverlay.js';
export default function(cfg, map, overlays, wsChannel, layerMgr){
function isDefault(key){
return cfg.defaultoverlays.indexOf(key) >= 0;
}
if (cfg.mapobjects.mapserver_player) {
overlays.Player = new PlayerOverlay(wsChannel, layerMgr);
if (isDefault("mapserver_player")) {
map.addLayer(overlays.Player);
2019-04-04 13:50:40 +03:00
}
2019-06-11 16:01:16 +03:00
}
if (cfg.mapobjects.mapserver_poi) {
overlays.POI = new PoiOverlay(wsChannel, layerMgr);
if (isDefault("mapserver_poi")) {
map.addLayer(overlays.POI);
2019-04-04 13:50:40 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-04-04 13:50:40 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.smartshop || cfg.mapobjects.fancyvend) {
overlays.Shop = new ShopOverlay(wsChannel, layerMgr);
if (isDefault("smartshop") || isDefault("fancyvend")) {
map.addLayer(overlays.Shop);
2019-04-14 20:58:59 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-04-14 20:58:59 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.mapserver_label) {
overlays.Label = new LabelOverlay(wsChannel, layerMgr);
if (isDefault("mapserver_label")) {
map.addLayer(overlays.Label);
2019-04-04 13:50:40 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-02-15 14:47:43 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.mapserver_trainline) {
overlays.Trainlines = new TrainlineOverlay(wsChannel, layerMgr);
if (isDefault("mapserver_trainline")) {
map.addLayer(overlays.Trainlines);
2019-04-04 13:50:40 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-04-04 13:50:40 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.mapserver_border) {
overlays.Border = new BorderOverlay(wsChannel, layerMgr);
if (isDefault("mapserver_border")) {
map.addLayer(overlays.Border);
2019-02-15 14:47:43 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-02-15 14:47:43 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.travelnet) {
overlays.Travelnet = new TravelnetOverlay(wsChannel, layerMgr);
if (isDefault("travelnet")) {
map.addLayer(overlays.Travelnet);
2019-02-15 14:47:43 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-02-15 14:47:43 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.bones) {
overlays.Bones = new BonesOverlay(wsChannel, layerMgr);
if (isDefault("bones")) {
map.addLayer(overlays.Bones);
2019-02-15 14:47:43 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-02-15 14:47:43 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.digilines) {
overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr);
if (isDefault("digilines")) {
map.addLayer(overlays["Digilines LCD"]);
2019-02-15 14:47:43 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-02-15 14:47:43 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.digiterms) {
overlays.Digiterms = new DigitermOverlay(wsChannel, layerMgr);
if (isDefault("digiterms")) {
map.addLayer(overlays.Digiterms);
2019-02-15 14:47:43 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-02-15 14:47:43 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.luacontroller) {
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);
if (isDefault("luacontroller")) {
map.addLayer(overlays["Lua Controller"]);
2019-02-15 14:47:43 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-02-15 14:47:43 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.technic_anchor) {
overlays["Technic Anchor"] = new TechnicAnchorOverlay(wsChannel, layerMgr);
if (isDefault("technic_anchor")) {
map.addLayer(overlays["Technic Anchor"]);
2019-04-04 13:50:40 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-04-04 13:50:40 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.technic_quarry) {
overlays["Technic Quarry"] = new TechnicQuarryOverlay(wsChannel, layerMgr);
if (isDefault("technic_quarry")) {
map.addLayer(overlays["Technic Quarry"]);
2019-04-04 13:50:40 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-04-04 13:50:40 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.technic_switch) {
overlays["Technic Switching station"] = new TechnicSwitchOverlay(wsChannel, layerMgr);
if (isDefault("technic_switch")) {
map.addLayer(overlays["Technic Switching station"]);
2019-02-15 14:47:43 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-02-15 14:47:43 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.protector) {
overlays.Protector = new ProtectorOverlay(wsChannel, layerMgr);
if (isDefault("protector")) {
map.addLayer(overlays.Protector);
2019-02-15 14:47:43 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-02-15 14:47:43 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.xpprotector) {
overlays["XP Protector"] = new XPProtectorOverlay(wsChannel, layerMgr);
if (isDefault("xpprotector")) {
map.addLayer(overlays["XP Protector"]);
}
2019-06-11 16:01:16 +03:00
}
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.privprotector) {
overlays["Priv Protector"] = new PrivProtectorOverlay(wsChannel, layerMgr);
if (isDefault("privprotector")) {
map.addLayer(overlays["Priv Protector"]);
}
2019-06-11 16:01:16 +03:00
}
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.mission) {
overlays.Missions = new MissionOverlay(wsChannel, layerMgr);
if (isDefault("mission")) {
map.addLayer(overlays.Missions);
2019-02-15 14:47:43 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-02-24 22:06:20 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.train) {
overlays.Trains = new TrainOverlay(wsChannel, layerMgr);
if (isDefault("train")) {
map.addLayer(overlays.Trains);
2019-02-24 22:06:20 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-04-24 17:21:04 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.minecart) {
overlays.Minecart = new MinecartOverlay(wsChannel, layerMgr);
if (isDefault("minecart")) {
map.addLayer(overlays.Minecart);
2019-04-24 17:21:04 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-05-14 10:01:52 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.atm) {
overlays.ATM = new ATMOverlay(wsChannel, layerMgr);
if (isDefault("atm")) {
map.addLayer(overlays.ATM);
2019-05-14 10:01:52 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-05-14 10:12:06 +03:00
2019-06-11 16:01:16 +03:00
if (cfg.mapobjects.locator) {
overlays.Locator = new LocatorOverlay(wsChannel, layerMgr);
if (isDefault("locator")) {
map.addLayer(overlays.Locator);
2019-05-14 10:12:06 +03:00
}
2019-06-11 16:01:16 +03:00
}
2019-05-14 10:12:06 +03:00
2019-02-15 14:47:43 +03:00
}