feat: Create /config/layers.js module for Separate of Consern
This commit is contained in:
@@ -74,6 +74,8 @@ import {
|
|||||||
addContextMenuToMarker,
|
addContextMenuToMarker,
|
||||||
openInNewTab,
|
openInNewTab,
|
||||||
} from "../utils/contextMenuUtils.js";
|
} from "../utils/contextMenuUtils.js";
|
||||||
|
import * as settings from "../config/settings.js";
|
||||||
|
import * as layers from "../config/layers.js";
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
//-------------------- MapComponent -----------------------------------
|
//-------------------- MapComponent -----------------------------------
|
||||||
@@ -146,19 +148,19 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const onlineTileLayer = urls.ONLINE_TILE_LAYER; //Talas_v5 Server
|
const onlineTileLayer = urls.ONLINE_TILE_LAYER; //Talas_v5 Server
|
||||||
|
|
||||||
// Create map layers
|
// Create map layers
|
||||||
const TALAS = config.MAP_LAYERS.TALAS;
|
const TALAS = layers.MAP_LAYERS.TALAS;
|
||||||
const ECI = config.MAP_LAYERS.ECI;
|
const ECI = layers.MAP_LAYERS.ECI;
|
||||||
const ULAF = config.MAP_LAYERS.ULAF;
|
const ULAF = layers.MAP_LAYERS.ULAF;
|
||||||
const GSMModem = config.MAP_LAYERS.GSMModem;
|
const GSMModem = layers.MAP_LAYERS.GSMModem;
|
||||||
const CiscoRouter = config.MAP_LAYERS.CiscoRouter;
|
const CiscoRouter = layers.MAP_LAYERS.CiscoRouter;
|
||||||
const WAGO = config.MAP_LAYERS.WAGO;
|
const WAGO = layers.MAP_LAYERS.WAGO;
|
||||||
const Siemens = config.MAP_LAYERS.Siemens;
|
const Siemens = layers.MAP_LAYERS.Siemens;
|
||||||
const OTDR = config.MAP_LAYERS.OTDR;
|
const OTDR = layers.MAP_LAYERS.OTDR;
|
||||||
const WDM = config.MAP_LAYERS.WDM;
|
const WDM = layers.MAP_LAYERS.WDM;
|
||||||
const GMA = config.MAP_LAYERS.GMA;
|
const GMA = layers.MAP_LAYERS.GMA;
|
||||||
const Sonstige = config.MAP_LAYERS.Sonstige;
|
const Sonstige = layers.MAP_LAYERS.Sonstige;
|
||||||
const TALASICL = config.MAP_LAYERS.TALASICL;
|
const TALASICL = layers.MAP_LAYERS.TALASICL;
|
||||||
const lineLayer = config.MAP_LAYERS.lineLayer;
|
const lineLayer = layers.MAP_LAYERS.lineLayer;
|
||||||
|
|
||||||
const [gisSystemStaticLoaded, setGisSystemStaticLoaded] = useState(false);
|
const [gisSystemStaticLoaded, setGisSystemStaticLoaded] = useState(false);
|
||||||
|
|
||||||
@@ -2108,22 +2110,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
//-------------------------Funktionen--------------------------------
|
//-------------------------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
|
// Call restoreMapSettings when the map is initialized
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (map) {
|
if (map) {
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
// /config/config.js
|
// /config/config.js
|
||||||
// BASE_URL für Station öffnen in neuer tab und gleicher tab, im localhost gab es keine Probleme mit der Frame
|
// BASE_URL für Station öffnen in neuer tab und gleicher tab, im localhost gab es keine Probleme mit der Frame
|
||||||
export const BASE_URL = "http://10.10.0.13/talas5/devices/";
|
//export const BASE_URL = "http://10.10.0.13/talas5/devices/";
|
||||||
//const baseUrl = "http://localhost:3000/talas5/devices/";
|
//const baseUrl = "http://localhost:3000/talas5/devices/";
|
||||||
//const baseUrl = "http://192.168.10.14/talas5/devices/";
|
//const baseUrl = "http://192.168.10.14/talas5/devices/";
|
||||||
//----
|
//----
|
||||||
//Talas_v5 Server
|
//Talas_v5 Server
|
||||||
//export const OFFLINE_TILE_LAYER = "/mapTiles/{z}/{x}/{y}.png"; // wenn im von localhost also selben Server die Karte angezeigt wird
|
//export const OFFLINE_TILE_LAYER = "/mapTiles/{z}/{x}/{y}.png"; // wenn im von localhost also selben Server die Karte angezeigt wird
|
||||||
export const OFFLINE_TILE_LAYER = "/mapTiles/{z}/{x}/{y}.png";
|
//export const OFFLINE_TILE_LAYER = "/mapTiles/{z}/{x}/{y}.png";
|
||||||
|
|
||||||
//const onlineTileLayer = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
|
//const onlineTileLayer = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
|
||||||
export const ONLINE_TILE_LAYER =
|
/* export const ONLINE_TILE_LAYER =
|
||||||
"http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"; //Talas_v5 Server
|
"http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"; //Talas_v5 Server */
|
||||||
|
|
||||||
// Create map layers
|
// Create map layers
|
||||||
export const MAP_LAYERS = {
|
/* export const MAP_LAYERS = {
|
||||||
TALAS: new L.layerGroup(),
|
TALAS: new L.layerGroup(),
|
||||||
ECI: new L.layerGroup(),
|
ECI: new L.layerGroup(),
|
||||||
ULAF: new L.layerGroup(),
|
ULAF: new L.layerGroup(),
|
||||||
@@ -27,7 +27,7 @@ export const MAP_LAYERS = {
|
|||||||
Sonstige: new L.layerGroup(),
|
Sonstige: new L.layerGroup(),
|
||||||
TALASICL: new L.layerGroup(),
|
TALASICL: new L.layerGroup(),
|
||||||
lineLayer: new L.LayerGroup(),
|
lineLayer: new L.LayerGroup(),
|
||||||
};
|
}; */
|
||||||
// Definieren der grundlegenden Umgebungseinstellungen und Konfigurationen der Karte
|
// Definieren der grundlegenden Umgebungseinstellungen und Konfigurationen der Karte
|
||||||
const mapVersion = "0.5.3"; // Die Version der verwendeten Karte
|
const mapVersion = "0.5.3"; // Die Version der verwendeten Karte
|
||||||
const standardSideMenu = true; // Einstellung, ob ein standardmäßiges Seitenmenü verwendet wird
|
const standardSideMenu = true; // Einstellung, ob ein standardmäßiges Seitenmenü verwendet wird
|
||||||
|
|||||||
17
config/layers.js
Normal file
17
config/layers.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import L from "leaflet";
|
||||||
|
|
||||||
|
export const MAP_LAYERS = {
|
||||||
|
TALAS: new L.layerGroup(),
|
||||||
|
ECI: new L.layerGroup(),
|
||||||
|
ULAF: new L.layerGroup(),
|
||||||
|
GSMModem: new L.layerGroup(),
|
||||||
|
CiscoRouter: new L.layerGroup(),
|
||||||
|
WAGO: new L.layerGroup(),
|
||||||
|
Siemens: new L.layerGroup(),
|
||||||
|
OTDR: new L.layerGroup(),
|
||||||
|
WDM: new L.layerGroup(),
|
||||||
|
GMA: new L.layerGroup(),
|
||||||
|
Sonstige: new L.layerGroup(),
|
||||||
|
TALASICL: new L.layerGroup(),
|
||||||
|
lineLayer: new L.LayerGroup(),
|
||||||
|
};
|
||||||
4
config/settings.js
Normal file
4
config/settings.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
// Definieren der grundlegenden Umgebungseinstellungen und Konfigurationen der Karte
|
||||||
|
export const MAP_VERSION = "0.5.3";
|
||||||
|
export const STANDARD_SIDE_MENU = true;
|
||||||
|
export const FULL_SIDE_MENU = false;
|
||||||
Reference in New Issue
Block a user