Mercurial > gemma
annotate client/src/components/layers/Layerselect.vue @ 4869:6b054b91d9b2
backend not reachable as error message etd. Login adjusted
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 19 Dec 2019 09:35:14 +0100 |
parents | 008bc1ae8897 |
children | 453a33b0717d |
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;" |
4866
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
5 v-tooltip="{ |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
6 content: rightclickLabel, |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
7 delay: { |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
8 show: 1000, |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
9 hide: 100 |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
10 }, |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
11 placement: 'bottom', |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
12 autohide: true |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
13 }" |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
14 > |
4864
6a148617e012
right click deactivates other layers
Thomas Junk <thomas.junk@intevation.de>
parents:
4777
diff
changeset
|
15 <div class="d-flex" @click.right.prevent="selectSingle"> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1277
diff
changeset
|
16 <input |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
17 v-for="map in openLayersMaps" |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
18 :key="map.getTarget()" |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
19 class="mt-1 mr-1" |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2953
diff
changeset
|
20 type="checkbox" |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
21 @change="toggle(map)" |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
22 :checked="isVisible(map)" |
1480 | 23 /> |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
24 <LegendElement class="pointer" :layer="layer" @click.native="toggle()" /> |
4864
6a148617e012
right click deactivates other layers
Thomas Junk <thomas.junk@intevation.de>
parents:
4777
diff
changeset
|
25 <label |
6a148617e012
right click deactivates other layers
Thomas Junk <thomas.junk@intevation.de>
parents:
4777
diff
changeset
|
26 class="pointer layername form-check-label ml-1" |
6a148617e012
right click deactivates other layers
Thomas Junk <thomas.junk@intevation.de>
parents:
4777
diff
changeset
|
27 @click.left="toggle()" |
6a148617e012
right click deactivates other layers
Thomas Junk <thomas.junk@intevation.de>
parents:
4777
diff
changeset
|
28 > |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2953
diff
changeset
|
29 {{ label }} |
2952
a3017800e045
client: map legend: reduced code
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
30 </label> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
31 </div> |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
32 <div> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
33 <div v-if="isVisible() && layer.get('id') === 'BOTTLENECKISOLINE'"> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
34 <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
|
35 </div> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
36 <div v-if="isVisible() && layer.get('id') === 'DIFFERENCES'"> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
37 <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
|
38 </div> |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2920
diff
changeset
|
39 </div> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1277
diff
changeset
|
40 </div> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
41 </template> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
42 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
43 <script> |
1362
ca33ad696594
remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1361
diff
changeset
|
44 /* 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
|
45 * 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
|
46 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
47 * SPDX-License-Identifier: AGPL-3.0-or-later |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
48 * 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
|
49 * |
1926
1220cfe96efd
client: prepare isoline legend graphic for reuse
Bernhard Reiter <bernhard@intevation.de>
parents:
1669
diff
changeset
|
50 * Copyright (C) 2018, 2019 by via donau |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
51 * – Österreichische Wasserstraßen-Gesellschaft mbH |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
52 * 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
|
53 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
54 * Author(s): |
1926
1220cfe96efd
client: prepare isoline legend graphic for reuse
Bernhard Reiter <bernhard@intevation.de>
parents:
1669
diff
changeset
|
55 * * Thomas Junk <thomas.junk@intevation.de> |
1220cfe96efd
client: prepare isoline legend graphic for reuse
Bernhard Reiter <bernhard@intevation.de>
parents:
1669
diff
changeset
|
56 * * Bernhard Reiter <bernhard.reiter@intevation.de> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
57 */ |
1613
f2d24dceecc7
refac: cleanup import paths
Thomas Junk <thomas.junk@intevation.de>
parents:
1558
diff
changeset
|
58 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
|
59 import { displayError } from "@/lib/errors"; |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
60 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
|
61 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
62 export default { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
63 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
|
64 LegendElement: () => import("./LegendElement") |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
65 }, |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
66 props: ["layerId"], |
1927
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1926
diff
changeset
|
67 computed: { |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2920
diff
changeset
|
68 ...mapState("map", [ |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
69 "openLayersMaps", |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2920
diff
changeset
|
70 "isolinesLegendImgDataURL", |
4275
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
71 "differencesLegendImgDataURL", |
4866
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
72 "ongoingRefresh", |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
73 "singleLayerVisible" |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2920
diff
changeset
|
74 ]), |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
75 ...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
|
76 ...mapState("bottlenecks", ["selectedSurvey"]), |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
77 layer() { |
3079
57255fda7594
client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents:
3055
diff
changeset
|
78 return this.openLayersMap().getLayer(this.layerId); |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
79 }, |
4866
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
80 rightclickLabel() { |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
81 if (this.singleLayerVisible) |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
82 return this.$gettext("Right click to select previous layers"); |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
83 return this.$gettext("Right click to select single layer"); |
9df7794ec969
adding toolstip to powertoggle
Thomas Junk <thomas.junk@intevation.de>
parents:
4865
diff
changeset
|
84 }, |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2953
diff
changeset
|
85 label() { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2953
diff
changeset
|
86 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
|
87 } |
1927
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1926
diff
changeset
|
88 }, |
4275
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
89 watch: { |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
90 ongoingRefresh() { |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
91 if (this.ongoingRefresh) return; |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
92 this.refreshLegend(); |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
93 } |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
94 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
95 methods: { |
4864
6a148617e012
right click deactivates other layers
Thomas Junk <thomas.junk@intevation.de>
parents:
4777
diff
changeset
|
96 selectSingle() { |
4865
e51b9b265df0
right click toggles single layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
4864
diff
changeset
|
97 this.$store.commit("map/viewSingleLayer", this.layerId); |
4864
6a148617e012
right click deactivates other layers
Thomas Junk <thomas.junk@intevation.de>
parents:
4777
diff
changeset
|
98 }, |
4275
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
99 refreshLegend() { |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
100 if (this.layer.get("id") === "BOTTLENECKISOLINE") { |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
101 this.loadLegendImage( |
4580
02cf2b4be955
Use new areas layer in client.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4275
diff
changeset
|
102 "sounding_results_areas_geoserver", |
4275
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
103 "isolinesLegendImgDataURL" |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
104 ); |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
105 } |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
106 if (this.layer.get("id") === "DIFFERENCES") { |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
107 this.loadLegendImage( |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
108 "sounding_differences", |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
109 "differencesLegendImgDataURL" |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
110 ); |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
111 } |
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
112 }, |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
113 toggle(map) { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
114 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
|
115 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
|
116 (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
|
117 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
|
118 !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
|
119 ) { |
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
|
120 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
|
121 .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
|
122 .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
|
123 .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
|
124 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
|
125 }); |
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
|
126 } |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
127 map |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
128 .getLayer(this.layerId) |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
129 .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
|
130 if ( |
9fba1be118e7
client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3079
diff
changeset
|
131 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
|
132 this.layerId === "STRETCHES" || |
3444
1559566662f5
client: data accuracy: Add diagram for sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3434
diff
changeset
|
133 this.layerId === "BOTTLENECKS" || |
1559566662f5
client: data accuracy: Add diagram for sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3434
diff
changeset
|
134 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
|
135 ) { |
9fba1be118e7
client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3079
diff
changeset
|
136 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
|
137 } |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
138 } else { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
139 this.openLayersMaps.forEach(m => { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
140 m.getLayer(this.layerId).setVisible( |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
141 !m.getLayer(this.layerId).getVisible() |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
142 ); |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
143 }); |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
144 } |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
145 }, |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
146 isVisible(map) { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
147 if (map) { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
148 return map.getLayer(this.layerId).getVisible(); |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
149 } else { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
150 let isVisible = false; |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
151 this.openLayersMaps.forEach(m => { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
152 if (m.getLayer(this.layerId).getVisible()) { |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
153 isVisible = true; |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
154 } |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
155 }); |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
156 return isVisible; |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
157 } |
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
|
158 }, |
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
|
159 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
|
160 HTTP.get( |
4777
702f06d827a8
Updated requested scale for legend elements to avoid duplicates.
Raimund Renkert <raimund@renkert.org>
parents:
4594
diff
changeset
|
161 `/internal/wms?REQUEST=GetLegendGraphic&VERSION=1.3.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=${layer}&legend_options=columns:4;fontAntiAliasing:true&SCALE=4000`, |
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
|
162 { |
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
|
163 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
|
164 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
|
165 "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
|
166 }, |
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
|
167 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
|
168 } |
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
|
169 ) |
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
|
170 .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
|
171 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
|
172 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
|
173 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
|
174 }; |
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
|
175 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
|
176 }) |
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
|
177 .catch(error => { |
4869
6b054b91d9b2
backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
4868
diff
changeset
|
178 let message = "Backend not reachable"; |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4866
diff
changeset
|
179 if (error.response) { |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4866
diff
changeset
|
180 const { status, data } = error.response; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4866
diff
changeset
|
181 message = `${status}: ${data.message || data}`; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4866
diff
changeset
|
182 } |
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
|
183 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
|
184 title: this.$gettext("Backend Error"), |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4866
diff
changeset
|
185 message: message |
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
|
186 }); |
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
|
187 }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
188 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
189 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
190 created() { |
4275
4f81082899c8
Legend: legend for bottlnecks isoline and differences should reload as well
Thomas Junk <thomas.junk@intevation.de>
parents:
4008
diff
changeset
|
191 this.refreshLegend(); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
192 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
193 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
194 </script> |