Mercurial > gemma
annotate client/src/components/layers/Layers.vue @ 3915:f7f09f32d6e0
hydrological conditions: omit rendering, when container isn't visible
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 11 Jul 2019 13:51:26 +0200 |
parents | 9fba1be118e7 |
children | d85d8de8c28c |
rev | line source |
---|---|
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
1480 | 2 <div |
3 :class="[ | |
4 'box ui-element rounded bg-white text-nowrap', | |
5 { expanded: showLayers } | |
6 ]" | |
7 > | |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
8 <div class="position-relative" style="width: 18rem; min-height: 350px;"> |
3167
85734c763652
client: layers: moved refresh button from zoom controls to layers dialog
Markus Kottlaender <markus@intevation.de>
parents:
3055
diff
changeset
|
9 <UIBoxHeader |
85734c763652
client: layers: moved refresh button from zoom controls to layers dialog
Markus Kottlaender <markus@intevation.de>
parents:
3055
diff
changeset
|
10 icon="layer-group" |
85734c763652
client: layers: moved refresh button from zoom controls to layers dialog
Markus Kottlaender <markus@intevation.de>
parents:
3055
diff
changeset
|
11 :title="label" |
85734c763652
client: layers: moved refresh button from zoom controls to layers dialog
Markus Kottlaender <markus@intevation.de>
parents:
3055
diff
changeset
|
12 :closeCallback="close" |
3177
fc008b32c593
client: layers: loading animation for refreshing layer sources
Markus Kottlaender <markus@intevation.de>
parents:
3167
diff
changeset
|
13 :actions="[ |
3181
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
14 { |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
15 callback: refreshLayers, |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
16 icon: sourcesLoading ? 'spinner' : 'sync' |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
17 } |
3177
fc008b32c593
client: layers: loading animation for refreshing layer sources
Markus Kottlaender <markus@intevation.de>
parents:
3167
diff
changeset
|
18 ]" |
3167
85734c763652
client: layers: moved refresh button from zoom controls to layers dialog
Markus Kottlaender <markus@intevation.de>
parents:
3055
diff
changeset
|
19 /> |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
20 <div class="small" v-if="openLayersMaps.length"> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
21 <Layerselect layerId="OPENSTREETMAP" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
22 <Layerselect layerId="INLANDECDIS" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
23 <Layerselect layerId="WATERWAYAREA" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
24 <Layerselect layerId="STRETCHES" /> |
3309
80037790032d
client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents:
3181
diff
changeset
|
25 <Layerselect layerId="SECTIONS" /> |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
26 <Layerselect layerId="FAIRWAYDIMENSIONSLOS3" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
27 <Layerselect layerId="FAIRWAYDIMENSIONSLOS2" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
28 <Layerselect layerId="FAIRWAYDIMENSIONSLOS1" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
29 <Layerselect layerId="WATERWAYAXIS" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
30 <Layerselect layerId="WATERWAYPROFILES" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
31 <Layerselect layerId="BOTTLENECKS" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
32 <Layerselect layerId="BOTTLENECKISOLINE" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
33 <Layerselect layerId="DIFFERENCES" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
34 <Layerselect layerId="BOTTLENECKSTATUS" /> |
3335
59db0b5921c5
client: added layer for fairway availability diagrams with demo diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3309
diff
changeset
|
35 <Layerselect layerId="BOTTLENECKFAIRWAYAVAILABILITY" /> |
3434
9fba1be118e7
client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3425
diff
changeset
|
36 <Layerselect layerId="DATAAVAILABILITY" /> |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
37 <Layerselect layerId="DISTANCEMARKS" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
38 <Layerselect layerId="DISTANCEMARKSAXIS" /> |
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
39 <Layerselect layerId="GAUGES" /> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
40 </div> |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
41 <UISpinnerOverlay v-else style="top: 34px;" /> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
42 </div> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
43 </div> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
44 </template> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
45 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
46 <script> |
1362
ca33ad696594
remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1361
diff
changeset
|
47 /* 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
|
48 * 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:
1299
diff
changeset
|
49 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
50 * SPDX-License-Identifier: AGPL-3.0-or-later |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
51 * 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:
1299
diff
changeset
|
52 * |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
53 * Copyright (C) 2018 by via donau |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
54 * – Österreichische Wasserstraßen-Gesellschaft mbH |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
55 * 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:
1299
diff
changeset
|
56 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
57 * Author(s): |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
58 * Thomas Junk <thomas.junk@intevation.de> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
59 * Markus Kottländer <markus.kottlaender@intevation.de> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
60 */ |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
61 import { mapState } from "vuex"; |
2870
35f6e4383161
layer structure overhaul
Thomas Junk <thomas.junk@intevation.de>
parents:
2851
diff
changeset
|
62 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
63 export default { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 components: { |
1669
16fb9667ddf8
refac: use dynamic imports for components
Thomas Junk <thomas.junk@intevation.de>
parents:
1558
diff
changeset
|
65 Layerselect: () => import("./Layerselect") |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
66 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
67 computed: { |
2754
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2534
diff
changeset
|
68 ...mapState("application", ["showLayers"]), |
3181
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
69 ...mapState("map", ["openLayersMaps"]), |
3055
b3c24c47931c
client: layers legend: support multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
70 label() { |
3425
cb2f67a07400
client: toolbar/dialogs: unified toolbar tooltips and dialog titles
Markus Kottlaender <markus@intevation.de>
parents:
3409
diff
changeset
|
71 return this.$gettext("Map Layers"); |
3181
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
72 }, |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
73 sourcesLoading() { |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
74 let counter = 0; |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
75 this.openLayersMaps.forEach(map => { |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
76 let layers = map.getLayers().getArray(); |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
77 for (let i = 0; i < layers.length; i++) { |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
78 if (layers[i].getSource().loading) counter++; |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
79 } |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
80 }); |
c122a064fd5e
client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents:
3177
diff
changeset
|
81 return counter; |
2754
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2534
diff
changeset
|
82 } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
83 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
84 methods: { |
2387
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2260
diff
changeset
|
85 close() { |
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2260
diff
changeset
|
86 this.$store.commit("application/showLayers", false); |
3167
85734c763652
client: layers: moved refresh button from zoom controls to layers dialog
Markus Kottlaender <markus@intevation.de>
parents:
3055
diff
changeset
|
87 }, |
85734c763652
client: layers: moved refresh button from zoom controls to layers dialog
Markus Kottlaender <markus@intevation.de>
parents:
3055
diff
changeset
|
88 refreshLayers() { |
3409
c0f5f62343c9
client: import review: refresh map layers after accepting/declining imports
Markus Kottlaender <markus@intevation.de>
parents:
3335
diff
changeset
|
89 this.$store.dispatch("map/refreshLayers"); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
90 } |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2952
diff
changeset
|
91 } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
92 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
93 </script> |