annotate client/src/map/store.js @ 659:ef658c66cfca

schema: disable sfcgal * Comment out sfcgal extension because it is not available on Ubuntu LTS right now and the setup script will stop completely.
author Bernhard Reiter <bernhard@intevation.de>
date Mon, 17 Sep 2018 16:25:44 +0200
parents ef9c733cc6aa
children db749c02127c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 //import { HTTP } from "../lib/http";
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 import TileWMS from "ol/source/TileWMS.js";
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 import { Tile as TileLayer, Vector as VectorLayer } from "ol/layer.js";
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 import OSM from "ol/source/OSM";
659
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
6 import { Stroke, Style, Fill, Text } from "ol/style.js";
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 import VectorSource from "ol/source/Vector.js";
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 const MapStore = {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 namespaced: true,
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 state: {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 layers: [
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 name: "Open Streetmap",
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
15 data: new TileLayer({
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 source: new OSM()
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 }),
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18 isVisible: true
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20 {
625
4acf60d1bbb4 clients: shorten ECDIS layer name.
Bernhard Reiter <bernhard@intevation.de>
parents: 620
diff changeset
21 name: "Inland ECDIS chart Danube",
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
22 data: new TileLayer({
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
23 source: new TileWMS({
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
24 url: "https://demo.d4d-portal.info/wms",
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 params: { LAYERS: "d4d", VERSION: "1.1.1", TILED: true }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 })
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27 }),
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 isVisible: true
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
30 {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
31 name: "Fairways Dimensions",
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
32 data: new VectorLayer({
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
33 source: new VectorSource(),
659
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
34 style: function(feature) {
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
35 return [
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
36 new Style({
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
37 stroke: new Stroke({
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
38 color: "rgba(0, 0, 255, 1.0)",
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
39 width: 2
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
40 })
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
41 }),
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
42 new Style({
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
43 text: new Text({
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
44 font: 'bold 12px "Open Sans", "sans-serif"',
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
45 placement: "line",
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
46 fill: new Fill({
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
47 color: "black"
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
48 }),
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
49 text: "LOS: " + feature.get("level_of_service").toString()
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
50 //, zIndex: 10
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
51 })
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
52 })
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
53 ];
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
54 }
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 }),
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 isVisible: true
620
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
57 },
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
58 {
628
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
59 name: "Waterway Area",
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
60 data: new VectorLayer({
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
61 source: new VectorSource(),
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
62 style: new Style({
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
63 stroke: new Stroke({
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
64 color: "rgba(180, 140, 40, 1.0)",
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
65 width: 1.5
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
66 })
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
67 })
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
68 }),
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
69 isVisible: true
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
70 },
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
71 {
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
72 name: "Waterway Axis",
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
73 data: new VectorLayer({
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
74 source: new VectorSource(),
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
75 style: new Style({
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
76 stroke: new Stroke({
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
77 color: "rgba(0, 0, 255, .5)",
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
78 lineDash: [5, 5],
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
79 width: 2
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
80 })
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
81 })
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
82 }),
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
83 isVisible: true
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
84 },
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
85 {
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
86 name: "Distance marks",
620
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
87 data: new VectorLayer({
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
88 source: new VectorSource() /*,
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
89 style: new Style({
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
90 stroke: new Stroke({
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
91 color: "rgba(0, 0, 255, 1.0)",
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
92 width: 2
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
93 })
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
94 })
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
95 */
ef00684e021f client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents: 618
diff changeset
96 }),
628
ef9c733cc6aa client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents: 625
diff changeset
97 isVisible: false
659
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
98 },
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
99 {
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
100 name: "Distance marks, Axis",
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
101 data: new VectorLayer({
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
102 source: new VectorSource(),
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
103 style: new Style({
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
104 stroke: new Stroke({
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
105 color: "rgba(0, 255, 255, 1.0)",
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
106 width: 3
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
107 })
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
108 })
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
109 }),
ef658c66cfca schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents: 628
diff changeset
110 isVisible: true
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
111 }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
112 ]
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
113 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
114 getters: {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
115 layers: state => {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
116 return state.layers;
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
117 }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
118 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
119 mutations: {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
120 toggleVisibility: (state, layer) => {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
121 state.layers[layer].isVisible = !state.layers[layer].isVisible;
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
122 state.layers[layer].data.setVisible(state.layers[layer].isVisible);
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
123 }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
124 }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
125 };
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
126
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
127 export default MapStore;