frontend overlay modules
This commit is contained in:
parent
2693b11d26
commit
c1e151a694
48
server/static/js/Overlaysetup.js
Normal file
48
server/static/js/Overlaysetup.js
Normal file
@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
function Overlaysetup(cfg, map, overlays, wsChannel, layerMgr){
|
||||
|
||||
if (cfg.mapobjects.mapserver) {
|
||||
overlays["Player"] = new PlayerOverlay(wsChannel, layerMgr);
|
||||
overlays["POI"] = new PoiOverlay(wsChannel, layerMgr);
|
||||
overlays["Labels"] = new LabelOverlay(wsChannel, layerMgr);
|
||||
|
||||
map.addLayer(overlays["Player"]);
|
||||
map.addLayer(overlays["POI"]);
|
||||
map.addLayer(overlays["Labels"]);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.travelnet) {
|
||||
overlays["Travelnet"] = new TravelnetOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.bones) {
|
||||
overlays["Bones"] = new BonesOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.digilines) {
|
||||
overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.digiterms) {
|
||||
overlays["Digiterms"] = new DigitermOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.luacontroller) {
|
||||
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.technic) {
|
||||
overlays["Technic Anchor"] = new TechnicAnchorOverlay(wsChannel, layerMgr);
|
||||
overlays["Technic Quarry"] = new TechnicQuarryOverlay(wsChannel, layerMgr);
|
||||
overlays["Technic Switching station"] = new TechnicSwitchOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.protector) {
|
||||
overlays["Protector"] = new ProtectorOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.mission) {
|
||||
overlays["Missions"] = new MissionOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
}
|
@ -23,55 +23,16 @@ api.getConfig().then(function(cfg){
|
||||
|
||||
var layerMgr = new LayerManager(cfg.layers, map);
|
||||
|
||||
var tileLayer = new RealtimeTileLayer(wsChannel, 0);
|
||||
tileLayer.addTo(map);
|
||||
//All layers
|
||||
cfg.layers.forEach(function(layer){
|
||||
var tileLayer = new RealtimeTileLayer(wsChannel, layer.id);
|
||||
tileLayer.addTo(map);
|
||||
|
||||
//TODO: all layers
|
||||
layers["Base"] = tileLayer;
|
||||
layers[layer.name] = tileLayer;
|
||||
});
|
||||
|
||||
if (cfg.mapobjects.mapserver) {
|
||||
overlays["Player"] = new PlayerOverlay(wsChannel, layerMgr);
|
||||
overlays["POI"] = new PoiOverlay(wsChannel, layerMgr);
|
||||
overlays["Labels"] = new LabelOverlay(wsChannel, layerMgr);
|
||||
|
||||
map.addLayer(overlays["Player"]);
|
||||
map.addLayer(overlays["POI"]);
|
||||
map.addLayer(overlays["Labels"]);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.travelnet) {
|
||||
overlays["Travelnet"] = new TravelnetOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.bones) {
|
||||
overlays["Bones"] = new BonesOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.digilines) {
|
||||
overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.digiterms) {
|
||||
overlays["Digiterms"] = new DigitermOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.luacontroller) {
|
||||
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.technic) {
|
||||
overlays["Technic Anchor"] = new TechnicAnchorOverlay(wsChannel, layerMgr);
|
||||
overlays["Technic Quarry"] = new TechnicQuarryOverlay(wsChannel, layerMgr);
|
||||
overlays["Technic Switching station"] = new TechnicSwitchOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.protector) {
|
||||
overlays["Protector"] = new ProtectorOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.mission) {
|
||||
overlays["Missions"] = new MissionOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
//All overlays
|
||||
Overlaysetup(cfg, map, overlays, wsChannel, layerMgr);
|
||||
|
||||
L.control.layers(layers, overlays).addTo(map);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user