comparison client/src/components/map/layers.js @ 3548:f3102fa16a69

client: data availability/accuracy: inject mapId into layer/styles factory to fix display issue with two maps This layer displays features based on which other layers are visible. To detect those other layers visibility realiably, the layer needs to be aware about the map it belongs to.
author Markus Kottlaender <markus@intevation.de>
date Fri, 31 May 2019 12:45:30 +0200
parents 47c61ea894b1
children 32d7bb1afdc9 f9032442620a
comparison
equal deleted inserted replaced
3547:47c61ea894b1 3548:f3102fa16a69
11 import { bbox as bboxStrategy } from "ol/loadingstrategy"; 11 import { bbox as bboxStrategy } from "ol/loadingstrategy";
12 import { WFS, GeoJSON } from "ol/format"; 12 import { WFS, GeoJSON } from "ol/format";
13 import OSM from "ol/source/OSM"; 13 import OSM from "ol/source/OSM";
14 import { equalTo } from "ol/format/filter"; 14 import { equalTo } from "ol/format/filter";
15 import { HTTP } from "@/lib/http"; 15 import { HTTP } from "@/lib/http";
16 import styles from "./styles"; 16 import styleFactory from "./styles";
17 import store from "@/store/index"; 17 import store from "@/store/index";
18 18
19 const buildVectorLoader = ( 19 const buildVectorLoader = (
20 featureRequestOptions, 20 featureRequestOptions,
21 vectorSource, 21 vectorSource,
160 } 160 }
161 return styles; 161 return styles;
162 } 162 }
163 }); 163 });
164 164
165 export default function() { 165 export default function(mapId) {
166 const styles = styleFactory(mapId);
166 // Shared feature source for layers: 167 // Shared feature source for layers:
167 // BOTTLENECKS, BOTTLENECKSTATUS and BOTTLENECKFAIRWAYAVAILABILITY 168 // BOTTLENECKS, BOTTLENECKSTATUS and BOTTLENECKFAIRWAYAVAILABILITY
168 // Reduces bottlenecks_geoserver requests and number of stored feature objects. 169 // Reduces bottlenecks_geoserver requests and number of stored feature objects.
169 const bottlenecksSource = new VectorSource({ strategy: bboxStrategy }); 170 const bottlenecksSource = new VectorSource({ strategy: bboxStrategy });
170 bottlenecksSource.setLoader( 171 bottlenecksSource.setLoader(