annotate client/src/components/systemconfiguration/MapLayers.vue @ 4022:efe0904b1d45

Change of ECDIS no longer requires reload When the maps are initialized, the source of th ECDIS is retireved from the store. When a change of the configuration is made, the store is updated.
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 22 Jul 2019 13:28:04 +0200
parents 851c0ccba59b
children
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>
3889
851c0ccba59b client: configuration: separated sections in tabs
Markus Kottlaender <markus@intevation.de>
parents: 3868
diff changeset
2 <div class="d-flex flex-column py-4">
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
3 <div class="px-3 container-fluid">
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
4 <div class="row">
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
5 <div class="col-sm-6">
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
6 <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
7 <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
8 ECDIS WMS URL
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
9 </label>
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
10 <input
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
11 type="url"
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
12 class="form-control"
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
13 placeholder="https://..."
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
14 @input="lookupWMSCapabilities()"
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
15 v-model="config.ecdis_wms_url"
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
16 />
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
17 </div>
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
18 <label for="ecdis-layers">
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
19 <translate>Layers</translate>
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
20 <transition name="fade"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
21 ><font-awesome-icon
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
22 icon="spinner"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
23 spin
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
24 v-if="availableWMSLayersLoading"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
25 class="ml-2"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
26 /></transition>
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
27 </label>
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
28 <div class="container-fluid">
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
29 <div class="row">
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
30 <div
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
31 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
32 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
33 :key="'layer-' + layer"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
34 >
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
35 <input
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
36 type="checkbox"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
37 class="custom-control-input"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
38 v-model="selectedWMSLayers"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
39 :id="'layer-' + layer"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
40 :value="layer"
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
41 />
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
42 <label
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
43 class="custom-control-label text-break"
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
44 :for="'layer-' + layer"
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
45 >
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
46 {{ layer }}
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
47 </label>
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
48 </div>
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>
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
51 </div>
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 class="mt-4 px-3">
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
55 <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
56 <translate>Send</translate>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
57 </a>
3868
91b4ca03174e client: configuration: reset map layer config to default
Markus Kottlaender <markus@intevation.de>
parents: 3641
diff changeset
58 <a @click.prevent="reset" class="btn btn-outline-info btn-sm ml-2">
91b4ca03174e client: configuration: reset map layer config to default
Markus Kottlaender <markus@intevation.de>
parents: 3641
diff changeset
59 <translate>Reset to defaults</translate>
91b4ca03174e client: configuration: reset map layer config to default
Markus Kottlaender <markus@intevation.de>
parents: 3641
diff changeset
60 </a>
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
61 </div>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
62 </div>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
63 </template>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
64
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
65 <script>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
66 /* 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
67 * 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
68 *
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
69 * 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
70 * License-Filename: LICENSES/AGPL-3.0.txt
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
71 *
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
72 * Copyright (C) 2018 by via donau
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
73 * – Österreichische Wasserstraßen-Gesellschaft mbH
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
74 * Software engineering by Intevation GmbH
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
75 *
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
76 * Author(s):
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
77 * Markus Kottländer <markus@intevation.de>
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
78 */
3622
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
79 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
80 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
81 import { HTTP } from "@/lib/http";
3868
91b4ca03174e client: configuration: reset map layer config to default
Markus Kottlaender <markus@intevation.de>
parents: 3641
diff changeset
82 import defaults from "./defaults";
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
83
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
84 const WMSCapabilitiesParser = new WMSCapabilities();
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
85
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
86 export default {
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
87 data() {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
88 return {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
89 selectedWMSLayers: [],
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
90 availableWMSLayers: [],
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
91 availableWMSLayersLoading: false,
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
92 lookupWMSCapabilitiesTimeout: null,
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
93 wmsVersion: ""
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
94 };
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
95 },
3622
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
96 computed: {
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
97 ...mapState("application", ["config"])
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
98 },
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
99 methods: {
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
100 lookupWMSCapabilities() {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
101 if (this.lookupWMSCapabilitiesTimeout) {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
102 clearTimeout(this.lookupWMSCapabilitiesTimeout);
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
103 }
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
104 this.lookupWMSCapabilitiesTimeout = setTimeout(() => {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
105 let url;
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
106 try {
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
107 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
108 url =
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
109 urlParts.protocol +
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 urlParts.host +
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
112 urlParts.pathname.trim("/") +
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 } catch (e) {
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
115 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
116 }
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
117 this.availableWMSLayersLoading = true;
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
118 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
119 .then(response => {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
120 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
121 this.wmsVersion = capabilities.version;
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
122 this.availableWMSLayers = [];
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
123 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
124 })
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
125 .catch(() => {
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
126 this.availableWMSLayers = [];
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
127 })
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
128 .finally(() => (this.availableWMSLayersLoading = false));
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
129 }, 500);
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
130 },
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
131 getLayersRecursive(layers) {
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
132 layers.forEach(l => {
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
133 if (l.hasOwnProperty("Layer")) {
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
134 this.getLayersRecursive(l.Layer);
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
135 } else {
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
136 this.availableWMSLayers.push(l.Name);
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
137 }
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
138 });
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
139 },
3868
91b4ca03174e client: configuration: reset map layer config to default
Markus Kottlaender <markus@intevation.de>
parents: 3641
diff changeset
140 reset() {
91b4ca03174e client: configuration: reset map layer config to default
Markus Kottlaender <markus@intevation.de>
parents: 3641
diff changeset
141 this.config.ecdis_wms_url = defaults.ecdis_wms_url;
91b4ca03174e client: configuration: reset map layer config to default
Markus Kottlaender <markus@intevation.de>
parents: 3641
diff changeset
142 let ecdisWmsParams = JSON.parse(defaults.ecdis_wms_params);
91b4ca03174e client: configuration: reset map layer config to default
Markus Kottlaender <markus@intevation.de>
parents: 3641
diff changeset
143 this.selectedWMSLayers = ecdisWmsParams.LAYERS.split(",");
91b4ca03174e client: configuration: reset map layer config to default
Markus Kottlaender <markus@intevation.de>
parents: 3641
diff changeset
144 this.lookupWMSCapabilities();
91b4ca03174e client: configuration: reset map layer config to default
Markus Kottlaender <markus@intevation.de>
parents: 3641
diff changeset
145 },
3622
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
146 submit() {
4022
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
147 const layers = this.selectedWMSLayers
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
148 .filter(l => this.availableWMSLayers.find(al => al === l))
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
149 .join(",");
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
150 const wmsParams = JSON.stringify({
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
151 LAYERS: layers,
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
152 VERSION: this.wmsVersion,
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
153 TILED: true
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
154 });
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
155 this.$store
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
156 .dispatch("application/saveConfig", {
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
157 ecdis_wms_url: this.config.ecdis_wms_url,
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
158 ecdis_wms_params: wmsParams
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
159 })
4022
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
160 .then(() => {
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
161 this.config.ecdis_wms_params = wmsParams;
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 3889
diff changeset
162 });
3622
30a9fdac70f0 client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
Markus Kottlaender <markus@intevation.de>
parents: 3603
diff changeset
163 }
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
164 },
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
165 mounted() {
3641
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
166 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
167 if (ecdisWmsParams.LAYERS) {
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
168 this.selectedWMSLayers = ecdisWmsParams.LAYERS.split(",");
32d7bb1afdc9 client: configuration: support wms services with nested layers
Markus Kottlaender <markus@intevation.de>
parents: 3637
diff changeset
169 }
3637
0e2605f6fddd client: configuration: look up wms capabilities and make layers configurable
Markus Kottlaender <markus@intevation.de>
parents: 3625
diff changeset
170 this.lookupWMSCapabilities();
3603
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
171 }
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
172 };
2cf7e167dad9 client: configuration: prepared component for map layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
173 </script>