[TASK] Automatic map switch based on time

This commit is contained in:
Xaver Maierhofer 2016-09-17 19:59:18 +02:00 committed by Xaver Maierhofer
parent d1017cca12
commit 2c80712fb9

View File

@ -132,10 +132,42 @@ define(["map/clientlayer", "map/labelslayer",
}); });
} }
var iconOnline = {color: "#1566A9", fillColor: "#1566A9", radius: 6, fillOpacity: 0.5, opacity: 0.5, weight: 2, className: "stroke-first"}; var iconOnline = {
var iconOffline = {color: "#D43E2A", fillColor: "#D43E2A", radius: 3, fillOpacity: 0.5, opacity: 0.5, weight: 1, className: "stroke-first"}; color: "#1566A9",
var iconLost = {color: "#D43E2A", fillColor: "#D43E2A", radius: 4, fillOpacity: 0.8, opacity: 0.8, weight: 1, className: "stroke-first"}; fillColor: "#1566A9",
var iconAlert = {color: "#D43E2A", fillColor: "#D43E2A", radius: 5, fillOpacity: 0.8, opacity: 0.8, weight: 2, className: "stroke-first"}; radius: 6,
fillOpacity: 0.5,
opacity: 0.5,
weight: 2,
className: "stroke-first"
};
var iconOffline = {
color: "#D43E2A",
fillColor: "#D43E2A",
radius: 3,
fillOpacity: 0.5,
opacity: 0.5,
weight: 1,
className: "stroke-first"
};
var iconLost = {
color: "#D43E2A",
fillColor: "#D43E2A",
radius: 4,
fillOpacity: 0.8,
opacity: 0.8,
weight: 1,
className: "stroke-first"
};
var iconAlert = {
color: "#D43E2A",
fillColor: "#D43E2A",
radius: 5,
fillOpacity: 0.8,
opacity: 0.8,
weight: 2,
className: "stroke-first"
};
var iconNew = {color: "#1566A9", fillColor: "#93E929", radius: 6, fillOpacity: 1.0, opacity: 0.5, weight: 2}; var iconNew = {color: "#1566A9", fillColor: "#93E929", radius: 6, fillOpacity: 1.0, opacity: 0.5, weight: 2};
return function (config, linkScale, sidebar, router, buttons) { return function (config, linkScale, sidebar, router, buttons) {
@ -241,6 +273,18 @@ define(["map/clientlayer", "map/labelslayer",
el.classList.add("map"); el.classList.add("map");
map = L.map(el, options); map = L.map(el, options);
var now = new Date();
config.mapLayers.forEach(function (item, i) {
if (item.config.start <= now.getHours() || item.config.end > now.getHours()) {
item.config.order = item.config.start * -1;
} else {
item.config.order = i;
}
});
config.mapLayers = config.mapLayers.sort(function (a, b) {
return a.config.order - b.config.order;
});
var layers = config.mapLayers.map(function (d) { var layers = config.mapLayers.map(function (d) {
return { return {