annotate client/src/components/map/Map.vue @ 3177:fc008b32c593

client: layers: loading animation for refreshing layer sources
author Markus Kottlaender <markus@intevation.de>
date Tue, 07 May 2019 12:18:07 +0200
parents 286c2e3cc105
children c122a064fd5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
1 <template>
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
2 <div
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
3 :id="'map-' + paneId"
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
4 :class="['map', { nocursor: this.hasActiveInteractions }]"
3165
891705431545 client: map zoom controls: each map has it's own independent contrls now
Markus Kottlaender <markus@intevation.de>
parents: 3146
diff changeset
5 >
891705431545 client: map zoom controls: each map has it's own independent contrls now
Markus Kottlaender <markus@intevation.de>
parents: 3146
diff changeset
6 <Zoom :map="map" />
891705431545 client: map zoom controls: each map has it's own independent contrls now
Markus Kottlaender <markus@intevation.de>
parents: 3146
diff changeset
7 </div>
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
8 </template>
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
9
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
10 <style lang="sass" scoped>
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
11 .map
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
12 width: 100%
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
13 height: 100%
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
14 background-color: #eee
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
15 background-image: linear-gradient(45deg, #e8e8e8 25%, transparent 25%, transparent 75%, #e8e8e8 75%, #e8e8e8), linear-gradient(45deg, #e8e8e8 25%, transparent 25%, transparent 75%, #e8e8e8 75%, #e8e8e8)
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
16 background-size: 20px 20px
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
17 background-position: 0 0, 10px 10px
3177
fc008b32c593 client: layers: loading animation for refreshing layer sources
Markus Kottlaender <markus@intevation.de>
parents: 3166
diff changeset
18
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
19 &.nocursor
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
20 cursor: none
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
21 </style>
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
22
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
23 <script>
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
24 /* This is Free Software under GNU Affero General Public License v >= 3.0
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
25 * without warranty, see README.md and license for details.
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
26 *
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
27 * SPDX-License-Identifier: AGPL-3.0-or-later
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
28 * License-Filename: LICENSES/AGPL-3.0.txt
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
29 *
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
30 * Copyright (C) 2018, 2019 by via donau
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
31 * – Österreichische Wasserstraßen-Gesellschaft mbH
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
32 * Software engineering by Intevation GmbH
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
33 *
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
34 * Author(s):
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
35 * * Thomas Junk <thomas.junk@intevation.de>
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
36 * * Bernhard E. Reiter <bernhard.reiter@intevation.de>
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
37 */
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
38 import { HTTP } from "@/lib/http";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
39 import { mapState } from "vuex";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
40 import { Map, View } from "ol";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
41 import { Stroke, Style, Fill } from "ol/style";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
42 import { displayError } from "@/lib/errors";
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
43 import { pane } from "@/lib/mixins";
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
44 import layers from "@/components/map/layers";
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
45 import { Tile as TileLayer } from "ol/layer";
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
46 import "ol/ol.css";
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
47 import OSM from "ol/source/OSM";
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
48
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
49 /* for the sake of debugging */
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
50 /* eslint-disable no-console */
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
51 export default {
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
52 mixins: [pane],
3165
891705431545 client: map zoom controls: each map has it's own independent contrls now
Markus Kottlaender <markus@intevation.de>
parents: 3146
diff changeset
53 components: {
3166
286c2e3cc105 client: moved Zoom component to map subdirectory
Markus Kottlaender <markus@intevation.de>
parents: 3165
diff changeset
54 Zoom: () => import("@/components/map/Zoom")
3165
891705431545 client: map zoom controls: each map has it's own independent contrls now
Markus Kottlaender <markus@intevation.de>
parents: 3146
diff changeset
55 },
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
56 data() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
57 return {
3016
083cd270bdfd client: splitview: implemented rotation mechanism
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
58 map: null,
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
59 splitscreen: false
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
60 };
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
61 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
62 computed: {
3086
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
63 ...mapState("map", ["initialLoad", "extent", "syncedMaps", "syncedView"]),
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
64 ...mapState("bottlenecks", ["selectedSurvey"]),
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
65 ...mapState("fairwayprofile", ["additionalSurvey"]),
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3109
diff changeset
66 ...mapState("application", ["paneSetup", "paneRotate"]),
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
67 ...mapState("imports", ["selectedStretchId"]),
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3016
diff changeset
68 layers() {
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3016
diff changeset
69 return layers();
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3016
diff changeset
70 },
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
71 hasActiveInteractions() {
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
72 return (
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
73 this.map &&
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3057
diff changeset
74 this.map
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3057
diff changeset
75 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3057
diff changeset
76 .getArray()
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
77 .filter(
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
78 i =>
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
79 ["linetool", "polygontool", "cuttool"].includes(i.get("id")) &&
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
80 i.getActive()
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
81 ).length
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
82 );
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
83 }
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
84 },
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
85 watch: {
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3109
diff changeset
86 paneSetup() {
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
87 this.$nextTick(() => this.map.updateSize());
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
88 },
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
89 paneRotate() {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
90 this.$nextTick(() => this.map.updateSize());
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
91 },
3086
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
92 syncedMaps(syncedMaps) {
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
93 if (syncedMaps.includes(this.paneId) || this.paneId === "main") {
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
94 this.map.setView(this.syncedView);
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
95 } else {
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
96 this.map.setView(
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
97 new View({
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
98 center: [this.extent.lon, this.extent.lat],
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
99 minZoom: 5, // restrict zooming out to ~size of Europe for width 1000px
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
100 zoom: this.extent.zoom,
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
101 projection: "EPSG:3857"
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
102 })
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
103 );
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
104 }
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
105 },
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
106 selectedSurvey(survey) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
107 if (this.paneId === "main") {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
108 if (survey) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
109 this.updateBottleneckFilter(survey.bottleneck_id, survey.date_info);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
110 } else {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
111 this.updateBottleneckFilter("does_not_exist", "1999-10-01");
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
112 }
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3057
diff changeset
113 }
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
114 },
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
115 additionalSurvey(survey) {
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3109
diff changeset
116 if (this.paneId === "compare-survey") {
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
117 if (survey) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
118 this.updateBottleneckFilter(survey.bottleneck_id, survey.date_info);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
119 } else {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
120 this.updateBottleneckFilter("does_not_exist", "1999-10-01");
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
121 }
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
122 }
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
123 },
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
124 selectedStretchId(id) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
125 this.layers
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
126 .get("STRETCHES")
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
127 .getSource()
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
128 .getFeatures()
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
129 .forEach(f => {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
130 f.set("highlighted", false);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
131 if (id === f.getId()) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
132 f.set("highlighted", true);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
133 }
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
134 });
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
135 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
136 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
137 methods: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
138 updateBottleneckFilter(bottleneck_id, datestr) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
139 const exists = bottleneck_id != "does_not_exist";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
140
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
141 if (exists) {
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3016
diff changeset
142 this.layers
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
143 .get("BOTTLENECKISOLINE")
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
144 .getSource()
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
145 .updateParams({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
146 cql_filter: `date_info='${datestr}' AND bottleneck_id='${bottleneck_id}'`
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
147 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
148 }
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3016
diff changeset
149 this.layers.get("BOTTLENECKISOLINE").setVisible(exists);
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
150 },
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
151 initMap() {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
152 if (!this.syncedView) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
153 this.$store.commit(
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
154 "map/syncedView",
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
155 new View({
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
156 center: [this.extent.lon, this.extent.lat],
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
157 minZoom: 5, // restrict zooming out to ~size of Europe for width 1000px
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
158 zoom: this.extent.zoom,
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
159 projection: "EPSG:3857"
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
160 })
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
161 );
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
162 }
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
163 this.map = new Map({
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
164 layers: this.layers.config,
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
165 target: "map-" + this.paneId,
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
166 controls: [],
3086
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
167 view:
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
168 this.syncedMaps.includes(this.paneId) || this.paneId === "main"
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
169 ? this.syncedView
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
170 : new View({
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
171 center: [this.extent.lon, this.extent.lat],
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
172 minZoom: 5,
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
173 zoom: this.extent.zoom,
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
174 projection: "EPSG:3857"
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
175 })
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
176 });
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
177 this.map.getLayer = id => this.layers.get(id);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
178
3177
fc008b32c593 client: layers: loading animation for refreshing layer sources
Markus Kottlaender <markus@intevation.de>
parents: 3166
diff changeset
179 this.map.on("rendercomplete", () => {
fc008b32c593 client: layers: loading animation for refreshing layer sources
Markus Kottlaender <markus@intevation.de>
parents: 3166
diff changeset
180 this.$store.commit("map/decreaseMapsLoading");
fc008b32c593 client: layers: loading animation for refreshing layer sources
Markus Kottlaender <markus@intevation.de>
parents: 3166
diff changeset
181 });
fc008b32c593 client: layers: loading animation for refreshing layer sources
Markus Kottlaender <markus@intevation.de>
parents: 3166
diff changeset
182
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
183 // store map position on every move
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
184 // will be obsolete once we abandoned the separated admin context
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
185 this.map.on("moveend", event => {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
186 const center = event.map.getView().getCenter();
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
187 this.$store.commit("map/extent", {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
188 lat: center[1],
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
189 lon: center[0],
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
190 zoom: event.map.getView().getZoom()
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
191 });
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
192 });
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
193 this.$store.dispatch("map/openLayersMap", this.map);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
194
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
195 // move to user specific default extent if map loads for the first time
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
196 // checking initialLoad will be obsolete once we abandoned the separated admin context
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
197 if (this.initialLoad) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
198 this.$store.commit("map/initialLoad", false);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
199 var currentUser = this.$store.state.user.user;
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
200 HTTP.get("/users/" + currentUser, {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
201 headers: {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
202 "X-Gemma-Auth": localStorage.getItem("token"),
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
203 "Content-type": "text/xml; charset=UTF-8"
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
204 }
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
205 })
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
206 .then(response => {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
207 this.$store.dispatch("map/moveToBoundingBox", {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
208 boundingBox: [
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
209 response.data.extent.x1,
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
210 response.data.extent.y1,
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
211 response.data.extent.x2,
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
212 response.data.extent.y2
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
213 ],
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
214 zoom: 17,
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
215 preventZoomOut: true
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
216 });
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
217 })
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
218 .catch(error => {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
219 const { status, data } = error.response;
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
220 displayError({
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
221 title: this.$gettext("Backend Error"),
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
222 message: `${status}: ${data.message || data}`
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
223 });
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
224 });
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
225 }
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
226
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
227 this.$store.dispatch("map/initIdentifyTool", this.map);
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
228 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
229 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
230 mounted() {
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
231 // ToDo set path to correct endpoint in order to retrieve an OSM URL
3104
19fc84a98479 Added "published-config" field to configuration.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3102
diff changeset
232 HTTP.get("/system/config", {
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
233 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
234 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
235 .then(response => {
3109
973312bb77c6 Client: Fixed usage of published config to configure the OSM server URL.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3104
diff changeset
236 const url = response.data["osm-url"];
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
237 const config = {};
3109
973312bb77c6 Client: Fixed usage of published config to configure the OSM server URL.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3104
diff changeset
238 if (url) {
973312bb77c6 Client: Fixed usage of published config to configure the OSM server URL.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3104
diff changeset
239 config["url"] = url;
973312bb77c6 Client: Fixed usage of published config to configure the OSM server URL.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3104
diff changeset
240 }
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
241 this.layers.config.unshift(
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
242 new TileLayer({
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
243 id: "OPENSTREETMAP",
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
244 label: "Open Streetmap",
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
245 visible: true,
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
246 source: new OSM(config)
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
247 })
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
248 );
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
249 this.initMap();
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
250
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
251 if (this.selectedSurvey && this.paneId === "main") {
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
252 this.updateBottleneckFilter(
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
253 this.selectedSurvey.bottleneck_id,
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
254 this.selectedSurvey.date_info
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
255 );
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
256 }
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3109
diff changeset
257 if (this.additionalSurvey && this.paneId === "compare-survey") {
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
258 this.updateBottleneckFilter(
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
259 this.additionalSurvey.bottleneck_id,
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
260 this.additionalSurvey.date_info
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
261 );
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
262 }
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
263 // load configured bottleneck colors
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
264 HTTP.get("/system/style/Bottlenecks/stroke", {
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
265 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
266 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
267 .then(response => {
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
268 let btlnStrokeC = response.data.code;
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
269 HTTP.get("/system/style/Bottlenecks/fill", {
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
270 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
271 })
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
272 .then(response => {
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
273 let btlnFillC = response.data.code;
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
274 var newStyle = new Style({
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
275 stroke: new Stroke({
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
276 color: btlnStrokeC,
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
277 width: 4
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
278 }),
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
279 fill: new Fill({
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
280 color: btlnFillC
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
281 })
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
282 });
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
283 this.layers.get("BOTTLENECKS").setStyle(newStyle);
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
284 })
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
285 .catch(error => {
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
286 console.log(error);
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
287 });
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
288 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
289 .catch(error => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
290 console.log(error);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
291 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
292 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
293 .catch(error => {
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
294 const { status, data } = error.response;
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
295 displayError({
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
296 title: "Backend Error",
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
297 message: `${status}: ${data.message || data}`
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
298 });
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
299 });
3052
01210542e028 client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents: 3051
diff changeset
300 },
01210542e028 client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents: 3051
diff changeset
301 destroyed() {
01210542e028 client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents: 3051
diff changeset
302 this.$store.commit("map/removeOpenLayersMap", this.map);
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
303 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
304 };
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
305 </script>