GMA Marker aktualisiert sich

This commit is contained in:
ISA
2024-11-27 12:15:55 +01:00
parent db9c57f90e
commit 9c4c646d55
47 changed files with 39 additions and 43 deletions

View File

@@ -1,31 +1,31 @@
#.env.local #.env.local
#je nach dem Mysql Server, ob localhost freigegeben ist oder die IP Adresse des Servers, manchmal die beide und manchmal nur eine #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_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_USER=root #DB_USER=root
#DB_PASSWORD="root#$" #DB_PASSWORD="root#$"
#DB_NAME=talas_v5 #DB_NAME=talas_v5
#DB_PORT=3306 #DB_PORT=3306
######################### #########################
#NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/" #NEXT_PUBLIC_BASE_URL="http://10.10.0.13/talas5/devices/"
#NEXT_PUBLIC_SERVER_URL="http://10.10.0.70" #NEXT_PUBLIC_SERVER_URL="http://10.10.0.13"
#NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.70" #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" #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" #NEXT_PUBLIC_ONLINE_TILE_LAYER="http://192.168.10.14:3000/mapTiles/{z}/{x}/{y}.png"
######################### online ######################### 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"

View File

@@ -392,7 +392,6 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
//console.log("priorityConfig in MapComponent2: ", priorityConfig); //console.log("priorityConfig in MapComponent2: ", priorityConfig);
useEffect(() => { useEffect(() => {
if (gisSystemStaticLoaded && map) { if (gisSystemStaticLoaded && map) {
createAndSetDevices(11, setGmaMarkers, GisSystemStatic, priorityConfig); // GMA-System createAndSetDevices(11, setGmaMarkers, GisSystemStatic, priorityConfig); // GMA-System
createAndSetDevices(1, setTalasMarkers, GisSystemStatic, priorityConfig); // TALAS-System createAndSetDevices(1, setTalasMarkers, GisSystemStatic, priorityConfig); // TALAS-System
createAndSetDevices(2, setEciMarkers, GisSystemStatic, priorityConfig); // ECI-System createAndSetDevices(2, setEciMarkers, GisSystemStatic, priorityConfig); // ECI-System
@@ -679,7 +678,7 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
useEffect(() => { useEffect(() => {
if (!map) return; // Stelle sicher, dass die Karte initialisiert ist if (!map) return; // Stelle sicher, dass die Karte initialisiert ist
const updateGmaData = async () => { const updateGmaData = async () => {
try { try {
const fetchOptions = { const fetchOptions = {
@@ -688,51 +687,47 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
Connection: "close", Connection: "close",
}, },
}; };
// Aktualisiere die Messdaten // Aktualisiere die Messdaten
await fetchGisStationsMeasurements(mapGisStationsMeasurementsUrl, setGisStationsMeasurements, fetchOptions); await fetchGisStationsMeasurements(mapGisStationsMeasurementsUrl, setGisStationsMeasurements, fetchOptions);
await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStationsStatusDistrict, fetchOptions); await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStationsStatusDistrict, fetchOptions);
// Aktualisiere die Marker-Layer // Aktualisiere die Marker-Layer
useGmaMarkersLayer(map, gmaMarkers, GisStationsMeasurements, layers.MAP_LAYERS.GMA, oms); useGmaMarkersLayer(map, gmaMarkers, GisStationsMeasurements, layers.MAP_LAYERS.GMA, oms);
} catch (error) { } catch (error) {
console.error("Fehler beim Aktualisieren der GMA-Daten:", error); console.error("Fehler beim Aktualisieren der GMA-Daten:", error);
} }
}; };
// Initialer Datenabruf // Initialer Datenabruf
updateGmaData(); updateGmaData();
// Setze ein Intervall, um die Daten alle 5 Sekunden zu aktualisieren // Setze ein Intervall, um die Daten alle 5 Sekunden zu aktualisieren
const intervalId = setInterval(() => { const intervalId = setInterval(() => {
updateGmaData(); updateGmaData();
}, 5000); }, 5000);
// Cleanup-Funktion, um das Intervall zu entfernen, wenn die Komponente entladen wird // Cleanup-Funktion, um das Intervall zu entfernen, wenn die Komponente entladen wird
return () => clearInterval(intervalId); 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); const markerLayerRef = useRef(null);
useEffect(() => { useEffect(() => {
if (!gisSystemStaticLoaded || !map) return; // Sicherstellen, dass alle Abhängigkeiten geladen sind if (!gisSystemStaticLoaded || !map) return; // Sicherstellen, dass alle Abhängigkeiten geladen sind
// Initialisiere die LayerGroup, falls noch nicht vorhanden // Initialisiere die LayerGroup, falls noch nicht vorhanden
if (!markerLayerRef.current) { if (!markerLayerRef.current) {
markerLayerRef.current = new L.LayerGroup().addTo(map); markerLayerRef.current = new L.LayerGroup().addTo(map);
} }
const updateMarkers = () => { const updateMarkers = () => {
// Alte Marker entfernen // Alte Marker entfernen
markerLayerRef.current.clearLayers(); markerLayerRef.current.clearLayers();
// Neue Marker für jedes System erstellen // Neue Marker für jedes System erstellen
/* createAndSetDevices(11, (markers) => { /* createAndSetDevices(11, (markers) => {
setGmaMarkers(markers); setGmaMarkers(markers);
markers.forEach((marker) => marker.addTo(markerLayerRef.current)); // Marker zur LayerGroup hinzufügen markers.forEach((marker) => marker.addTo(markerLayerRef.current)); // Marker zur LayerGroup hinzufügen
}, GisSystemStatic, priorityConfig); }, GisSystemStatic, priorityConfig);
@@ -740,15 +735,15 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
createAndSetDevices(11, setGmaMarkers, GisSystemStatic, priorityConfig); createAndSetDevices(11, setGmaMarkers, GisSystemStatic, priorityConfig);
// Füge hier weitere `createAndSetDevices`-Aufrufe für andere Systeme ein // Füge hier weitere `createAndSetDevices`-Aufrufe für andere Systeme ein
}; };
// Initiales Update der Marker // Initiales Update der Marker
updateMarkers(); updateMarkers();
// Setze ein Intervall, um die Marker alle 10 Sekunden zu aktualisieren // Setze ein Intervall, um die Marker alle 10 Sekunden zu aktualisieren
const intervalId = setInterval(() => { const intervalId = setInterval(() => {
updateMarkers(); updateMarkers();
}, 10000); // 10 Sekunden }, 10000); // 10 Sekunden
// Aufräumen bei Komponentenentladung // Aufräumen bei Komponentenentladung
return () => { return () => {
clearInterval(intervalId); clearInterval(intervalId);
@@ -758,10 +753,9 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
}; };
}, [gisSystemStaticLoaded, map, GisSystemStatic, priorityConfig]); }, [gisSystemStaticLoaded, map, GisSystemStatic, priorityConfig]);
//---------------------------------------
//--------------------------------------- //-----------------
//-----------------
return ( return (
<> <>
<ToastContainer /> <ToastContainer />

View File

@@ -15,6 +15,7 @@ const useMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms) => {
let measurements = {}; let measurements = {};
let area_name = marker.options.areaName; let area_name = marker.options.areaName;
let idLD = marker.options.idLD;
relevantMeasurements.forEach((m) => { relevantMeasurements.forEach((m) => {
measurements[m.Na] = m.Val; measurements[m.Na] = m.Val;
@@ -27,6 +28,7 @@ const useMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms) => {
const rlf = measurements["RLF"] || "---"; const rlf = measurements["RLF"] || "---";
console.log(`Station oder Bereich ${area_name} - LT: ${lt}, FBT: ${fbt}, GT: ${gt}, RLF: ${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 // Tooltip für den Marker binden
marker.bindTooltip( marker.bindTooltip(

2
package-lock.json generated
View File

@@ -1,5 +1,5 @@
{ {
"name": "16.09.2024 NodeMap", "name": "nodeMap",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB