annotate client/src/components/map/layers.js @ 3309:80037790032d

client: fully implemented sections - added map layer with new style - implemented in identify tool, map popup and fairway availability dialog - added sidebar menu item
author Markus Kottlaender <markus@intevation.de>
date Fri, 17 May 2019 12:45:13 +0200
parents b74e9768231d
children 59db0b5921c5
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";
3270
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3123
diff changeset
13 import OSM from "ol/source/OSM";
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
14 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
15 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
16 import styles from "./styles";
3271
b74e9768231d client: map layers: added support for vuex store in layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
17 import store from "@/store/index";
3011
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 const buildVectorLoader = (
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
20 featureRequestOptions,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
21 vectorSource,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
22 bboxStrategyDisabled,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
23 featurePostProcessor
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
24 ) => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
25 // 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
26 // 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
27 // 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
28 // 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
29 // bboxStrategy (default) is used
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
30 featureRequestOptions.featureNS = "gemma";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
31 featureRequestOptions.featurePrefix = "gemma";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
32 featureRequestOptions.outputFormat = "application/json";
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
33 return (extent, resolution, projection) => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
34 if (!bboxStrategyDisabled) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
35 featureRequestOptions.bbox = extent;
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
36 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
37 featureRequestOptions.srsName = projection.getCode();
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
38 HTTP.post(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
39 "/internal/wfs",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
40 new XMLSerializer().serializeToString(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
41 new WFS().writeGetFeature(featureRequestOptions)
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
42 ),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
43 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
44 headers: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
45 "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
46 "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
47 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
48 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
49 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
50 .then(response => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
51 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
52 JSON.stringify(response.data)
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
53 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
54 if (featurePostProcessor) {
3271
b74e9768231d client: map layers: added support for vuex store in layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
55 features.map(f => featurePostProcessor(f, store));
3011
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 vectorSource.addFeatures(features);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
58 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
59 .catch(() => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
60 vectorSource.removeLoadedExtent(extent);
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 };
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
63 };
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
64
3123
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
65 // SHARED LAYERS:
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
66 // 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
67 // 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
68 // 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
69 // 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
70 const DRAWLAYER = new VectorLayer({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
71 id: "DRAWTOOL",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
72 label: "Draw Tool",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
73 visible: true,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
74 source: new VectorSource({ wrapX: false }),
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
75 style: function(feature) {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
76 // 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
77 var geometry = feature.getGeometry();
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
78 var styles = [
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
79 // linestring
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
80 new Style({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
81 stroke: new Stroke({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
82 color: "#369aca",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
83 width: 2
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 ];
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
87
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
88 if (geometry.getType() === "LineString") {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
89 geometry.forEachSegment(function(start, end) {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
90 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
91 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
92 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
93 // arrows
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
94 styles.push(
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
95 new Style({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
96 geometry: new Point(end),
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
97 image: new Icon({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
98 // 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
99 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
100 // 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
101 // 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
102 // 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
103 // 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
104 // precision
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
105 anchor: [0.75, 0.5],
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
106 rotateWithView: true,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
107 rotation: -rotation
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 });
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 return styles;
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
114 }
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
115 });
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
116
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
117 const CUTLAYER = new VectorLayer({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
118 id: "CUTTOOL",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
119 label: "Cut Tool",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
120 visible: true,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
121 source: new VectorSource({ wrapX: false }),
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
122 style: function(feature) {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
123 // 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
124 var geometry = feature.getGeometry();
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
125 var styles = [
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
126 // linestring
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
127 new Style({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
128 stroke: new Stroke({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
129 color: "#333333",
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
130 width: 2,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
131 lineDash: [7, 7]
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 ];
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
135
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
136 if (geometry.getType() === "LineString") {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
137 geometry.forEachSegment(function(start, end) {
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
138 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
139 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
140 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
141 // arrows
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
142 styles.push(
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
143 new Style({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
144 geometry: new Point(end),
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
145 image: new Icon({
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
146 // 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
147 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
148 // 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
149 // 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
150 // 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
151 // 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
152 // precision
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
153 anchor: [0.75, 0.5],
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
154 rotateWithView: true,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
155 rotation: -rotation
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 });
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 return styles;
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
162 }
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
163 });
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
164
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
165 export default function() {
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
166 return {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
167 get(id) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
168 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
169 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
170 config: [
3270
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3123
diff changeset
171 new TileLayer({
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3123
diff changeset
172 id: "OPENSTREETMAP",
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3123
diff changeset
173 label: "Open Streetmap",
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3123
diff changeset
174 visible: true,
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3123
diff changeset
175 source: new OSM()
d7bc51fd50b0 client: map layers: integrated osm layer into main layer configuration file
Markus Kottlaender <markus@intevation.de>
parents: 3123
diff changeset
176 }),
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
177 new ImageLayer({
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
178 id: "INLANDECDIS",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
179 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
180 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
181 source: new ImageSource({
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
182 preload: 1,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
183 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
184 crossOrigin: "anonymous",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
185 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
186 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
187 }),
3047
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
188 new ImageLayer({
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
189 id: "WATERWAYAREA",
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
190 label: "Waterway Area",
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
191 maxResolution: 100,
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
192 minResolution: 0,
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
193 source: new ImageSource({
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
194 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
195 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
196 imageLoadFunction: function(tile, src) {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
197 HTTP.get(src, {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
198 headers: {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
199 "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
200 },
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
201 responseType: "blob"
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
202 }).then(response => {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
203 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
204 });
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
205 } // TODO tile.setState(TileState.ERROR);
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
206 })
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
207 }),
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
208 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
209 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
210 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
211 buildVectorLoader(
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 featureTypes: ["stretches_geoserver"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
214 geometryName: "area"
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 source,
3271
b74e9768231d client: map layers: added support for vuex store in layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
217 true,
b74e9768231d client: map layers: added support for vuex store in layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
218 (f, store) => {
b74e9768231d client: map layers: added support for vuex store in layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 3270
diff changeset
219 if (f.getId() === store.state.imports.selectedStretchId) {
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
220 f.set("highlighted", true);
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
221 }
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
222 return f;
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 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
226 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
227 id: "STRETCHES",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
228 label: "Stretches",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
229 visible: false,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
230 style: styles.stretches,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
231 source
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 })(),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
234 (function() {
3309
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
235 const source = new VectorSource({ strategy: bboxStrategy });
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
236 source.setLoader(
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
237 buildVectorLoader(
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
238 {
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
239 featureTypes: ["sections_geoserver"],
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
240 geometryName: "area"
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
241 },
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
242 source,
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
243 true,
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
244 (f, store) => {
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
245 if (f.getId() === store.state.imports.selectedSectionId) {
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
246 f.set("highlighted", true);
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
247 }
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
248 return f;
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
249 }
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
250 )
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
251 );
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
252 return new VectorLayer({
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
253 id: "SECTIONS",
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
254 label: "Sections",
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
255 visible: false,
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
256 style: styles.sections,
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
257 source
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
258 });
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
259 })(),
80037790032d client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents: 3271
diff changeset
260 (function() {
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
261 const source = new VectorSource();
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
262 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
263 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
264 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
265 featureTypes: ["fairway_dimensions"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
266 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
267 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
268 source,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
269 true
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
270 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
271 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
272 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
273 id: "FAIRWAYDIMENSIONSLOS1",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
274 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
275 visible: false,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
276 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
277 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
278 minResolution: 0,
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
279 source
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 })(),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
282 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
283 const source = new VectorSource();
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
284 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
285 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
286 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
287 featureTypes: ["fairway_dimensions"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
288 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
289 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
290 source,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
291 true
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
292 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
293 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
294 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
295 id: "FAIRWAYDIMENSIONSLOS2",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
296 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
297 visible: false,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
298 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
299 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
300 minResolution: 0,
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
301 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
302 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
303 })(),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
304 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
305 const source = new VectorSource();
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
306 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
307 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
308 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
309 featureTypes: ["fairway_dimensions"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
310 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
311 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
312 source,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
313 true
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
314 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
315 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
316 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
317 id: "FAIRWAYDIMENSIONSLOS3",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
318 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
319 visible: true,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
320 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
321 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
322 minResolution: 0,
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
323 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
324 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
325 })(),
3047
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
326 new ImageLayer({
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
327 id: "WATERWAYAXIS",
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
328 label: "Waterway Axis",
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
329 source: new ImageSource({
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
330 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
331 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
332 imageLoadFunction: function(tile, src) {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
333 HTTP.get(src, {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
334 headers: {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
335 "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
336 },
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
337 responseType: "blob"
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
338 }).then(response => {
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
339 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
340 });
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
341 } // TODO tile.setState(TileState.ERROR);
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
342 })
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3031
diff changeset
343 }),
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
344 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
345 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
346 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
347 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
348 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
349 featureTypes: ["waterway_profiles"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
350 geometryName: "geom"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
351 },
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 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
356 id: "WATERWAYPROFILES",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
357 label: "Waterway Profiles",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
358 visible: true,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
359 style: new Style({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
360 stroke: new Stroke({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
361 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
362 lineDash: [5, 5],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
363 width: 2
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
364 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
365 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
366 maxResolution: 2.5,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
367 minResolution: 0,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
368 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
369 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
370 })(),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
371 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
372 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
373 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
374 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
375 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
376 featureTypes: ["bottlenecks_geoserver"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
377 geometryName: "area"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
378 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
379 source
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 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
382 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
383 id: "BOTTLENECKS",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
384 label: "Bottlenecks",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
385 visible: true,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
386 style: styles.bottleneck,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
387 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
388 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
389 })(),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
390 new TileLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
391 id: "BOTTLENECKISOLINE",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
392 label: "Bottleneck isolines",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
393 visible: false,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
394 source: new TileWMS({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
395 preload: 0,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
396 projection: "EPSG:3857",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
397 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
398 params: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
399 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
400 VERSION: "1.1.1",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
401 TILED: true
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
402 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
403 tileLoadFunction: function(tile, src) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
404 // 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
405 HTTP.get(src, {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
406 headers: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
407 "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
408 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
409 responseType: "blob"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
410 }).then(response => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
411 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
412 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
413 } // 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
414 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
415 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
416 new TileLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
417 id: "DIFFERENCES",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
418 label: "Bottleneck Differences",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
419 visible: false,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
420 source: new TileWMS({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
421 preload: 0,
3075
3cf7189fa93e Changed projection for sounding differences layer. Fixes font size.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3073
diff changeset
422 projection: "EPSG:3857",
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
423 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
424 params: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
425 LAYERS: "sounding_differences",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
426 VERSION: "1.1.1",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
427 TILED: true
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
428 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
429 tileLoadFunction: function(tile, src) {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
430 // 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
431 HTTP.get(src, {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
432 headers: {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
433 "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
434 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
435 responseType: "blob"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
436 }).then(response => {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
437 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
438 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
439 } // 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
440 })
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
441 }),
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
442 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
443 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
444 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
445 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
446 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
447 featureTypes: ["bottlenecks_geoserver"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
448 geometryName: "area"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
449 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
450 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
451 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
452 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
453 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
454 id: "BOTTLENECKSTATUS",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
455 label: "Critical Bottlenecks",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
456 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
457 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
458 zIndex: 1,
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
459 style: styles.bottleneckStatus,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
460 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
461 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
462 })(),
3081
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
463 new ImageLayer({
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
464 id: "DISTANCEMARKS",
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
465 label: "Distance Marks",
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
466 maxResolution: 10,
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
467 minResolution: 0,
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
468 source: new ImageSource({
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
469 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
470 params: {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
471 LAYERS: "distance_marks_ashore_geoserver",
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
472 VERSION: "1.1.1",
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
473 TILED: true
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
474 },
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
475 imageLoadFunction: function(tile, src) {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
476 HTTP.get(src, {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
477 headers: {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
478 "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
479 },
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
480 responseType: "blob"
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
481 }).then(response => {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
482 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
483 });
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
484 } // TODO tile.setState(TileState.ERROR);
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
485 })
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3075
diff changeset
486 }),
3029
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
487 new ImageLayer({
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
488 id: "DISTANCEMARKSAXIS",
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
489 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
490 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
491 url: window.location.origin + "/api/internal/wms",
3031
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
492 params: {
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
493 LAYERS: "distance_marks_geoserver",
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
494 VERSION: "1.1.1",
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
495 TILED: true
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3030
diff changeset
496 },
3029
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
497 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
498 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
499 headers: {
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
500 "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
501 },
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
502 responseType: "blob"
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
503 }).then(response => {
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
504 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
505 });
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
506 } // 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
507 })
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3021
diff changeset
508 }),
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
509 (function() {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
510 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
511 source.setLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
512 buildVectorLoader(
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
513 {
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
514 featureTypes: ["gauges_geoserver"],
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
515 geometryName: "geom"
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
516 },
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
517 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
518 )
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
519 );
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
520 return new VectorLayer({
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
521 id: "GAUGES",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
522 label: "Gauges",
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
523 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
524 visible: true,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
525 style: styles.gauge,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
526 maxResolution: 100,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
527 minResolution: 0,
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
528 source
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
529 });
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
530 })(),
3123
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
531 DRAWLAYER,
f0af359391a0 client: map layers: share certain layer objects across map
Markus Kottlaender <markus@intevation.de>
parents: 3102
diff changeset
532 CUTLAYER
3011
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
533 ]
fc8fbea24568 client: moved map component, layer factory and styles to own subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
534 };
3021
2e2a271c1026 client: fixed layer factory to actually serve different objects
Markus Kottlaender <markus@intevation.de>
parents: 3011
diff changeset
535 }