Mercurial > gemma
annotate client/src/components/layers/Layerselect.vue @ 4112:7959f62d3051
calculate scaling factor depending on DPI
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 30 Jul 2019 16:31:21 +0200 |
parents | 224ee5a3acb1 |
children | 4f81082899c8 |
rev | line source |
---|---|
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
2 <div |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
3 class="d-flex flex-column flex-start px-2 border-bottom" |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
4 style="border-bottom-style: dashed !important;" |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
5 > |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
6 <div class="d-flex"> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1277
diff
changeset
|
7 <input |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
8 v-for="map in openLayersMaps" |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
9 :key="map.getTarget()" |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
10 class="mt-1 mr-1" |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2953
diff
changeset
|
11 type="checkbox" |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
12 @change="toggle(map)" |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
13 :checked="isVisible(map)" |
1480 | 14 /> |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
15 <LegendElement class="pointer" :layer="layer" @click.native="toggle()" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
16 <label class="pointer layername form-check-label ml-1" @click="toggle()"> |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2953
diff
changeset
|
17 {{ label }} |
2952
a3017800e045
client: map legend: reduced code
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
18 </label> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
19 </div> |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
20 <div> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
21 <div v-if="isVisible() && layer.get('id') === 'BOTTLENECKISOLINE'"> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
22 <img class="rounded my-1 d-block" :src="isolinesLegendImgDataURL" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
23 </div> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
24 <div v-if="isVisible() && layer.get('id') === 'DIFFERENCES'"> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
25 <img class="rounded my-1 d-block" :src="differencesLegendImgDataURL" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
26 </div> |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2920
diff
changeset
|
27 </div> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1277
diff
changeset
|
28 </div> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
29 </template> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
30 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
31 <script> |
1362
ca33ad696594
remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1361
diff
changeset
|
32 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
33 * without warranty, see README.md and license for details. |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1277
diff
changeset
|
34 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
35 * SPDX-License-Identifier: AGPL-3.0-or-later |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
36 * License-Filename: LICENSES/AGPL-3.0.txt |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1277
diff
changeset
|
37 * |
1926
1220cfe96efd
client: prepare isoline legend graphic for reuse
Bernhard Reiter <bernhard@intevation.de>
parents:
1669
diff
changeset
|
38 * Copyright (C) 2018, 2019 by via donau |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
39 * – Österreichische Wasserstraßen-Gesellschaft mbH |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
40 * Software engineering by Intevation GmbH |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1277
diff
changeset
|
41 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
42 * Author(s): |
1926
1220cfe96efd
client: prepare isoline legend graphic for reuse
Bernhard Reiter <bernhard@intevation.de>
parents:
1669
diff
changeset
|
43 * * Thomas Junk <thomas.junk@intevation.de> |
1220cfe96efd
client: prepare isoline legend graphic for reuse
Bernhard Reiter <bernhard@intevation.de>
parents:
1669
diff
changeset
|
44 * * Bernhard Reiter <bernhard.reiter@intevation.de> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
45 */ |
1613
f2d24dceecc7
refac: cleanup import paths
Thomas Junk <thomas.junk@intevation.de>
parents:
1558
diff
changeset
|
46 import { HTTP } from "@/lib/http"; |
2960
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
47 import { displayError } from "@/lib/errors"; |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
48 import { mapState, mapGetters } from "vuex"; |
2920
c1f2b9148cc8
client: removed more unnecessary closing tags and opzimized imports
Markus Kottlaender <markus@intevation.de>
parents:
2851
diff
changeset
|
49 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
50 export default { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
51 components: { |
2960
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
52 LegendElement: () => import("./LegendElement") |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
53 }, |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
54 props: ["layerId"], |
1927
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1926
diff
changeset
|
55 computed: { |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2920
diff
changeset
|
56 ...mapState("map", [ |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
57 "openLayersMaps", |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2920
diff
changeset
|
58 "isolinesLegendImgDataURL", |
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2920
diff
changeset
|
59 "differencesLegendImgDataURL" |
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2920
diff
changeset
|
60 ]), |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
61 ...mapGetters("map", ["openLayersMap"]), |
4008
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
62 ...mapState("bottlenecks", ["selectedSurvey"]), |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
63 layer() { |
3079
57255fda7594
client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents:
3055
diff
changeset
|
64 return this.openLayersMap().getLayer(this.layerId); |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
65 }, |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2953
diff
changeset
|
66 label() { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2953
diff
changeset
|
67 return this.$gettext(this.layer.get("label")); |
2343
33d2ef9f9e5d
client: use the name constants for Layer names
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2154
diff
changeset
|
68 } |
1927
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1926
diff
changeset
|
69 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
70 methods: { |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
71 toggle(map) { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
72 if (map) { |
4008
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
73 if ( |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
74 (this.layerId === "BOTTLENECKISOLINE" || |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
75 this.layerId === "DIFFERENCES") && |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
76 !this.selectedSurvey |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
77 ) { |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
78 map |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
79 .getLayer(this.layerId) |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
80 .getSource() |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
81 .updateParams({ |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
82 cql_filter: `bottleneck_id='NO_BOTTLENECK_SELECTED'` |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
83 }); |
224ee5a3acb1
Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
Thomas Junk <thomas.junk@intevation.de>
parents:
3444
diff
changeset
|
84 } |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
85 map |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
86 .getLayer(this.layerId) |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
87 .setVisible(!map.getLayer(this.layerId).getVisible()); |
3434
9fba1be118e7
client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3079
diff
changeset
|
88 if ( |
9fba1be118e7
client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3079
diff
changeset
|
89 this.layerId === "GAUGES" || |
9fba1be118e7
client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3079
diff
changeset
|
90 this.layerId === "STRETCHES" || |
3444
1559566662f5
client: data accuracy: Add diagram for sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3434
diff
changeset
|
91 this.layerId === "BOTTLENECKS" || |
1559566662f5
client: data accuracy: Add diagram for sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3434
diff
changeset
|
92 this.layerId === "SECTIONS" |
3434
9fba1be118e7
client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3079
diff
changeset
|
93 ) { |
9fba1be118e7
client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3079
diff
changeset
|
94 map.getLayer("DATAAVAILABILITY").changed(); |
9fba1be118e7
client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3079
diff
changeset
|
95 } |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
96 } else { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
97 this.openLayersMaps.forEach(m => { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
98 m.getLayer(this.layerId).setVisible( |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
99 !m.getLayer(this.layerId).getVisible() |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
100 ); |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
101 }); |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
102 } |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
103 }, |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
104 isVisible(map) { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
105 if (map) { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
106 return map.getLayer(this.layerId).getVisible(); |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
107 } else { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
108 let isVisible = false; |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
109 this.openLayersMaps.forEach(m => { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
110 if (m.getLayer(this.layerId).getVisible()) { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
111 isVisible = true; |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
112 } |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
113 }); |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
114 return isVisible; |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
115 } |
2960
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
116 }, |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
117 loadLegendImage(layer, storeTarget) { |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
118 HTTP.get( |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
119 `/internal/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=${layer}&legend_options=columns:4;fontAntiAliasing:true`, |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
120 { |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
121 headers: { |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
122 Accept: "image/png", |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
123 "X-Gemma-Auth": localStorage.getItem("token") |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
124 }, |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
125 responseType: "blob" |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
126 } |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
127 ) |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
128 .then(response => { |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
129 const reader = new FileReader(); |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
130 reader.onload = event => { |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
131 this.$store.commit("map/" + storeTarget, event.target.result); |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
132 }; |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
133 reader.readAsDataURL(response.data); |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
134 }) |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
135 .catch(error => { |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
136 displayError({ |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
137 title: this.$gettext("Backend Error"), |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
138 message: `${error.response.status}: ${error.response.statusText}` |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
139 }); |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
140 }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
141 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
142 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
143 created() { |
3006
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2960
diff
changeset
|
144 if (this.layer.get("id") === "BOTTLENECKISOLINE") { |
2960
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
145 this.loadLegendImage( |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
146 "sounding_results_contour_lines_geoserver", |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
147 "isolinesLegendImgDataURL" |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
148 ); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
149 } |
3006
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2960
diff
changeset
|
150 if (this.layer.get("id") === "DIFFERENCES") { |
2960
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
151 this.loadLegendImage( |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
152 "sounding_differences", |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
153 "differencesLegendImgDataURL" |
41cdff9b7f4a
client: layer legend: removed unnecessary methods, added method for legend image loading and added error handling
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
154 ); |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2920
diff
changeset
|
155 } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
156 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
157 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
158 </script> |