Files
nodeMap/MessagesMap/js/app.js
2024-04-27 15:47:36 +02:00

115 lines
2.8 KiB
JavaScript

/**
* @file app.js
* @author Andreas Tholen
* Contact: info@littwin-systechnik.de
* @version 0.5.3
* @description Basic Functions
*/
function getDataMenu() {
var stationsListing = [];
// Stationen erfassen
for (var i = 0; i < dataStaticlength; i++) {
var gisStatics = dataStatic[i];
var stationListing = gisStatics.Area_Name; // Area_Name
stationsListing.push(stationListing);
}
// Doppelte Einträge löschen
console.log("%cMAP| Einträge der Stationen werden geprüft",'color: green');
let uniqueStations = [];
stationsListing.forEach((c) => {
if (!uniqueStations.includes(c)) {
uniqueStations.push(c);
}
});
console.log("%cMAP| Stationen indexiert: %c"+uniqueStations,'color: green', 'color:grey');
var select = document.getElementById("stationListing");
for(var i = 0; i < uniqueStations.length; i++) {
var opt = uniqueStations[i];
var el = document.createElement("option");
el.textContent = opt;
el.value = opt;
el.style.color = "#000000";
el.style.fontWeight = "thin";
select.appendChild(el);
}
}
var checkbox = document.querySelector("#box-TALAS");
checkbox.addEventListener('change', function() {
if (this.checked) {
map.addLayer(TALAS);
console.log("TALAS is checked..");
} else {
map.removeLayer(TALAS);
console.log("TALAS is not checked..");
}
});
var checkbox = document.querySelector("#box-GMA");
checkbox.addEventListener('change', function() {
if (this.checked) {
map.addLayer(GMA);
console.log("GMA is checked..");
} else {
map.removeLayer(GMA);
console.log("GMA is not checked..");
}
});
var checkbox = document.querySelector("#box-MODEM");
checkbox.addEventListener('change', function() {
if (this.checked) {
map.addLayer(GSM);
console.log("GSM is checked..");
} else {
map.removeLayer(GSM);
console.log("GSM is not checked..");
}
});
var checkbox = document.querySelector("#box-SIEMENS");
checkbox.addEventListener('change', function() {
if (this.checked) {
map.addLayer(Siemens);
console.log("Notrufsäulen is checked..");
} else {
map.removeLayer(Siemens);
console.log("Notrufsäulen is not checked..");
}
});
// ISS Positions-Update Test
/*var iss;
function update_position() {
$.getJSON('http://open-notify-api.herokuapp.com/iss-now.json?callback=?', function(data) {
var latitude = data["iss_position"]["latitude"];
var longitude = data["iss_position"]["longitude"];
if (!iss) {
iss = L.marker([latitude,longitude], {icon: spaceStationMarker}).bindPopup("Ich bin die ISS").addTo(map);
}
iss.setLatLng([latitude,longitude]).update();
setTimeout(update_position, 1000);
});
}
update_position();*/