comparison client/src/store/map.js @ 3409:c0f5f62343c9

client: import review: refresh map layers after accepting/declining imports
author Markus Kottlaender <markus@intevation.de>
date Thu, 23 May 2019 14:47:33 +0200
parents b01c2f474770
children 45eab8e9b580
comparison
equal deleted inserted replaced
3408:a26c1d745fc3 3409:c0f5f62343c9
22 import bbox from "@turf/bbox"; 22 import bbox from "@turf/bbox";
23 import app from "@/main"; 23 import app from "@/main";
24 import { HTTP } from "@/lib/http"; 24 import { HTTP } from "@/lib/http";
25 import Feature from "ol/Feature"; 25 import Feature from "ol/Feature";
26 import Point from "ol/geom/Point"; 26 import Point from "ol/geom/Point";
27 import { Vector as VectorLayer } from "ol/layer";
27 import { toLonLat } from "ol/proj"; 28 import { toLonLat } from "ol/proj";
28 29
29 // initial state 30 // initial state
30 const init = () => { 31 const init = () => {
31 return { 32 return {
537 // cannot directly query here because of SOP 538 // cannot directly query here because of SOP
538 console.log("GetFeatureInfo url:", iecdisUrl); 539 console.log("GetFeatureInfo url:", iecdisUrl);
539 } 540 }
540 }); 541 });
541 }, 542 },
543 refreshLayers({ state }) {
544 state.openLayersMaps.forEach(map => {
545 let layers = map.getLayers().getArray();
546 for (let i = 0; i < layers.length; i++) {
547 let layer = layers[i];
548 if (
549 layer instanceof VectorLayer &&
550 layer.get("source").loader_.name != "VOID"
551 ) {
552 layer.getSource().clear(true);
553 layer.getSource().refresh({ force: true });
554 }
555 }
556 });
557 },
542 moveToBoundingBox( 558 moveToBoundingBox(
543 { state }, 559 { state },
544 { boundingBox, zoom, preventZoomOut, duration } 560 { boundingBox, zoom, preventZoomOut, duration }
545 ) { 561 ) {
546 const extent = transformExtent(boundingBox, "EPSG:4326", "EPSG:3857"); 562 const extent = transformExtent(boundingBox, "EPSG:4326", "EPSG:3857");