Mercurial > gemma
annotate client/src/map/Maplayer.vue @ 1122:a4c74a95c177 store-refactoring
minor store refactoring
removed unused getters from user store and renamed functions to adhere to nameing scheme
removed unnecessary getter from map store
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 06 Nov 2018 11:21:29 +0100 |
parents | 035dc35e1dfc |
children | d9e6a1f6f394 |
rev | line source |
---|---|
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
621
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
620
diff
changeset
|
2 <div id="map" :class="mapStyle"></div> |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 </template> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
4 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 <style lang="scss"> |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
6 .mapsplit { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
7 height: 50vh; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
8 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
9 |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
10 .mapfull { |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
11 height: 100vh; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
12 } |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
13 |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
14 @media print { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
15 .mapfull { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
16 width: 2000px; |
902 | 17 height: 2828px; |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
18 } |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
19 .mapsplit { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
20 width: 2000px; |
902 | 21 height: 2828px; |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
22 } |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
23 } |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
24 </style> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
25 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
26 <script> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
27 /* |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
28 * This is Free Software under GNU Affero General Public License v >= 3.0 |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
29 * without warranty, see README.md and license for details. |
1062
d3bdad8ed8d3
client: simply code structure and add author
Bernhard Reiter <bernhard@intevation.de>
parents:
1043
diff
changeset
|
30 * |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
31 * SPDX-License-Identifier: AGPL-3.0-or-later |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
32 * License-Filename: LICENSES/AGPL-3.0.txt |
1062
d3bdad8ed8d3
client: simply code structure and add author
Bernhard Reiter <bernhard@intevation.de>
parents:
1043
diff
changeset
|
33 * |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
34 * Copyright (C) 2018 by via donau |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
35 * – Österreichische Wasserstraßen-Gesellschaft mbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
36 * Software engineering by Intevation GmbH |
1062
d3bdad8ed8d3
client: simply code structure and add author
Bernhard Reiter <bernhard@intevation.de>
parents:
1043
diff
changeset
|
37 * |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
38 * Author(s): |
1062
d3bdad8ed8d3
client: simply code structure and add author
Bernhard Reiter <bernhard@intevation.de>
parents:
1043
diff
changeset
|
39 * * Thomas Junk <thomas.junk@intevation.de> |
d3bdad8ed8d3
client: simply code structure and add author
Bernhard Reiter <bernhard@intevation.de>
parents:
1043
diff
changeset
|
40 * * Bernhard E. Reiter <bernhard.reiter@intevation.de> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
41 */ |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
42 import { HTTP } from "../application/lib/http"; |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
43 import { mapGetters, mapState } from "vuex"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
44 import "ol/ol.css"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
45 import { Map, View } from "ol"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
46 import { WFS, GeoJSON } from "ol/format.js"; |
709
35fd15711e9e
client: prepare to send profile cut to backend
Bernhard Reiter <bernhard@intevation.de>
parents:
706
diff
changeset
|
47 import LineString from "ol/geom/LineString.js"; |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
48 import Draw from "ol/interaction/Draw.js"; |
709
35fd15711e9e
client: prepare to send profile cut to backend
Bernhard Reiter <bernhard@intevation.de>
parents:
706
diff
changeset
|
49 import { Vector as VectorLayer } from "ol/layer.js"; |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
50 import { Vector as VectorSource } from "ol/source.js"; |
1063
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
51 import { getLength, getArea } from "ol/sphere.js"; |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
52 import { Stroke, Style, Fill } from "ol/style.js"; |
843
d2aa972df342
client: add example for setting style
Bernhard Reiter <bernhard@intevation.de>
parents:
842
diff
changeset
|
53 |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
765
diff
changeset
|
54 import { displayError } from "../application/lib/errors.js"; |
1029
1fdeb9404afb
refac: extract calculation of fairway coordinates
Thomas Junk <thomas.junk@intevation.de>
parents:
1028
diff
changeset
|
55 import { calculateFairwayCoordinates } from "../application/lib/geo.js"; |
738
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
56 |
802
327aa4a18a1c
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
797
diff
changeset
|
57 const DEMODATA = 2.5; |
327aa4a18a1c
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
797
diff
changeset
|
58 |
848
22f7d33eee65
Make eslint happy again.
Sascha Wilde <wilde@intevation.de>
parents:
843
diff
changeset
|
59 /* for the sake of debugging */ |
22f7d33eee65
Make eslint happy again.
Sascha Wilde <wilde@intevation.de>
parents:
843
diff
changeset
|
60 /* eslint-disable no-console */ |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
61 export default { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
62 name: "maplayer", |
1062
d3bdad8ed8d3
client: simply code structure and add author
Bernhard Reiter <bernhard@intevation.de>
parents:
1043
diff
changeset
|
63 props: ["lat", "long", "zoom", "split"], |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
64 data() { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
65 return { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
66 projection: "EPSG:3857", |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
67 interaction: null |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
68 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
69 }, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
70 computed: { |
1122
a4c74a95c177
minor store refactoring
Markus Kottlaender <markus@intevation.de>
parents:
1121
diff
changeset
|
71 ...mapGetters("map", ["getLayerByName"]), |
a4c74a95c177
minor store refactoring
Markus Kottlaender <markus@intevation.de>
parents:
1121
diff
changeset
|
72 ...mapState("map", ["layers", "openLayersMap", "drawMode"]), |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
73 ...mapState("bottlenecks", ["selectedSurvey"]), |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
74 mapStyle() { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
75 return { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
76 mapfull: !this.split, |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
77 mapsplit: this.split |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
78 }; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
79 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
80 }, |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
81 methods: { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
82 removeCurrentInteraction() { |
1113
595654ad3f66
renamed mapstore to map (like other stores)
Markus Kottlaender <markus@intevation.de>
parents:
1112
diff
changeset
|
83 this.$store.commit("map/setCurrentMeasurement", null); |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
84 this.getLayerByName("Draw Tool").data.getSource().clear(); |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
85 this.openLayersMap.removeInteraction(this.interaction); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
86 this.interaction = null; |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
87 }, |
1063
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
88 createInteraction(drawMode) { |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
89 const drawVectorSrc = this.getLayerByName("Draw Tool").data.getSource(); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
90 drawVectorSrc.clear(); |
705
6aa09d12157f
client: add detection of drawend
Bernhard Reiter <bernhard@intevation.de>
parents:
703
diff
changeset
|
91 var draw = new Draw({ |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
92 source: drawVectorSrc, |
1063
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
93 type: drawMode, |
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
94 maxPoints: drawMode === "LineString" ? 2 : 50 |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
95 }); |
1071
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
96 draw.on("drawstart", () => { |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
97 drawVectorSrc.clear(); |
1113
595654ad3f66
renamed mapstore to map (like other stores)
Markus Kottlaender <markus@intevation.de>
parents:
1112
diff
changeset
|
98 this.$store.commit("map/setCurrentMeasurement", null); |
1071
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
99 // we are not setting an id here, to avoid the regular identify to |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
100 // pick it up |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
101 // event.feature.setId("drawn.1"); // unique id for new feature |
706
d47fa556a3e8
client: improve draw behaviour
Bernhard Reiter <bernhard@intevation.de>
parents:
705
diff
changeset
|
102 }); |
705
6aa09d12157f
client: add detection of drawend
Bernhard Reiter <bernhard@intevation.de>
parents:
703
diff
changeset
|
103 draw.on("drawend", this.drawEnd); |
6aa09d12157f
client: add detection of drawend
Bernhard Reiter <bernhard@intevation.de>
parents:
703
diff
changeset
|
104 return draw; |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
105 }, |
706
d47fa556a3e8
client: improve draw behaviour
Bernhard Reiter <bernhard@intevation.de>
parents:
705
diff
changeset
|
106 drawEnd(event) { |
1063
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
107 if (this.drawMode === "Polygon") { |
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
108 const areaSize = getArea(event.feature.getGeometry()); |
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
109 // also place the a rounded areaSize in a property, |
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
110 // so identify will show it |
1067
3f14b73414e2
client: correct and improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1063
diff
changeset
|
111 if (areaSize > 100000) { |
1113
595654ad3f66
renamed mapstore to map (like other stores)
Markus Kottlaender <markus@intevation.de>
parents:
1112
diff
changeset
|
112 this.$store.commit("map/setCurrentMeasurement", { |
1071
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
113 quantity: "Area", |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
114 unitSymbol: "km²", |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
115 // convert into 1 km² == 1000*1000 m² and round to 1000 m² |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
116 value: Math.round(areaSize / 1000) / 1000 |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
117 }); |
1067
3f14b73414e2
client: correct and improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1063
diff
changeset
|
118 } else { |
1113
595654ad3f66
renamed mapstore to map (like other stores)
Markus Kottlaender <markus@intevation.de>
parents:
1112
diff
changeset
|
119 this.$store.commit("map/setCurrentMeasurement", { |
1071
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
120 quantity: "Area", |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
121 unitSymbol: "m²", |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
122 value: Math.round(areaSize) |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
123 }); |
1067
3f14b73414e2
client: correct and improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1063
diff
changeset
|
124 } |
1063
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
125 } |
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
126 if (this.drawMode === "LineString") { |
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
127 const length = getLength(event.feature.getGeometry()); |
1113
595654ad3f66
renamed mapstore to map (like other stores)
Markus Kottlaender <markus@intevation.de>
parents:
1112
diff
changeset
|
128 this.$store.commit("map/setCurrentMeasurement", { |
1071
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
129 quantity: "Length", |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
130 unitSymbol: "m", |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
131 value: Math.round(length * 10) / 10 |
f8f398e36e38
client: improve area measurement
Bernhard Reiter <bernhard@intevation.de>
parents:
1068
diff
changeset
|
132 }); |
1063
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
133 } |
793
073394629ec6
client: add measurement and improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
790
diff
changeset
|
134 |
829
797063af6dc8
client: complete simple survey selection
Bernhard Reiter <bernhard@intevation.de>
parents:
810
diff
changeset
|
135 // if a survey has been selected, request a profile |
797063af6dc8
client: complete simple survey selection
Bernhard Reiter <bernhard@intevation.de>
parents:
810
diff
changeset
|
136 // TODO an improvement could be to check if the line intersects |
797063af6dc8
client: complete simple survey selection
Bernhard Reiter <bernhard@intevation.de>
parents:
810
diff
changeset
|
137 // with the bottleneck area's polygon before trying the server request |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
138 if (this.selectedSurvey) { |
1056
28eb62f7c676
additional survey as dynamic property
Thomas Junk <thomas.junk@intevation.de>
parents:
1043
diff
changeset
|
139 this.$store.commit("fairwayprofile/clearCurrentProfile"); |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
140 console.log("requesting profile for", this.selectedSurvey); |
1020
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
141 const inputLineString = event.feature.getGeometry().clone(); |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
142 inputLineString.transform("EPSG:3857", "EPSG:4326"); |
1041
7e3c620a5639
rounding cut coordinates
Markus Kottlaender <markus@intevation.de>
parents:
1029
diff
changeset
|
143 const [start, end] = inputLineString |
7e3c620a5639
rounding cut coordinates
Markus Kottlaender <markus@intevation.de>
parents:
1029
diff
changeset
|
144 .getCoordinates() |
7e3c620a5639
rounding cut coordinates
Markus Kottlaender <markus@intevation.de>
parents:
1029
diff
changeset
|
145 .map(coords => coords.map(coord => parseFloat(coord.toFixed(8)))); |
1020
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
146 this.$store.commit("fairwayprofile/setStartPoint", start); |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
147 this.$store.commit("fairwayprofile/setEndPoint", end); |
1028
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
148 const profileLine = new LineString([start, end]); |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
149 this.$store |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
150 .dispatch("fairwayprofile/loadProfile", this.selectedSurvey) |
1028
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
151 .then(() => { |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
152 var vectorSource = this.getLayerByName( |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
153 "Fairway Dimensions" |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
154 ).data.getSource(); |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
155 this.calculateIntersection(vectorSource, profileLine); |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
156 }) |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
157 .then(() => { |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
158 this.$store.commit("application/openSplitScreen"); |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
159 }) |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
160 .catch(error => { |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
161 const { status, data } = error.response; |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
162 displayError({ |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
163 title: "Backend Error", |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
164 message: `${status}: ${data.message || data}` |
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
165 }); |
1025
a55f20dc8d8d
refac: store profiles by date
Thomas Junk <thomas.junk@intevation.de>
parents:
1022
diff
changeset
|
166 }); |
1028
dd67e46366ef
refac: loading of profile data via fairwayprofile store
Thomas Junk <thomas.junk@intevation.de>
parents:
1027
diff
changeset
|
167 } |
706
d47fa556a3e8
client: improve draw behaviour
Bernhard Reiter <bernhard@intevation.de>
parents:
705
diff
changeset
|
168 }, |
1022
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
169 calculateIntersection(vectorSource, profileLine) { |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
170 const transformedLine = profileLine |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
171 .clone() |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
172 .transform("EPSG:4326", "EPSG:3857") |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
173 .getExtent(); |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
174 const featureCallback = feature => { |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
175 // transform back to prepare for usage |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
176 var intersectingPolygon = feature |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
177 .getGeometry() |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
178 .clone() |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
179 .transform("EPSG:3857", "EPSG:4326"); |
1029
1fdeb9404afb
refac: extract calculation of fairway coordinates
Thomas Junk <thomas.junk@intevation.de>
parents:
1028
diff
changeset
|
180 const fairwayCoordinates = calculateFairwayCoordinates( |
1022
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
181 profileLine, |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
182 intersectingPolygon, |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
183 DEMODATA |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
184 ); |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
185 this.$store.commit( |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
186 "fairwayprofile/setFairwayCoordinates", |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
187 fairwayCoordinates |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
188 ); |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
189 }; |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
190 vectorSource.forEachFeatureIntersectingExtent( |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
191 // need to use EPSG:3857 which is the proj of vectorSource |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
192 transformedLine, |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
193 featureCallback |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
194 ); |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
195 }, |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
196 activateInteraction() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
197 const interaction = this.createInteraction(this.drawMode); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
198 this.interaction = interaction; |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
199 this.openLayersMap.addInteraction(interaction); |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
200 }, |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
201 identify(coordinate, pixel) { |
1113
595654ad3f66
renamed mapstore to map (like other stores)
Markus Kottlaender <markus@intevation.de>
parents:
1112
diff
changeset
|
202 this.$store.commit("map/setIdentifiedFeatures", []); |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
203 // checking our WFS layers |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
204 var features = this.openLayersMap.getFeaturesAtPixel(pixel); |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
205 if (features) { |
1113
595654ad3f66
renamed mapstore to map (like other stores)
Markus Kottlaender <markus@intevation.de>
parents:
1112
diff
changeset
|
206 this.$store.commit("map/setIdentifiedFeatures", features); |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
207 |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
208 // get selected bottleneck from identified features |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
209 for (let feature of features) { |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
210 let id = feature.getId(); |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
211 // RegExp.prototype.test() works with number, str and undefined |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
212 if (/^bottlenecks\./.test(id)) { |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
213 this.$store.dispatch("bottlenecks/setSelectedBottleneck", feature.get("objnam")); |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
214 } |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
215 } |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
216 } |
770
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
767
diff
changeset
|
217 |
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
767
diff
changeset
|
218 // DEBUG output and example how to remove the GeometryName |
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
767
diff
changeset
|
219 /* |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
220 for (let feature of features) { |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
221 console.log("Identified:", feature.getId()); |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
222 for (let key of feature.getKeys()) { |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
223 if (key != feature.getGeometryName()) { |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
224 console.log(key, feature.get(key)); |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
225 } |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
226 } |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
227 } |
770
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
767
diff
changeset
|
228 */ |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
229 |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
230 // trying the GetFeatureInfo way for WMS |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
231 var wmsSource = this.getLayerByName( |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
232 "Inland ECDIS chart Danube" |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
233 ).data.getSource(); |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
234 var url = wmsSource.getGetFeatureInfoUrl( |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
235 coordinate, |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
236 100 /* resolution */, |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
237 "EPSG:3857", |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
238 // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
239 { INFO_FORMAT: "text/plain" } |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
240 ); |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
241 |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
242 if (url) { |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
243 // cannot directly query here because of SOP |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
244 console.log("GetFeatureInfo url:", url); |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
245 } |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
246 }, |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
247 buildVectorLoader(featureRequestOptions, endpoint, vectorSource) { |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
248 // build a function to be used for VectorSource.setLoader() |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
249 // make use of WFS().writeGetFeature to build the request |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
250 // and use our HTTP library to actually do it |
703
e9c28c42c927
client: improve WFS loader
Bernhard Reiter <bernhard@intevation.de>
parents:
702
diff
changeset
|
251 // NOTE: a) the geometryName has to be given in featureRequestOptions, |
e9c28c42c927
client: improve WFS loader
Bernhard Reiter <bernhard@intevation.de>
parents:
702
diff
changeset
|
252 // because we want to load depending on the bbox |
e9c28c42c927
client: improve WFS loader
Bernhard Reiter <bernhard@intevation.de>
parents:
702
diff
changeset
|
253 // b) the VectorSource has to have the option strategy: bbox |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
254 featureRequestOptions["outputFormat"] = "application/json"; |
702
aaf5dbfb9512
client: improve loading of WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
701
diff
changeset
|
255 var loader = function(extent, resolution, projection) { |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
256 featureRequestOptions["bbox"] = extent; |
702
aaf5dbfb9512
client: improve loading of WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
701
diff
changeset
|
257 featureRequestOptions["srsName"] = projection.getCode(); |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
258 var featureRequest = new WFS().writeGetFeature(featureRequestOptions); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
259 // DEBUG console.log(featureRequest); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
260 HTTP.post( |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
261 endpoint, |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
262 new XMLSerializer().serializeToString(featureRequest), |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
263 { |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
264 headers: { |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
265 "X-Gemma-Auth": localStorage.getItem("token"), |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
266 "Content-type": "text/xml; charset=UTF-8" |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
267 } |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
268 } |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
269 ) |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
270 .then(response => { |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
271 var features = new GeoJSON().readFeatures( |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
272 JSON.stringify(response.data) |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
273 ); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
274 vectorSource.addFeatures(features); |
754
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
275 // console.log( |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
276 // "loaded", |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
277 // features.length, |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
278 // featureRequestOptions.featureTypes, |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
279 // "features" |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
280 // ); |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
281 // DEBUG console.log("loaded ", features, "for", vectorSource); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
282 // eslint-disable-next-line |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
709
diff
changeset
|
283 }) |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
709
diff
changeset
|
284 .catch(() => { |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
285 vectorSource.removeLoadedExtent(extent); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
286 }); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
287 }; |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
288 return loader; |
842
ee6f127f573c
client: add first prototype for bottleneck iso layer
Bernhard Reiter <bernhard@intevation.de>
parents:
832
diff
changeset
|
289 }, |
860
38b682eaa7b1
client: add updateing of bottleneck filter
Bernhard Reiter <bernhard@intevation.de>
parents:
859
diff
changeset
|
290 updateBottleneckFilter(bottleneck_id, datestr) { |
38b682eaa7b1
client: add updateing of bottleneck filter
Bernhard Reiter <bernhard@intevation.de>
parents:
859
diff
changeset
|
291 console.log("updating filter with", bottleneck_id, datestr); |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
292 var layer = this.getLayerByName("Bottleneck isolines"); |
918
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
293 var wmsSrc = layer.data.getSource(); |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
294 |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
295 if (bottleneck_id != "does_not_exist") { |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
296 wmsSrc.updateParams({ |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
297 cql_filter: |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
298 "date_info='" + |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
299 datestr + |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
300 "' AND bottleneck_id='" + |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
301 bottleneck_id + |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
302 "'" |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
303 }); |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
304 layer.isVisible = true; |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
305 layer.data.setVisible(true); |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
306 } else { |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
307 layer.isVisible = false; |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
308 layer.data.setVisible(false); |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
309 } |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
310 }, |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
311 onBeforePrint(/* evt */) { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
312 // console.log("onBeforePrint(", evt ,")"); |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
313 // |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
314 // the following code shows how to get the current map canvas |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
315 // and change it, however this does not work well enough, as |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
316 // another mechanism seems to update the size again before the rendering |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
317 // for printing is done: |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
318 // console.log(this.openLayersMap.getViewport()); |
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
319 // var canvas = this.openLayersMap.getViewport().getElementsByTagName("canvas")[0]; |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
320 // console.log(canvas); |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
321 // canvas.width=1000; |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
322 // canvas.height=1414; |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
323 // |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
324 // An experiment which also did not work: |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
325 // this.openLayersMap.setSize([1000, 1414]); // estimate portait DIN A4 |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
326 // |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
327 // according to documentation |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
328 // http://openlayers.org/en/latest/apidoc/module-ol_PluggableMap-PluggableMap.html#updateSize |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
329 // "Force a recalculation of the map viewport size. This should be called when third-party code changes the size of the map viewport." |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
330 // but did not help |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
331 // this.openLayersMap.updateSize(); |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
332 }, |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
333 onAfterPrint(/* evt */) { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
334 // could be used to undo changes that have been done for printing |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
335 // though https://www.tjvantoll.com/2012/06/15/detecting-print-requests-with-javascript/ |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
336 // reported that this was not feasable (back then). |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
337 // console.log("onAfterPrint(", evt, ")"); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
338 } |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
339 }, |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
340 watch: { |
1063
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
341 drawMode(newValue) { |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
342 if (this.interaction) { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
343 this.removeCurrentInteraction(); |
1063
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
344 } |
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1062
diff
changeset
|
345 if (newValue) { |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
346 this.activateInteraction(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
347 } |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
348 }, |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
349 split() { |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
350 const map = this.openLayersMap; |
594
6987b5c926b8
fix: leveraging vue.nexttick instead of timeout
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
351 this.$nextTick(() => { |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
352 map.updateSize(); |
594
6987b5c926b8
fix: leveraging vue.nexttick instead of timeout
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
353 }); |
860
38b682eaa7b1
client: add updateing of bottleneck filter
Bernhard Reiter <bernhard@intevation.de>
parents:
859
diff
changeset
|
354 }, |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
355 selectedSurvey(newSelectedSurvey) { |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
356 if (newSelectedSurvey) { |
861
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
357 this.updateBottleneckFilter( |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
358 newSelectedSurvey.bottleneck_id, |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1104
diff
changeset
|
359 newSelectedSurvey.date_info |
861
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
360 ); |
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
361 } else { |
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
362 this.updateBottleneckFilter("does_not_exist", "1999-10-01"); |
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
363 } |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
364 } |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
365 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
366 mounted() { |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
782
diff
changeset
|
367 let map = new Map({ |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
368 layers: [...this.layers.map(x => x.data)], |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
369 target: "map", |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
370 controls: [], |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
371 view: new View({ |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
372 center: [this.long, this.lat], |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
373 zoom: this.zoom, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
374 projection: this.projection |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
375 }) |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
376 }); |
1113
595654ad3f66
renamed mapstore to map (like other stores)
Markus Kottlaender <markus@intevation.de>
parents:
1112
diff
changeset
|
377 this.$store.commit("map/setOpenLayersMap", map); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
378 |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
379 // TODO make display of layers more dynamic, e.g. from a list |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
380 |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
381 // loading the full WFS layer, by not setting the loader function |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
382 // and without bboxStrategy |
1103
dfe3966bb308
removed unnecessary methods and renamed variable
Markus Kottlaender <markus@intevation.de>
parents:
1071
diff
changeset
|
383 var featureRequest = new WFS().writeGetFeature({ |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
384 srsName: "EPSG:3857", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
385 featureNS: "gemma", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
386 featurePrefix: "gemma", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
387 featureTypes: ["fairway_dimensions"], |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
388 outputFormat: "application/json" |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
389 }); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
390 |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
391 // NOTE: loading the full fairway_dimensions makes sure |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
392 // that all are available for the intersection with the profile |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
393 HTTP.post( |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
394 "/internal/wfs", |
1103
dfe3966bb308
removed unnecessary methods and renamed variable
Markus Kottlaender <markus@intevation.de>
parents:
1071
diff
changeset
|
395 new XMLSerializer().serializeToString(featureRequest), |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
396 { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
397 headers: { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
398 "X-Gemma-Auth": localStorage.getItem("token"), |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
399 "Content-type": "text/xml; charset=UTF-8" |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
400 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
401 } |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
402 ).then(response => { |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
403 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
404 var vectorSrc = this.getLayerByName( |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
405 "Fairway Dimensions" |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
406 ).data.getSource(); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
407 vectorSrc.addFeatures(features); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
408 // would scale to the extend of all resulting features |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
409 // this.openLayersMap.getView().fit(vectorSrc.getExtent()); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
410 }); |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
411 |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
412 // load following layers with bboxStrategy (using our request builder) |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
413 var layer = null; |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
414 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
415 layer = this.getLayerByName("Waterway Area"); |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
416 layer.data.getSource().setLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
417 this.buildVectorLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
418 { |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
419 featurePrefix: "ws-wamos", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
420 featureTypes: ["ienc_wtware"], |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
421 geometryName: "geom" |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
422 }, |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
423 "/external/d4d", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
424 layer.data.getSource() |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
425 ) |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
426 ); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
427 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
428 layer = this.getLayerByName("Waterway Axis"); |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
429 layer.data.getSource().setLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
430 this.buildVectorLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
431 { |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
432 featurePrefix: "ws-wamos", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
433 featureTypes: ["ienc_wtwaxs"], |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
434 geometryName: "geom" |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
435 }, |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
436 "/external/d4d", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
437 layer.data.getSource() |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
438 ) |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
439 ); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
440 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
441 layer = this.getLayerByName("Distance marks"); |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
442 layer.data.getSource().setLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
443 this.buildVectorLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
444 { |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
445 featurePrefix: "ws-wamos", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
446 featureTypes: ["ienc_dismar"], |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
447 geometryName: "geom" //, |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
448 /* restrict loading approximately to extend of danube in Austria */ |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
449 // filter: bboxFilter("geom", [13.3, 48.0, 17.1, 48.6], "EPSG:4326") |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
450 }, |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
451 "/external/d4d", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
452 layer.data.getSource() |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
453 ) |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
454 ); |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
455 layer.data.setVisible(layer.isVisible); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
456 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
457 layer = this.getLayerByName("Distance marks, Axis"); |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
458 layer.data.getSource().setLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
459 this.buildVectorLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
460 { |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
461 featureNS: "gemma", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
462 featurePrefix: "gemma", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
463 featureTypes: ["distance_marks_geoserver"], |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
464 geometryName: "geom" |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
465 }, |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
466 "/internal/wfs", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
467 layer.data.getSource() |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
468 ) |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
469 ); |
745
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
470 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
471 layer = this.getLayerByName("Waterway Area, named"); |
745
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
472 layer.data.getSource().setLoader( |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
473 this.buildVectorLoader( |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
474 { |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
475 featureNS: "gemma", |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
476 featurePrefix: "gemma", |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
477 featureTypes: ["hydro_seaare"], |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
478 geometryName: "geom" |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
479 }, |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
480 "/external/d4d", |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
481 layer.data.getSource() |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
482 ) |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
483 ); |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
484 layer.data.setVisible(layer.isVisible); |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
485 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
486 layer = this.getLayerByName("Bottlenecks"); |
790
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
487 layer.data.getSource().setLoader( |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
488 this.buildVectorLoader( |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
489 { |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
490 featureNS: "gemma", |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
491 featurePrefix: "gemma", |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
492 featureTypes: ["bottlenecks"], |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
493 geometryName: "area" |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
494 }, |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
495 "/internal/wfs", |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
496 layer.data.getSource() |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
497 ) |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
498 ); |
858
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
499 HTTP.get("/system/style/Bottlenecks/stroke", { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
500 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
501 }) |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
502 .then(response => { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
503 this.btlnStrokeC = response.data.code; |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
504 HTTP.get("/system/style/Bottlenecks/fill", { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
505 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
506 }) |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
507 .then(response => { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
508 this.btlnFillC = response.data.code; |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
509 var newstyle = new Style({ |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
510 stroke: new Stroke({ |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
511 color: this.btlnStrokeC, |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
512 width: 4 |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
513 }), |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
514 fill: new Fill({ |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
515 color: this.btlnFillC |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
516 }) |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
517 }); |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
518 layer.data.setStyle(newstyle); |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
519 }) |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
520 .catch(error => { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
521 console.log(error); |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
522 }); |
848
22f7d33eee65
Make eslint happy again.
Sascha Wilde <wilde@intevation.de>
parents:
843
diff
changeset
|
523 }) |
858
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
524 .catch(error => { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
525 console.log(error); |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
526 }); |
790
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
527 |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
528 window.addEventListener("beforeprint", this.onBeforePrint); |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
529 window.addEventListener("afterprint", this.onAfterPrint); |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
530 |
842
ee6f127f573c
client: add first prototype for bottleneck iso layer
Bernhard Reiter <bernhard@intevation.de>
parents:
832
diff
changeset
|
531 // so none is shown |
938
fe923c8ef08f
client: add static legend image to contour_lines
Bernhard Reiter <bernhard@intevation.de>
parents:
918
diff
changeset
|
532 this.updateBottleneckFilter("does_not_exist", "1999-10-01"); |
1104
9c15e3bf8066
removed unnecessary function and reduced code a bit
Markus Kottlaender <markus@intevation.de>
parents:
1103
diff
changeset
|
533 this.openLayersMap.on(["singleclick", "dblclick"], event => { |
9c15e3bf8066
removed unnecessary function and reduced code a bit
Markus Kottlaender <markus@intevation.de>
parents:
1103
diff
changeset
|
534 this.identify(event.coordinate, event.pixel); |
9c15e3bf8066
removed unnecessary function and reduced code a bit
Markus Kottlaender <markus@intevation.de>
parents:
1103
diff
changeset
|
535 }); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
536 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
537 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
538 </script> |