annotate client/src/components/map/layers.js @ 3212:f87fd173f750

client: waterlevel diagrams: fixed tooltip bug Bug was caused by selecting elements by css class instead of id (when multiple diagrams are displayed).
author Markus Kottlaender <markus@intevation.de>
date Thu, 09 May 2019 10:34:09 +0200
parents f0af359391a0
children d7bc51fd50b0
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 TileWMS from "ol/source/TileWMS";
3031
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
2 import {
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
3 Tile as TileLayer,
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
4 Vector as VectorLayer,
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
5 Image as ImageLayer
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
6 } from "ol/layer";
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
7 import { Icon, Stroke, Style } from "ol/style";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
8 import VectorSource from "ol/source/Vector";
3029
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
9 import { ImageWMS as ImageSource } from "ol/source";
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
10 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
11 import { bbox as bboxStrategy } from "ol/loadingstrategy";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
12 import { WFS, GeoJSON } from "ol/format";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
13 import { equalTo } from "ol/format/filter";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
14 import { HTTP } from "@/lib/http";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
15 import styles from "./styles";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
16
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
17 const buildVectorLoader = (
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
18 featureRequestOptions,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
19 vectorSource,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
20 bboxStrategyDisabled,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
21 featurePostProcessor
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
22 ) => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
23 // 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
24 // 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
25 // 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
26 // 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
27 // bboxStrategy (default) is used
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
28 featureRequestOptions.featureNS = "gemma";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
29 featureRequestOptions.featurePrefix = "gemma";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
30 featureRequestOptions.outputFormat = "application/json";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
31 return (extent, resolution, projection) => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
32 if (!bboxStrategyDisabled) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
33 featureRequestOptions.bbox = extent;
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 featureRequestOptions.srsName = projection.getCode();
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
36 HTTP.post(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
37 "/internal/wfs",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
38 new XMLSerializer().serializeToString(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
39 new WFS().writeGetFeature(featureRequestOptions)
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
40 ),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
41 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
42 headers: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
43 "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
44 "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
45 }
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 .then(response => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
49 const features = new GeoJSON().readFeatures(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
50 JSON.stringify(response.data)
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
51 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
52 if (featurePostProcessor) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
53 features.map(f => featurePostProcessor(f));
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
54 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
55 vectorSource.addFeatures(features);
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 .catch(() => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
58 vectorSource.removeLoadedExtent(extent);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
59 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
60 };
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
61 };
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
62
3123
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
63 // SHARED LAYERS:
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
64 // 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
65 // 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
66 // 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
67 // 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
68 const DRAWLAYER = new VectorLayer({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
69 id: "DRAWTOOL",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
70 label: "Draw Tool",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
71 visible: true,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
72 source: new VectorSource({ wrapX: false }),
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
73 style: function(feature) {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
74 // 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
75 var geometry = feature.getGeometry();
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
76 var styles = [
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
77 // linestring
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
78 new Style({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
79 stroke: new Stroke({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
80 color: "#369aca",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
81 width: 2
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
82 })
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
83 })
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
84 ];
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
85
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
86 if (geometry.getType() === "LineString") {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
87 geometry.forEachSegment(function(start, end) {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
88 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
89 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
90 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
91 // arrows
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
92 styles.push(
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
93 new Style({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
94 geometry: new Point(end),
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
95 image: new Icon({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
96 // 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
97 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
98 // 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
99 // 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
100 // 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
101 // 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
102 // precision
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
103 anchor: [0.75, 0.5],
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
104 rotateWithView: true,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
105 rotation: -rotation
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
106 })
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
107 })
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
108 );
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
109 });
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
110 }
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
111 return styles;
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
112 }
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
113 });
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 const CUTLAYER = new VectorLayer({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
116 id: "CUTTOOL",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
117 label: "Cut Tool",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
118 visible: true,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
119 source: new VectorSource({ wrapX: false }),
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
120 style: function(feature) {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
121 // 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
122 var geometry = feature.getGeometry();
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
123 var styles = [
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
124 // linestring
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 stroke: new Stroke({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
127 color: "#333333",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
128 width: 2,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
129 lineDash: [7, 7]
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
130 })
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
131 })
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
132 ];
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
133
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
134 if (geometry.getType() === "LineString") {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
135 geometry.forEachSegment(function(start, end) {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
136 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
137 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
138 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
139 // arrows
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
140 styles.push(
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
141 new Style({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
142 geometry: new Point(end),
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
143 image: new Icon({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
144 // 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
145 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
146 // 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
147 // 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
148 // 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
149 // 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
150 // precision
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
151 anchor: [0.75, 0.5],
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
152 rotateWithView: true,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
153 rotation: -rotation
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
154 })
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
155 })
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
156 );
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
157 });
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
158 }
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
159 return styles;
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
160 }
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
161 });
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
162
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
163 export default function() {
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
164 return {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
165 get(id) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
166 return this.config.find(l => l.get("id") === id);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
167 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
168 config: [
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
169 new ImageLayer({
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
170 id: "INLANDECDIS",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
171 label: "Inland ECDIS chart Danube",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
172 visible: true,
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
173 source: new ImageSource({
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
174 preload: 1,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
175 url: "https://service.d4d-portal.info/wms/",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
176 crossOrigin: "anonymous",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
177 params: { LAYERS: "d4d", VERSION: "1.1.1", TILED: true }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
178 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
179 }),
3047
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
180 new ImageLayer({
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
181 id: "WATERWAYAREA",
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
182 label: "Waterway Area",
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
183 maxResolution: 100,
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
184 minResolution: 0,
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
185 source: new ImageSource({
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
186 url: window.location.origin + "/api/internal/wms",
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
187 params: { LAYERS: "waterway_area", VERSION: "1.1.1", TILED: true },
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
188 imageLoadFunction: function(tile, src) {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
189 HTTP.get(src, {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
190 headers: {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
191 "X-Gemma-Auth": localStorage.getItem("token")
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
192 },
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
193 responseType: "blob"
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
194 }).then(response => {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
195 tile.getImage().src = URL.createObjectURL(response.data);
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
196 });
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
197 } // TODO tile.setState(TileState.ERROR);
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
198 })
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
199 }),
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
200 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
201 const source = new VectorSource({ strategy: bboxStrategy });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
202 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
203 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
204 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
205 featureTypes: ["stretches_geoserver"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
206 geometryName: "area"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
207 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
208 source,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
209 f => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
210 if (f.getId() === this.selectedStretchId) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
211 f.set("highlighted", true);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
212 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
213 return f;
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
214 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
215 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
216 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
217 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
218 id: "STRETCHES",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
219 label: "Stretches",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
220 visible: false,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
221 style: styles.stretches,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
222 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
223 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
224 })(),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
225 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
226 const source = new VectorSource();
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
227 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
228 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
229 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
230 featureTypes: ["fairway_dimensions"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
231 filter: equalTo("level_of_service", 1)
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
232 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
233 source,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
234 true
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
235 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
236 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
237 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
238 id: "FAIRWAYDIMENSIONSLOS1",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
239 label: "LOS 1 Fairway Dimensions",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
240 visible: false,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
241 style: styles.fwd1,
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
242 maxResolution: 80,
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
243 minResolution: 0,
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
244 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
245 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
246 })(),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
247 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
248 const source = new VectorSource();
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
249 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
250 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
251 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
252 featureTypes: ["fairway_dimensions"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
253 filter: equalTo("level_of_service", 2)
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
254 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
255 source,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
256 true
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
257 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
258 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
259 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
260 id: "FAIRWAYDIMENSIONSLOS2",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
261 label: "LOS 2 Fairway Dimensions",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
262 visible: false,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
263 style: styles.fwd2,
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
264 maxResolution: 80,
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
265 minResolution: 0,
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
266 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
267 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
268 })(),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
269 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
270 const source = new VectorSource();
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
271 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
272 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
273 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
274 featureTypes: ["fairway_dimensions"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
275 filter: equalTo("level_of_service", 3)
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
276 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
277 source,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
278 true
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
279 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
280 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
281 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
282 id: "FAIRWAYDIMENSIONSLOS3",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
283 label: "LOS 3 Fairway Dimensions",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
284 visible: true,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
285 style: styles.fwd3,
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
286 maxResolution: 80,
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
287 minResolution: 0,
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
288 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
289 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
290 })(),
3047
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
291 new ImageLayer({
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
292 id: "WATERWAYAXIS",
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
293 label: "Waterway Axis",
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
294 source: new ImageSource({
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
295 url: window.location.origin + "/api/internal/wms",
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
296 params: { LAYERS: "waterway_axis", VERSION: "1.1.1", TILED: true },
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
297 imageLoadFunction: function(tile, src) {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
298 HTTP.get(src, {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
299 headers: {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
300 "X-Gemma-Auth": localStorage.getItem("token")
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
301 },
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
302 responseType: "blob"
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
303 }).then(response => {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
304 tile.getImage().src = URL.createObjectURL(response.data);
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
305 });
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
306 } // TODO tile.setState(TileState.ERROR);
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
307 })
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
308 }),
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
309 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
310 const source = new VectorSource({ strategy: bboxStrategy });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
311 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
312 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
313 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
314 featureTypes: ["waterway_profiles"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
315 geometryName: "geom"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
316 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
317 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
318 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
319 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
320 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
321 id: "WATERWAYPROFILES",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
322 label: "Waterway Profiles",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
323 visible: true,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
324 style: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
325 stroke: new Stroke({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
326 color: "rgba(0, 0, 255, .5)",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
327 lineDash: [5, 5],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
328 width: 2
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
329 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
330 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
331 maxResolution: 2.5,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
332 minResolution: 0,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
333 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
334 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
335 })(),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
336 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
337 const source = new VectorSource({ strategy: bboxStrategy });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
338 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
339 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
340 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
341 featureTypes: ["bottlenecks_geoserver"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
342 geometryName: "area"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
343 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
344 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
345 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
346 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
347 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
348 id: "BOTTLENECKS",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
349 label: "Bottlenecks",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
350 visible: true,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
351 style: styles.bottleneck,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
352 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
353 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
354 })(),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
355 new TileLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
356 id: "BOTTLENECKISOLINE",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
357 label: "Bottleneck isolines",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
358 visible: false,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
359 source: new TileWMS({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
360 preload: 0,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
361 projection: "EPSG:3857",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
362 url: window.location.origin + "/api/internal/wms",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
363 params: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
364 LAYERS: "sounding_results_contour_lines_geoserver",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
365 VERSION: "1.1.1",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
366 TILED: true
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
367 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
368 tileLoadFunction: function(tile, src) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
369 // console.log("calling for", tile, src);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
370 HTTP.get(src, {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
371 headers: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
372 "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
373 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
374 responseType: "blob"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
375 }).then(response => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
376 tile.getImage().src = URL.createObjectURL(response.data);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
377 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
378 } // TODO tile.setState(TileState.ERROR);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
379 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
380 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
381 new TileLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
382 id: "DIFFERENCES",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
383 label: "Bottleneck Differences",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
384 visible: false,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
385 source: new TileWMS({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
386 preload: 0,
3075
3cf7189fa93e Changed projection for sounding differences layer. Fixes font size.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3073
diff changeset
387 projection: "EPSG:3857",
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
388 url: window.location.origin + "/api/internal/wms",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
389 params: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
390 LAYERS: "sounding_differences",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
391 VERSION: "1.1.1",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
392 TILED: true
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
393 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
394 tileLoadFunction: function(tile, src) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
395 // console.log("calling for", tile, src);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
396 HTTP.get(src, {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
397 headers: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
398 "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
399 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
400 responseType: "blob"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
401 }).then(response => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
402 tile.getImage().src = URL.createObjectURL(response.data);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
403 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
404 } // TODO tile.setState(TileState.ERROR);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
405 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
406 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
407 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
408 const source = new VectorSource({ strategy: bboxStrategy });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
409 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
410 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
411 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
412 featureTypes: ["bottlenecks_geoserver"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
413 geometryName: "area"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
414 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
415 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
416 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
417 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
418 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
419 id: "BOTTLENECKSTATUS",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
420 label: "Critical Bottlenecks",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
421 forLegendStyle: { point: true, resolution: 16 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
422 visible: true,
3073
0cb180676722 client: map layers: changed z-index of critical bottleneck layer to be always on top
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
423 zIndex: 1,
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
424 style: styles.bottleneckStatus,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
425 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
426 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
427 })(),
3081
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
428 new ImageLayer({
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
429 id: "DISTANCEMARKS",
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
430 label: "Distance Marks",
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
431 maxResolution: 10,
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
432 minResolution: 0,
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
433 source: new ImageSource({
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
434 url: window.location.origin + "/api/internal/wms",
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
435 params: {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
436 LAYERS: "distance_marks_ashore_geoserver",
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
437 VERSION: "1.1.1",
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
438 TILED: true
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
439 },
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
440 imageLoadFunction: function(tile, src) {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
441 HTTP.get(src, {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
442 headers: {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
443 "X-Gemma-Auth": localStorage.getItem("token")
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
444 },
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
445 responseType: "blob"
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
446 }).then(response => {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
447 tile.getImage().src = URL.createObjectURL(response.data);
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
448 });
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
449 } // TODO tile.setState(TileState.ERROR);
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
450 })
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
451 }),
3029
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
452 new ImageLayer({
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
453 id: "DISTANCEMARKSAXIS",
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
454 label: "Distance Marks, Axis",
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
455 source: new ImageSource({
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
456 url: window.location.origin + "/api/internal/wms",
3031
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
457 params: {
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
458 LAYERS: "distance_marks_geoserver",
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
459 VERSION: "1.1.1",
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
460 TILED: true
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
461 },
3029
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
462 imageLoadFunction: function(tile, src) {
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
463 HTTP.get(src, {
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
464 headers: {
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
465 "X-Gemma-Auth": localStorage.getItem("token")
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
466 },
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
467 responseType: "blob"
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
468 }).then(response => {
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
469 tile.getImage().src = URL.createObjectURL(response.data);
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
470 });
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
471 } // TODO tile.setState(TileState.ERROR);
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
472 })
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
473 }),
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
474 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
475 const source = new VectorSource({ strategy: bboxStrategy });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
476 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
477 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
478 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
479 featureTypes: ["gauges_geoserver"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
480 geometryName: "geom"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
481 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
482 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
483 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
484 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
485 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
486 id: "GAUGES",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
487 label: "Gauges",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
488 forLegendStyle: { point: true, resolution: 8 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
489 visible: true,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
490 style: styles.gauge,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
491 maxResolution: 100,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
492 minResolution: 0,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
493 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
494 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
495 })(),
3123
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
496 DRAWLAYER,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
497 CUTLAYER
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
498 ]
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
499 };
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
500 }