Mercurial > gemma
annotate client/src/components/layers/layers.js @ 5356:3216b4a19023 extented-report
spinner added to info tool's download link for DQL reports
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 22 Jun 2021 14:44:34 +0200 |
parents | a17c2a0b8e44 |
children | 67ffa7517888 |
rev | line source |
---|---|
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
1 import { GeoJSON, WFS } from "ol/format"; |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
2 import { Icon, Stroke, Style } from "ol/style"; |
3031 | 3 import { |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
4 Image as ImageLayer, |
3031 | 5 Tile as TileLayer, |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
6 Vector as VectorLayer |
3031 | 7 } from "ol/layer"; |
5142
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
8 import { |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
9 and as andFilter, |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
10 equalTo, |
5146
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
11 greaterThanOrEqualTo, |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
12 lessThanOrEqualTo |
5142
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
13 } from "ol/format/filter"; |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
14 |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
15 import { HTTP } from "@/lib/http"; |
3029
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3021
diff
changeset
|
16 import { ImageWMS as ImageSource } from "ol/source"; |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
17 import OSM from "ol/source/OSM"; |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
18 import Point from "ol/geom/Point"; |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
19 import TileWMS from "ol/source/TileWMS"; |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
20 import VectorSource from "ol/source/Vector"; |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
21 import { bbox as bboxStrategy } from "ol/loadingstrategy"; |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
22 import store from "@/store/index"; |
4241
27434b0d4d96
Map: setting styles correctly for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4223
diff
changeset
|
23 import { styleFactory } from "./styles"; |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
24 |
4374
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
25 export const buildVectorLoader = ( |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
26 featureRequestOptions, |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
27 vectorSource, |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
28 bboxStrategyDisabled, |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
29 featurePostProcessor |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
30 ) => { |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
31 // build a function to be used for VectorSource.setLoader() |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
32 // make use of WFS().writeGetFeature to build the request |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
33 // and use our HTTP library to actually do it |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
34 // NOTE: the geometryName has to be given in featureRequestOptions if |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
35 // bboxStrategy (default) is used |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
36 featureRequestOptions.featureNS = "gemma"; |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
37 featureRequestOptions.featurePrefix = "gemma"; |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
38 featureRequestOptions.outputFormat = "application/json"; |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
39 return (extent, resolution, projection) => { |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
40 if (!bboxStrategyDisabled) { |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
41 featureRequestOptions.bbox = extent; |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
42 } |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
43 featureRequestOptions.srsName = projection.getCode(); |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
44 HTTP.post( |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
45 "/internal/wfs", |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
46 new XMLSerializer().serializeToString( |
5142
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
47 new WFS().writeGetFeature( |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
48 (function() { |
5279
a17c2a0b8e44
client: use current time in the review layer request
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5159
diff
changeset
|
49 if (!vectorSource.get("useCurrentTime")) { |
a17c2a0b8e44
client: use current time in the review layer request
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5159
diff
changeset
|
50 if (featureRequestOptions.filter) { |
a17c2a0b8e44
client: use current time in the review layer request
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5159
diff
changeset
|
51 for (let condition of featureRequestOptions.filter.conditions) { |
a17c2a0b8e44
client: use current time in the review layer request
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5159
diff
changeset
|
52 if (condition.propertyName == "valid_from") { |
a17c2a0b8e44
client: use current time in the review layer request
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5159
diff
changeset
|
53 condition.expression = store.state.application.refreshLayersTime.toISOString(); |
a17c2a0b8e44
client: use current time in the review layer request
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5159
diff
changeset
|
54 } |
a17c2a0b8e44
client: use current time in the review layer request
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5159
diff
changeset
|
55 if (condition.propertyName == "valid_to") { |
a17c2a0b8e44
client: use current time in the review layer request
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5159
diff
changeset
|
56 condition.expression = store.state.application.refreshLayersTime.toISOString(); |
a17c2a0b8e44
client: use current time in the review layer request
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5159
diff
changeset
|
57 } |
5142
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
58 } |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
59 } |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
60 } |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
61 return featureRequestOptions; |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
62 })() |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
63 ) |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 ), |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
65 { |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
66 headers: { |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
67 "X-Gemma-Auth": localStorage.getItem("token"), |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
68 "Content-type": "text/xml; charset=UTF-8" |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
69 } |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
70 } |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
71 ) |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
72 .then(response => { |
5139
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
73 try { |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
74 const features = new GeoJSON().readFeatures( |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
75 JSON.stringify(response.data) |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
76 ); |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
77 if (featurePostProcessor) { |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
78 features.map(f => featurePostProcessor(f, store, features)); |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
79 } |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
80 vectorSource.addFeatures(features); |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
81 } catch (error) { |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
82 console.log(error); |
5151
2584fedb2e99
Set empty feature array if loading failed for WFS.
Raimund Renkert <raimund@renkert.org>
parents:
5146
diff
changeset
|
83 console.log("Loading failed for:", vectorSource); |
2584fedb2e99
Set empty feature array if loading failed for WFS.
Raimund Renkert <raimund@renkert.org>
parents:
5146
diff
changeset
|
84 vectorSource.addFeatures([]); |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
85 } |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
86 }) |
5139
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
87 .catch(error => { |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
88 console.log(error); |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
89 vectorSource.removeLoadedExtent(extent); |
4867
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
90 store.dispatch("application/reportBackendError"); |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
91 }); |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
92 }; |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
93 }; |
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
94 |
3123
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
95 // SHARED LAYERS: |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
96 // DRAW- and CUTLAYER are shared across maps. E.g. you want to see the cross cut |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
97 // arrow on both maps when comparing surveys. So we don't need to initialize a |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
98 // new VectorLayer object for each map. Instead we use these two constants so |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
99 // that all maps use the same object. |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
100 const DRAWLAYER = new VectorLayer({ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
101 id: "DRAWTOOL", |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
102 label: "Draw Tool", |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
103 visible: true, |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
104 source: new VectorSource({ wrapX: false }), |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
105 style: function(feature) { |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
106 // adapted from OpenLayer's LineString Arrow Example |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
107 var geometry = feature.getGeometry(); |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
108 var styles = [ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
109 // linestring |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
110 new Style({ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
111 stroke: new Stroke({ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
112 color: "#369aca", |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
113 width: 2 |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
114 }) |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
115 }) |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
116 ]; |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
117 |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
118 if (geometry.getType() === "LineString") { |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
119 geometry.forEachSegment(function(start, end) { |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
120 var dx = end[0] - start[0]; |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
121 var dy = end[1] - start[1]; |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
122 var rotation = Math.atan2(dy, dx); |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
123 // arrows |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
124 styles.push( |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
125 new Style({ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
126 geometry: new Point(end), |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
127 image: new Icon({ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
128 // we need to make sure the image is loaded by Vue Loader |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
129 src: require("@/assets/linestring_arrow.png"), |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
130 // fiddling with the anchor's y value does not help to |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
131 // position the image more centered on the line ending, as the |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
132 // default line style seems to be slightly uncentered in the |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
133 // anti-aliasing, but the image is not placed with subpixel |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
134 // precision |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
135 anchor: [0.75, 0.5], |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
136 rotateWithView: true, |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
137 rotation: -rotation |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
138 }) |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
139 }) |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
140 ); |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
141 }); |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
142 } |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
143 return styles; |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
144 } |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
145 }); |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
146 |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
147 const CUTLAYER = new VectorLayer({ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
148 id: "CUTTOOL", |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
149 label: "Cut Tool", |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
150 visible: true, |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
151 source: new VectorSource({ wrapX: false }), |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
152 style: function(feature) { |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
153 // adapted from OpenLayer's LineString Arrow Example |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
154 var geometry = feature.getGeometry(); |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
155 var styles = [ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
156 // linestring |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
157 new Style({ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
158 stroke: new Stroke({ |
3643
f9032442620a
client: cross profiles: improved style of arrow on the map (added white border to have higher contrast)
Markus Kottlaender <markus@intevation.de>
parents:
3548
diff
changeset
|
159 color: "#FFFFFF", |
f9032442620a
client: cross profiles: improved style of arrow on the map (added white border to have higher contrast)
Markus Kottlaender <markus@intevation.de>
parents:
3548
diff
changeset
|
160 width: 5, |
f9032442620a
client: cross profiles: improved style of arrow on the map (added white border to have higher contrast)
Markus Kottlaender <markus@intevation.de>
parents:
3548
diff
changeset
|
161 lineDash: [7, 7] |
f9032442620a
client: cross profiles: improved style of arrow on the map (added white border to have higher contrast)
Markus Kottlaender <markus@intevation.de>
parents:
3548
diff
changeset
|
162 }) |
f9032442620a
client: cross profiles: improved style of arrow on the map (added white border to have higher contrast)
Markus Kottlaender <markus@intevation.de>
parents:
3548
diff
changeset
|
163 }), |
f9032442620a
client: cross profiles: improved style of arrow on the map (added white border to have higher contrast)
Markus Kottlaender <markus@intevation.de>
parents:
3548
diff
changeset
|
164 new Style({ |
f9032442620a
client: cross profiles: improved style of arrow on the map (added white border to have higher contrast)
Markus Kottlaender <markus@intevation.de>
parents:
3548
diff
changeset
|
165 stroke: new Stroke({ |
3123
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
166 color: "#333333", |
3643
f9032442620a
client: cross profiles: improved style of arrow on the map (added white border to have higher contrast)
Markus Kottlaender <markus@intevation.de>
parents:
3548
diff
changeset
|
167 width: 3, |
3123
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
168 lineDash: [7, 7] |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
169 }) |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
170 }) |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
171 ]; |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
172 |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
173 if (geometry.getType() === "LineString") { |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
174 geometry.forEachSegment(function(start, end) { |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
175 var dx = end[0] - start[0]; |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
176 var dy = end[1] - start[1]; |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
177 var rotation = Math.atan2(dy, dx); |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
178 // arrows |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
179 styles.push( |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
180 new Style({ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
181 geometry: new Point(end), |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
182 image: new Icon({ |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
183 // we need to make sure the image is loaded by Vue Loader |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
184 src: require("@/assets/linestring_arrow_grey.png"), |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
185 // fiddling with the anchor's y value does not help to |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
186 // position the image more centered on the line ending, as the |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
187 // default line style seems to be slightly uncentered in the |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
188 // anti-aliasing, but the image is not placed with subpixel |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
189 // precision |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
190 anchor: [0.75, 0.5], |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
191 rotateWithView: true, |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
192 rotation: -rotation |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
193 }) |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
194 }) |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
195 ); |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
196 }); |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
197 } |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
198 return styles; |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
199 } |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
200 }); |
f0af359391a0
client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents:
3102
diff
changeset
|
201 |
3685
8775bea8042a
client: layers: unset layer config on logout
Markus Kottlaender <markus@intevation.de>
parents:
3678
diff
changeset
|
202 let layerConfigs = {}; |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
203 |
3685
8775bea8042a
client: layers: unset layer config on logout
Markus Kottlaender <markus@intevation.de>
parents:
3678
diff
changeset
|
204 export const unsetLayerConfigs = function() { |
8775bea8042a
client: layers: unset layer config on logout
Markus Kottlaender <markus@intevation.de>
parents:
3678
diff
changeset
|
205 layerConfigs = {}; |
8775bea8042a
client: layers: unset layer config on logout
Markus Kottlaender <markus@intevation.de>
parents:
3678
diff
changeset
|
206 }; |
8775bea8042a
client: layers: unset layer config on logout
Markus Kottlaender <markus@intevation.de>
parents:
3678
diff
changeset
|
207 |
8775bea8042a
client: layers: unset layer config on logout
Markus Kottlaender <markus@intevation.de>
parents:
3678
diff
changeset
|
208 export const layerFactory = function(mapId) { |
3548
f3102fa16a69
client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents:
3547
diff
changeset
|
209 const styles = styleFactory(mapId); |
3547
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
210 // Shared feature source for layers: |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
211 // BOTTLENECKS, BOTTLENECKSTATUS and BOTTLENECKFAIRWAYAVAILABILITY |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
212 // Reduces bottlenecks_geoserver requests and number of stored feature objects. |
4336
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4292
diff
changeset
|
213 const FDREVIEWLAYER = new VectorLayer({ |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4292
diff
changeset
|
214 id: "FDREVIEWLAYER", |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4292
diff
changeset
|
215 label: "Review", |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4292
diff
changeset
|
216 visible: true, |
4368
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
217 source: new VectorSource({ wrapX: false }), |
4336
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4292
diff
changeset
|
218 style: styles.sections |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4292
diff
changeset
|
219 }); |
3547
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
220 const bottlenecksSource = new VectorSource({ strategy: bboxStrategy }); |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
221 bottlenecksSource.setLoader( |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
222 buildVectorLoader( |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
223 { |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
224 featureTypes: ["bottlenecks_geoserver"], |
5142
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
225 geometryName: "area", |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
226 filter: andFilter( |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
227 lessThanOrEqualTo( |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
228 "valid_from", |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
229 store.state.application.refreshLayersTime.toISOString() |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
230 ), |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
231 greaterThanOrEqualTo( |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
232 "valid_to", |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
233 store.state.application.refreshLayersTime.toISOString() |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
234 ) |
ea22d3efa76c
client: Time based request for bottlenecks layer
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5139
diff
changeset
|
235 ) |
3547
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
236 }, |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
237 bottlenecksSource, |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
238 false, |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
239 async (f, store) => { |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
240 if (f.get("fa_critical")) { |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
241 // look for fairway availability data in store. If present and |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
242 // not older than 15 min use it or fetch new data and store it. |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
243 let data = store.getters["fairwayavailability/fwLNWLOverviewData"](f); |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
244 if ( |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
245 data && |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
246 new Date().getTime() - data.createdAt.getTime() < 900000 |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
247 ) { |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
248 f.set("fa_data", data.data); |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
249 } else { |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
250 let date = new Date(); |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
251 data = await store.dispatch( |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
252 "fairwayavailability/loadAvailableFairwayDepthLNWLForMap", |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
253 { |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
254 feature: f, |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
255 from: date.toISOString().split("T")[0], |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
256 to: date.toISOString().split("T")[0], |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
257 frequency: "monthly", |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
258 LOS: 3 |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
259 } |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
260 ); |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
261 if (data) { |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
262 store.commit("fairwayavailability/addFwLNWLOverviewData", { |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
263 feature: f, |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
264 data, |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
265 createdAt: new Date() |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
266 }); |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
267 f.set("fa_data", data); |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
268 } |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
269 } |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
270 } |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
271 return f; |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
272 } |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
273 ) |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
274 ); |
47c61ea894b1
client: map layers: share same vector source object for layers that use the same geoserver view (bottlenecks_geoserver)
Markus Kottlaender <markus@intevation.de>
parents:
3507
diff
changeset
|
275 |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
276 // either use existing config or create new one |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
277 // important is only each map has its individual layer config |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
278 // but we don't want to create new layer objects each time a store value |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
279 // that is used here changes. |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
280 const config = layerConfigs.hasOwnProperty(mapId) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
281 ? layerConfigs[mapId] |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
282 : [ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
283 new TileLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
284 id: "OPENSTREETMAP", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
285 label: "Open Streetmap", |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
286 visible: true, |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
287 source: new OSM() |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
288 }), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
289 new ImageLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
290 id: "INLANDECDIS", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
291 label: "Inland ECDIS chart Danube", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
292 visible: true, |
4022
efe0904b1d45
Change of ECDIS no longer requires reload
Thomas Junk <thomas.junk@intevation.de>
parents:
3685
diff
changeset
|
293 source: null |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
294 }), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
295 new ImageLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
296 id: "WATERWAYAREA", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
297 label: "Waterway Area", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
298 maxResolution: 100, |
3030
3524bbc5067e
Use dingle tile WMS for ECDIS Layer and Max resolutions for some vector layers.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3029
diff
changeset
|
299 minResolution: 0, |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
300 source: new ImageSource({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
301 url: window.location.origin + "/api/internal/wms", |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
302 params: { |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
303 LAYERS: "waterway_area", |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
304 VERSION: "1.1.1", |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
305 TILED: true |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
306 }, |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
307 imageLoadFunction: function(tile, src) { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
308 HTTP.get(src, { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
309 headers: { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
310 "X-Gemma-Auth": localStorage.getItem("token") |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
311 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
312 responseType: "blob" |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
313 }).then(response => { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
314 tile.getImage().src = URL.createObjectURL(response.data); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
315 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
316 } // TODO tile.setState(TileState.ERROR); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
317 }) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
318 }), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
319 (function() { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
320 const source = new VectorSource({ strategy: bboxStrategy }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
321 source.setLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
322 buildVectorLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
323 { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
324 featureTypes: ["stretches_geoserver"], |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
325 geometryName: "area" |
3047
e0b77d7463e7
Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3031
diff
changeset
|
326 }, |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
327 source, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
328 true, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
329 (f, store) => { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
330 if (f.getId() === store.state.imports.selectedStretchId) { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
331 f.set("highlighted", true); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
332 } |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
333 return f; |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
334 } |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
335 ) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
336 ); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
337 return new VectorLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
338 id: "STRETCHES", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
339 label: "Stretches", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
340 visible: false, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
341 style: styles.stretches, |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
342 source |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
343 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
344 })(), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
345 (function() { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
346 const source = new VectorSource({ strategy: bboxStrategy }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
347 source.setLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
348 buildVectorLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
349 { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
350 featureTypes: ["sections_geoserver"], |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
351 geometryName: "area" |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
352 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
353 source, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
354 true, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
355 (f, store) => { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
356 if (f.getId() === store.state.imports.selectedSectionId) { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
357 f.set("highlighted", true); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
358 } |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
359 return f; |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
360 } |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
361 ) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
362 ); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
363 return new VectorLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
364 id: "SECTIONS", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
365 label: "Sections", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
366 visible: false, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
367 style: styles.sections, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
368 source |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
369 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
370 })(), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
371 (function() { |
4600
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
372 return new VectorLayer({ |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
373 id: "BOTTLENECKS", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
374 label: "Bottlenecks", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
375 visible: true, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
376 style: styles.bottleneck, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
377 source: bottlenecksSource |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
378 }); |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
379 })(), |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
380 new TileLayer({ |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
381 id: "BOTTLENECKISOLINE", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
382 label: "Bottleneck morphology", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
383 visible: false, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
384 source: new TileWMS({ |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
385 preload: 0, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
386 projection: "EPSG:3857", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
387 url: window.location.origin + "/api/internal/wms", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
388 params: { |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
389 LAYERS: "sounding_results_areas_geoserver", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
390 VERSION: "1.1.1", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
391 TILED: true |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
392 }, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
393 tileLoadFunction: function(tile, src) { |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
394 HTTP.get(src, { |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
395 headers: { |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
396 "X-Gemma-Auth": localStorage.getItem("token") |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
397 }, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
398 responseType: "blob" |
4867
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
399 }) |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
400 .then(response => { |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
401 tile.getImage().src = URL.createObjectURL(response.data); |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
402 }) |
5139
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
403 .catch(error => { |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
404 console.log(error); |
4867
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
405 store.dispatch("application/reportBackendError"); |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
406 }); |
4600
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
407 } // TODO tile.setState(TileState.ERROR); |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
408 }) |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
409 }), |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
410 new TileLayer({ |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
411 id: "DIFFERENCES", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
412 label: "Bottleneck Differences", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
413 visible: false, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
414 source: new TileWMS({ |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
415 preload: 0, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
416 projection: "EPSG:3857", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
417 url: window.location.origin + "/api/internal/wms", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
418 params: { |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
419 LAYERS: "sounding_differences", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
420 VERSION: "1.1.1", |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
421 TILED: true, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
422 CQL_FILTER: "id=" + store.state.fairwayprofile.currentDifference |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
423 }, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
424 tileLoadFunction: function(tile, src) { |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
425 HTTP.get(src, { |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
426 headers: { |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
427 "X-Gemma-Auth": localStorage.getItem("token") |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
428 }, |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
429 responseType: "blob" |
4867
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
430 }) |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
431 .then(response => { |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
432 tile.getImage().src = URL.createObjectURL(response.data); |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
433 }) |
5139
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
434 .catch(error => { |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
435 console.log(error); |
4867
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
436 store.dispatch("application/reportBackendError"); |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
437 }); |
4600
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
438 } // TODO tile.setState(TileState.ERROR); |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
439 }) |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
440 }), |
75d1126f7299
Reordered layers so that features are not covered by new filled morphology.
Sascha Wilde <wilde@intevation.de>
parents:
4580
diff
changeset
|
441 (function() { |
4261
ac99e13e9ca9
layers: BBox strategy for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4241
diff
changeset
|
442 const source = new VectorSource({ strategy: bboxStrategy }); |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
443 source.setLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
444 buildVectorLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
445 { |
4261
ac99e13e9ca9
layers: BBox strategy for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4241
diff
changeset
|
446 geometryName: "area", |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
447 featureTypes: ["fairway_dimensions"], |
4378
09406e3b052c
layers: only load fairwaydimensions with staging_done on map
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
448 filter: andFilter( |
09406e3b052c
layers: only load fairwaydimensions with staging_done on map
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
449 equalTo("level_of_service", 1), |
5146
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
450 equalTo("staging_done", true), |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
451 lessThanOrEqualTo( |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
452 "valid_from", |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
453 store.state.application.refreshLayersTime.toISOString() |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
454 ), |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
455 greaterThanOrEqualTo( |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
456 "valid_to", |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
457 store.state.application.refreshLayersTime.toISOString() |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
458 ) |
4378
09406e3b052c
layers: only load fairwaydimensions with staging_done on map
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
459 ) |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
460 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
461 source, |
4261
ac99e13e9ca9
layers: BBox strategy for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4241
diff
changeset
|
462 false |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
463 ) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
464 ); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
465 return new VectorLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
466 id: "FAIRWAYDIMENSIONSLOS1", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
467 label: "LOS 1 Fairway Dimensions", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
468 visible: false, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
469 style: styles.fwd1, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
470 maxResolution: 80, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
471 minResolution: 0, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
472 source |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
473 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
474 })(), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
475 (function() { |
4261
ac99e13e9ca9
layers: BBox strategy for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4241
diff
changeset
|
476 const source = new VectorSource({ strategy: bboxStrategy }); |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
477 source.setLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
478 buildVectorLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
479 { |
4261
ac99e13e9ca9
layers: BBox strategy for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4241
diff
changeset
|
480 geometryName: "area", |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
481 featureTypes: ["fairway_dimensions"], |
4378
09406e3b052c
layers: only load fairwaydimensions with staging_done on map
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
482 filter: andFilter( |
09406e3b052c
layers: only load fairwaydimensions with staging_done on map
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
483 equalTo("level_of_service", 2), |
5146
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
484 equalTo("staging_done", true), |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
485 lessThanOrEqualTo( |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
486 "valid_from", |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
487 store.state.application.refreshLayersTime.toISOString() |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
488 ), |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
489 greaterThanOrEqualTo( |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
490 "valid_to", |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
491 store.state.application.refreshLayersTime.toISOString() |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
492 ) |
4378
09406e3b052c
layers: only load fairwaydimensions with staging_done on map
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
493 ) |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
494 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
495 source, |
4261
ac99e13e9ca9
layers: BBox strategy for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4241
diff
changeset
|
496 false |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
497 ) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
498 ); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
499 return new VectorLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
500 id: "FAIRWAYDIMENSIONSLOS2", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
501 label: "LOS 2 Fairway Dimensions", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
502 visible: false, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
503 style: styles.fwd2, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
504 maxResolution: 80, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
505 minResolution: 0, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
506 source |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
507 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
508 })(), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
509 (function() { |
4261
ac99e13e9ca9
layers: BBox strategy for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4241
diff
changeset
|
510 const source = new VectorSource({ strategy: bboxStrategy }); |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
511 source.setLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
512 buildVectorLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
513 { |
4261
ac99e13e9ca9
layers: BBox strategy for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4241
diff
changeset
|
514 geometryName: "area", |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
515 featureTypes: ["fairway_dimensions"], |
4378
09406e3b052c
layers: only load fairwaydimensions with staging_done on map
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
516 filter: andFilter( |
09406e3b052c
layers: only load fairwaydimensions with staging_done on map
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
517 equalTo("level_of_service", 3), |
5146
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
518 equalTo("staging_done", true), |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
519 lessThanOrEqualTo( |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
520 "valid_from", |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
521 store.state.application.refreshLayersTime.toISOString() |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
522 ), |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
523 greaterThanOrEqualTo( |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
524 "valid_to", |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
525 store.state.application.refreshLayersTime.toISOString() |
265265725277
timeslide for fairway_dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
5142
diff
changeset
|
526 ) |
4378
09406e3b052c
layers: only load fairwaydimensions with staging_done on map
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
527 ) |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
528 }, |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
529 source, |
4261
ac99e13e9ca9
layers: BBox strategy for fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4241
diff
changeset
|
530 false |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
531 ) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
532 ); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
533 return new VectorLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
534 id: "FAIRWAYDIMENSIONSLOS3", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
535 label: "LOS 3 Fairway Dimensions", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
536 visible: true, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
537 style: styles.fwd3, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
538 maxResolution: 80, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
539 minResolution: 0, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
540 source |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
541 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
542 })(), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
543 new ImageLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
544 id: "WATERWAYAXIS", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
545 label: "Waterway Axis", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
546 source: new ImageSource({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
547 url: window.location.origin + "/api/internal/wms", |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
548 params: { |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
549 LAYERS: "waterway_axis", |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
550 VERSION: "1.1.1", |
5087
d77dd0220780
client: Timebased request for waterway_axis
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5085
diff
changeset
|
551 TILED: true, |
d77dd0220780
client: Timebased request for waterway_axis
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5085
diff
changeset
|
552 TIME: store.state.application.refreshLayersTime.toISOString() |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
553 }, |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
554 imageLoadFunction: function(tile, src) { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
555 HTTP.get(src, { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
556 headers: { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
557 "X-Gemma-Auth": localStorage.getItem("token") |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
558 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
559 responseType: "blob" |
4867
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
560 }) |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
561 .then(response => { |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
562 tile.getImage().src = URL.createObjectURL(response.data); |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
563 }) |
5139
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
564 .catch(error => { |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
565 console.log(error); |
4867
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
566 store.dispatch("application/reportBackendError"); |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
567 }); |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
568 } // TODO tile.setState(TileState.ERROR); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
569 }) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
570 }), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
571 (function() { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
572 const source = new VectorSource({ strategy: bboxStrategy }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
573 source.setLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
574 buildVectorLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
575 { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
576 featureTypes: ["waterway_profiles"], |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
577 geometryName: "geom" |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
578 }, |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
579 source |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
580 ) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
581 ); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
582 return new VectorLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
583 id: "WATERWAYPROFILES", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
584 label: "Waterway Profiles", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
585 visible: true, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
586 style: new Style({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
587 stroke: new Stroke({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
588 color: "rgba(0, 0, 255, .5)", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
589 lineDash: [5, 5], |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
590 width: 2 |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
591 }) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
592 }), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
593 maxResolution: 2.5, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
594 minResolution: 0, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
595 source |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
596 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
597 })(), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
598 (function() { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
599 return new VectorLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
600 id: "BOTTLENECKSTATUS", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
601 label: "Critical Bottlenecks", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
602 forLegendStyle: { point: true, resolution: 16 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
603 visible: true, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
604 zIndex: 1, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
605 style: styles.bottleneckStatus, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
606 source: bottlenecksSource |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
607 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
608 })(), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
609 (function() { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
610 return new VectorLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
611 id: "BOTTLENECKFAIRWAYAVAILABILITY", |
4223
a76a6b26e327
client: improve layer label
Bernhard Reiter <bernhard@intevation.de>
parents:
4022
diff
changeset
|
612 label: "Bottleneck Fairway Availability", |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
613 forLegendStyle: { point: true, resolution: 16 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
614 visible: false, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
615 zIndex: 1, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
616 style: styles.bottleneckFairwayAvailability, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
617 source: bottlenecksSource |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
618 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
619 })(), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
620 (function() { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
621 const source = new VectorSource({ strategy: bboxStrategy }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
622 source.setLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
623 buildVectorLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
624 { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
625 featureTypes: [ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
626 "bottlenecks_geoserver", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
627 "gauges_geoserver", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
628 "stretches_geoserver", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
629 "sections_geoserver" |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
630 ] |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
631 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
632 source, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
633 true, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
634 // since we don't use bbox strategy, features will contain all features and we can use it |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
635 // to find reference gauges for bottlenecks, yeah! |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
636 async (f, store, features) => { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
637 // attach reference gauge to bottleneck |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
638 if (f.getId().indexOf("bottlenecks") > -1) { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
639 f.set( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
640 "gauge_obj", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
641 features.find(feat => { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
642 return ( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
643 feat.getId().indexOf("gauges") > -1 && |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
644 feat.get("objname") === f.get("gauge_objname") |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
645 ); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
646 }) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
647 ); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
648 } |
3507
a606d003730c
client: spuc12: implemented diagram for reference gauge of bottlenecks
Markus Kottlaender <markus@intevation.de>
parents:
3501
diff
changeset
|
649 |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
650 // attach nsc data to gauge |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
651 if (f.getId().indexOf("gauges") > -1) { |
4292
18a34d9b289c
data availability layer: loader uses new cache
Thomas Junk <thomas.junk@intevation.de>
parents:
4261
diff
changeset
|
652 store |
18a34d9b289c
data availability layer: loader uses new cache
Thomas Junk <thomas.junk@intevation.de>
parents:
4261
diff
changeset
|
653 .dispatch( |
18a34d9b289c
data availability layer: loader uses new cache
Thomas Junk <thomas.junk@intevation.de>
parents:
4261
diff
changeset
|
654 "gauges/getNashSutcliffeForISRS", |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
655 f.get("isrs_code") |
4292
18a34d9b289c
data availability layer: loader uses new cache
Thomas Junk <thomas.junk@intevation.de>
parents:
4261
diff
changeset
|
656 ) |
18a34d9b289c
data availability layer: loader uses new cache
Thomas Junk <thomas.junk@intevation.de>
parents:
4261
diff
changeset
|
657 .then(response => { |
18a34d9b289c
data availability layer: loader uses new cache
Thomas Junk <thomas.junk@intevation.de>
parents:
4261
diff
changeset
|
658 f.set("nsc_data", response); |
18a34d9b289c
data availability layer: loader uses new cache
Thomas Junk <thomas.junk@intevation.de>
parents:
4261
diff
changeset
|
659 }); |
3501
c5c7cc24fe72
client: spuc12: implemented nash sutcliffe for forcast vs reality accuracy indicator
Markus Kottlaender <markus@intevation.de>
parents:
3457
diff
changeset
|
660 } |
c5c7cc24fe72
client: spuc12: implemented nash sutcliffe for forcast vs reality accuracy indicator
Markus Kottlaender <markus@intevation.de>
parents:
3457
diff
changeset
|
661 } |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
662 ) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
663 ); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
664 return new VectorLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
665 id: "DATAAVAILABILITY", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
666 label: "Data Availability/Accuracy", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
667 forLegendStyle: { point: true, resolution: 16 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
668 visible: false, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
669 zIndex: 1, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
670 style: styles.dataAvailability, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
671 source |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
672 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
673 })(), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
674 new ImageLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
675 id: "DISTANCEMARKS", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
676 label: "Distance Marks", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
677 maxResolution: 10, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
678 minResolution: 0, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
679 source: new ImageSource({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
680 url: window.location.origin + "/api/internal/wms", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
681 params: { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
682 LAYERS: "distance_marks_ashore_geoserver", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
683 VERSION: "1.1.1", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
684 TILED: true |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
685 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
686 imageLoadFunction: function(tile, src) { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
687 HTTP.get(src, { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
688 headers: { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
689 "X-Gemma-Auth": localStorage.getItem("token") |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
690 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
691 responseType: "blob" |
4867
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
692 }) |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
693 .then(response => { |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
694 tile.getImage().src = URL.createObjectURL(response.data); |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
695 }) |
5139
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
696 .catch(error => { |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
697 console.log(error); |
4867
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
698 store.dispatch("application/reportBackendError"); |
5555b77b8c4e
report backenderror due to failing OL loaders
Thomas Junk <thomas.junk@intevation.de>
parents:
4600
diff
changeset
|
699 }); |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
700 } // TODO tile.setState(TileState.ERROR); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
701 }) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
702 }), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
703 new ImageLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
704 id: "DISTANCEMARKSAXIS", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
705 label: "Distance Marks, Axis", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
706 source: new ImageSource({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
707 url: window.location.origin + "/api/internal/wms", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
708 params: { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
709 LAYERS: "distance_marks_geoserver", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
710 VERSION: "1.1.1", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
711 TILED: true |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
712 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
713 imageLoadFunction: function(tile, src) { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
714 HTTP.get(src, { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
715 headers: { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
716 "X-Gemma-Auth": localStorage.getItem("token") |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
717 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
718 responseType: "blob" |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
719 }).then(response => { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
720 tile.getImage().src = URL.createObjectURL(response.data); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
721 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
722 } // TODO tile.setState(TileState.ERROR); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
723 }) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
724 }), |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
725 (function() { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
726 const source = new VectorSource({ strategy: bboxStrategy }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
727 source.setLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
728 buildVectorLoader( |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
729 { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
730 featureTypes: ["gauges_geoserver"], |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
731 geometryName: "geom" |
3081
9107c959bb3b
client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3075
diff
changeset
|
732 }, |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
733 source |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
734 ) |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
735 ); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
736 return new VectorLayer({ |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
737 id: "GAUGES", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
738 label: "Gauges", |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
739 forLegendStyle: { point: true, resolution: 8 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
740 visible: true, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
741 style: styles.gauge, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
742 maxResolution: 100, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
743 minResolution: 0, |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
744 source |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
745 }); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
746 })(), |
5159
e688e79a51e8
Use ImageLayer instead of TileLayer for FairwayMarks
Raimund Renkert <raimund@renkert.org>
parents:
5151
diff
changeset
|
747 new ImageLayer({ |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
748 id: "FAIRWAYMARKS", |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
749 label: "Fairway marks", |
4944
6256d1bca8f6
make fairwaymarks layer visible per default
Thomas Junk <thomas.junk@intevation.de>
parents:
4942
diff
changeset
|
750 visible: true, |
5159
e688e79a51e8
Use ImageLayer instead of TileLayer for FairwayMarks
Raimund Renkert <raimund@renkert.org>
parents:
5151
diff
changeset
|
751 source: new ImageSource({ |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
752 preload: 0, |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
753 projection: "EPSG:3857", |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
754 url: window.location.origin + "/api/internal/wms", |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
755 params: { |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
756 LAYERS: "fairway_marks", |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
757 VERSION: "1.1.1", |
5077
c9354fcf6050
add TIME-Filter to layer and GetFeatureInfo
Thomas Junk <thomas.junk@intevation.de>
parents:
5076
diff
changeset
|
758 TILED: true, |
5085
fe63733750d7
client: correct refresh layers request time
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5077
diff
changeset
|
759 TIME: store.state.application.refreshLayersTime.toISOString() |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
760 }, |
5159
e688e79a51e8
Use ImageLayer instead of TileLayer for FairwayMarks
Raimund Renkert <raimund@renkert.org>
parents:
5151
diff
changeset
|
761 imageLoadFunction: function(tile, src) { |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
762 HTTP.get(src, { |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
763 headers: { |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
764 "X-Gemma-Auth": localStorage.getItem("token") |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
765 }, |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
766 responseType: "blob" |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
767 }) |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
768 .then(response => { |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
769 tile.getImage().src = URL.createObjectURL(response.data); |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
770 }) |
5139
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
771 .catch(error => { |
8a7c39804d2f
layers: log errors additinally to console.
Thomas Junk <thomas.junk@intevation.de>
parents:
5087
diff
changeset
|
772 console.log(error); |
4942
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
773 store.dispatch("application/reportBackendError"); |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
774 }); |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
775 } // TODO tile.setState(TileState.ERROR); |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
776 }) |
c4d84be3a476
add fairwaymarks layer
Thomas Junk <thomas.junk@intevation.de>
parents:
4867
diff
changeset
|
777 }), |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
778 DRAWLAYER, |
4336
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4292
diff
changeset
|
779 CUTLAYER, |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
4292
diff
changeset
|
780 FDREVIEWLAYER |
3678
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
781 ]; |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
782 |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
783 layerConfigs[mapId] = config; |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
784 |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
785 return { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
786 get(id) { |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
787 return config.find(l => l.get("id") === id); |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
788 }, |
8f58851927c0
client: make layer factory only return new layer config for individual maps
Markus Kottlaender <markus@intevation.de>
parents:
3649
diff
changeset
|
789 config |
3011
fc8fbea24568
client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
790 }; |
3685
8775bea8042a
client: layers: unset layer config on logout
Markus Kottlaender <markus@intevation.de>
parents:
3678
diff
changeset
|
791 }; |