Kombination für 30, Linien ausblenden, und checkbox in localStorage mergen

This commit is contained in:
ISA
2024-09-12 09:14:05 +02:00
parent 0230600da9
commit da5e5a8b65
2 changed files with 24 additions and 51 deletions

View File

@@ -1,17 +1,17 @@
#.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.30
#DB_USER=root
#DB_PASSWORD="root#$"
#DB_NAME=talas_v5
#DB_PORT=3306
DB_HOST=10.10.0.30
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.30"
#NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.30"
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.30:3000/mapTiles/{z}/{x}/{y}.png"
NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/"
NEXT_PUBLIC_SERVER_URL="http://10.10.0.30"
NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.30"
NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.30:3000/mapTiles/{z}/{x}/{y}.png"
#########################
@@ -29,17 +29,17 @@
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
#########################
DB_HOST=192.168.10.168
DB_USER=root
DB_PASSWORD="root#$"
DB_NAME=talas_v5
DB_PORT=3306
#DB_HOST=192.168.10.168
#DB_USER=root
#DB_PASSWORD="root#$"
#DB_NAME=talas_v5
#DB_PORT=3306
#########################
#URLs für den Client (clientseitig)
NEXT_PUBLIC_BASE_URL="http://192.168.10.168/talas5/devices/"
NEXT_PUBLIC_SERVER_URL="http://192.168.10.168"
NEXT_PUBLIC_PROXY_TARGET="http://192.168.10.168"
NEXT_PUBLIC_ONLINE_TILE_LAYER="http://192.168.10.14:3000/mapTiles/{z}/{x}/{y}.png"
#NEXT_PUBLIC_BASE_URL="http://192.168.10.168/talas5/devices/"
#NEXT_PUBLIC_SERVER_URL="http://192.168.10.168"
#NEXT_PUBLIC_PROXY_TARGET="http://192.168.10.168"
#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"

View File

@@ -32,43 +32,22 @@ export function enablePolylineEvents(polylines, lineColors) {
// Falls Polylinien vorhanden sind, wende die Events an
polylines.forEach((polyline) => {
polyline.on("mouseover", (e) => {
//console.log("Mouseover on polyline", polyline.options);
polyline.setStyle({ weight: 14 });
const link = `${process.env.NEXT_PUBLIC_BASE_URL}cpl.aspx?id=${polyline.options.idLD}`;
// Verwende den Link oder speichere ihn, falls nötig
//localStorage.setItem("lastElementType", "polyline");
//localStorage.setItem("polylineLink", link);
});
polyline.on("mouseout", (e) => {
//console.log("Mouseout from polyline", polyline.options);
polyline.setStyle({ weight: 3 });
});
});
}
// Funktion zum Schließen des Kontextmenüs vor dem Intervall
const closeContextMenuBeforeInterval = (map) => {
if (map && map.contextmenu && map.contextmenu.isVisible && map.contextmenu.isVisible()) {
console.log("Schließe Kontextmenü 2 Sekunden vor dem Intervall");
map.contextmenu.hide();
}
};
// Zeitintervall mit Schließen des Kontextmenüs 2 Sekunden vorher
export const startIntervalWithContextMenuHandling = (map) => {
setInterval(() => {
remainingTime = 20; // Zeit zurücksetzen für den neuen Durchlauf
// Kontextmenü überwachen
monitorContextMenu(map);
// Schließe das Kontextmenü 2 Sekunden vor dem API-Aufruf
setTimeout(() => {
closeContextMenuBeforeInterval(map);
}, 18000); // 18 Sekunden warten, dann schließen
// API-Aufruf oder Logik, die alle 20 Sekunden ausgeführt wird
fetchData();
}, 20000); // 20-Sekunden-Intervall
};
export const setupPolylines = (map, linePositions, lineColors, tooltipContents, setNewCoords, tempMarker, polylineVisible) => {
export const setupPolylines = (map, linePositions, lineColors, tooltipContents, setNewCoords, tempMarker, currentZoom, currentCenter, polylineVisible) => {
polylineVisible = localStorage.getItem("polylineVisible") === "true";
if (!polylineVisible) {
// Entferne alle Polylinien, wenn sie ausgeblendet werden sollen
if (window.polylines) {
@@ -265,12 +244,6 @@ export const setupPolylines = (map, linePositions, lineColors, tooltipContents,
console.log("Link der Linie (via Rechtsklick):", link);
localStorage.setItem("lastElementType", "polyline");
localStorage.setItem("polylineLink", link);
if (editMode) {
polyline.bindContextMenu({
contextmenuItems: polyline.options.contextmenuItems,
});
}
closeContextMenuBeforeInterval(map);
});
polylines.push(polyline);