[TASK] Automatic map switch based on time
This commit is contained in:
parent
d1017cca12
commit
2c80712fb9
52
lib/map.js
52
lib/map.js
@ -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 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 iconOnline = {
|
||||
color: "#1566A9",
|
||||
fillColor: "#1566A9",
|
||||
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};
|
||||
|
||||
return function (config, linkScale, sidebar, router, buttons) {
|
||||
@ -241,6 +273,18 @@ define(["map/clientlayer", "map/labelslayer",
|
||||
el.classList.add("map");
|
||||
|
||||
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) {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user