feat: Create /config/layers.js module for Separate of Consern

This commit is contained in:
ISA
2024-07-10 08:27:00 +02:00
parent 34ad670ae1
commit 6c60700b7c
4 changed files with 42 additions and 35 deletions

View File

@@ -74,6 +74,8 @@ import {
addContextMenuToMarker,
openInNewTab,
} from "../utils/contextMenuUtils.js";
import * as settings from "../config/settings.js";
import * as layers from "../config/layers.js";
//---------------------------------------------------------------------
//-------------------- MapComponent -----------------------------------
@@ -146,19 +148,19 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const onlineTileLayer = urls.ONLINE_TILE_LAYER; //Talas_v5 Server
// Create map layers
const TALAS = config.MAP_LAYERS.TALAS;
const ECI = config.MAP_LAYERS.ECI;
const ULAF = config.MAP_LAYERS.ULAF;
const GSMModem = config.MAP_LAYERS.GSMModem;
const CiscoRouter = config.MAP_LAYERS.CiscoRouter;
const WAGO = config.MAP_LAYERS.WAGO;
const Siemens = config.MAP_LAYERS.Siemens;
const OTDR = config.MAP_LAYERS.OTDR;
const WDM = config.MAP_LAYERS.WDM;
const GMA = config.MAP_LAYERS.GMA;
const Sonstige = config.MAP_LAYERS.Sonstige;
const TALASICL = config.MAP_LAYERS.TALASICL;
const lineLayer = config.MAP_LAYERS.lineLayer;
const TALAS = layers.MAP_LAYERS.TALAS;
const ECI = layers.MAP_LAYERS.ECI;
const ULAF = layers.MAP_LAYERS.ULAF;
const GSMModem = layers.MAP_LAYERS.GSMModem;
const CiscoRouter = layers.MAP_LAYERS.CiscoRouter;
const WAGO = layers.MAP_LAYERS.WAGO;
const Siemens = layers.MAP_LAYERS.Siemens;
const OTDR = layers.MAP_LAYERS.OTDR;
const WDM = layers.MAP_LAYERS.WDM;
const GMA = layers.MAP_LAYERS.GMA;
const Sonstige = layers.MAP_LAYERS.Sonstige;
const TALASICL = layers.MAP_LAYERS.TALASICL;
const lineLayer = layers.MAP_LAYERS.lineLayer;
const [gisSystemStaticLoaded, setGisSystemStaticLoaded] = useState(false);
@@ -2108,22 +2110,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//---------------------------------------------------------
//-------------------------Funktionen--------------------------------
// Call this function on page load to restore zoom and center
/* function restoreMapSettings() {
const savedZoom = localStorage.getItem("mapZoom");
const savedCenter = localStorage.getItem("mapCenter");
if (savedZoom && savedCenter) {
try {
const centerCoords = JSON.parse(savedCenter);
map.setView(centerCoords, parseInt(savedZoom));
} catch (e) {
console.error("Error parsing stored map center:", e);
map.setView([53.111111, 8.4625], 12); // Standardkoordinaten und -zoom
}
}
} */
// Call restoreMapSettings when the map is initialized
useEffect(() => {
if (map) {