annotate client/src/components/map/Map.vue @ 4455:112120ed510d

removed empty catch statement
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 23 Sep 2019 09:22:03 +0200
parents 69166db6ba8a
children 8c98d801e62e
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";
3685
8775bea8042a client: layers: unset layer config on logout
Markus Kottlaender <markus@intevation.de>
parents: 3548
diff changeset
44 import { layerFactory } from "@/components/map/layers";
4022
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 4003
diff changeset
45 import { ImageWMS as ImageSource } from "ol/source";
4241
27434b0d4d96 Map: setting styles correctly for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents: 4210
diff changeset
46 import { styles } from "./styles";
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
47 import "ol/ol.css";
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 {
3182
77fc44ad05e3 client: removed old splitscreen code
Markus Kottlaender <markus@intevation.de>
parents: 3181
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 };
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 computed: {
4271
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
62 ...mapState("map", [
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
63 "initialLoad",
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
64 "extent",
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
65 "syncedMaps",
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
66 "syncedView",
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
67 "ongoingRefresh"
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
68 ]),
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
69 ...mapState("bottlenecks", ["selectedSurvey"]),
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
70 ...mapState("fairwayprofile", ["additionalSurvey"]),
4022
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 4003
diff changeset
71 ...mapState("application", ["paneSetup", "paneRotate", "config"]),
3309
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
72 ...mapState("imports", ["selectedStretchId", "selectedSectionId"]),
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3016
diff changeset
73 layers() {
3685
8775bea8042a client: layers: unset layer config on logout
Markus Kottlaender <markus@intevation.de>
parents: 3548
diff changeset
74 return layerFactory(this.paneId);
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3016
diff changeset
75 },
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
76 hasActiveInteractions() {
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
77 return (
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
78 this.map &&
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3057
diff changeset
79 this.map
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3057
diff changeset
80 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3057
diff changeset
81 .getArray()
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
82 .filter(
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
83 i =>
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
84 ["linetool", "polygontool", "cuttool"].includes(i.get("id")) &&
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
85 i.getActive()
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
86 ).length
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
87 );
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 },
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
90 watch: {
4271
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
91 ongoingRefresh() {
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
92 if (this.ongoingRefresh) return;
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
93 this.loadStyles();
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
94 },
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3109
diff changeset
95 paneSetup() {
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
96 this.$nextTick(() => this.map.updateSize());
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
97 },
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
98 paneRotate() {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
99 this.$nextTick(() => this.map.updateSize());
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
100 },
3086
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
101 syncedMaps(syncedMaps) {
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
102 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
103 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
104 } else {
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
105 this.map.setView(
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
106 new View({
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
107 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
108 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
109 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
110 projection: "EPSG:3857"
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
111 })
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
112 );
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
113 }
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
114 },
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
115 selectedSurvey(survey) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
116 if (this.paneId === "main") {
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 }
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3057
diff changeset
122 }
3079
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 additionalSurvey(survey) {
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3109
diff changeset
125 if (this.paneId === "compare-survey") {
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
126 if (survey) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
127 this.updateBottleneckFilter(survey.bottleneck_id, survey.date_info);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
128 } else {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
129 this.updateBottleneckFilter("does_not_exist", "1999-10-01");
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
130 }
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
131 }
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
132 },
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
133 selectedStretchId(id) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
134 this.layers
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
135 .get("STRETCHES")
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
136 .getSource()
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
137 .getFeatures()
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
138 .forEach(f => {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
139 f.set("highlighted", false);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
140 if (id === f.getId()) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
141 f.set("highlighted", true);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
142 }
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
143 });
3309
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
144 },
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
145 selectedSectionId(id) {
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
146 this.layers
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
147 .get("SECTIONS")
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
148 .getSource()
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
149 .getFeatures()
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
150 .forEach(f => {
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
151 f.set("highlighted", false);
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
152 if (id === f.getId()) {
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
153 f.set("highlighted", true);
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
154 }
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
155 });
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
156 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
157 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
158 methods: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
159 updateBottleneckFilter(bottleneck_id, datestr) {
4003
5d4edf268aec if no bottlenck is given the update bottleneck filter should not query the geoserver
Thomas Junk <thomas.junk@intevation.de>
parents: 3852
diff changeset
160 if (!bottleneck_id) return;
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
161 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
162 if (exists) {
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3016
diff changeset
163 this.layers
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
164 .get("BOTTLENECKISOLINE")
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
165 .getSource()
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
166 .updateParams({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
167 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
168 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
169 }
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3016
diff changeset
170 this.layers.get("BOTTLENECKISOLINE").setVisible(exists);
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
171 },
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
172 initMap() {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
173 if (!this.syncedView) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
174 this.$store.commit(
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
175 "map/syncedView",
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
176 new View({
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
177 center: [this.extent.lon, this.extent.lat],
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
178 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
179 zoom: this.extent.zoom,
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
180 projection: "EPSG:3857"
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
181 })
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
182 );
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
183 }
3181
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
184
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
185 // move to user specific default extent if map loads for the first time
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
186 // checking initialLoad will be obsolete once we abandoned the separated admin context
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
187 if (this.initialLoad) {
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
188 this.$store.commit("map/initialLoad", false);
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
189 var currentUser = this.$store.state.user.user;
4426
a769e14f4baf fix typo, encodeURIComponent only for username
Thomas Junk <thomas.junk@intevation.de>
parents: 4422
diff changeset
190 HTTP.get("/users/" + encodeURIComponent(`${currentUser}`), {
3181
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
191 headers: {
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
192 "X-Gemma-Auth": localStorage.getItem("token"),
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
193 "Content-type": "text/xml; charset=UTF-8"
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
194 }
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
195 })
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
196 .then(response => {
4422
562f9da8ba0b map: restore zoom to extent functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 4421
diff changeset
197 this.mountMap();
3181
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
198 this.$store.dispatch("map/moveToBoundingBox", {
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
199 boundingBox: [
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
200 response.data.extent.x1,
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
201 response.data.extent.y1,
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
202 response.data.extent.x2,
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
203 response.data.extent.y2
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
204 ],
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
205 zoom: 17,
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
206 preventZoomOut: true,
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
207 duration: 0
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
208 });
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
209 })
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
210 .catch(error => {
4422
562f9da8ba0b map: restore zoom to extent functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 4421
diff changeset
211 this.mountMap();
3181
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
212 const { status, data } = error.response;
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
213 displayError({
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
214 title: this.$gettext("Backend Error"),
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
215 message: `${status}: ${data.message || data}`
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
216 });
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
217 });
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
218 } else {
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
219 this.mountMap();
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
220 }
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
221 },
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
222 mountMap() {
4022
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 4003
diff changeset
223 const source = new ImageSource({
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 4003
diff changeset
224 preload: 1,
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 4003
diff changeset
225 url: this.config.ecdis_wms_url,
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 4003
diff changeset
226 crossOrigin: "anonymous",
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 4003
diff changeset
227 params: JSON.parse(this.config.ecdis_wms_params)
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 4003
diff changeset
228 });
efe0904b1d45 Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents: 4003
diff changeset
229 this.layers.get("INLANDECDIS").setSource(source);
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
230 this.map = new Map({
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
231 layers: this.layers.config,
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
232 target: "map-" + this.paneId,
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
233 controls: [],
3086
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
234 view:
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
235 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
236 ? this.syncedView
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
237 : new View({
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
238 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
239 minZoom: 5,
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
240 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
241 projection: "EPSG:3857"
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3079
diff changeset
242 })
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
243 });
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
244 this.map.getLayer = id => this.layers.get(id);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
245 // store map position on every move
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
246 // 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
247 this.map.on("moveend", event => {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
248 const center = event.map.getView().getCenter();
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
249 this.$store.commit("map/extent", {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
250 lat: center[1],
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
251 lon: center[0],
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
252 zoom: event.map.getView().getZoom()
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
253 });
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
254 });
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
255 this.$store.dispatch("map/openLayersMap", this.map);
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3077
diff changeset
256 this.$store.dispatch("map/initIdentifyTool", this.map);
4271
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
257 },
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
258 loadStyles() {
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
259 // load configured bottleneck colors
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
260 HTTP.get("/system/settings", {
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
261 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
4455
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
262 }).then(response => {
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
263 let btlnStrokeC = response.data.bottlenecks_stroke,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
264 btlnFillC = response.data.bottlenecks_fill,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
265 strFillC = response.data.stretches_fill,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
266 strStrokeC = response.data.stretches_stroke,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
267 secStrokeC = response.data.sections_stroke,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
268 secFillC = response.data.sections_fill,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
269 fwd1StrokeC = response.data.fairwaydimensionslos1_stroke,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
270 fwd1FillC = response.data.fairwaydimensionslos1_fill,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
271 fwd2StrokeC = response.data.fairwaydimensionslos2_stroke,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
272 fwd2FillC = response.data.fairwaydimensionslos2_fill,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
273 fwd3StrokeC = response.data.fairwaydimensionslos3_stroke,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
274 fwd3FillC = response.data.fairwaydimensionslos3_fill,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
275 wwpStokeC = response.data.waterwayprofiles_stroke;
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
276 let btlnStyle = new Style({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
277 stroke: new Stroke({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
278 color: btlnStrokeC,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
279 width: 4
4271
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
280 }),
4455
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
281 fill: new Fill({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
282 color: btlnFillC
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
283 })
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
284 }),
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
285 strStyle = new Style({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
286 stroke: new Stroke({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
287 color: strStrokeC,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
288 width: 2
4271
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
289 }),
4455
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
290 fill: new Fill({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
291 color: strFillC
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
292 })
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
293 }),
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
294 secStyle = new Style({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
295 stroke: new Stroke({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
296 color: secStrokeC,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
297 width: 5
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
298 }),
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
299 fill: new Fill({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
300 color: secFillC
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
301 })
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
302 }),
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
303 fwd1Style = new Style({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
304 stroke: new Stroke({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
305 lineDash: [2, 4],
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
306 lineCap: "round",
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
307 color: fwd1StrokeC,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
308 width: 2
4271
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
309 }),
4455
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
310 fill: new Fill({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
311 color: fwd1FillC
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
312 })
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
313 }),
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
314 fwd2Style = new Style({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
315 stroke: new Stroke({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
316 lineDash: [3, 6],
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
317 lineCap: "round",
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
318 color: fwd2StrokeC,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
319 width: 2
4271
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
320 }),
4455
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
321 fill: new Fill({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
322 color: fwd2FillC
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
323 })
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
324 }),
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
325 fwd3Style = new Style({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
326 stroke: new Stroke({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
327 color: fwd3StrokeC,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
328 width: 2
4271
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
329 }),
4455
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
330 fill: new Fill({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
331 color: fwd3FillC
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
332 })
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
333 }),
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
334 wwpStyle = new Style({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
335 stroke: new Stroke({
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
336 color: wwpStokeC,
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
337 lineDash: [5, 5],
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
338 width: 2
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
339 })
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
340 });
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
341 this.layers.get("WATERWAYPROFILES").setStyle(wwpStyle);
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
342 this.layers
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
343 .get("FAIRWAYDIMENSIONSLOS1")
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
344 .setStyle(() => [fwd1Style, styles.textFW1]);
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
345 this.layers
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
346 .get("FAIRWAYDIMENSIONSLOS2")
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
347 .setStyle(() => [fwd2Style, styles.textFW2]);
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
348 this.layers
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
349 .get("FAIRWAYDIMENSIONSLOS3")
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
350 .setStyle(() => [fwd3Style, styles.textFW3]);
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
351 this.layers.get("SECTIONS").setStyle(secStyle);
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
352 this.layers.get("STRETCHES").setStyle(strStyle);
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
353 this.layers.get("BOTTLENECKS").setStyle(btlnStyle);
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
354 this.$store.commit("gauges/deleteNashSutcliffeCache");
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
355 this.$store.dispatch("map/refreshLayers");
112120ed510d removed empty catch statement
Thomas Junk <thomas.junk@intevation.de>
parents: 4454
diff changeset
356 });
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
357 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
358 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
359 mounted() {
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
360 // 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
361 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
362 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
363 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
364 .then(response => {
3270
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3182
diff changeset
365 if (response.data["osm-url"]) {
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3182
diff changeset
366 this.layers
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3182
diff changeset
367 .get("OPENSTREETMAP")
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3182
diff changeset
368 .getSource()
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3182
diff changeset
369 .setUrl(response.data["osm-url"]);
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
370 }
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
371 this.initMap();
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
372
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
373 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
374 this.updateBottleneckFilter(
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
375 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
376 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
377 );
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
378 }
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3109
diff changeset
379 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
380 this.updateBottleneckFilter(
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
381 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
382 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
383 );
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
384 }
4271
315474a66589 Map: refreshing layers triggers reloading of styles
Thomas Junk <thomas.junk@intevation.de>
parents: 4252
diff changeset
385 this.loadStyles();
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
386 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
387 .catch(error => {
3102
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
388 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
389 displayError({
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
390 title: "Backend Error",
a9c7825303b3 layers: Code for provisioning a dynamic URL for OSM etd.
Thomas Junk <thomas.junk@intevation.de>
parents: 3086
diff changeset
391 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
392 });
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
393 });
3052
01210542e028 client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents: 3051
diff changeset
394 },
01210542e028 client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents: 3051
diff changeset
395 destroyed() {
01210542e028 client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents: 3051
diff changeset
396 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
397 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
398 };
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
399 </script>