comparison client/src/components/layers/Layerselect.vue @ 4275:4f81082899c8

Legend: legend for bottlnecks isoline and differences should reload as well
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 28 Aug 2019 16:09:19 +0200
parents 224ee5a3acb1
children 02cf2b4be955
comparison
equal deleted inserted replaced
4274:e4ff09ebc2c3 4275:4f81082899c8
54 props: ["layerId"], 54 props: ["layerId"],
55 computed: { 55 computed: {
56 ...mapState("map", [ 56 ...mapState("map", [
57 "openLayersMaps", 57 "openLayersMaps",
58 "isolinesLegendImgDataURL", 58 "isolinesLegendImgDataURL",
59 "differencesLegendImgDataURL" 59 "differencesLegendImgDataURL",
60 "ongoingRefresh"
60 ]), 61 ]),
61 ...mapGetters("map", ["openLayersMap"]), 62 ...mapGetters("map", ["openLayersMap"]),
62 ...mapState("bottlenecks", ["selectedSurvey"]), 63 ...mapState("bottlenecks", ["selectedSurvey"]),
63 layer() { 64 layer() {
64 return this.openLayersMap().getLayer(this.layerId); 65 return this.openLayersMap().getLayer(this.layerId);
65 }, 66 },
66 label() { 67 label() {
67 return this.$gettext(this.layer.get("label")); 68 return this.$gettext(this.layer.get("label"));
68 } 69 }
69 }, 70 },
71 watch: {
72 ongoingRefresh() {
73 if (this.ongoingRefresh) return;
74 this.refreshLegend();
75 }
76 },
70 methods: { 77 methods: {
78 refreshLegend() {
79 if (this.layer.get("id") === "BOTTLENECKISOLINE") {
80 this.loadLegendImage(
81 "sounding_results_contour_lines_geoserver",
82 "isolinesLegendImgDataURL"
83 );
84 }
85 if (this.layer.get("id") === "DIFFERENCES") {
86 this.loadLegendImage(
87 "sounding_differences",
88 "differencesLegendImgDataURL"
89 );
90 }
91 },
71 toggle(map) { 92 toggle(map) {
72 if (map) { 93 if (map) {
73 if ( 94 if (
74 (this.layerId === "BOTTLENECKISOLINE" || 95 (this.layerId === "BOTTLENECKISOLINE" ||
75 this.layerId === "DIFFERENCES") && 96 this.layerId === "DIFFERENCES") &&
139 }); 160 });
140 }); 161 });
141 } 162 }
142 }, 163 },
143 created() { 164 created() {
144 if (this.layer.get("id") === "BOTTLENECKISOLINE") { 165 this.refreshLegend();
145 this.loadLegendImage(
146 "sounding_results_contour_lines_geoserver",
147 "isolinesLegendImgDataURL"
148 );
149 }
150 if (this.layer.get("id") === "DIFFERENCES") {
151 this.loadLegendImage(
152 "sounding_differences",
153 "differencesLegendImgDataURL"
154 );
155 }
156 } 166 }
157 }; 167 };
158 </script> 168 </script>