This commit is contained in:
ISA
2025-05-28 08:04:34 +02:00
parent 97fbb6fdc1
commit 5f0133d638
107 changed files with 1446 additions and 454 deletions

View File

@@ -0,0 +1,28 @@
<!-- /docs/utils/addContextMenuToMarker.md -->
# 🧭 addContextMenuToMarker.js
Fügt einem Leaflet-Marker ein individuelles Kontextmenü hinzu.
## Zweck
- Erlaubt dem Nutzer über Rechtsklick oder Interaktion den Zugriff auf Funktionen wie:
- „Station öffnen (Tab)“
- „Details anzeigen“
- „Bearbeiten starten“
## Verwendung
```js
addContextMenuToMarker(marker, idLD, name);
```
## Parameter
- `marker`: Leaflet-Marker
- `idLD`: Geräte-ID
- `name`: Anzeigename
## Kontext
- Wird z.B. in `createAndSetDevices.js` verwendet

View File

@@ -0,0 +1,14 @@
<!-- /docs/utils/contextMenuUtils.md -->
# 📋 contextMenuUtils.js
Hilfsfunktionen zur Verwaltung des Kontextmenüs auf Kartenmarkern und Polylinien.
## Exportierte Funktionen
- `getPoiContextMenuOptions(marker)`
- `getPolylineContextMenuOptions(line)`
## Zweck
- Menüeinträge je nach Zustand und Marker-Art dynamisch generieren

View File

@@ -0,0 +1,14 @@
<!-- /docs/utils/geometryUtils.md -->
# 📐 geometryUtils.js
Mathematische Funktionen zur Berechnung geometrischer Werte auf der Karte.
## Funktionen
- `calculateDistance(latlng1, latlng2)`
- `getMidpoint(coords)`
## Zweck
- Interne Hilfsfunktionen für Strecken, Tooltip-Positionen etc.

View File

@@ -0,0 +1,15 @@
<!-- /docs/initializeMap.md -->
# 🗺️ initializeMap.js
Initialisiert die Leaflet-Karte mit Basislayern, Gruppen und globalen Events.
## Funktionen
- `initializeMap(mapElementId)`
## Verhalten
- Erstellt LayerGroups (Devices, POIs, Linien)
- Bindet Kontextmenü
- Stellt Default-Zoom und Position ein

10
docs/utils/mapUtils.md Normal file
View File

@@ -0,0 +1,10 @@
<!-- /docs/utils/mapUtils.md -->
# 🧰 mapUtils.js
Allgemeine Hilfsfunktionen für Leaflet (z.B. Zoom, Marker-Checks, Layer-Findung).
## Funktionen
- `zoomToBounds(layerGroup)`
- `findLayerById(map, id)`

14
docs/utils/markerUtils.md Normal file
View File

@@ -0,0 +1,14 @@
<!-- /docs/utils/markerUtils.md -->
# 📍 markerUtils.js
Hilfsfunktionen zur Erstellung und Konfiguration von Leaflet-Markern.
## Exportierte Funktionen
- `createIconByType(type)`
- `createMarker(position, icon)`
## Kontext
- Wird in `setupDevices.js` und `setupPOIs.js` verwendet

16
docs/utils/mysqlPool.md Normal file
View File

@@ -0,0 +1,16 @@
<!-- /docs/utils/mysqlPool.md -->
# 💾 mysqlPool.js
MySQL-Verbindungspool für effiziente Datenbankabfragen (z.B. mit `promise-mysql`).
## Verwendung
```js
const connection = await pool.getConnection();
```
## Zweck
- Reuse von Verbindungen
- Fehlervermeidung bei vielen gleichzeitigen Abfragen

View File

@@ -0,0 +1,15 @@
<!-- /docs/utils/openInNewTab.md -->
# 🪟 openInNewTab.js
Öffnet eine URL in einem neuen Tab und schützt vor Referrer-Leaks.
## Verwendung
```js
openInNewTab(url);
```
## Intern
- nutzt `window.open` mit `noopener,noreferrer`

View File

@@ -0,0 +1,15 @@
<!-- /docs/utils/openInSameWindow.md -->
# 🚪 openInSameWindow.js
Öffnet eine URL im aktuellen Tab.
## Verwendung
```js
openInSameWindow("/target");
```
## Verhalten
- `window.location.href = url`

14
docs/utils/poiUtils.md Normal file
View File

@@ -0,0 +1,14 @@
<!-- /docs/utils/poiUtils.md -->
# 🧭 poiUtils.js
Hilfsfunktionen zur Handhabung von POIs (z.B. Icons, Typzuordnung, Interaktion).
## Funktionen
- `getIconForPoiType(type)`
- `groupPOIsByType(list)`
## Verwendung
- In `setupPOIs.js` und Thunks für POI-Handling

View File

@@ -0,0 +1,10 @@
<!-- /docs/utils/polylines/contextMenu.md -->
# 📋 contextMenu.js
Funktionen zum Steuern des Polyline-Kontextmenüs (Schließen, Zurücksetzen, etc.).
## exportierte Funktionen
- `closePolylineSelectionAndContextMenu(map)`: Setzt Polyline-Auswahl zurück und schließt das Kontextmenü
- `monitorContextMenu(map)`: Überwacht via `localStorage`, ob das Menü automatisch geschlossen werden soll

View File

@@ -0,0 +1,10 @@
<!-- /docs/utils/polylines/eventHandlers.md -->
# 🖱️ eventHandlers.js
Bindet Maus-Events an Polylinien (z.B. Hover-Effekte).
## exportierte Funktionen
- `enablePolylineEvents(polylines, lineColors)`
- `disablePolylineEvents(polylines)`

View File

@@ -0,0 +1,10 @@
<!-- /docs/utils/polylines/monitorContextMenu.md -->
# 🔄 monitorContextMenu.js
Erweiterte Überwachung des Kontextmenüs über `localStorage`.
## Funktion
- Importiert `closePolylineSelectionAndContextMenu`
- Ruft regelmäßig `setTimeout` auf, um `contextMenuExpired` zu prüfen

View File

@@ -0,0 +1,10 @@
<!-- /docs/utils/polylines/polylineSubscription.md -->
# 🧭 polylineSubscription.js
Abonnement auf den Redux-Store, um auf `forceClose` im Kontextmenü zu reagieren.
## Verhalten
- Erkennt `polylineContextMenu.forceClose`
- Ruft `contextmenu.hide()` auf und resetet Redux-Status

View File

@@ -0,0 +1,14 @@
<!-- /docs/utils/polylines/redrawPolyline.md -->
# 🔁 redrawPolyline.js
Zeichnet eine Polyline mit neuen Koordinaten und Tooltip neu.
## Funktion
```js
redrawPolyline(lineData, lineColors, tooltipContents, map)
```
- Entfernt vorherige Polyline
- Erstellt neue mit Tooltip und Hover-Effekten

View File

@@ -1,3 +1,5 @@
<!-- /docs/utils/polylines/setupPolylines.md -->
# 🧭 setupPolylines.js Polylinien zeichnen und verwalten
## Zweck
@@ -38,10 +40,7 @@ NEXT_PUBLIC_API_PORT_MODE=dev
```js
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
const baseUrl =
mode === "dev"
? `${window.location.protocol}//${window.location.hostname}:80/talas5/`
: `${window.location.origin}/talas5/`;
const baseUrl = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80/talas5/` : `${window.location.origin}/talas5/`;
```
---
@@ -74,4 +73,4 @@ const baseUrl =
---
📄 Pfad: `/docs/frontend/utils/polylines/setupPolylines.md`
📄 Pfad: `/docs/frontend/utils/polylines/setupPolylines.md`

View File

@@ -0,0 +1,15 @@
<!-- /docs/setupDevices.md -->
# 🔌 setupDevices.js
Fügt alle Geräte (Devices) zur Karte hinzu.
## Funktionen
- `setupDevices(map, deviceList)`
## Verhalten
- Marker-Erstellung
- Eventbindung
- Layer-Zuweisung

View File

@@ -1,3 +1,5 @@
<!-- /docs/utils/setupPOIs.md -->
# 🧭 `setupPOIs.js`
## Zweck

View File

@@ -0,0 +1,10 @@
<!-- /docs/utils/zoomAndCenterUtils.md -->
# 🔍 zoomAndCenterUtils.js
Hilfsfunktionen zum Zoomen auf Marker oder Linien.
## Funktionen
- `zoomToMarker(map, marker)`
- `centerOnCoordinates(map, coords)`