diff client/src/components/map/Map.vue @ 4022:efe0904b1d45

Change of ECDIS no longer requires reload When the maps are initialized, the source of th ECDIS is retireved from the store. When a change of the configuration is made, the store is updated.
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 22 Jul 2019 13:28:04 +0200
parents 5d4edf268aec
children be34d02cff73
line wrap: on
line diff
--- a/client/src/components/map/Map.vue	Mon Jul 22 11:20:20 2019 +0200
+++ b/client/src/components/map/Map.vue	Mon Jul 22 13:28:04 2019 +0200
@@ -42,6 +42,7 @@
 import { displayError } from "@/lib/errors";
 import { pane } from "@/lib/mixins";
 import { layerFactory } from "@/components/map/layers";
+import { ImageWMS as ImageSource } from "ol/source";
 import "ol/ol.css";
 
 /* for the sake of debugging */
@@ -60,7 +61,7 @@
     ...mapState("map", ["initialLoad", "extent", "syncedMaps", "syncedView"]),
     ...mapState("bottlenecks", ["selectedSurvey"]),
     ...mapState("fairwayprofile", ["additionalSurvey"]),
-    ...mapState("application", ["paneSetup", "paneRotate"]),
+    ...mapState("application", ["paneSetup", "paneRotate", "config"]),
     ...mapState("imports", ["selectedStretchId", "selectedSectionId"]),
     layers() {
       return layerFactory(this.paneId);
@@ -207,6 +208,13 @@
       }
     },
     mountMap() {
+      const source = new ImageSource({
+        preload: 1,
+        url: this.config.ecdis_wms_url,
+        crossOrigin: "anonymous",
+        params: JSON.parse(this.config.ecdis_wms_params)
+      });
+      this.layers.get("INLANDECDIS").setSource(source);
       this.map = new Map({
         layers: this.layers.config,
         target: "map-" + this.paneId,
@@ -222,7 +230,6 @@
               })
       });
       this.map.getLayer = id => this.layers.get(id);
-
       // store map position on every move
       // will be obsolete once we abandoned the separated admin context
       this.map.on("moveend", event => {