annotate client/src/components/map/styles.js @ 3678:8f58851927c0

client: make layer factory only return new layer config for individual maps instead of each time it is invoked. The purpose of the factory was to support multiple maps with individual layers. But returning a new config each time it is invoked leads to bugs that rely on the layer's state. Now this factory reuses the same objects it created before, per map.
author Markus Kottlaender <markus@intevation.de>
date Mon, 17 Jun 2019 17:31:35 +0200
parents 9e296d686f16
children 1525ead37a2e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
1 import { Icon, Stroke, Style, Fill, Text, Circle } from "ol/style";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
2 import Point from "ol/geom/Point";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
3 import { getCenter } from "ol/extent";
3434
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
4 import store from "@/store/index";
3472
71022e6bd98e client: Use classifications for bottleneck diagrams on map and extracted classification algos
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3457
diff changeset
5 import classifications from "../../lib/classifications";
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
6
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
7 const styles = {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
8 blue1: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
9 stroke: new Stroke({
3571
9e296d686f16 client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents: 3548
diff changeset
10 color: [0, 0, 255, 0.8],
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
11 lineDash: [2, 4],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
12 lineCap: "round",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
13 width: 2
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
14 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
15 fill: new Fill({
3571
9e296d686f16 client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents: 3548
diff changeset
16 color: [240, 230, 0, 0.2]
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
17 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
18 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
19 blue2: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
20 stroke: new Stroke({
3571
9e296d686f16 client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents: 3548
diff changeset
21 color: [0, 0, 255, 0.9],
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
22 lineDash: [3, 6],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
23 lineCap: "round",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
24 width: 2
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
25 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
26 fill: new Fill({
3571
9e296d686f16 client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents: 3548
diff changeset
27 color: [240, 230, 0, 0.1]
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
28 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
29 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
30 blue3: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
31 stroke: new Stroke({
3571
9e296d686f16 client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents: 3548
diff changeset
32 color: [0, 0, 255, 1.0],
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
33 width: 2
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
34 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
35 fill: new Fill({
3571
9e296d686f16 client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents: 3548
diff changeset
36 color: [255, 255, 255, 0.4]
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
37 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
38 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
39 yellow1: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
40 stroke: new Stroke({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
41 color: "rgba(230, 230, 10, .8)",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
42 width: 4
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
43 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
44 fill: new Fill({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
45 color: "rgba(230, 230, 10, .3)"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
46 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
47 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
48 yellow2: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
49 stroke: new Stroke({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
50 color: "rgba(250, 200, 0, .8)",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
51 width: 2
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
52 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
53 fill: new Fill({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
54 color: "rgba(250, 200, 10, .3)"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
55 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
56 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
57 yellow3: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
58 stroke: new Stroke({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
59 color: "rgba(250, 240, 10, .9)",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
60 width: 5
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
61 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
62 fill: new Fill({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
63 color: "rgba(250, 240, 0, .7)"
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 }),
3309
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
66 orange1: new Style({
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
67 stroke: new Stroke({
3312
00548f0e81c3 client: sections layer: adjusted colors
Markus Kottlaender <markus@intevation.de>
parents: 3309
diff changeset
68 color: "rgba(255, 150, 10, .8)",
3309
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
69 width: 2
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
70 }),
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
71 fill: new Fill({
3312
00548f0e81c3 client: sections layer: adjusted colors
Markus Kottlaender <markus@intevation.de>
parents: 3309
diff changeset
72 color: "rgba(255, 150, 0, .3)"
3309
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
73 })
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
74 }),
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
75 orange2: new Style({
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
76 stroke: new Stroke({
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
77 color: "rgba(255, 166, 10, .9)",
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
78 width: 5
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
79 }),
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
80 fill: new Fill({
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
81 color: "rgba(255, 166, 0, .7)"
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
82 })
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
83 }),
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
84 red1: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
85 stroke: new Stroke({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
86 color: "rgba(255, 0, 0, 1)",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
87 width: 4
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
88 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
89 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
90 circleBlue: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
91 image: new Circle({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
92 radius: 5,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
93 fill: new Fill({ color: "rgba(255, 0, 0, 0.1)" }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
94 stroke: new Stroke({ color: "blue", width: 1 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
95 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
96 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
97 textFW1: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
98 text: new Text({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
99 font: 'bold 12px "Open Sans", "sans-serif"',
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
100 placement: "line",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
101 fill: new Fill({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
102 color: "black"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
103 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
104 text: "LOS: 1"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
105 //, zIndex: 10
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
106 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
107 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
108 textFW2: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
109 text: new Text({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
110 font: 'bold 12px "Open Sans", "sans-serif"',
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
111 placement: "line",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
112 fill: new Fill({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
113 color: "black"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
114 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
115 text: "LOS: 2"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
116 //, zIndex: 10
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
117 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
118 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
119 textFW3: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
120 text: new Text({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
121 font: 'bold 12px "Open Sans", "sans-serif"',
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
122 placement: "line",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
123 fill: new Fill({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
124 color: "black"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
125 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
126 text: "LOS: 3"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
127 //, zIndex: 10
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
128 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
129 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
130 };
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
131
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: 3516
diff changeset
132 export default function(mapId) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
133 return {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
134 stretches(feature) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
135 let style = styles.yellow2;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
136 if (feature.get("highlighted")) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
137 style = styles.yellow3;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
138 }
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
139 return style;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
140 },
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
141 sections(feature) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
142 let style = styles.orange1;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
143 if (feature.get("highlighted")) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
144 style = styles.orange2;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
145 }
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
146 return style;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
147 },
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
148 fwd1() {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
149 return [styles.blue1, styles.textFW1];
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
150 },
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
151 fwd2() {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
152 return [styles.blue2, styles.textFW2];
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
153 },
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
154 fwd3() {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
155 return [styles.blue3, styles.textFW3];
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
156 },
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
157 bottleneck() {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
158 return styles.yellow1;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
159 },
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
160 bottleneckStatus(feature, resolution, isLegend) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
161 let s = [];
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
162 if ((feature.get("fa_critical") && resolution > 15) || isLegend) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
163 let bnCenter = getCenter(feature.getGeometry().getExtent());
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
164 s.push(
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
165 new Style({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
166 geometry: new Point(bnCenter),
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
167 image: new Icon({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
168 src: require("@/assets/marker-bottleneck-critical.png"),
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
169 anchor: [0.5, 0.5],
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
170 scale: isLegend ? 0.5 : 1
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
171 })
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
172 })
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: 3516
diff changeset
173 );
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
174 }
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
175 if (feature.get("fa_critical") && !isLegend) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
176 s.push(styles.red1);
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
177 }
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
178 return s;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
179 },
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
180 bottleneckFairwayAvailability(feature, resolution, isLegend) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
181 let s = [];
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
182 if (isLegend) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
183 s.push(
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
184 new Style({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
185 image: new Icon({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
186 src: require("@/assets/fa-diagram.png"),
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
187 anchor: [0.5, 0.5],
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
188 scale: 1
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
189 })
3335
59db0b5921c5 client: added layer for fairway availability diagrams with demo diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3312
diff changeset
190 })
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: 3516
diff changeset
191 );
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
192 }
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
193 if (
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
194 feature.get("fa_critical") &&
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
195 feature.get("fa_data") &&
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
196 resolution > 15
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
197 ) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
198 let data = feature.get("fa_data");
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
199 let lnwlHeight = (80 / 100) * data.ldc;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
200 let belowThresholdHeight = (80 / 100) * data.below;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
201 let betweenThresholdHeight = (80 / 100) * data.between;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
202 let aboveThresholdHeight = (80 / 100) * data.above;
3433
e56b280582ae client: spuc05: use real data for diagrams on map
Markus Kottlaender <markus@intevation.de>
parents: 3390
diff changeset
203
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: 3516
diff changeset
204 let frame = `<rect x='0' y='0' width='32' height='84' stroke-width='0' fill='white'/>`;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
205 let lnwl = `<rect x='2' y='${80 -
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
206 lnwlHeight +
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
207 2}' width='10' height='${lnwlHeight}' stroke-width='0' fill='aqua'/>`;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
208 let range1 = `<rect x='12' y='2' width='18' height='${belowThresholdHeight}' stroke-width='0' fill='hotpink'/>`;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
209 let range2 = `<rect x='12' y='${belowThresholdHeight +
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
210 2}' width='18' height='${betweenThresholdHeight}' stroke-width='0' fill='darksalmon'/>`;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
211 let range3 = `<rect x='12' y='${80 -
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
212 aboveThresholdHeight +
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
213 2}' width='18' height='${aboveThresholdHeight}' stroke-width='0' fill='blue'/>`;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
214 let svg = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='84'><g>${frame}${lnwl}${range1}${range2}${range3}</g></svg>`;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
215 let bnCenter = getCenter(feature.getGeometry().getExtent());
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
216 s.push(
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
217 new Style({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
218 geometry: new Point(bnCenter),
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
219 image: new Icon({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
220 src: svg,
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
221 anchor: [1.2, 1.2]
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
222 })
3335
59db0b5921c5 client: added layer for fairway availability diagrams with demo diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3312
diff changeset
223 })
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: 3516
diff changeset
224 );
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
225 }
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
226 return s;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
227 },
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
228 dataAvailability(feature, resolution, isLegend) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
229 let s = [];
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
230 if (isLegend) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
231 s.push(
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
232 new Style({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
233 image: new Icon({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
234 src: require("@/assets/da-diagram.png"),
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
235 anchor: [0.5, 0.5],
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
236 scale: 1
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
237 })
3434
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
238 })
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: 3516
diff changeset
239 );
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
240 } else {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
241 // TODO: Get information from feature and check the ranges according to #423, #424, #425
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
242 let colorWaterlevel = classifications.gmAvailability(feature);
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
243 let colorComparison = classifications.forecastVsReality(feature);
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
244 let colorAccuracy = classifications.forecastAccuracy(feature);
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
245 let map = store.getters["map/openLayersMap"](mapId);
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
246 let geom = feature.getGeometry();
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
247 if (!(geom instanceof Point)) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
248 geom = new Point(getCenter(feature.getGeometry().getExtent()));
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
249 }
3516
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
250 if (
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: 3516
diff changeset
251 (map.getLayer("BOTTLENECKS").getVisible() &&
3516
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
252 feature.getId().indexOf("bottlenecks") > -1) ||
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: 3516
diff changeset
253 (map.getLayer("SECTIONS").getVisible() &&
3516
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
254 feature.getId().indexOf("sections") > -1) ||
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: 3516
diff changeset
255 (map.getLayer("STRETCHES").getVisible() &&
3516
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
256 feature.getId().indexOf("stretches") > -1) ||
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: 3516
diff changeset
257 (map.getLayer("GAUGES").getVisible() &&
3516
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
258 feature.getId().indexOf("gauges") > -1)
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
259 ) {
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
260 let frame = `<polyline points='16,0 32,32 0,32 16,0' stroke='grey' stroke-width='1' fill='white'/>`;
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
261 let waterlevel = `<polyline points="16,0 24,16 16,32 8,16 16,0" stroke='grey' stroke-width='1' fill='${colorWaterlevel}'/>`;
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
262 let accuracy = `<polyline points="24,16 32,32 16,32 24,16" stroke='grey' stroke-width='1' fill='${colorAccuracy}'/>`;
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
263 let comparison = `<polyline points="8,16 16,32 0,32 8,16" stroke='grey' stroke-width='1' fill='${colorComparison}'/>`;
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
264 let svg = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><g>${frame}${waterlevel}${comparison}${accuracy}</g></svg>`;
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
265 s.push(
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
266 new Style({
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
267 geometry: geom,
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
268 image: new Icon({
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
269 src: svg,
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
270 anchor: [-0.5, 1]
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
271 })
3448
d0278e7399fb client: data accuracy: use single color for bottlenecks in diagram.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3444
diff changeset
272 })
3516
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
273 );
6cdfc05fd6b0 client: data accuracy layer: show only diagrams for layers that are active
Markus Kottlaender <markus@intevation.de>
parents: 3507
diff changeset
274 }
3507
a606d003730c client: spuc12: implemented diagram for reference gauge of bottlenecks
Markus Kottlaender <markus@intevation.de>
parents: 3501
diff changeset
275
3448
d0278e7399fb client: data accuracy: use single color for bottlenecks in diagram.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3444
diff changeset
276 if (
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: 3516
diff changeset
277 map.getLayer("BOTTLENECKS").getVisible() &&
3448
d0278e7399fb client: data accuracy: use single color for bottlenecks in diagram.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3444
diff changeset
278 feature.getId().indexOf("bottlenecks") > -1
d0278e7399fb client: data accuracy: use single color for bottlenecks in diagram.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3444
diff changeset
279 ) {
3507
a606d003730c client: spuc12: implemented diagram for reference gauge of bottlenecks
Markus Kottlaender <markus@intevation.de>
parents: 3501
diff changeset
280 let colorUniformTriangle = classifications.surveyCurrency(feature);
3472
71022e6bd98e client: Use classifications for bottleneck diagrams on map and extracted classification algos
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3457
diff changeset
281 let frame = `<polyline points='16,0 32,32 0,32 16,0' stroke='grey' stroke-width='1' fill='${colorUniformTriangle}'/>`;
3448
d0278e7399fb client: data accuracy: use single color for bottlenecks in diagram.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3444
diff changeset
282 let svg = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><g>${frame}</g></svg>`;
3434
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
283 s.push(
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
284 new Style({
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
285 geometry: geom,
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
286 image: new Icon({
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
287 src: svg,
3507
a606d003730c client: spuc12: implemented diagram for reference gauge of bottlenecks
Markus Kottlaender <markus@intevation.de>
parents: 3501
diff changeset
288 anchor: [0.5, 1]
3434
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
289 })
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
290 })
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
291 );
9fba1be118e7 client: data accuracy: Show diagrams for gauges, bottlenecks and stretches on map.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3433
diff changeset
292 }
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: 3516
diff changeset
293 }
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
294 return s;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
295 },
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
296 dma(feature, resolution) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
297 if (resolution < 10) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
298 var s = styles.circleBlue;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
299 if (resolution < 6) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
300 s.setText(
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
301 new Text({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
302 offsetY: 12,
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
303 font: '10px "Open Sans", "sans-serif"',
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
304 fill: new Fill({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
305 color: "black"
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
306 }),
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
307 text: (feature.get("hectometre") / 10).toString()
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
308 })
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
309 );
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
310 }
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
311 return s;
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
312 }
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
313 return [];
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
314 },
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
315 gauge(feature, resolution, isLegend) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
316 let waterlevel = feature.get("gm_waterlevel");
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
317 let text = feature.get("objname");
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
318 let iconColor = "white";
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
319 if (waterlevel) {
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
320 text += "\n(" + waterlevel + " cm)";
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
321 let refWaterlevels = JSON.parse(feature.get("reference_water_levels"));
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
322 if (waterlevel < refWaterlevels.LDC) iconColor = "brown";
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
323 if (waterlevel > refWaterlevels.LDC && waterlevel < refWaterlevels.HDC)
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
324 iconColor = "blue";
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
325 if (waterlevel > refWaterlevels.HDC) iconColor = "red";
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
326 }
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
327
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
328 return [
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
329 new Style({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
330 image: new Icon({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
331 src: require("@/assets/marker-gauge-" + iconColor + ".png"),
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
332 anchor: [0.5, isLegend ? 0.5 : 1],
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
333 scale: isLegend ? 0.5 : 1
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
334 }),
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
335 text: new Text({
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
336 font: '10px "Open Sans", "sans-serif"',
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: 3516
diff changeset
337 offsetY: 15,
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
338 fill: new Fill({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
339 color: "black"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
340 }),
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: 3516
diff changeset
341 backgroundFill: new Fill({
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
342 color: "rgba(255, 255, 255, 0.7)"
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
343 }),
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
344 padding: [2, 2, 2, 2],
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
345 text
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
346 })
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: 3516
diff changeset
347 })
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
348 ];
3364
b62b9d5ce06d client: gauges on map: display latest waterlevel and colored icons depending on waterlevel
Markus Kottlaender <markus@intevation.de>
parents: 3338
diff changeset
349 }
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: 3516
diff changeset
350 };
f3102fa16a69 client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps
Markus Kottlaender <markus@intevation.de>
parents: 3516
diff changeset
351 }