GMA Marker aktualisiert sich
40
.env.local
@@ -1,31 +1,31 @@
|
||||
#.env.local
|
||||
#je nach dem Mysql Server, ob localhost freigegeben ist oder die IP Adresse des Servers, manchmal die beide und manchmal nur eine
|
||||
|
||||
DB_HOST=10.10.0.13
|
||||
DB_USER=root
|
||||
DB_PASSWORD="root#$"
|
||||
DB_NAME=talas_v5
|
||||
DB_PORT=3306
|
||||
#########################
|
||||
|
||||
NEXT_PUBLIC_BASE_URL="http://10.10.0.13/talas5/devices/"
|
||||
NEXT_PUBLIC_SERVER_URL="http://10.10.0.13"
|
||||
NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.13"
|
||||
NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
|
||||
#########################
|
||||
|
||||
|
||||
#DB_HOST=10.10.0.70
|
||||
#DB_HOST=10.10.0.13
|
||||
#DB_USER=root
|
||||
#DB_PASSWORD="root#$"
|
||||
#DB_NAME=talas_v5
|
||||
#DB_PORT=3306
|
||||
|
||||
#########################
|
||||
|
||||
#NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/"
|
||||
#NEXT_PUBLIC_SERVER_URL="http://10.10.0.70"
|
||||
#NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.70"
|
||||
#NEXT_PUBLIC_BASE_URL="http://10.10.0.13/talas5/devices/"
|
||||
#NEXT_PUBLIC_SERVER_URL="http://10.10.0.13"
|
||||
#NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.13"
|
||||
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
|
||||
#########################
|
||||
|
||||
|
||||
DB_HOST=10.10.0.70
|
||||
DB_USER=root
|
||||
DB_PASSWORD="root#$"
|
||||
DB_NAME=talas_v5
|
||||
DB_PORT=3306
|
||||
|
||||
#########################
|
||||
#device nur Verlinkung wenn die gleiche DB ist
|
||||
NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/"
|
||||
NEXT_PUBLIC_SERVER_URL="http://10.10.0.70"
|
||||
NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.70"
|
||||
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
|
||||
#########################
|
||||
|
||||
@@ -42,4 +42,4 @@ NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
|
||||
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://192.168.10.14:3000/mapTiles/{z}/{x}/{y}.png"
|
||||
|
||||
######################### online
|
||||
#NEXT_PUBLIC_ONLINE_TILE_LAYER="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
NEXT_PUBLIC_ONLINE_TILE_LAYER="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
@@ -392,7 +392,6 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
|
||||
//console.log("priorityConfig in MapComponent2: ", priorityConfig);
|
||||
useEffect(() => {
|
||||
if (gisSystemStaticLoaded && map) {
|
||||
|
||||
createAndSetDevices(11, setGmaMarkers, GisSystemStatic, priorityConfig); // GMA-System
|
||||
createAndSetDevices(1, setTalasMarkers, GisSystemStatic, priorityConfig); // TALAS-System
|
||||
createAndSetDevices(2, setEciMarkers, GisSystemStatic, priorityConfig); // ECI-System
|
||||
@@ -679,7 +678,7 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
|
||||
|
||||
useEffect(() => {
|
||||
if (!map) return; // Stelle sicher, dass die Karte initialisiert ist
|
||||
|
||||
|
||||
const updateGmaData = async () => {
|
||||
try {
|
||||
const fetchOptions = {
|
||||
@@ -688,51 +687,47 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
|
||||
Connection: "close",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
// Aktualisiere die Messdaten
|
||||
await fetchGisStationsMeasurements(mapGisStationsMeasurementsUrl, setGisStationsMeasurements, fetchOptions);
|
||||
await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStationsStatusDistrict, fetchOptions);
|
||||
|
||||
|
||||
|
||||
// Aktualisiere die Marker-Layer
|
||||
useGmaMarkersLayer(map, gmaMarkers, GisStationsMeasurements, layers.MAP_LAYERS.GMA, oms);
|
||||
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Aktualisieren der GMA-Daten:", error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Initialer Datenabruf
|
||||
updateGmaData();
|
||||
|
||||
|
||||
// Setze ein Intervall, um die Daten alle 5 Sekunden zu aktualisieren
|
||||
const intervalId = setInterval(() => {
|
||||
updateGmaData();
|
||||
}, 5000);
|
||||
|
||||
|
||||
// Cleanup-Funktion, um das Intervall zu entfernen, wenn die Komponente entladen wird
|
||||
return () => clearInterval(intervalId);
|
||||
}, [map, gmaMarkers, layers.MAP_LAYERS.GMA, oms, mapGisStationsMeasurementsUrl,mapGisStationsStatusDistrictUrl]);
|
||||
}, [map, gmaMarkers, layers.MAP_LAYERS.GMA, oms, mapGisStationsMeasurementsUrl, mapGisStationsStatusDistrictUrl]);
|
||||
|
||||
|
||||
//---------------------------------
|
||||
|
||||
|
||||
const markerLayerRef = useRef(null);
|
||||
useEffect(() => {
|
||||
if (!gisSystemStaticLoaded || !map) return; // Sicherstellen, dass alle Abhängigkeiten geladen sind
|
||||
|
||||
|
||||
// Initialisiere die LayerGroup, falls noch nicht vorhanden
|
||||
if (!markerLayerRef.current) {
|
||||
markerLayerRef.current = new L.LayerGroup().addTo(map);
|
||||
}
|
||||
|
||||
|
||||
const updateMarkers = () => {
|
||||
// Alte Marker entfernen
|
||||
markerLayerRef.current.clearLayers();
|
||||
|
||||
|
||||
// Neue Marker für jedes System erstellen
|
||||
/* createAndSetDevices(11, (markers) => {
|
||||
/* createAndSetDevices(11, (markers) => {
|
||||
setGmaMarkers(markers);
|
||||
markers.forEach((marker) => marker.addTo(markerLayerRef.current)); // Marker zur LayerGroup hinzufügen
|
||||
}, GisSystemStatic, priorityConfig);
|
||||
@@ -740,15 +735,15 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
|
||||
createAndSetDevices(11, setGmaMarkers, GisSystemStatic, priorityConfig);
|
||||
// Füge hier weitere `createAndSetDevices`-Aufrufe für andere Systeme ein
|
||||
};
|
||||
|
||||
|
||||
// Initiales Update der Marker
|
||||
updateMarkers();
|
||||
|
||||
|
||||
// Setze ein Intervall, um die Marker alle 10 Sekunden zu aktualisieren
|
||||
const intervalId = setInterval(() => {
|
||||
updateMarkers();
|
||||
}, 10000); // 10 Sekunden
|
||||
|
||||
|
||||
// Aufräumen bei Komponentenentladung
|
||||
return () => {
|
||||
clearInterval(intervalId);
|
||||
@@ -758,10 +753,9 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
|
||||
};
|
||||
}, [gisSystemStaticLoaded, map, GisSystemStatic, priorityConfig]);
|
||||
|
||||
//---------------------------------------
|
||||
|
||||
//---------------------------------------
|
||||
|
||||
//-----------------
|
||||
//-----------------
|
||||
return (
|
||||
<>
|
||||
<ToastContainer />
|
||||
|
||||
@@ -15,6 +15,7 @@ const useMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms) => {
|
||||
|
||||
let measurements = {};
|
||||
let area_name = marker.options.areaName;
|
||||
let idLD = marker.options.idLD;
|
||||
|
||||
relevantMeasurements.forEach((m) => {
|
||||
measurements[m.Na] = m.Val;
|
||||
@@ -27,6 +28,7 @@ const useMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms) => {
|
||||
const rlf = measurements["RLF"] || "---";
|
||||
|
||||
console.log(`Station oder Bereich ${area_name} - LT: ${lt}, FBT: ${fbt}, GT: ${gt}, RLF: ${rlf}`);
|
||||
console.log(`Station idLD: ${idLD} `);
|
||||
|
||||
// Tooltip für den Marker binden
|
||||
marker.bindTooltip(
|
||||
|
||||
2
package-lock.json
generated
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "16.09.2024 NodeMap",
|
||||
"name": "nodeMap",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
BIN
public/img/icons/Stationsausfall-marker-icon-0.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-1.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-10.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-11.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-12.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-13.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-14.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-15.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-16.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-17.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-18.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-19.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-2.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-20.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-21.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-22.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-23.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-24.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-25.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-26.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-27.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-28.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-29.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-3.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-30.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-31.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-32.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-4.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-5.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-6.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-7.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-8.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
public/img/icons/Stationsausfall-marker-icon-9.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/img/icons/critical-marker-icon-31.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
public/img/icons/critical-marker-icon-32.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/img/icons/major-marker-icon-31.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
public/img/icons/major-marker-icon-32.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/marker-icon-31.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
public/img/icons/marker-icon-32.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/img/icons/minor-marker-icon-31.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
public/img/icons/minor-marker-icon-32.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/img/icons/system-marker-icon-31.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
public/img/icons/system-marker-icon-32.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |