annotate client/src/components/systemconfiguration/MapLayers.vue @ 3678:8f58851927c0

client: make layer factory only return new layer config for individual maps instead of each time it is invoked. The purpose of the factory was to support multiple maps with individual layers. But returning a new config each time it is invoked leads to bugs that rely on the layer's state. Now this factory reuses the same objects it created before, per map.
author Markus Kottlaender <markus@intevation.de>
date Mon, 17 Jun 2019 17:31:35 +0200
parents 32d7bb1afdc9
children 91b4ca03174e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
1 <template>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
2 <div class="d-flex flex-column pb-4 border-bottom">
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
3 <h5 class="py-2 px-3 mb-2 m-0"><translate>Map Layers</translate></h5>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
4 <div class="px-3 container-fluid">
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
5 <div class="row">
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
6 <div class="col-sm-6">
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
7 <div class="form-group">
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
8 <label for="ecdis-url" class="font-weight-bold">
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
9 ECDIS WMS URL
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
10 </label>
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
11 <input
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
12 type="url"
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
13 class="form-control"
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
14 placeholder="https://..."
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
15 @input="lookupWMSCapabilities()"
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
16 v-model="config.ecdis_wms_url"
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
17 />
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
18 </div>
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
19 <label for="ecdis-layers">
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
20 <translate>Layers</translate>
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
21 <transition name="fade"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
22 ><font-awesome-icon
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
23 icon="spinner"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
24 spin
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
25 v-if="availableWMSLayersLoading"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
26 class="ml-2"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
27 /></transition>
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
28 </label>
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
29 <div class="container-fluid">
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
30 <div class="row">
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
31 <div
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
32 class="custom-control custom-checkbox col-sm-4"
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
33 v-for="layer in availableWMSLayers"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
34 :key="'layer-' + layer"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
35 >
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
36 <input
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
37 type="checkbox"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
38 class="custom-control-input"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
39 v-model="selectedWMSLayers"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
40 :id="'layer-' + layer"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
41 :value="layer"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
42 />
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
43 <label
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
44 class="custom-control-label text-break"
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
45 :for="'layer-' + layer"
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
46 >
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
47 {{ layer }}
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
48 </label>
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
49 </div>
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
50 </div>
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
51 </div>
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
52 </div>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
53 </div>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
54 </div>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
55 <div class="mt-4 px-3">
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
56 <a @click.prevent="submit" class="btn btn-info btn-sm text-white">
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
57 <translate>Send</translate>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
58 </a>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
59 </div>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
60 </div>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
61 </template>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
62
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
63 <script>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
64 /* This is Free Software under GNU Affero General Public License v >= 3.0
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
65 * without warranty, see README.md and license for details.
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
66 *
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
67 * SPDX-License-Identifier: AGPL-3.0-or-later
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
68 * License-Filename: LICENSES/AGPL-3.0.txt
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
69 *
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
70 * Copyright (C) 2018 by via donau
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
71 * – Österreichische Wasserstraßen-Gesellschaft mbH
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
72 * Software engineering by Intevation GmbH
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
73 *
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
74 * Author(s):
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
75 * Markus Kottländer <markus@intevation.de>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
76 */
3622
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
77 import { mapState } from "vuex";
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
78 import WMSCapabilities from "ol/format/WMSCapabilities";
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
79 import { HTTP } from "@/lib/http";
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
80
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
81 const WMSCapabilitiesParser = new WMSCapabilities();
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
82
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
83 export default {
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
84 data() {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
85 return {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
86 selectedWMSLayers: [],
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
87 availableWMSLayers: [],
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
88 availableWMSLayersLoading: false,
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
89 lookupWMSCapabilitiesTimeout: null,
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
90 wmsVersion: ""
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
91 };
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
92 },
3622
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
93 computed: {
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
94 ...mapState("application", ["config"])
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
95 },
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
96 methods: {
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
97 lookupWMSCapabilities() {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
98 if (this.lookupWMSCapabilitiesTimeout) {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
99 clearTimeout(this.lookupWMSCapabilitiesTimeout);
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
100 }
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
101 this.lookupWMSCapabilitiesTimeout = setTimeout(() => {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
102 let url;
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
103 try {
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
104 let urlParts = new URL(this.config.ecdis_wms_url);
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
105 url =
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
106 urlParts.protocol +
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
107 "//" +
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
108 urlParts.host +
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
109 urlParts.pathname.trim("/") +
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
110 "/";
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
111 } catch (e) {
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
112 url = this.config.ecdis_wms_url;
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
113 }
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
114 this.availableWMSLayersLoading = true;
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
115 HTTP.get(url + "?request=GetCapabilities&service=WMS")
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
116 .then(response => {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
117 let capabilities = WMSCapabilitiesParser.read(response.data);
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
118 this.wmsVersion = capabilities.version;
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
119 this.availableWMSLayers = [];
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
120 this.getLayersRecursive(capabilities.Capability.Layer.Layer);
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
121 })
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
122 .catch(() => {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
123 this.availableWMSLayers = [];
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
124 })
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
125 .finally(() => (this.availableWMSLayersLoading = false));
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
126 }, 500);
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
127 },
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
128 getLayersRecursive(layers) {
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
129 layers.forEach(l => {
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
130 if (l.hasOwnProperty("Layer")) {
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
131 this.getLayersRecursive(l.Layer);
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
132 } else {
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
133 this.availableWMSLayers.push(l.Name);
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
134 }
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
135 });
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
136 },
3622
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
137 submit() {
3625
a688a478e35f implemented configuration backend and frontend
Markus Kottlaender <markus@intevation.de>
parents: 3622
diff changeset
138 this.$store.dispatch("application/saveConfig", {
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
139 ecdis_wms_url: this.config.ecdis_wms_url,
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
140 ecdis_wms_params: JSON.stringify({
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
141 LAYERS: this.selectedWMSLayers
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
142 .filter(l => this.availableWMSLayers.find(al => al === l))
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
143 .join(","),
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
144 VERSION: this.wmsVersion,
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
145 TILED: true
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
146 })
3625
a688a478e35f implemented configuration backend and frontend
Markus Kottlaender <markus@intevation.de>
parents: 3622
diff changeset
147 });
3622
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
148 }
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
149 },
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
150 mounted() {
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
151 let ecdisWmsParams = JSON.parse(this.config.ecdis_wms_params);
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
152 if (ecdisWmsParams.LAYERS) {
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
153 this.selectedWMSLayers = ecdisWmsParams.LAYERS.split(",");
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
154 }
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
155 this.lookupWMSCapabilities();
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
156 }
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
157 };
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
158 </script>