Mercurial > gemma
annotate client/src/store/fairway.js @ 3044:c71373594719
client: map: prepared store to hold multiple map objects
This will be necessary to sync maps, toggle layers per map, etc. Therefore the methods to move the map
(moveToExtent, etc.) became actions instead of mutations.
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Sat, 13 Apr 2019 16:02:06 +0200 |
parents | 44493664d40e |
children | 051a3f446ac2 |
rev | line source |
---|---|
1362
ca33ad696594
remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1361
diff
changeset
|
1 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
2 * without warranty, see README.md and license for details. |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1296
diff
changeset
|
3 * |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
4 * SPDX-License-Identifier: AGPL-3.0-or-later |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
5 * License-Filename: LICENSES/AGPL-3.0.txt |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1296
diff
changeset
|
6 * |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1296
diff
changeset
|
7 * Copyright (C) 2018 by via donau |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
8 * – Österreichische Wasserstraßen-Gesellschaft mbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
9 * Software engineering by Intevation GmbH |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1296
diff
changeset
|
10 * |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
11 * Author(s): |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
12 * Thomas Junk <thomas.junk@intevation.de> |
1044
f8a4ec146d47
fixed Vue reactivity issue (splitscreen button)
Markus Kottlaender <markus@intevation.de>
parents:
1038
diff
changeset
|
13 * Markus Kottländer <markuks.kottlaender@intevation.de> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
14 */ |
1044
f8a4ec146d47
fixed Vue reactivity issue (splitscreen button)
Markus Kottlaender <markus@intevation.de>
parents:
1038
diff
changeset
|
15 import Vue from "vue"; |
2947
a6eea3002e6e
client: cleanup import paths
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2851
diff
changeset
|
16 import { HTTP } from "@/lib/http"; |
a6eea3002e6e
client: cleanup import paths
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2851
diff
changeset
|
17 import { prepareProfile } from "@/lib/geo"; |
2985
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
18 import LineString from "ol/geom/LineString"; |
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
19 import { generateFeatureRequest } from "@/lib/geo"; |
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
20 import { getLength } from "ol/sphere"; |
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
21 import { displayError } from "@/lib/errors"; |
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
22 import { featureToFairwayCoordinates } from "@/lib/geo"; |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
23 |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
24 // initial state |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
25 const init = () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
26 return { |
1391
801ae5f4bc5b
fixed bug when changing additional survey in profile dialog
Markus Kottlaender <markus@intevation.de>
parents:
1377
diff
changeset
|
27 additionalSurvey: null, |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
28 minAlt: 0, |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
29 maxAlt: 0, |
1025
a55f20dc8d8d
refac: store profiles by date
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
30 currentProfile: {}, |
2389
13de09e30645
fairway_profile: available_waterlevels selection with dummy data added
Thomas Junk <thomas.junk@intevation.de>
parents:
2368
diff
changeset
|
31 referenceWaterLevel: null, |
2368
96b0314f2bd6
fairway_profile: consuming the offered waterlevel WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2365
diff
changeset
|
32 waterLevels: {}, |
96b0314f2bd6
fairway_profile: consuming the offered waterlevel WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2365
diff
changeset
|
33 selectedWaterLevel: "", |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
34 fairwayData: [], |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
35 startPoint: null, |
1177
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
36 endPoint: null, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
37 previousCuts: [], |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
38 profileLoading: false, |
2851
a7e31594959d
profiles: difference selection now with spinner
Thomas Junk <thomas.junk@intevation.de>
parents:
2590
diff
changeset
|
39 selectedCut: null, |
a7e31594959d
profiles: difference selection now with spinner
Thomas Junk <thomas.junk@intevation.de>
parents:
2590
diff
changeset
|
40 differencesLoading: false |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
41 }; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
42 }; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
43 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
44 export default { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
45 init, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
46 namespaced: true, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
47 state: init(), |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
48 getters: { |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
49 totalLength: state => { |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
50 const keys = Object.keys(state.currentProfile); |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
51 return keys.length |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
52 ? Math.max(...keys.map(x => state.currentProfile[x].length)) |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
53 : 0; |
1056
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
54 }, |
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
55 additionalSurvey: state => { |
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
56 return state.additionalSurvey; |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
57 } |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
58 }, |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
59 mutations: { |
1391
801ae5f4bc5b
fixed bug when changing additional survey in profile dialog
Markus Kottlaender <markus@intevation.de>
parents:
1377
diff
changeset
|
60 additionalSurvey: (state, additionalSurvey) => { |
1056
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
61 state.additionalSurvey = additionalSurvey; |
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
62 }, |
841 | 63 setSelectedWaterLevel: (state, level) => { |
2389
13de09e30645
fairway_profile: available_waterlevels selection with dummy data added
Thomas Junk <thomas.junk@intevation.de>
parents:
2368
diff
changeset
|
64 state.selectedWaterLevel = state.waterLevels[level]; |
841 | 65 }, |
2851
a7e31594959d
profiles: difference selection now with spinner
Thomas Junk <thomas.junk@intevation.de>
parents:
2590
diff
changeset
|
66 setDifferencesLoading: (state, value) => { |
a7e31594959d
profiles: difference selection now with spinner
Thomas Junk <thomas.junk@intevation.de>
parents:
2590
diff
changeset
|
67 state.differencesLoading = value; |
a7e31594959d
profiles: difference selection now with spinner
Thomas Junk <thomas.junk@intevation.de>
parents:
2590
diff
changeset
|
68 }, |
1025
a55f20dc8d8d
refac: store profiles by date
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
69 profileLoaded: (state, answer) => { |
a55f20dc8d8d
refac: store profiles by date
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
70 const { response, surveyDate } = answer; |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
71 const { data } = response; |
2368
96b0314f2bd6
fairway_profile: consuming the offered waterlevel WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2365
diff
changeset
|
72 const { waterlevel } = response.data.properties; |
96b0314f2bd6
fairway_profile: consuming the offered waterlevel WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2365
diff
changeset
|
73 const { value, when } = waterlevel; |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
74 const coordinates = data.geometry.coordinates; |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
75 if (!coordinates) return; |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
76 const startPoint = state.startPoint; |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
77 const endPoint = state.endPoint; |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
78 const geoJSON = data; |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
79 const result = prepareProfile({ geoJSON, startPoint, endPoint }); |
1044
f8a4ec146d47
fixed Vue reactivity issue (splitscreen button)
Markus Kottlaender <markus@intevation.de>
parents:
1038
diff
changeset
|
80 // Use Vue.set() to make new object properties rective |
f8a4ec146d47
fixed Vue reactivity issue (splitscreen button)
Markus Kottlaender <markus@intevation.de>
parents:
1038
diff
changeset
|
81 // https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats |
2389
13de09e30645
fairway_profile: available_waterlevels selection with dummy data added
Thomas Junk <thomas.junk@intevation.de>
parents:
2368
diff
changeset
|
82 const entry = { |
13de09e30645
fairway_profile: available_waterlevels selection with dummy data added
Thomas Junk <thomas.junk@intevation.de>
parents:
2368
diff
changeset
|
83 date: when, |
2540
3c17d401fbd4
client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents:
2391
diff
changeset
|
84 value: value |
2389
13de09e30645
fairway_profile: available_waterlevels selection with dummy data added
Thomas Junk <thomas.junk@intevation.de>
parents:
2368
diff
changeset
|
85 }; |
2540
3c17d401fbd4
client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents:
2391
diff
changeset
|
86 state.waterLevels = { [when]: entry }; |
3c17d401fbd4
client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents:
2391
diff
changeset
|
87 state.selectedWaterLevel = entry; |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
88 Vue.set(state.currentProfile, surveyDate, { |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
89 points: result.points, |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
90 length: result.lengthPolyLine |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
91 }); |
1056
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
92 if (!state.minAlt || state.minAlt > result.minAlt) { |
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
93 state.minAlt = result.minAlt; |
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
94 } |
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
95 if (!state.maxAlt || state.maxAlt < result.maxAlt) { |
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
96 state.maxAlt = result.maxAlt; |
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1044
diff
changeset
|
97 } |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
98 }, |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
99 setStartPoint: (state, start) => { |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
100 state.startPoint = start; |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
101 }, |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
102 setEndPoint: (state, end) => { |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
103 state.endPoint = end; |
802
327aa4a18a1c
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
786
diff
changeset
|
104 }, |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
105 addFairwayData: (state, coordinates) => { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
106 state.fairwayData.push(coordinates); |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
107 }, |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
108 clearFairwayData: state => { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
109 state.fairwayData = []; |
1015
d2f30a784fb3
feat: add selectfield to fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents:
1013
diff
changeset
|
110 }, |
d2f30a784fb3
feat: add selectfield to fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents:
1013
diff
changeset
|
111 clearCurrentProfile: state => { |
1391
801ae5f4bc5b
fixed bug when changing additional survey in profile dialog
Markus Kottlaender <markus@intevation.de>
parents:
1377
diff
changeset
|
112 state.additionalSurvey = null; |
1025
a55f20dc8d8d
refac: store profiles by date
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
113 state.currentProfile = {}; |
1057
7242b5a427bc
completely nulling the units
Thomas Junk <thomas.junk@intevation.de>
parents:
1056
diff
changeset
|
114 state.minAlt = null; |
7242b5a427bc
completely nulling the units
Thomas Junk <thomas.junk@intevation.de>
parents:
1056
diff
changeset
|
115 state.maxAlt = null; |
7242b5a427bc
completely nulling the units
Thomas Junk <thomas.junk@intevation.de>
parents:
1056
diff
changeset
|
116 state.totalLength = null; |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
117 state.fairwayData = []; |
1057
7242b5a427bc
completely nulling the units
Thomas Junk <thomas.junk@intevation.de>
parents:
1056
diff
changeset
|
118 state.startPoint = null; |
7242b5a427bc
completely nulling the units
Thomas Junk <thomas.junk@intevation.de>
parents:
1056
diff
changeset
|
119 state.endPoint = null; |
2391
123e7f43b676
fairway_store: fix cleanup bug
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
120 state.referenceWaterLevel = null; |
123e7f43b676
fairway_store: fix cleanup bug
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
121 state.waterLevels = {}; |
123e7f43b676
fairway_store: fix cleanup bug
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
122 state.selectedWaterLevel = ""; |
1177
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
123 }, |
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
124 previousCuts: (state, previousCuts) => { |
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
125 state.previousCuts = previousCuts; |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
126 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
127 profileLoading: (state, loading) => { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
128 state.profileLoading = loading; |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
129 }, |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
130 selectedCut: (state, cut) => { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
131 state.selectedCut = cut; |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
646
diff
changeset
|
132 } |
1028
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
133 }, |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
134 actions: { |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
135 clearSelection({ commit, dispatch, rootState, rootGetters }) { |
1146
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1114
diff
changeset
|
136 dispatch("bottlenecks/setSelectedBottleneck", null, { root: true }); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1424
diff
changeset
|
137 dispatch("map/enableIdentifyTool", null, { root: true }); |
1146
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1114
diff
changeset
|
138 commit("clearCurrentProfile"); |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1177
diff
changeset
|
139 rootState.map.cutTool.setActive(false); |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
140 rootGetters["map/openLayersMap"] |
3006
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
141 .getLayer("CUTTOOL") |
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
142 .getSource() |
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
143 .clear(); |
1146
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1114
diff
changeset
|
144 }, |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
145 loadProfile({ commit, state }, survey) { |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
146 if (state.startPoint && state.endPoint) { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
147 return new Promise((resolve, reject) => { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
148 const profileLine = new LineString([ |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
149 state.startPoint, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
150 state.endPoint |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
151 ]); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
152 const geoJSON = generateFeatureRequest( |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
153 profileLine, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
154 survey.bottleneck_id, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
155 survey.date_info |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
156 ); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
157 HTTP.post("/cross", geoJSON, { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
158 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
1028
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
159 }) |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
160 .then(response => { |
1440
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
161 if (response.data.geometry.coordinates.length) { |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
162 commit("profileLoaded", { |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
163 response: response, |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
164 surveyDate: survey.date_info |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
165 }); |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
166 resolve(response); |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
167 } else { |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
168 commit("clearCurrentProfile"); |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
169 reject({ |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
170 response: { |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
171 status: null, |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
172 data: "No intersection with sounding data." |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
173 } |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
174 }); |
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
175 } |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
176 }) |
1440
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
177 .catch(error => reject(error)); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
178 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
179 } |
1165
a44ac5193b38
fixed code duplication
Markus Kottlaender <markus@intevation.de>
parents:
1146
diff
changeset
|
180 }, |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
181 cut({ commit, dispatch, rootState, rootGetters }, cut) { |
1440
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
182 return new Promise(resolve => { |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
183 const length = getLength(cut.getGeometry()); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
184 commit( |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
185 "map/setCurrentMeasurement", |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
186 { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
187 quantity: "Length", |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
188 unitSymbol: "m", |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
189 value: Math.round(length * 10) / 10 |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
190 }, |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
191 { root: true } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
192 ); |
2265
940ae7c20326
client: pdf-gen: use default template when backend does not provide any
Markus Kottlaender <markus@intevation.de>
parents:
2264
diff
changeset
|
193 commit("clearFairwayData"); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
194 // if a survey has been selected, request a profile |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
195 // TODO an improvement could be to check if the line intersects |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
196 // with the bottleneck area's polygon before trying the server request |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
197 if (rootState.bottlenecks.selectedSurvey) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
198 const inputLineString = cut.getGeometry().clone(); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
199 inputLineString.transform("EPSG:3857", "EPSG:4326"); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
200 const [start, end] = inputLineString |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
201 .getCoordinates() |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
202 .map(coords => coords.map(coord => parseFloat(coord.toFixed(8)))); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
203 commit("setStartPoint", start); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
204 commit("setEndPoint", end); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
205 const profileLine = new LineString([start, end]); |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
206 |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
207 const profileLoaders = [ |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
208 dispatch("loadProfile", rootState.bottlenecks.selectedSurvey) |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
209 ]; |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
210 if (rootState.fairwayprofile.additionalSurvey) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
211 profileLoaders.push( |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
212 dispatch("loadProfile", rootState.fairwayprofile.additionalSurvey) |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
213 ); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
214 } |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
215 |
2549
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2540
diff
changeset
|
216 commit("application/showSplitscreen", true, { root: true }); |
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2540
diff
changeset
|
217 commit("application/splitscreenLoading", true, { root: true }); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
218 commit("profileLoading", true); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
219 Promise.all(profileLoaders) |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
220 .then(() => { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
221 rootState.map.cutTool.setActive(false); |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
222 const los3 = rootGetters["map/openLayersMap"].getLayer( |
3006
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
223 "FAIRWAYDIMENSIONSLOS3" |
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
224 ); |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2947
diff
changeset
|
225 los3.getSource().forEachFeatureIntersectingExtent( |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
226 profileLine |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
227 .clone() |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
228 .transform("EPSG:4326", "EPSG:3857") |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
229 .getExtent(), |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
230 feature => { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
231 const fairwayCoordinates = featureToFairwayCoordinates( |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
232 feature, |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
233 profileLine |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
234 ); |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
235 let fairwayData = { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
236 coordinates: fairwayCoordinates, |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2947
diff
changeset
|
237 style: los3.getStyle() |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
238 }; |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
239 if (fairwayCoordinates.length > 0) { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
240 commit("addFairwayData", fairwayData); |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
241 } |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
242 } |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
243 ); |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
244 const los2 = rootGetters["map/openLayersMap"].getLayer( |
3006
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
245 "FAIRWAYDIMENSIONSLOS2" |
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
246 ); |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2947
diff
changeset
|
247 los2.getSource().forEachFeatureIntersectingExtent( |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
248 profileLine |
1165
a44ac5193b38
fixed code duplication
Markus Kottlaender <markus@intevation.de>
parents:
1146
diff
changeset
|
249 .clone() |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
250 .transform("EPSG:4326", "EPSG:3857") |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
251 .getExtent(), |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
252 feature => { |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
253 let fairwayCoordinates = featureToFairwayCoordinates( |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
254 feature, |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
255 profileLine |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
256 ); |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
257 let fairwayData = { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
258 coordinates: fairwayCoordinates, |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2947
diff
changeset
|
259 style: los2.getStyle() |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
260 }; |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
261 if (fairwayCoordinates.length > 0) { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
262 commit("addFairwayData", fairwayData); |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
263 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
264 } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
265 ); |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
266 const los1 = rootGetters["map/openLayersMap"].getLayer( |
3006
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
267 "FAIRWAYDIMENSIONSLOS1" |
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
268 ); |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2947
diff
changeset
|
269 los1.getSource().forEachFeatureIntersectingExtent( |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
270 profileLine |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
271 .clone() |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
272 .transform("EPSG:4326", "EPSG:3857") |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
273 .getExtent(), |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
274 feature => { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
275 const fairwayCoordinates = featureToFairwayCoordinates( |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
276 feature, |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
277 profileLine |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
278 ); |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
279 let fairwayData = { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
280 coordinates: fairwayCoordinates, |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2947
diff
changeset
|
281 style: los1.getStyle() |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
282 }; |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
283 if (fairwayCoordinates.length > 0) { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
284 commit("addFairwayData", fairwayData); |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
285 } |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
286 } |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
287 ); |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2125
diff
changeset
|
288 resolve(); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
289 }) |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
290 .catch(error => { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
291 const { status, data } = error.response; |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
292 displayError({ |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
293 title: "Backend Error", |
1440
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
294 message: `${status ? status + ":" : ""} ${data.message || data}` |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
295 }); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
296 }) |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
297 .finally(() => { |
2566
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
298 let splitscreenConf = { |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
299 id: "fairwayprofile", |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
300 component: "fairwayprofile", |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
301 title: `${rootState.bottlenecks.selectedBottleneck} (${ |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
302 rootState.bottlenecks.selectedSurvey.date_info |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
303 })`, |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
304 icon: "chart-area", |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
305 closeCallback: () => { |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
306 dispatch("clearSelection"); |
2549
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2540
diff
changeset
|
307 }, |
2566
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
308 expandCallback: () => { |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
309 let bottleneck = rootState.bottlenecks.bottlenecksList.find( |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
310 bn => |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
311 bn.properties.name === |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
312 rootState.bottlenecks.selectedBottleneck |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
313 ); |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
314 dispatch( |
2566
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
315 "map/moveToExtent", |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
316 { |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
317 feature: bottleneck, |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
318 zoom: 17, |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
319 preventZoomOut: true |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
320 }, |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
321 { root: true } |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
322 ); |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
323 } |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
324 }; |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
325 commit("application/addSplitscreen", splitscreenConf, { |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
326 root: true |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
327 }); |
2590
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
328 commit("application/activeSplitscreenId", "fairwayprofile", { |
2566
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
329 root: true |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
330 }); |
2549
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2540
diff
changeset
|
331 commit("application/splitscreenLoading", false, { root: true }); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
332 commit("profileLoading", false); |
1165
a44ac5193b38
fixed code duplication
Markus Kottlaender <markus@intevation.de>
parents:
1146
diff
changeset
|
333 }); |
1440
b3920ac3b2fd
fixed bug when drawing crowss profile outside of bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
334 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
335 }); |
1177
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
336 }, |
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
337 previousCuts({ commit, rootState }) { |
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
338 const previousCuts = |
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
339 JSON.parse(localStorage.getItem("previousCuts")) || []; |
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
340 commit( |
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
341 "previousCuts", |
1377
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
342 previousCuts |
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
343 .filter(cut => { |
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
344 return ( |
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
345 cut.bottleneckName === rootState.bottlenecks.selectedBottleneck |
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
346 ); |
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
347 }) |
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
348 .sort((a, b) => (a.timestamp < b.timestamp ? 1 : -1)) |
1177
48ae4458710d
save cross profiles to local storage to restore them from a dropdown
Markus Kottlaender <markus@intevation.de>
parents:
1165
diff
changeset
|
349 ); |
2265
940ae7c20326
client: pdf-gen: use default template when backend does not provide any
Markus Kottlaender <markus@intevation.de>
parents:
2264
diff
changeset
|
350 } |
940ae7c20326
client: pdf-gen: use default template when backend does not provide any
Markus Kottlaender <markus@intevation.de>
parents:
2264
diff
changeset
|
351 } |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
352 }; |