comparison client/src/components/layers/Layers.vue @ 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 59db0b5921c5
children cb2f67a07400
comparison
equal deleted inserted replaced
3408:a26c1d745fc3 3409:c0f5f62343c9
56 * Author(s): 56 * Author(s):
57 * Thomas Junk <thomas.junk@intevation.de> 57 * Thomas Junk <thomas.junk@intevation.de>
58 * Markus Kottländer <markus.kottlaender@intevation.de> 58 * Markus Kottländer <markus.kottlaender@intevation.de>
59 */ 59 */
60 import { mapState } from "vuex"; 60 import { mapState } from "vuex";
61 import { Vector as VectorLayer } from "ol/layer";
62 61
63 export default { 62 export default {
64 components: { 63 components: {
65 Layerselect: () => import("./Layerselect") 64 Layerselect: () => import("./Layerselect")
66 }, 65 },
84 methods: { 83 methods: {
85 close() { 84 close() {
86 this.$store.commit("application/showLayers", false); 85 this.$store.commit("application/showLayers", false);
87 }, 86 },
88 refreshLayers() { 87 refreshLayers() {
89 this.openLayersMaps.forEach(map => { 88 this.$store.dispatch("map/refreshLayers");
90 let layers = map.getLayers().getArray();
91 for (let i = 0; i < layers.length; i++) {
92 let layer = layers[i];
93 if (
94 layer instanceof VectorLayer &&
95 layer.get("source").loader_.name != "VOID"
96 ) {
97 layer.getSource().clear(true);
98 layer.getSource().refresh({ force: true });
99 }
100 }
101 });
102 } 89 }
103 } 90 }
104 }; 91 };
105 </script> 92 </script>